Files
isaac-port/generated-src/entity_knife.cpp
T
shweetandClaude Opus 5.5 780767f5e1 Curation round 2, wave A: anm2 (Anm2Ed JSON), text, config as idiomatic classes; SDL3 platform opens a window
- anm2.h/.cpp take over ANM2, AnimationState, LayerState, AnmCache and the frame data. They read Anm2Ed's JSON documents
  with simdjson and play them as the game does (interpolation baked at load). src/anm2/ and msvc.h are retired.
- font, formatted_text, string_table and rich_text take over the text classes. FormattedText::parse is still bit-exact
  against its assembly.
- options_config and challenge_params take over OptionsConfig, ChallengeParams and the .ini helpers. The tests include
  Save's exact bytes.
- platform.h/.cpp and main.cpp run IsaacMain on SDL3: the window and GL context open, and the run stops at the first
  built-in shader (FUN_00a13fa0).
- source_tree.py: a taken-over parent stays bytes, taken-over methods are not re-emitted as a namespace, and every
  address in a (a, b, c to d) list on a comment counts as taken over.
- log.h: reconstruction_missing() for a taken-over class's methods that are not written yet.
206 functions taken over, boot path 89/615. The full build waits for wave B: item_config, entity_config and mod_manager
still use the old APIs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 23:04:54 -05:00

4881 lines
226 KiB
C++

#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<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._l) + 4));
qVar3 = (this->_tearFlags)._h;
uVar2 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._h) + 4));
*GHIDRA_CAST<int *>(&outFlags->_l) = GHIDRA_INT((this->_tearFlags)._l);
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&outFlags->_l) + 4)) = uVar1;
*GHIDRA_CAST<int *>(&outFlags->_h) = GHIDRA_INT(qVar3);
*GHIDRA_CAST<uint32_t *>((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<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::constructor();
*GHIDRA_CAST<uint8_t ***>(this) = IsaacRepentancePlus::Entity_Knife::vftable;
*GHIDRA_CAST<uint32_t *>(&(this->_tearFlags)._l) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) = 0;
*GHIDRA_CAST<uint32_t *>(&(this->_tearFlags)._h) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) = 0;
*GHIDRA_CAST<uint32_t *>(&(this->_usedTearFlags)._l) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_usedTearFlags)._l) + 4)) = 0;
*GHIDRA_CAST<uint32_t *>(&(this->_usedTearFlags)._h) = 0;
*GHIDRA_CAST<uint32_t *>((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<HomingLaser *>((&this->_homingLaser)))->HomingLaser::HomingLaser();
(this->_hitList)._begin = (void *)0x0;
(this->_hitList)._end = (void *)0x0;
(this->_hitList)._capacity = (void *)0x0;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x510)))) = 0;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((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<ANM2 *>(0x0)) {
local_34 = operator_new(0x114);
local_8 = 0;
if (local_34 == GHIDRA_CAST<ANM2 *>(0x0)) {
local_34 = GHIDRA_CAST<ANM2 *>(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<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) = msvc::_Allocate(0x20);
anm2Path._size = 0x1a;
anm2Path._capacity = 0x1f;
builtin_strncpy((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(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<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(anm2Path._buf))) + 0x0)));
if (0xfff < uVar7) {
ptr = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + -4));
uVar7 = anm2Path._capacity + 0x24;
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(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<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) & 0xffffff00;
layer = ANM2::GetLayer(DAT_00c72214,GHIDRA_CAST<uint8_t *>(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<uint8_t *>(0x0)) {
curAnimName = animData;
if (0xf < *GHIDRA_CAST<uint32_t *>((animData + 0x14))) {
curAnimName = *GHIDRA_CAST<uint8_t **>(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<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::Init(type,variant,subType,initSeed);
if (this->_config != (void *)0x0) {
ANM2::Load(&this->_sprite,GHIDRA_CAST<std_string *>((GHIDRA_INT(this->_config) + 0x74)),1);
local_34 = GHIDRA_CAST<ANM2 *>(&(this->_sprite)._animDefaultName);
if (0xf < (this->_sprite)._animDefaultName._capacity) {
local_34 = *GHIDRA_CAST<ANM2 **>((GHIDRA_CAST<std_string *>(local_34))->_buf);
}
animData = (this->_sprite)._animState._animData;
if (animData != GHIDRA_CAST<uint8_t *>(0x0)) {
curAnimName = animData;
pAVar6 = local_34;
if (0xf < *GHIDRA_CAST<uint32_t *>((animData + 0x14))) {
curAnimName = *GHIDRA_CAST<uint8_t **>(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<ANM2 *>(((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<uint8_t *>(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<uint32_t *>(&(this->_tearFlags)._l) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) = 0;
*GHIDRA_CAST<uint32_t *>(&(this->_tearFlags)._h) = 0;
*GHIDRA_CAST<uint32_t *>((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<uint16_t *>(&this->_isSwinging) = 0;
*GHIDRA_CAST<uint16_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4e8)))) = 0;
this->_isSpinAttack = 0;
dVar1 = __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)];
*GHIDRA_CAST<uint8_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x504)))) = &DAT_bf800000;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4ec)))) = 0;
*GHIDRA_CAST<uint16_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4f0)))) = 0;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4fc)))) = 0;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x500)))) = 0;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4f4)))) = 0;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4f8)))) = 0;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x508)))) = 0;
this->_pathOffset = (float)((double)GHIDRA_INT(uVar7) + dVar1) * 2.3283064e-10 * 50.0 - 25.0;
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x50c)))) = g_vectorZero.x;
fVar3 = g_vectorZero.y;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = GHIDRA_UINT(this->_flags) | 0x4000000;
this->_isPrimaryClub = 0;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x518)))) = 0;
uVar2 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x510)))) = fVar3;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = uVar2;
*GHIDRA_CAST<uint8_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((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<uint8_t *>(0x0));
layer->_visible = isLayerVisible;
isLayerVisible = this->_subtype == 4;
layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST<uint8_t *>(0x1));
break;
case 0xb:
code_r0x00961110:
isLayerVisible = this->_subtype != 4;
layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST<uint8_t *>(0x0));
layer->_visible = isLayerVisible;
isLayerVisible = this->_subtype == 4;
layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST<uint8_t *>(0x1));
layer->_visible = isLayerVisible;
isLayerVisible = this->_subtype == 4;
layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST<uint8_t *>(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<int *>((parent + 0x28)) == 2)) {
if ((*GHIDRA_CAST<Entity_Knife **>((parent + 0x49c)) == this) &&
(*GHIDRA_CAST<Entity_Knife **>((parent + 0x49c)) != GHIDRA_CAST<Entity_Knife *>(0x0))) {
erasedRef = GHIDRA_CAST<Entity_Knife *>((parent + 0x49c));
msvc::multiset<unsigned_int>::erase(&erasedRef);
*GHIDRA_CAST<uint32_t *>((parent + 0x49c)) = 0;
}
}
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::ClearReferences();
puVar1 = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4fc)));
if (*GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4fc)))) != GHIDRA_CAST<int *>(0x0)) {
(**(code **)(**GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4fc)))) + 0x28))();
}
secondRef = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x500)));
if (*GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x500)))) != GHIDRA_CAST<int *>(0x0)) {
(**(code **)(**GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x500)))) + 0x28))();
}
if (*GHIDRA_CAST<int *>(puVar1) != 0) {
erasedRef = GHIDRA_CAST<Entity_Knife *>(puVar1);
msvc::multiset<unsigned_int>::erase(&erasedRef);
}
*GHIDRA_CAST<uint32_t *>(puVar1) = 0;
if (*GHIDRA_CAST<int *>(secondRef) != 0) {
erasedRef = GHIDRA_CAST<Entity_Knife *>(secondRef);
msvc::multiset<unsigned_int>::erase(&erasedRef);
}
*GHIDRA_CAST<uint32_t *>(secondRef) = 0;
puVar1 = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4f4)));
if (*GHIDRA_CAST<int *>(puVar1) != 0) {
erasedRef = GHIDRA_CAST<Entity_Knife *>(puVar1);
msvc::multiset<unsigned_int>::erase(&erasedRef);
}
secondRef = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4f8)));
*GHIDRA_CAST<uint32_t *>(puVar1) = 0;
if (*GHIDRA_CAST<int *>(secondRef) != 0) {
erasedRef = GHIDRA_CAST<Entity_Knife *>(secondRef);
msvc::multiset<unsigned_int>::erase(&erasedRef);
}
*GHIDRA_CAST<uint32_t *>(secondRef) = 0;
return;
}
// 009612e0
void * Entity_Knife::GetHitEntities()
{
uint8_t isUsingParentHitList;
Entity_Knife *parent;
isUsingParentHitList = this->_isUsingParentHitList;
while (((isUsingParentHitList != 0 &&
(parent = GHIDRA_CAST<Entity_Knife *>(this->_parent), parent != GHIDRA_CAST<Entity_Knife *>(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<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((this->_homingLaser))) + 0x20)))) = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((this->_homingLaser))) + 0x1c))));
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((this->_homingLaser))) + 0x38)))) = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((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<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((this->_homingLaser))) + 0x18)))) = 0x1e;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((this->_homingLaser))) + 0x40)))) = 0;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((this->_homingLaser))) + 0x14)))) = 0x43160000;
Entity_Laser::CalculateEndPoint(&local_10,&this->_pos,&direction,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),20.0)
;
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((this->_homingLaser))) + 0x4)))) = (this->_pos).x;
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((this->_homingLaser))) + 0x8)))) = (this->_pos).y;
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((this->_homingLaser))) + 0xc)))) = direction.x * 200.0 + local_10.x;
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((this->_homingLaser))) + 0x10)))) = direction.y * 200.0 + local_10.y;
tearFlagsWord3 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._h) + 4));
local_10.x = (float)(tearFlagsWord3 & (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_tearFlagOrbit._h)) + 0x4))));
tearFlagsWord2 = GHIDRA_UINT((this->_tearFlags)._h);
if ((!((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagOrbit._l)) == 0 &&
(*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_tearFlagOrbit._l)) + 0x4)))) == 0)) ||
(!((tearFlagsWord2 & GHIDRA_UINT(g_tearFlagOrbit._h)) == 0 && local_10.x == 0.0))) {
(GHIDRA_CAST<HomingLaser *>((&this->_homingLaser)))->HomingLaser::build_curl_path(60.0);
tearFlagsWord2 = GHIDRA_UINT((this->_tearFlags)._h);
tearFlagsWord3 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._h) + 4));
}
if (((GHIDRA_UINT((this->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagHoming._l)) == 0 &&
(*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_tearFlagHoming._l)) + 0x4)))) == 0) &&
((tearFlagsWord2 & GHIDRA_UINT(g_tearFlagHoming._h)) == 0 &&
(tearFlagsWord3 & (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_tearFlagHoming._h)) + 0x4)))) == 0)) {
(GHIDRA_CAST<HomingLaser *>((&this->_homingLaser)))->HomingLaser::build_bezier_path(0,source);
return;
}
(GHIDRA_CAST<HomingLaser *>((&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<int *>(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<uint32_t *>((GHIDRA_INT(&(source->_tearFlags)._l) + 4));
tearFlagsHigh = (source->_tearFlags)._h;
tearFlagsHighHigh = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(source->_tearFlags)._h) + 4));
iVar1 = *GHIDRA_CAST<int *>(this);
*GHIDRA_CAST<int *>(&(this->_tearFlags)._l) = GHIDRA_INT((source->_tearFlags)._l);
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) = tearFlagsLowHigh;
*GHIDRA_CAST<int *>(&(this->_tearFlags)._h) = GHIDRA_INT(tearFlagsHigh);
*GHIDRA_CAST<uint32_t *>((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<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((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 *)
(GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(8,this->_variant,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),
this->_subtype,rngResult,1);
if (childKnife == GHIDRA_CAST<Entity_Knife *>(0x0)) break;
if (childKnife->_parent != 0) {
local_1c[0] = &childKnife->_parent;
msvc::multiset<unsigned_int>::erase(local_1c);
}
childKnife->_parent = this;
msvc::multiset<unsigned_int>::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<uint8_t *>(cos(angle));
local_20 = sin(angle);
direction.y = local_20;
direction.x = (float)local_24;
InitHomingPath(childKnife,direction,GHIDRA_CAST<Entity *>(this),
(float)((double)GHIDRA_INT(rngResult) + dVar1) * 2.3283064e-10 * 50.0 - 25.0);
}
else {
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((childKnife)) + 0x504)))) = this->_knifeDistance;
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((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<uint8_t *>((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<int *>(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<int *>((fadeFrames + 0x28)) == 2) && (isSwingWeapon == '\0')) && (isSword == '\0')) {
local_12c = *GHIDRA_CAST<float *>((fadeFrames + 0x420)) * 20.0;
}
if (extraout_EDX == 9) {
ownerPlayer = GetPlayer(this);
if ((ownerPlayer == GHIDRA_CAST<Entity_Player *>(0x0)) ||
(bVar8 = (GHIDRA_CAST<Entity_Player *>((ownerPlayer)))->Entity_Player::HasCollectible(0x3b,0), bVar8 == 0)) {
layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST<uint8_t *>(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<uint8_t *>(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<int *>((GHIDRA_INT(&pBVar11->_l) + 4)) == 0) &&
(GHIDRA_INT(pBVar11->_h) == 0 && *GHIDRA_CAST<int *>((GHIDRA_INT(&pBVar11->_h) + 4)) == 0)) {
room = GHIDRA_CAST<Room *>(GetRootParent(this));
fadeFrames = this->_variant;
local_15c = room->_gridEntities[0xe6];
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) = room;
if ((fadeFrames != 9) && ((fadeFrames != 8 && (fadeFrames != 4)))) {
if (local_15c == GHIDRA_CAST<Entity_Player *>(0x0)) goto LAB_00961f38;
if (local_15c->_type == 1) {
bVar8 = (GHIDRA_CAST<Entity_Player *>((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<int *>((fadeFrames + 0x4c)) != 0))))
goto LAB_00961e18;
bVar8 = *GHIDRA_CAST<uint8_t *>((*GHIDRA_CAST<int *>(&local_15c->_isControlsEnabled) + 0x13f0 + GHIDRA_INT(local_134.y)));
}
if (bVar8 == 0) goto LAB_00961f38;
}
LAB_00961e18:
if (room != GHIDRA_CAST<Room *>(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<ANM2 *>((room->_gridEntities + 0x15)),
GHIDRA_CAST<std_string *>(local_40));
ehState = 0;
if (0xf < GHIDRA_UINT(((GHIDRA_CAST<Room *>(local_108.y))->_topLeftPos).x)) {
local_108.y = *GHIDRA_CAST<float *>(local_108.y);
}
pbVar12 = ((void **)(GHIDRA_INT(local_120.y) + 0x24))[4];
if (pbVar12 == GHIDRA_CAST<uint8_t *>(0x0)) {
LAB_00961f64:
bVar8 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST<uint8_t *>(local_108.y),1);
if (bVar8 != 0) {
AnimationState::Rewind(&(this->_sprite)._animState);
(this->_sprite)._animState._isPlaying = 1;
room = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<Room *>(local_170))) + 0xc)));
}
}
else {
if (0xf < *GHIDRA_CAST<uint32_t *>((pbVar12 + 0x14))) {
pbVar12 = *GHIDRA_CAST<uint8_t **>(pbVar12);
}
pRVar24 = GHIDRA_CAST<Room *>(local_108.y);
do {
bVar8 = *pbVar12;
bVar18 = bVar8 < *GHIDRA_CAST<uint8_t *>(pRVar24);
if (bVar8 != *GHIDRA_CAST<uint8_t *>(pRVar24)) {
LAB_00961f44:
uVar10 = -GHIDRA_UINT(bVar18) | 1;
goto LAB_00961f49;
}
if (bVar8 == 0) break;
bVar8 = pbVar12[1];
bVar18 = bVar8 < (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(((uint8_t)pRVar24)) + 0x1)));
if (bVar8 != (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pRVar24)) + 0x1)))) goto LAB_00961f44;
pbVar12 = pbVar12 + 2;
pRVar24 = GHIDRA_CAST<Room *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pRVar24)) + 0x2))));
} while (bVar8 != 0);
uVar10 = 0;
LAB_00961f49:
if ((uVar10 != 0) ||
((*GHIDRA_CAST<char *>((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) != '\0' &&
((this->_sprite)._animState._isPlaying == 0)))) goto LAB_00961f64;
}
ehState = -1;
if (0xf < (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_38._h)) + 0x4)))) {
uVar10 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_38._h)) + 0x4))) + 1;
pvVar21 = local_40[0];
if (0xfff < uVar10) {
pvVar21 = *(void **)(GHIDRA_INT(local_40[0]) + -4);
uVar10 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(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<uint32_t *>((GHIDRA_CAST<char *>(&(local_38._h)) + 0x0))) = 0;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(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<char *>((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<uint8_t *>("SwingEnd")), bVar8 == 0)) ||
(this->_isInterpolating != 0)) {
if (((room != GHIDRA_CAST<Room *>(this)) && (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(room->_gridEntities) + 0x4c6)) != '\0')) &&
(this->_isSpinAttack == 0)) {
SpinAttack(this,*GHIDRA_CAST<short *>((room->_gridEntities + 0x133)),0);
local_d9 = 1;
}
}
else {
bVar8 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x400000);
if ((bVar8 != 0) || (this->_isSpinAttack != 0)) {
local_120.y = this->_displayRotation * 0.017453292;
uVar3 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
*GHIDRA_CAST<uint32_t *>(&this->_flags) = GHIDRA_UINT(this->_flags) & 0xffbfffff;
*GHIDRA_CAST<uint32_t *>((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<uint32_t *>((GHIDRA_CAST<char *>(&(local_100)) + 0x8))) = local_120.y;
local_f4[0] = GHIDRA_CAST<Room *>(local_108.y);
if (player != GHIDRA_CAST<Entity_Player *>(0x0)) {
Entity_Player::GetTearMovementInheritance
(player,&local_e8,GHIDRA_CAST<Vector *>((local_100 + 8)),0);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_100)) + 0x8))) = (local_120.y + *extraout_EAX) * ownerPlayer->_shotspeed;
local_f4[0] = GHIDRA_CAST<Room *>(((local_108.y + extraout_EAX[1]) * ownerPlayer->_shotspeed));
}
if (this->_isSpinAttack != 0) {
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_100)) + 0x8))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_100)) + 0x8))) + (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_100)) + 0x8)));
local_f4[0] = GHIDRA_CAST<Room *>(((float)local_f4[0] + (float)local_f4[0]));
}
fadeFrames = this->_variant;
uVar10 = Random();
spawnedTear = (Entity_Tear *)
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(2,GHIDRA_UINT((fadeFrames == 0xb)) * 2 + 0x2f,&this->_pos,
GHIDRA_CAST<Vector *>((local_100 + 8)),GHIDRA_CAST<Entity *>(this->_spawnerEntity),0,
uVar10);
if (player != GHIDRA_CAST<Entity_Player *>(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<Entity_Projectile *>((GHIDRA_CAST<Entity_Projectile *>(spawnedTear))))->Entity_Projectile::SetHeight(player->_tearheight);
}
local_e8.y = (float)this->_spawnerEntity;
if (spawnedTear->_parent != 0) {
local_120.y = (float)&spawnedTear->_parent;
msvc::multiset<unsigned_int>::erase(&local_120.y);
}
spawnedTear->_parent = local_e8.y;
if (local_e8.y != 0.0) {
msvc::multiset<unsigned_int>::insert(&spawnedTear->_parent);
}
tearFlagsTmp = (GHIDRA_CAST<BitSet128 *>((&g_tearFlagFetus)))->BitSet128::__bnot(GHIDRA_CAST<BitSet128 *>(&local_158));
tearFlagsTmp = BitSet128::operator_and
(GHIDRA_CAST<BitSet128 *>(local_100),&this->_tearFlags,tearFlagsTmp);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(flags._h)) + 0x1))) = (char)(tearFlagsTmp->_h >> 8);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(flags)) + 0x0))) = *GHIDRA_CAST<unkbyte9 *>(tearFlagsTmp);
(*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(&(flags._h)) + 0x2))) = (short)(tearFlagsTmp->_h >> 0x10);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags._h)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&tearFlagsTmp->_h) + 4));
(GHIDRA_CAST<Entity_Tear *>((spawnedTear)))->Entity_Tear::SetTearFlags(flags);
pcVar4 = *(code **)(*GHIDRA_CAST<int *>(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<int *>(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<Entity_Tear *>((spawnedTear)))->Entity_Tear::ResetSpriteScale();
(**(code **)(*GHIDRA_CAST<int *>(spawnedTear) + 0xc))();
room = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<Room *>(local_170))) + 0xc)));
if ((this->_isSpinAttack != 0) &&
(spinsLeft = *GHIDRA_CAST<short *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4f0)))), 1 < spinsLeft)) {
if (*GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4f8)))) != GHIDRA_CAST<int *>(0x0)) {
(**(code **)(**GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4f8)))) + 0x28))();
spinsLeft = *GHIDRA_CAST<short *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4f0))));
}
*GHIDRA_CAST<short *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4f0)))) = spinsLeft + -1;
SpinAttack(this,spinsLeft + -1,2);
local_d9 = 1;
}
}
}
}
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(room->_gridEntities) + 0x441)) != '\0') &&
(*GHIDRA_CAST<char *>((room->_gridEntities + 0x110)) == '\0')) && (local_d9 == 0)) {
UpdateSwingHits(this);
local_d9 = 1;
}
if ((isSword != '\0') && (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(room->_gridEntities) + 0x441)) == '\0')) {
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(room->_gridEntities) + 0x442)) != '\0') {
local_108.y = this->_displayRotation * 0.017453292;
local_120.y = sin(local_108.y);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_100)) + 0x8))) = cos(local_108.y);
bVar8 = 0;
local_f4[0] = GHIDRA_CAST<Room *>(local_120.y);
fadeFrames = vector_to_direction(GHIDRA_CAST<Vector *>((local_100 + 8)));
if (*GHIDRA_CAST<char *>((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<char *>((room->_gridEntities + 0x110)) == '\0') {
if (room == GHIDRA_CAST<Room *>(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<Entity_Player *>(0x0)) ||
(bVar8 = (GHIDRA_CAST<Entity_Player *>((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<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::SetTarget(GHIDRA_CAST<Entity *>(0x0));
if ((0.0 <= *GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x504))))) && (room != GHIDRA_CAST<Room *>(this))) {
this->Remove();
}
ownerPlayer = local_15c;
*GHIDRA_CAST<uint8_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x504)))) = &DAT_bf800000;
if (0.0 <= *GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x514))))) {
this->_visible = 1;
}
*GHIDRA_CAST<uint8_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x514)))) = &DAT_bf800000;
local_e8.y = (local_15c->_pos).x;
local_108.y = (local_15c->_pos).y;
local_f4[0] = GHIDRA_CAST<Room *>((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<Room *>(this)) {
pRVar24 = GHIDRA_CAST<Room *>(this->_speedMultiplier);
local_108.y = (float)pRVar24;
tearFlagsTmp = BitSet128::operator_and
(GHIDRA_CAST<BitSet128 *>(&local_158),&this->_tearFlags,&g_tearFlagBigSpiral
);
bVar8 = (GHIDRA_CAST<BitSet128 *>((tearFlagsTmp)))->BitSet128::IsNonZero();
if (bVar8 == 0) {
tearFlagsTmp = BitSet128::operator_and
(GHIDRA_CAST<BitSet128 *>(&local_158),&this->_tearFlags,&g_tearFlagSpiral)
;
bVar8 = (GHIDRA_CAST<BitSet128 *>((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<Room *>(local_108.y);
tearFlagsTmp = BitSet128::operator_and
(GHIDRA_CAST<BitSet128 *>(&local_158),&this->_tearFlags,&g_tearFlagOrbit);
bVar8 = (GHIDRA_CAST<BitSet128 *>((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<msvc::vector *>((&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<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::SetTarget(GHIDRA_CAST<Entity *>(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<Entity_Player *>(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<Room *>(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<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::SetFrame_1(fadeFrames);
room = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<Room *>(local_170))) + 0xc)));
}
(GHIDRA_CAST<msvc::vector *>((&this->_hitList)))->msvc::vector::clear(0);
}
if ((0.0 < this->_knifeVelocity) && ((float)room->_gridEntities[0x109] <= 0.0)) {
(GHIDRA_CAST<msvc::vector *>((&this->_hitList)))->msvc::vector::clear(0);
}
}
}
fVar19 = 0.0;
bVar8 = (GHIDRA_CAST<Vector *>((&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<Room *>(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<BitSet128 *>(&local_158),&this->_tearFlags,&g_tearFlagOrbit);
bVar8 = (GHIDRA_CAST<BitSet128 *>((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<Room *>((local_120.y / fVar19));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_100)) + 0x8))) = local_e8.y / fVar19;
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(sizeMulti.y)) + 0x0))) = (char)local_f4[0];
sizeMulti.x = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_100)) + 0x8)));
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(sizeMulti.y)) + 0x1))) = (char)(GHIDRA_UINT(local_f4[0]) >> 8);
(*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(&(sizeMulti.y)) + 0x2))) = (short)(GHIDRA_UINT(local_f4[0]) >> 0x10);
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::SetSize(fVar19 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(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<BitSet128 *>(&local_158),&this->_tearFlags,&g_tearFlagOrbit);
bVar8 = (GHIDRA_CAST<BitSet128 *>((tearFlagsTmp)))->BitSet128::IsNonZero();
if (bVar8 != 0) {
local_ec = fVar19 + 90.0;
local_e0 = local_ec;
}
fVar19 = *GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x504))));
fVar20 = (this->_pos).y;
if (0.0 <= fVar19) {
if (this->_knifeDistance <= fVar19) {
if ((this->_knifeDistance < fVar19) && (room != GHIDRA_CAST<Room *>(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<BitSet128 *>(&local_158),&this->_tearFlags,&g_tearFlagOrbit
);
if ((GHIDRA_INT(tearFlagsTmp->_l) == 0 && *GHIDRA_CAST<int *>((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) == 0) &&
(GHIDRA_INT(tearFlagsTmp->_h) == 0 && *GHIDRA_CAST<int *>((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<Room *>(((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<Room *>((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<Room *>(local_108.y) == GHIDRA_CAST<Room *>(0x0)) ||
((GHIDRA_CAST<Room *>(local_108.y))->_gridEntities[1] != &DAT_00000008)) break;
}
room = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<Room *>(local_170))) + 0xc)));
}
}
fVar19 = *GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((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<BitSet128 *>(&local_158),&this->_tearFlags,&g_tearFlagContinuum);
bVar8 = (GHIDRA_CAST<BitSet128 *>((tearFlagsTmp)))->BitSet128::IsNonZero();
if (bVar8 != 0) {
screen_wrap(this);
}
tearFlagsTmp = BitSet128::operator_and
(GHIDRA_CAST<BitSet128 *>(&local_158),&this->_tearFlags,&g_tearFlagHoming);
bVar8 = (GHIDRA_CAST<BitSet128 *>((tearFlagsTmp)))->BitSet128::IsNonZero();
if (bVar8 != 0) {
update_target(this,&local_e0);
local_ec = local_e0;
}
fVar19 = local_ec;
tearFlagsTmp = BitSet128::operator_and
(GHIDRA_CAST<BitSet128 *>(&local_158),&this->_tearFlags,&g_tearFlagWiggle);
bVar8 = (GHIDRA_CAST<BitSet128 *>((tearFlagsTmp)))->BitSet128::IsNonZero();
if (bVar8 != 0) {
apply_wiggle(this,&local_e0);
local_ec = local_e0;
fVar19 = local_e0;
}
tearFlagsTmp = BitSet128::operator_and
(GHIDRA_CAST<BitSet128 *>(&local_158),&this->_tearFlags,&g_tearFlagBigSpiral);
bVar8 = (GHIDRA_CAST<BitSet128 *>((tearFlagsTmp)))->BitSet128::IsNonZero();
if (bVar8 == 0) {
tearFlagsTmp = BitSet128::operator_and
(GHIDRA_CAST<BitSet128 *>(&local_158),&this->_tearFlags,&g_tearFlagSpiral);
bVar8 = (GHIDRA_CAST<BitSet128 *>((tearFlagsTmp)))->BitSet128::IsNonZero();
if (bVar8 != 0) {
rootParent = GHIDRA_CAST<Entity_Knife *>(GetRootParent(this));
if (rootParent == this) {
local_108.y = 0.0;
}
else {
(GHIDRA_CAST<RNG *>((&local_158)))->RNG::game_constructor(this->_initSeed,0x23);
fVar19 = (GHIDRA_CAST<RNG *>((spiralRng)))->RNG::RandomFloat();
local_108.y = fVar19 * 360.0;
fVar19 = local_ec;
}
local_f4[0] = GHIDRA_CAST<Room *>((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<Room *>(((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<Entity_Knife *>(GetRootParent(this));
if (rootParent == this) {
local_108.y = 0.0;
}
else {
(GHIDRA_CAST<RNG *>((&local_158)))->RNG::game_constructor(this->_initSeed,0x23);
fVar19 = (GHIDRA_CAST<RNG *>((spawnedTear)))->RNG::RandomFloat();
local_108.y = fVar19 * 360.0;
fVar19 = local_ec;
}
local_f4[0] = GHIDRA_CAST<Room *>((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<Room *>(((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<Room *>(0x0);
tearFlagsTmp = BitSet128::operator_and
(GHIDRA_CAST<BitSet128 *>(&local_158),&this->_tearFlags,&g_tearFlagSquare);
bVar8 = (GHIDRA_CAST<BitSet128 *>((tearFlagsTmp)))->BitSet128::IsNonZero();
if (bVar8 != 0) {
rootParent = GHIDRA_CAST<Entity_Knife *>(GetRootParent(this));
if (rootParent != this) {
(GHIDRA_CAST<RNG *>((GHIDRA_CAST<RNG *>(local_100))))->RNG::game_constructor(this->_initSeed,0x23);
fVar19 = (GHIDRA_CAST<RNG *>((squareRng)))->RNG::RandomFloat();
pRVar24 = GHIDRA_CAST<Room *>((fVar19 * 120.0));
}
local_f4[0] = GHIDRA_CAST<Room *>((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<Room *>(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<Room *>(this)) && (player != GHIDRA_CAST<Entity_Player *>(0x0))) {
bVar8 = (GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::HasCollectible(0x76,0);
if ((bVar8 != 0) && (this->_knifeVelocity <= 0.0 && this->_knifeVelocity != 0.0)) {
bVar8 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(2,0);
if (bVar8 != 0) {
uVar10 = Random();
local_108.y = *GHIDRA_CAST<float *>((this->_parent + 0x33c));
local_e0 = *GHIDRA_CAST<float *>((this->_parent + 0x340));
local_f4[0] = GHIDRA_CAST<Room *>((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<Room *>((GHIDRA_CAST<Game *>((g_game)))->Game)::SpawnEx(8,0,&local_118,&g_vectorZero,GHIDRA_CAST<Entity *>(player),1,
uVar10,1);
local_108.y = (float)room;
if (room != GHIDRA_CAST<Room *>(0x0)) {
fadeFrames = *GHIDRA_CAST<int *>(room);
(GHIDRA_CAST<Vector *>((room->_gridEntities + 0xca)))->x = 0.0;
room->_gridEntities[0xcb] = (void *)0xc1200000;
(**(code **)(fadeFrames + 0x40))(this->_collisionDamage * 0.4);
(**(code **)(*GHIDRA_CAST<int *>(room) + 0x3c))(&(this->_sprite)._color,0xffffffff,0xff,0,1);
HomingLaser::operator_assign
(GHIDRA_CAST<HomingLaser *>((room->_gridEntities + 0x111)),&this->_homingLaser);
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(room))))->Entity::SetParent(GHIDRA_CAST<Entity *>(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<Room *>((this->_rotation * 0.017453292));
local_e8.y = sin((float)local_f4[0]);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_100)) + 0x8))) = cos((float)local_f4[0]);
local_f4[0] = GHIDRA_CAST<Room *>(local_e8.y);
direction.y = local_e8.y;
direction.x = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_100)) + 0x8)));
InitHomingPath(GHIDRA_CAST<Entity_Knife *>(local_108.y),direction,GHIDRA_CAST<Entity *>(this),local_e0);
(GHIDRA_CAST<Vector *>(((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<float *>(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<uint8_t *>(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<Room *>(local_e8.y) != GHIDRA_CAST<Room *>(0x0)) {
local_f4[0] = GHIDRA_CAST<Room *>(((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<float *>((GHIDRA_CAST<char *>(local_e8.y) + 4)) + fVar19 * *GHIDRA_CAST<float *>(local_e8.y);
}
}
LAB_00963c34:
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x518)))) = local_ec;
if ((this->_isFlying != 0) && (this->_visible != 0)) {
tearFlagsTmp = BitSet128::operator_and
(GHIDRA_CAST<BitSet128 *>(flagsAnd),&this->_tearFlags,
&g_tearFlagMysteriousLiquidCreep);
bVar8 = (GHIDRA_CAST<BitSet128 *>((tearFlagsTmp)))->BitSet128::IsNonZero();
if ((bVar8 != 0) &&
((bVar8 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(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<Vector *>((local_100 + 8)),&local_e8,15.0);
local_e8.x = pVVar13->x;
local_e8.y = pVVar13->y;
uVar10 = Random();
tmpEntity = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x35,&local_e8,&g_vectorZero,
GHIDRA_CAST<Entity *>(this->_spawnerEntity),0,uVar10);
fVar19 = (this->_sprite)._scale.x;
fVar20 = g_vectorOne.x * 0.4;
fadeFrames = *GHIDRA_CAST<int *>(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<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<Entity_Knife *>(local_170))) + 0xc))) != this) || (this->_variant == 8)) ||
(this->_variant == 4)) &&
((*GHIDRA_CAST<char *>(((void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) + 0x24) + 0x110)) == '\0' &&
(*GHIDRA_CAST<char *>((GHIDRA_INT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) + 0x24)) + 0x442)) == '\0')))) &&
(*GHIDRA_CAST<char *>((GHIDRA_INT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) + 0x24)) + 0x441)) == '\0')) {
this->Remove();
}
}
else if (*GHIDRA_CAST<int *>((this->_parent + 0x28)) == 1) {
ownerPlayer = (Entity_Player *)
__RTDynamicCast(this->_parent,0,
&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor,0xdc,0);
bVar8 = (GHIDRA_CAST<Entity_Player *>((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<uint8_t *>(0x0));
layer->_flipX = local_d9;
pBVar11 = BitSet128::operator_and(GHIDRA_CAST<BitSet128 *>(&local_158),tearFlagsTmp,&g_tearFlagContinuum)
;
bVar8 = (GHIDRA_CAST<BitSet128 *>((pBVar11)))->BitSet128::IsNonZero();
if (bVar8 != 0) {
screen_wrap(this);
}
tearFlagsTmp = BitSet128::operator_and
(GHIDRA_CAST<BitSet128 *>(&local_158),tearFlagsTmp,&g_tearFlagHoming);
bVar8 = (GHIDRA_CAST<BitSet128 *>((tearFlagsTmp)))->BitSet128::IsNonZero();
if (bVar8 != 0) {
room = GHIDRA_CAST<Room *>(this->_target);
if (room == GHIDRA_CAST<Room *>(0x0)) {
local_120.y = 22500.0;
local_108.y = (float)room;
EntityList::QueryRadius
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST<EntityList_EL *>(&local_158),
&this->_pos,150.0,8);
ehState = 1;
local_e8.y = 0.0;
if (GHIDRA_CAST<uint32_t *>(local_158._shift3) != GHIDRA_CAST<uint32_t *>(0x0)) {
do {
room = *GHIDRA_CAST<Room **>((local_158._shift1 + GHIDRA_INT(local_e8.y) * 4));
bVar8 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(room))))->Entity::IsVulnerableEnemy(GHIDRA_CAST<Entity *>(0x0));
if (bVar8 != 0) {
fVar19 = (this->_pos).x - (GHIDRA_CAST<Vector *>((room->_gridEntities + 0xc6)))->x;
fVar20 = (this->_pos).y - (float)room->_gridEntities[199];
pRVar24 = GHIDRA_CAST<Room *>((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<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::SetTarget(GHIDRA_CAST<Entity *>(local_108.y));
(GHIDRA_CAST<EntityList_Query *>((&local_158)))->EntityList_Query::~EntityList_Query();
}
else {
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_100)) + 0x8))) = (this->_pos).x - (GHIDRA_CAST<Vector *>((room->_gridEntities + 0xc6)))->x;
local_f4[0] = GHIDRA_CAST<Room *>(((this->_pos).y - (float)room->_gridEntities[199]));
pVVar13 = (GHIDRA_CAST<Vector *>((GHIDRA_CAST<Vector *>((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<float *>((fadeFrames + 0x340));
fVar20 = (this->_pos).x - *GHIDRA_CAST<float *>((fadeFrames + 0x33c));
if (22500.0 < fVar19 * fVar19 + fVar20 * fVar20) {
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::SetTarget(GHIDRA_CAST<Entity *>(0x0));
}
}
}
tearFlagsTmp = BitSet128::operator_and
(GHIDRA_CAST<BitSet128 *>(&local_158),&this->_tearFlags,&g_tearFlagWiggle);
if ((GHIDRA_INT(tearFlagsTmp->_l) != 0 || *GHIDRA_CAST<int *>((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) != 0) ||
(GHIDRA_INT(tearFlagsTmp->_h) != 0 || *GHIDRA_CAST<int *>((GHIDRA_INT(&tearFlagsTmp->_h) + 4)) != 0)) {
local_e8.x = (this->_velocity).y;
local_e8.y = (float)(GHIDRA_UINT((this->_velocity).x) ^ 0x80000000);
(GHIDRA_CAST<Vector *>((&local_e8)))->Vector::Normalize();
fVar19 = (this->_velocity).y;
fVar20 = (this->_velocity).x;
fVar19 = sqrtf(fVar20 * fVar20 + fVar19 * fVar19);
local_f4[0] = GHIDRA_CAST<Room *>((fVar19 * 0.5));
local_120.y = 30.0;
pfVar14 = GHIDRA_CAST<float *>(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<int *>((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) == 0) &&
(GHIDRA_INT(tearFlagsTmp->_h) == 0 && *GHIDRA_CAST<int *>((GHIDRA_INT(&tearFlagsTmp->_h) + 4)) == 0)) {
pVVar13 = (GHIDRA_CAST<Room *>((g_game->_room)))->Room::GetClampedPosition(&local_134,&this->_pos,0.0);
(this->_pos).x = pVVar13->x;
(this->_pos).y = pVVar13->y;
}
puVar16 = GHIDRA_CAST<uint32_t *>(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<Room *>(local_108.y) != GHIDRA_CAST<Room *>(0x0)) {
do {
if (GHIDRA_CAST<uint32_t *>(local_158._shift2) == puVar16) {
msvc::vector<unsigned_int>::_Emplace_reallocate((char)local_158._shift2,&local_108.y);
puVar16 = GHIDRA_CAST<uint32_t *>(local_158._shift3);
}
else {
*GHIDRA_CAST<float *>(local_158._shift2) = local_108.y;
local_158._shift2 = local_158._shift2 + 4;
}
local_108.y = (float)(GHIDRA_CAST<Room *>(local_108.y))->_gridEntities[0xe7];
} while (GHIDRA_CAST<Room *>(local_108.y) != GHIDRA_CAST<Room *>(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<uint8_t *>((fadeFrames >> 2));
if (puVar17 != GHIDRA_CAST<uint8_t *>(0x0)) {
local_12c = local_e0 * 6.0;
do {
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) = *GHIDRA_CAST<uint32_t *>((local_158._shift1 + GHIDRA_INT(local_e8.y) * 4));
(GHIDRA_CAST<Vector *>((((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<Room *>(local_170))) + 0xc))))->_gridEntities + 0xcf)))->x = (this->_velocity).x;
((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<Room *>(local_170))) + 0xc))))->_gridEntities[0xd0] = (void *)(this->_velocity).y;
local_108.y = this->_size * 5.0;
room = GHIDRA_CAST<Room *>((((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<int *>((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) != 0) ||
(GHIDRA_INT(tearFlagsTmp->_h) != 0 || *GHIDRA_CAST<int *>((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<Room *>(local_120.y);
}
local_f4[0] = GHIDRA_CAST<Room *>(((float)room * 0.017453292));
local_15c = GHIDRA_CAST<Entity_Player *>(sin((float)local_f4[0]));
fVar20 = cos((float)local_f4[0]);
fVar19 = (this->_pos).y;
(GHIDRA_CAST<Vector *>(((void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) + 0x24) + 0xc6)))->x =
fVar20 * local_108.y + (this->_pos).x;
pvVar21 = (void *)(local_120.y - 90.0);
((void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(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<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<float *>(local_170))) + 0xc)));
((void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) + 0x24))[0x32] = pvVar21;
(**(code **)(GHIDRA_CAST<char *>(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<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<float *>(local_170))) + 0xc)));
((void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) + 0x24))[0xfb] = *(void **)&(this->_tearFlags)._l;
((void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) + 0x24))[0xfc] = pvVar21;
((void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) + 0x24))[0xfd] = pvVar23;
((void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) + 0x24))[0xfe] = pvVar1;
(**(code **)(GHIDRA_CAST<char *>(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<int *>((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) != 0 ||
(GHIDRA_INT(tearFlagsTmp->_h) != 0 || *GHIDRA_CAST<int *>((GHIDRA_INT(&tearFlagsTmp->_h) + 4)) != 0)))) {
fVar19 = this->_height;
room = GHIDRA_CAST<Room *>(&this->_fallingSpeed);
if ((fVar19 < 0.0) || (*GHIDRA_CAST<float *>(room) <= 0.0 && *GHIDRA_CAST<float *>(room) != 0.0)) {
fVar20 = *GHIDRA_CAST<float *>(room);
local_120.y = (float)room;
fVar19 = fVar19 + fVar20;
this->_height = fVar19;
if (this->_knifeVelocity <= 0.0) {
local_f4[0] = GHIDRA_CAST<Room *>((fVar19 * -0.1));
pfVar14 = GHIDRA_CAST<float *>(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<float *>(room) = fVar20;
uVar10 = Random();
tmpEntity = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xe,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar10);
fVar19 = g_vectorOne.y * 0.75;
pcVar4 = *(code **)(*GHIDRA_CAST<int *>(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<uint8_t *>((GHIDRA_CAST<char *>(&(flags_00._h)) + 0x1))) = (char)(GHIDRA_UINT(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_140.y) + 8))) >> 8);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(flags_00)) + 0x0))) = *GHIDRA_CAST<unkbyte9 *>(local_140.y);
(*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(&(flags_00._h)) + 0x2))) = (short)(GHIDRA_UINT(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_140.y) + 8))) >> 0x10);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags_00._h)) + 0x4))) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_140.y) + 0xc));
tear_flags_area_apply(&this->_pos,GHIDRA_CAST<Entity *>(knife),30.0,knife->_collisionDamage,flags_00)
;
fVar19 = knife->_height;
room = GHIDRA_CAST<Room *>(local_120.y);
this = knife;
}
}
(this->_posOffset).y = fVar19 + this->_basePosOffsetY;
if ((isSwingWeapon == '\0') && (isSword == '\0')) {
local_f4[0] = GHIDRA_CAST<Room *>(this->_knifeVelocity);
local_140.y = atan2f(-*GHIDRA_CAST<float *>(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<uint8_t *>(0x0));
local_d9 = layer->_flipX == 0;
layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST<uint8_t *>(0x0));
layer->_flipX = local_d9;
}
}
}
if (this->_isInterpolating == 0) {
if ((this->_isFlying == 0) || (this->_dead != 0)) {
fadeFrames = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4fc))));
if (fadeFrames != 0) {
iVar2 = *GHIDRA_CAST<int *>((fadeFrames + 0x458));
if (iVar2 < 9) {
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(local_1ac))))->Color::operator_assign(GHIDRA_CAST<ColorMod *>((fadeFrames + 0xf0)));
fadeFrames = 8;
if (iVar2 < 8) {
fadeFrames = iVar2;
}
fadeAlpha = (float)fadeFrames * (this->_color)._tint[3] * 0.125;
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>((extraout_EDX_01 + 0x48)))))->Sprite::SetColor(GHIDRA_CAST<ColorMod *>(local_1ac));
*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4fc)))) + 0x4bc)) =
*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4fc)))) + 0x4bc)) + 4.0;
}
else {
*GHIDRA_CAST<uint32_t *>((fadeFrames + 0x458)) = 8;
}
}
}
else if ((player != GHIDRA_CAST<Entity_Player *>(0x0)) &&
(bVar8 = (GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::HasCollectible(0x44,0), bVar8 != 0)) {
laser = *GHIDRA_CAST<Entity_NPC **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x500))));
local_d9 = 0;
if (laser == GHIDRA_CAST<Entity_NPC *>(0x0)) {
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_100)) + 0x8))) = (player->_pos).x;
local_f4[0] = GHIDRA_CAST<Room *>((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<Vector *>((local_100 + 8)),0.0,-1,&local_140,GHIDRA_CAST<Entity *>(player),0)
;
b = &g_tearFlagOrbit;
flagsByte0 = 0xe0;
flagsByte1 = 0x48;
flagsHalf1 = 0xc3;
pBVar11 = &g_tearFlagSpiral;
tearFlagsTmp = BitSet128::operator_or
(GHIDRA_CAST<BitSet128 *>(wiggleSquareMask),&g_tearFlagWiggle,
&g_tearFlagSquare);
tearFlagsTmp = BitSet128::operator_or(GHIDRA_CAST<BitSet128 *>(spiralMask),tearFlagsTmp,pBVar11);
tearFlagsTmp = BitSet128::operator_or
(GHIDRA_CAST<BitSet128 *>(local_170),tearFlagsTmp,
(BitSet128 *)
CONCAT22(flagsHalf1,CONCAT11(flagsByte1,flagsByte0)));
tearFlagsTmp = BitSet128::operator_or(&excludedMask,tearFlagsTmp,b);
tearFlagsTmp = (GHIDRA_CAST<BitSet128 *>((tearFlagsTmp)))->BitSet128::__bnot(&flagsScratch);
tearFlagsTmp = BitSet128::operator_and(&local_38,&this->_tearFlags,tearFlagsTmp);
uVar3 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&tearFlagsTmp->_l) + 4));
qVar7 = tearFlagsTmp->_h;
uVar5 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&tearFlagsTmp->_h) + 4));
*GHIDRA_CAST<int *>(&(techLaser->_tearFlags)._l) = GHIDRA_INT(tearFlagsTmp->_l);
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(techLaser->_tearFlags)._l) + 4)) = uVar3;
*GHIDRA_CAST<int *>(&(techLaser->_tearFlags)._h) = GHIDRA_INT(qVar7);
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(techLaser->_tearFlags)._h) + 4)) = uVar5;
color = (GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::get_laser_color_copy(GHIDRA_CAST<ColorMod *>(local_6c));
(*extraout_EDX_00)(color,0xffffffff,0xff,0,1);
techLaser->SetCollisionDamage(this->_charge * this->_collisionDamage);
techLaser->_mass = 0.0;
(GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<EntityPtr *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x500)))))))->EntityPtr::SetReference(GHIDRA_CAST<Entity *>(techLaser));
laser = *GHIDRA_CAST<Entity_NPC **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x500))));
local_d9 = 1;
if (laser != GHIDRA_CAST<Entity_NPC *>(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<Entity_NPC *>((laser)))->Entity_NPC::SetAimAngle(fVar19 * 57.295776);
fadeFrames = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x500))));
fVar19 = sqrtf(local_140.y * local_140.y + local_120.y * local_120.y);
*GHIDRA_CAST<float *>((fadeFrames + 0x4d0)) = fVar19;
if (-0.5 <= local_120.y) {
*GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x500)))) + 0x358)) = 0x453b8000;
}
else {
*GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x500)))) + 0x358)) = 0xc1200000;
}
}
if (local_d9 != 0) {
(**(code **)(**GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x500)))) + 0xc))();
}
}
if (((this->_isFlying == 0) || (this->_dead != 0)) &&
(*GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x500)))) != GHIDRA_CAST<int *>(0x0))) {
fadeFrames = **GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x500))));
goto LAB_009652a6;
}
}
}
else if (iVar2 == 1) {
local_108.y = -100.0;
puVar16 = GHIDRA_CAST<uint32_t *>(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<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) = GHIDRA_INT(puVar16) * 0x18;
do {
pvVar21 = (void *)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) + GHIDRA_INT((this->_homingLaser)._bezier._begin));
room = GHIDRA_CAST<Room *>(bezier_closest_point)
(&this->_pos,pvVar21,(void *)(GHIDRA_INT(pvVar21) + 0x18),&local_140.y);
if ((float)room < local_120.y) {
if (puVar16 == GHIDRA_CAST<uint32_t *>(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<uint32_t *>((GHIDRA_INT(puVar16) + 1));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) + 0x18;
} while (puVar16 < (GHIDRA_INT((this->_homingLaser)._bezier._end) -
GHIDRA_INT((this->_homingLaser)._bezier._begin)) / 0x18 - 1U);
}
room = GHIDRA_CAST<Room *>(&this->_tearFlags);
local_140.y = (float)room;
tearFlagsTmp = BitSet128::operator_and(&local_38,GHIDRA_CAST<BitSet128 *>(room),&g_tearFlagHydrobounce);
if ((GHIDRA_INT(tearFlagsTmp->_l) != 0 || *GHIDRA_CAST<int *>((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) != 0) ||
(GHIDRA_INT(tearFlagsTmp->_h) != 0 || *GHIDRA_CAST<int *>((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 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xe,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar10);
fVar19 = g_vectorOne.y * 0.75;
pcVar4 = *(code **)(*GHIDRA_CAST<int *>(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<Room *>(local_140.y);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(flags_01._h)) + 0x1))) = (char)(GHIDRA_UINT(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_140.y) + 8))) >> 8);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(flags_01)) + 0x0))) = *GHIDRA_CAST<unkbyte9 *>(local_140.y);
(*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(&(flags_01._h)) + 0x2))) = (short)(GHIDRA_UINT(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_140.y) + 8))) >> 0x10);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags_01._h)) + 0x4))) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_140.y) + 0xc));
tear_flags_area_apply(&this->_pos,GHIDRA_CAST<Entity *>(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<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) =
bezierB2 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x24)) +
fVar25 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 4)) +
fVar20 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x14)) +
bezierB3 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(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<float *>((GHIDRA_CAST<char *>(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x1c)) +
nextBezierB0 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 4)) +
fVar19 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x14)) +
fVar26 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x24));
local_f4[0] = GHIDRA_CAST<Room *>((nextBezierB0 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar21) + GHIDRA_INT(local_118.y) * 0x18)) +
fVar19 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x10)) +
fVar26 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x20)) +
nextBezierB3 *
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x18))));
local_140.y = local_e0 - (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_170)) + 0xc)));
local_140.x = (float)local_f4[0] -
(bezierB2 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x20)) +
fVar20 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x10)) +
fVar25 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar21) + GHIDRA_INT(local_118.y) * 0x18)) +
bezierB3 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar21) + GHIDRA_INT(local_118.y) * 0x18 + 0x18)));
(GHIDRA_CAST<Vector *>((&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<Vector *>((&local_140)))->Vector::Resized(GHIDRA_CAST<Vector *>((local_100 + 8)),8.0);
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(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<uint8_t *>(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<BitSet128 *>(room),&g_tearFlagContinuum);
if ((GHIDRA_INT(tearFlagsTmp->_l) == 0 && *GHIDRA_CAST<int *>((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) == 0) &&
(GHIDRA_INT(tearFlagsTmp->_h) == 0 && *GHIDRA_CAST<int *>((GHIDRA_INT(&tearFlagsTmp->_h) + 4)) == 0)) {
this->Remove();
}
else {
pVVar13 = (GHIDRA_CAST<Room *>((g_game->_room)))->Room::ScreenWrapPosition(&local_140,&this->_pos,-200.0);
(this->_pos).x = pVVar13->x;
(this->_pos).y = pVVar13->y;
tearFlagsTmp = (GHIDRA_CAST<BitSet128 *>((&g_tearFlagContinuum)))->BitSet128::__bnot(&local_38);
tearFlagsTmp = BitSet128::operator_and(&flagsScratch,GHIDRA_CAST<BitSet128 *>(room),tearFlagsTmp);
uVar3 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&tearFlagsTmp->_l) + 4));
qVar7 = tearFlagsTmp->_h;
fadeFrames = *GHIDRA_CAST<int *>((GHIDRA_INT(&tearFlagsTmp->_h) + 4));
*GHIDRA_CAST<int *>(room) = GHIDRA_INT(tearFlagsTmp->_l);
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((room)) + 0x4)))) = uVar3;
room->_roomType = GHIDRA_INT(qVar7);
room->_gridWidth = fadeFrames;
tearFlagsTmp = (GHIDRA_CAST<BitSet128 *>((&g_tearFlagOrbit)))->BitSet128::__bnot(&local_38);
tearFlagsTmp = BitSet128::operator_and(&flagsScratch,GHIDRA_CAST<BitSet128 *>(room),tearFlagsTmp);
uVar3 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&tearFlagsTmp->_l) + 4));
qVar7 = tearFlagsTmp->_h;
iVar2 = *GHIDRA_CAST<int *>((GHIDRA_INT(&tearFlagsTmp->_h) + 4));
fadeFrames = this->_parent;
*GHIDRA_CAST<int *>(room) = GHIDRA_INT(tearFlagsTmp->_l);
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((room)) + 0x4)))) = uVar3;
room->_roomType = GHIDRA_INT(qVar7);
room->_gridWidth = iVar2;
tmpEntity = *GHIDRA_CAST<Entity **>((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<Vector *>((&this->_velocity)))->Vector::Normalized(&local_120);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_100)) + 0x8))) = pVVar13->x;
local_f4[0] = GHIDRA_CAST<Room *>(pVVar13->y);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(direction_00.y)) + 0x1))) = (char)(GHIDRA_UINT(local_f4[0]) >> 8);
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(direction_00)) + 0x0))) = *GHIDRA_CAST<undefined5 *>(pVVar13);
(*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(&(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<float *>((fadeFrames + 0x33c));
local_f4[0] = *GHIDRA_CAST<Room **>((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<Vector *>((&local_108)))->Vector::Resized(GHIDRA_CAST<Vector *>((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<uint8_t *>(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<Room **>((fadeFrames + 0x33c));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) = *GHIDRA_CAST<uint32_t *>((fadeFrames + 0x340));
tearFlagsTmp = BitSet128::operator_and(&local_38,&this->_tearFlags,&g_tearFlagWait);
bVar8 = (GHIDRA_CAST<BitSet128 *>((tearFlagsTmp)))->BitSet128::IsZero();
if (((bVar8 == 0) && (4 < g_game->_frameCount - this->_spawnFrame)) ||
(bVar8 = (GHIDRA_CAST<Vector *>((&this->_targetPosition)))->Vector::operator_ne(&g_vectorZero), bVar8 == 0)) {
tearFlagsTmp = BitSet128::operator_and(&local_38,&this->_tearFlags,&g_tearFlagWait);
bVar8 = (GHIDRA_CAST<BitSet128 *>((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<Room *>(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<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4f4))));
local_108.y = this->_rotation * fVar19;
room = GHIDRA_CAST<Room *>(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<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_170)) + 0xc))) + fVar19 * local_140.y) - (this->_pos).y) /
this->_friction;
}
else {
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_170)) + 0xc))) = room;
fVar20 = cos(local_108.y);
fVar19 = (this->_targetPosition).x;
fVar20 = (fVar20 * fVar19 + *GHIDRA_CAST<float *>((fadeFrames + 0x33c))) - (this->_pos).x;
fVar19 = ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_170)) + 0xc))) * fVar19 + *GHIDRA_CAST<float *>((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<float *>(0x0)) {
local_140.y = (this->_sprite)._rotation * 0.017453292;
local_f4[0] = GHIDRA_CAST<Room *>(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<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4f4)))) != 0)) {
msvc::vector<int>::assign(&this->_hitList);
}
}
}
local_d9 = this->_isInterpolating;
if ((local_d9 == 0) && (this->_multidimensionalApplied != 0)) {
if ((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(ThreadLocalStoragePointer) + 0xc)) < DAT_00c94188) &&
(_Init_thread_header(&DAT_00c94188), DAT_00c94188 == -1)) {
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(&DAT_00c94190))))->Color::Color(-1.0,-1.0,-1.0,1.0,1.0,1.0);
fVar20 = -0.33;
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(&DAT_00c941bc))))->Color::Color(-0.33,-0.33,-0.33,0.66,0.66,0.66);
fVar19 = 0.33;
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(&DAT_00c941e8))))->Color::Color(0.33,0.33,0.33,0.33,0.33,0.33);
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(&DAT_00c94214))))->Color::Color(1.0,1.0,1.0,0.0,0.0,0.0);
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(&DAT_00c94240))))->Color::Color(fVar19,fVar19,fVar19,0.33,0.33,0.33);
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(&DAT_00c9426c))))->Color::Color(fVar20,fVar20,fVar20,0.66,0.66,0.66);
_Init_thread_footer(&DAT_00c94188);
}
colorOffsetXY = *GHIDRA_CAST<uint64_t *>((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<Sprite *>((GHIDRA_CAST<Sprite *>(&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<int *>((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) != 0) ||
(GHIDRA_INT(tearFlagsTmp->_h) != 0 || *GHIDRA_CAST<int *>((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<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(GHIDRA_UINT(bVar8),0);
if (bVar8 != 0) {
(GHIDRA_CAST<msvc::vector *>((&this->_hitList)))->msvc::vector::clear(0);
}
}
else {
if (this->_isFlying != 0) {
this->_size = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(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<int *>((GHIDRA_INT(&tearFlagsTmp->_l) + 4)) == 0) &&
(GHIDRA_INT(tearFlagsTmp->_h) == 0 && *GHIDRA_CAST<int *>((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)))->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<Room *>(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<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._l) + 4));
local_158._shift2 = *GHIDRA_CAST<int *>(&(this->_tearFlags)._h);
local_158._shift3 = *GHIDRA_CAST<int *>((GHIDRA_INT(&(this->_tearFlags)._h) + 4));
if (player != GHIDRA_CAST<Entity_Player *>(0x0)) {
pTVar15 = Entity_Player::GetTearHitParams
(player,&tearHitParams,4,1.0,0,GHIDRA_CAST<Entity *>(this->_spawnerEntity));
local_158._seed = local_158._seed | GHIDRA_UINT((pTVar15->_flags)._l);
local_158._shift1 = local_158._shift1 | *GHIDRA_CAST<uint32_t *>((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<uint32_t *>((GHIDRA_INT(&(pTVar15->_flags)._h) + 4));
}
tearFlagsTmp = BitSet128::operator_or(&local_38,&g_tearFlagAcid,&g_tearFlagRock);
tearFlagsTmp = BitSet128::operator_and(&flagsScratch,GHIDRA_CAST<BitSet128 *>(&local_158),tearFlagsTmp)
;
bVar8 = (GHIDRA_CAST<BitSet128 *>((tearFlagsTmp)))->BitSet128::IsNonZero();
if ((bVar8 != 0) && (cVar9 = (**(code **)(GHIDRA_INT(*GHIDRA_CAST<float *>(room)) + 0x1c))(), cVar9 != '\0'))
{
pcVar4 = *(code **)(GHIDRA_INT(*GHIDRA_CAST<float *>(room)) + 0x14);
(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>((local_6c + 4)))))->EntityRef::constructor(GHIDRA_CAST<Entity *>(this));
cVar9 = (*pcVar4)(0,local_6c + 4);
if (cVar9 != '\0') {
local_140.y = ((this->_sprite)._rotation + 90.0) * 0.017453292;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_100)) + 0x8))) = cos(local_140.y);
local_f4[0] = GHIDRA_CAST<Room *>(sin(local_140.y));
Vector::ToCardinal(&local_140,GHIDRA_CAST<Vector *>((local_100 + 8)));
bVar8 = (GHIDRA_CAST<Vector *>((cardinalDir)))->Vector::operator_ne(&g_vectorZero);
fVar19 = local_120.y;
if (bVar8 != 0) {
pVVar13 = (GHIDRA_CAST<GridEntity *>((GHIDRA_CAST<GridEntity *>(local_120.y))))->GridEntity::Position(&local_e8);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_100)) + 0x8))) = local_140.x * 40.0 + pVVar13->x;
local_f4[0] = GHIDRA_CAST<Room *>((local_140.y * 40.0 + pVVar13->y));
local_120.y = (float)g_game->_room;
fadeFrames = (GHIDRA_CAST<Room *>((GHIDRA_CAST<Room *>(local_120.y))))->Room::GetGridIndex(GHIDRA_CAST<Vector *>((local_100 + 8)));
if (-1 < fadeFrames) {
if (fadeFrames < 0x1c0) {
(GHIDRA_CAST<Room *>((GHIDRA_CAST<Room *>(local_120.y))))->Room::TryMakeBridge(((void **)(GHIDRA_INT(local_120.y) + 0x24))[fadeFrames],
GHIDRA_CAST<GridEntity *>(fVar19));
}
else {
(GHIDRA_CAST<Room *>((GHIDRA_CAST<Room *>(local_120.y))))->Room::TryMakeBridge(GHIDRA_CAST<GridEntity *>(0x0),GHIDRA_CAST<GridEntity *>(fVar19));
}
}
}
goto LAB_00965b8b;
}
}
}
}
room = g_game->_room;
(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>((local_1ac + 4)))))->EntityRef::constructor(GHIDRA_CAST<Entity *>(this));
(GHIDRA_CAST<Room *>((room)))->Room::DamageGridWithSource(GHIDRA_INT(local_140.y),1,GHIDRA_CAST<EntityRef *>((local_1ac + 4)));
}
}
LAB_00965b8b:
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(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<Entity_Player *>(0x0)) || (*GHIDRA_CAST<int *>(&g_game->_stageTransition) == 0)) {
fVar2 = 0.5;
if ((((GHIDRA_UINT(g_tearFlagOrbit._l) & GHIDRA_UINT((this->_tearFlags)._l)) != 0 ||
((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_tearFlagOrbit._l)) + 0x4))) & *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._l) + 4))) != 0) ||
((GHIDRA_UINT((this->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagOrbit._h)) != 0 ||
(*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(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<float *>((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<float *>((GHIDRA_CAST<char *>(local_d0) + 0x340)),
local_e8 - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(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<float *>((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<Entity_Player *>(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<Sprite *>((DAT_00c72214)))->Sprite::SetColor(&deadEyeColor);
if ((this->_isFlying == 0) && (local_e0 != GHIDRA_CAST<float *>(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<float *>((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<ANM2 *>(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<Entity_Player *>(this->_parent);
if ((owner != GHIDRA_CAST<Entity_Player *>(0x0)) &&
((owner->_type != 8 || (owner = GHIDRA_CAST<Entity_Player *>(owner->_parent), owner != GHIDRA_CAST<Entity_Player *>(0x0))
))) {
ownerType = owner->_type;
if (ownerType == 1) {
return owner;
}
if (ownerType == 3) {
return *GHIDRA_CAST<Entity_Player **>(&owner->_isControlsEnabled);
}
if (ownerType == 1000) {
owner = GHIDRA_CAST<Entity_Player *>(owner->_parent);
if ((owner != GHIDRA_CAST<Entity_Player *>(0x0)) && (owner->_type == 1)) {
return owner;
}
}
else if (((ownerType == 2) &&
(owner = GHIDRA_CAST<Entity_Player *>(owner->_spawnerEntity), owner != GHIDRA_CAST<Entity_Player *>(0x0))) &&
(owner->_type == 1)) {
return owner;
}
}
return GHIDRA_CAST<Entity_Player *>(0x0);
}
// 009666c0
Entity * Entity_Knife::GetRootParent()
{
Entity_Knife *nextParent;
Entity_Knife *parent;
nextParent = GHIDRA_CAST<Entity_Knife *>(this->_parent);
while ((parent = nextParent, parent != GHIDRA_CAST<Entity_Knife *>(0x0) && (parent->_type == 8))) {
this = parent;
nextParent = GHIDRA_CAST<Entity_Knife *>(parent->_parent);
}
return GHIDRA_CAST<Entity *>(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<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_tearFlagOrbit._l)) + 0x4)))) != 0) ||
((uVar2 & GHIDRA_UINT(g_tearFlagOrbit._h)) != 0 ||
(*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(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<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_tearFlagHydrobounce._l)) + 0x4)))) != 0) ||
((uVar2 & GHIDRA_UINT(g_tearFlagHydrobounce._h)) != 0 ||
(*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(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<uint8_t *>(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<uint32_t *>((animData + 0x14))) {
curAnimChar = *GHIDRA_CAST<uint8_t **>(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<uint32_t *>((GHIDRA_CAST<char *>(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<uint32_t *>(&(this->_usedTearFlags)._l) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_usedTearFlags)._l) + 4)) = 0;
*GHIDRA_CAST<uint32_t *>(&(this->_usedTearFlags)._h) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_usedTearFlags)._h) + 4)) = 0;
player = GetPlayer(this);
if (player != GHIDRA_CAST<Entity_Player *>(0x0)) {
iVar7 = GetBaseVariant(this);
if ((((iVar7 != 1) && (iVar7 = GetBaseVariant(this), iVar7 != 10)) && (extraout_DL != '\0')) &&
((bVar6 = (GHIDRA_CAST<Entity_Player *>((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<float *>((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<float *>((iVar7 + 0x33c));
fVar8 = sin(fVar8);
spawnPos.y = fVar8 * 30.0 + fVar12;
spawned = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(8,0,&spawnPos,&g_vectorZero,GHIDRA_CAST<Entity *>(player),1,seed,0);
spawnedKnife = GHIDRA_CAST<Entity_Knife *>(__RTDynamicCast(spawned,0));
iVar7 = *GHIDRA_CAST<int *>(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<HomingLaser *>((&spawnedKnife->_homingLaser)))->HomingLaser::operator_assign(&local_5c->_homingLaser);
if (spawnedKnife->_parent != 0) {
msvc::multiset<unsigned_int>::erase(auStack_5e + -0xe);
}
spawnedKnife->_parent = local_5c;
msvc::multiset<unsigned_int>::insert(&spawnedKnife->_parent);
uVar2 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(local_5c->_tearFlags)._l) + 4));
qVar5 = (local_5c->_tearFlags)._h;
uVar3 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(local_5c->_tearFlags)._h) + 4));
*GHIDRA_CAST<int *>(&(spawnedKnife->_tearFlags)._l) = GHIDRA_INT((local_5c->_tearFlags)._l);
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(spawnedKnife->_tearFlags)._l) + 4)) = uVar2;
*GHIDRA_CAST<int *>(&(spawnedKnife->_tearFlags)._h) = GHIDRA_INT(qVar5);
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(spawnedKnife->_tearFlags)._h) + 4)) = uVar3;
fVar8 = cos(fVar12);
spawned = GHIDRA_CAST<Entity_Knife *>(sin(fVar12));
direction.y = (float)spawned;
direction.x = fVar8;
InitHomingPath(spawnedKnife,direction,GHIDRA_CAST<Entity *>(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<Entity_Player *>((player)))->Entity_Player::HasCollectible(0x18b,0);
if (bVar6 != 0) {
if (*GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4fc)))) != GHIDRA_CAST<int *>(0x0)) {
(**(code **)(**GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4fc)))) + 0x28))();
}
rngResult = Random();
spawned = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(7,2,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(player),3,rngResult,0);
laser = GHIDRA_CAST<int *>(__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<uint64_t *>((GHIDRA_CAST<char *>(&(laserColor._offset)) + 0x0))) = *GHIDRA_CAST<uint64_t *>((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<unsigned_int>::erase(auStack_5e + -0x12);
}
laser[0xef] = GHIDRA_INT(this);
msvc::multiset<unsigned_int>::insert(laser + 0xef);
laser[0xd6] = 0x453b8000;
iVar7 = *GHIDRA_CAST<int *>((GHIDRA_INT(&(this->_tearFlags)._l) + 4));
qVar5 = (this->_tearFlags)._h;
iVar4 = *GHIDRA_CAST<int *>((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<uint32_t *>((GHIDRA_CAST<char *>(&(auVar11)) + 0x0))) < this->_charge) {
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(auVar11)) + 0x4))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(auVar11)) + 0x4)));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar11)) + 0x0))) = this->_charge;
}
(**(code **)(*laser + 0x40))((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(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<unsigned_int>::erase(auStack_5e + -0x16);
}
laser[0xf2] = unaff_EDI;
msvc::multiset<unsigned_int>::insert(laser + 0xf2);
(**(code **)(*laser + 0xc))();
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4fc)))) != 0) {
msvc::multiset<unsigned_int>::erase();
}
*GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4fc)))) = laser;
msvc::multiset<unsigned_int>::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<uint32_t **>((GHIDRA_CAST<char *>(g_game->_room) + 0x125c));
local_20 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(g_game->_room) + 0x1264));
entityIndex = 0;
local_8 = 0;
local_18 = GHIDRA_CAST<Entity *>(0x0);
if (local_20 != 0.0) {
do {
this_00 = GHIDRA_CAST<Entity *>(local_24[entityIndex]);
bVar1 = (GHIDRA_CAST<Entity *>((this_00)))->Entity::IsVulnerableEnemy(GHIDRA_CAST<Entity *>(this));
if ((bVar1 == 0) || (isVulnerable = '\x01', (this_00->_flags & 0x20000010) != 0)) {
isVulnerable = '\0';
}
if ((((*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2) || (this_00->_type != 3)) ||
(this_00->_variant != 0x43)) ||
(bVar1 = (GHIDRA_CAST<Entity *>((this_00)))->Entity::IsDescendantOf(GHIDRA_CAST<Entity *>(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<unsigned_int>::erase(&local_24);
}
}
puVar6 = &this->_target;
*puVar6 = local_18;
bVar2 = local_18 == GHIDRA_CAST<Entity *>(0x0);
targetEntity = 0;
if (!bVar2) {
msvc::multiset<unsigned_int>::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<float *>((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<float *>((targetEntity + 0x340)) - fVar3) * (1.0 - fVar4) + fVar3
;
(this->_targetPosition).x = (fVar5 - fVar7) * (1.0 - fVar4) + fVar7;
}
else {
fVar5 = (this->_targetPosition).y;
fVar4 = *GHIDRA_CAST<float *>((targetEntity + 0x340));
(this->_targetPosition).x = (*GHIDRA_CAST<float *>((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<Entity *>(((this->_pos).x - fVar3));
local_1c = (this->_pos).y - fVar5;
local_24 = GHIDRA_CAST<uint32_t *>(((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<uint32_t *>(((float)local_24 * (fVar4 / fVar3)));
fVar5 = local_20 * (fVar4 / fVar3);
fVar3 = fVar4;
}
fVar3 = this->_knifeDistance / fVar3;
local_18 = GHIDRA_CAST<Entity *>(((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<Entity_Knife *>(this->_parent);
if (ancestor == GHIDRA_CAST<Entity_Knife *>(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<int *>((grandParent + 0x28)) != 1)) goto LAB_00967b6b;
local_10.x = *GHIDRA_CAST<float *>((grandParent + 0x33c)) - (this->_pos).x;
local_10.y = *GHIDRA_CAST<float *>((grandParent + 0x340)) - (this->_pos).y;
normalizedDir = (GHIDRA_CAST<Vector *>((&local_10)))->Vector::Normalized(GHIDRA_CAST<Vector *>(&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<int *>((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0) &&
(GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST<int *>((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<Entity_Knife *>(*parentSlot);
} while (GHIDRA_CAST<Entity_Knife *>(*parentSlot) != GHIDRA_CAST<Entity_Knife *>(0x0));
local_10.y = perpX;
if (rootKnife != this) {
rngState = this->_initSeed;
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4))) = 0x900000005;
local_14 = 9.80909e-45;
if (rngState == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("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<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._l) + 4)) & (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_tearFlagLudovico._l)) + 0x4)))) == 0) &&
((GHIDRA_UINT((this->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagLudovico._h)) == 0 &&
(*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._h) + 4)) & (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(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<float *>((parent + 0x340));
parentX = *GHIDRA_CAST<float *>((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<Vector *>((&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<uint8_t *>(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<unsigned_int>::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<uint32_t *>((animNameCursor + 0x14))) {
animNameCursor = *GHIDRA_CAST<uint8_t **>(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<uint8_t *>((curAnim + 0xe));
local_14 = GHIDRA_CAST<uint8_t ****>(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<uint8_t *>(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<uint8_t *****>(0x0);
puStack_20 = GHIDRA_CAST<uint8_t *>((curAnim + 0xe));
}
else {
puStack_20 = GHIDRA_CAST<uint8_t *>((curAnim + 0xe));
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(curAnim))))->msvc::string::string(animData);
}
local_14 = GHIDRA_CAST<uint8_t ****>(0x0);
pppppbVar1 = GHIDRA_CAST<uint8_t *****>(curAnim);
if (0xf < curAnimCapacity) {
pppppbVar1 = curAnim[0];
}
isAnimSet = str_eq(GHIDRA_CAST<uint8_t *>(pppppbVar1),curAnimSize,GHIDRA_CAST<uint8_t *>("Swing"),5);
animName = "Swing2";
if (isAnimSet == 0) {
animName = "Swing";
}
isAnimSet = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST<uint8_t *>(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<uint8_t *****>(curAnim[0][-1]);
size = curAnimCapacity + 0x24;
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((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<int *>((parent + 0x28)) == 1 || (*GHIDRA_CAST<int *>((parent + 0x28)) == 3)))) {
fVar3 = this->_displayRotation * 0.017453292;
cosRot = cos(fVar3);
fVar2 = *GHIDRA_CAST<float *>((parent + 0x33c));
sinRot = sin(fVar3);
fVar3 = *GHIDRA_CAST<float *>((parent + 0x340));
(this->_pos).x = cosRot * 5.0 + fVar2;
(this->_pos).y = sinRot * 5.0 + fVar3;
fVar2 = *GHIDRA_CAST<float *>((parent + 0x340));
(this->_anchorPosition).x = *GHIDRA_CAST<float *>((parent + 0x33c));
(this->_anchorPosition).y = fVar2;
fVar2 = atan2f((this->_pos).y - *GHIDRA_CAST<float *>((parent + 0x340)),
(this->_pos).x - *GHIDRA_CAST<float *>((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<uint16_t *>(&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<uint8_t *>("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<uint8_t *>(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<int *>(&local_10));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_10),1.0,2,0,local_c,0.0);
this->_isDeadEyeHit = 0;
*GHIDRA_CAST<uint16_t *>(&this->_isSwinging) = 1;
this->_isSpinAttack = 1;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4ec)))) = 1;
*GHIDRA_CAST<short *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((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<Entity_Player *>(0x0)) || (iVar3 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((player)) + 0x4f4)))), iVar3 == 0)) ||
(*GHIDRA_CAST<int *>((iVar3 + 0x28)) != 8)) || (*GHIDRA_CAST<char *>((iVar3 + 0x171)) == '\0')) {
return 0;
}
cVar1 = FUN_00961ad0();
if ((cVar1 != '\0') && (uVar2 = Random(), (uVar2 & 3) != 0)) {
return 0;
}
uVar2 = (GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::GetActiveItemSlot(0x93);
if (-1 < GHIDRA_INT(uVar2)) {
Entity_Player::AddActiveCharge(player,-charge,uVar2,0,0,0);
iVar3 = (GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::GetActiveItem(uVar2);
if (0 < iVar3) {
return 0;
}
(GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::DischargeActiveItem(uVar2,0);
}
(GHIDRA_CAST<TemporaryEffects *>((&player->_temporaryeffects)))->TemporaryEffects::RemoveCollectibleEffect(0x93,-1);
manager = g_manager;
local_3c = 6.474e-43;
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_3c));
(GHIDRA_CAST<SoundEffects *>((&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<int *>(&local_3c));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_3c),1.0,2,0,1.0,0.0);
(GHIDRA_CAST<Color *>((&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<Color *>((&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<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((player)) + 0x4f4))));
if ((iVar3 != 0) && (*GHIDRA_CAST<int *>((iVar3 + 0x28)) == 8)) {
*GHIDRA_CAST<uint8_t *>((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<int *>((uVar7 + 0x28)) == 8) {
uVar7 = *GHIDRA_CAST<uint32_t *>((uVar7 + 0x3bc));
if (uVar7 == 0) goto LAB_00968980;
}
iVar5 = *GHIDRA_CAST<int *>((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<Entity_Player *>(((fVar12 * 4.0) / 3.0));
local_94 = (GHIDRA_CAST<DebugRenderer *>((GHIDRA_CAST<DebugRenderer *>(&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<Entity_Player *>(0x0)) && (ownerPlayer->_playerType == 0x23)) {
local_d0 = GHIDRA_CAST<Entity_Player *>(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<int *>((GHIDRA_INT(&maskedFlags->_l) + 4)) == 0) &&
(GHIDRA_INT(maskedFlags->_h) == 0 && *GHIDRA_CAST<int *>((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<Entity_Knife *>((this->_sprite)._animState._animFrame);
dVar16 = floor((double)(float)local_c0);
local_c0 = GHIDRA_CAST<Entity_Knife *>((float)dVar16);
local_a8 = CONCAT44(GHIDRA_INT(dVar16),GHIDRA_CAST<GridEntity *>(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<GridEntity *>(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<uint32_t *>((GHIDRA_CAST<char *>(&(hitTearFlags._l)) + 0x0))) = GHIDRA_UINT((this->_tearFlags)._l);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(hitTearFlags._l)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._l) + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(hitTearFlags._h)) + 0x0))) = GHIDRA_UINT((this->_tearFlags)._h);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(hitTearFlags._h)) + 0x4))) = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._h) + 4));
if (ownerPlayer == GHIDRA_CAST<Entity_Player *>(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<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlagsCopy._l)) + 0x0))) = GHIDRA_UINT(hitTearFlags._l);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlagsCopy._l)) + 0x4))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(hitTearFlags._l)) + 0x4)));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlagsCopy._h)) + 0x0))) = GHIDRA_UINT(hitTearFlags._h);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlagsCopy._h)) + 0x4))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(hitTearFlags._h)) + 0x4)));
local_c0 = GHIDRA_CAST<Entity_Knife *>(&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<Capsule *>((GHIDRA_CAST<Capsule *>(&tipCapsule))))->Capsule::constructor(&tipPos,&local_f0,0.0,scaleY * tipRadius);
(GHIDRA_CAST<Capsule *>((GHIDRA_CAST<Capsule *>(&extraCapsule))))->Capsule::constructor(&g_vectorZero,&g_vectorZero,0.0,0.0);
if ((*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2) || (this->_variant != 3)) {
if (this->_variant == 0xb) {
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(hitTearFlags._l)) + 0x0))) = GHIDRA_UINT(tearFlagsCopy._l) | GHIDRA_UINT(g_tearFlagShielded._l);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(hitTearFlags._l)) + 0x4))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlagsCopy._l)) + 0x4))) | (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_tearFlagShielded._l)) + 0x4)));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(hitTearFlags._h)) + 0x0))) = GHIDRA_UINT(tearFlagsCopy._h) | GHIDRA_UINT(g_tearFlagShielded._h);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(hitTearFlags._h)) + 0x4))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlagsCopy._h)) + 0x4))) | (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_tearFlagShielded._h)) + 0x4)));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlagsCopy._l)) + 0x0))) = GHIDRA_UINT(hitTearFlags._l);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlagsCopy._l)) + 0x4))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(hitTearFlags._l)) + 0x4)));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlagsCopy._h)) + 0x0))) = GHIDRA_UINT(hitTearFlags._h);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlagsCopy._h)) + 0x4))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(hitTearFlags._h)) + 0x4)));
}
}
else {
damage = this->_collisionDamage * 1.5;
}
if (baseVariant == 10) {
nullCapsule = (EntityRef *)
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::GetNullCapsule(GHIDRA_CAST<Capsule *>((local_50 + 4)),&DAT_00b1d3b0)
;
(GHIDRA_CAST<EntityRef *>((&tipCapsule)))->EntityRef::operator_(nullCapsule);
nullCapsule = (EntityRef *)
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::GetNullCapsule(GHIDRA_CAST<Capsule *>((local_50 + 4)),&DAT_00b7cb20)
;
(GHIDRA_CAST<EntityRef *>((&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<Capsule *>(&tipCapsule));
}
if (0.0 < (float)extraCapsule._flags) {
push_shape_points(pvVar8,GHIDRA_CAST<Capsule *>(&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)))->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<GridEntity *>(0x0);
}
else {
gridEntity = room->_gridEntities[iVar5];
}
local_bc = gridEntity;
if (gridEntity != GHIDRA_CAST<GridEntity *>(0x0)) {
iVar5 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(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<Capsule *>((gridCapsule)))->Capsule::constructor(&scratchVec,&g_vectorOne,0.0,20.0);
bVar3 = Capsule::Collide(gridCapsule,GHIDRA_CAST<Capsule *>(&tipCapsule),&local_f0);
if ((bVar3 != 0) ||
((0.0 < (float)extraCapsule._flags &&
(bVar3 = Capsule::Collide(gridCapsule,GHIDRA_CAST<Capsule *>(&extraCapsule),&local_f0),
bVar3 != 0)))) {
pEVar10 = knife;
if (knife->_variant == 9) {
if (0 < gridEntity->_collisionClass) {
virtualFn = *(code **)(*GHIDRA_CAST<int *>(gridEntity) + 0x14);
(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>((local_50 + 4)))))->EntityRef::constructor(GHIDRA_CAST<Entity *>(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<uint32_t *>((GHIDRA_CAST<char *>(&(local_b8)) + 0x4))))) {
bridgeDirX = 0.0;
if (0.0 <= (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(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<GridEntity *>(0x0);
}
(GHIDRA_CAST<Room *>((room)))->Room::TryMakeBridge(gridEntity,local_bc);
}
}
bVar3 = drain_notched_axe(pEVar10,1);
if (bVar3 != 0) {
if (pEVar10->_variant == 9) {
DAT_00c7ac6c = GHIDRA_CAST<Entity_Player *>(0x0);
ExceptionList = savedExceptionList;
return;
}
ExceptionList = savedExceptionList;
return;
}
isHitAnything = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(isHitAnything)) + 0x1))),1);
}
}
}
else {
local_78 = 0;
local_74 = 0;
local_70 = 0;
local_6c = 0;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_68)) + 0x0))) = g_vectorZero.x;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(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<BitSet128 *>(maskResult),&tearFlagsCopy,&g_tearFlagShielded);
if (((((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST<int *>((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) ||
(GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST<int *>((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) ||
((this->_variant == 4 || (this->_variant == 3)))) ||
((baseVariant == 10 && (this->_isSpinAttack != 0)))) && ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(local_a8))) + 0x4))) < 5)) {
uVar7 = 0x1f;
}
EntityList::QueryRadius
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST<EntityList_EL *>(queryResults),&local_e0
,local_98,uVar7);
ehState = 0;
loopIndex = 0;
if (uStack_1a4 != 0) {
fVar12 = 0.0;
do {
ownerPlayer = *GHIDRA_CAST<Entity_Pickup **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(queryResults)) + 0x4))) + loopIndex * 4));
if ((ownerPlayer->_size != fVar12) && (ownerPlayer->_entityCollisionClass != 0)) {
if (fVar12 < (float)tipCapsule._entity) {
entityCapsule =
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(ownerPlayer))))->Entity::GetCollisionCapsule(local_50 + 4,&g_vectorZero);
bVar3 = Capsule::Collide(entityCapsule,GHIDRA_CAST<Capsule *>(&tipCapsule),&local_f0);
fVar12 = 0.0;
if ((bVar3 == 0) && (0.0 < (float)extraCapsule._flags)) {
entityCapsule =
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(ownerPlayer))))->Entity::GetCollisionCapsule(local_50 + 4,&g_vectorZero);
bVar3 = Capsule::Collide(entityCapsule,GHIDRA_CAST<Capsule *>(&extraCapsule),&local_f0);
fVar12 = 0.0;
if (bVar3 == 0) goto LAB_0096a6af;
}
}
piVar9 = &ownerPlayer->_type;
if (*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2) {
LAB_00969714:
iVar5 = *piVar9;
local_a8 = CONCAT44(piVar9,GHIDRA_CAST<GridEntity *>(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<Entity_Player *>(ownerPlayer->_parent) != player) ||
(*GHIDRA_CAST<char *>(&(ownerPlayer->_priceANM2)._animState._layerFrames) == '\0')) ||
(pfVar2 = &(ownerPlayer->_posOffset).y, fVar12 < *pfVar2 || fVar12 == *pfVar2)) {
hitList = GetHitEntities(this);
bVar3 = (GHIDRA_CAST<EntityList *>((hitList)))->EntityList::HitListContains(GHIDRA_CAST<Entity *>(ownerPlayer));
if (bVar3 == 0) {
pvVar8 = GetHitEntities(this);
uVar7 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(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<GridEntity *>(local_a8));
fVar13 = sqrtf(fVar12 * fVar12 + local_84 * local_84);
fVar12 = 0.0;
if (fVar13 <= 0.0) {
fVar14 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_a8)) + 0x4)));
fVar13 = local_84;
}
else {
fVar14 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((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<Entity_Player *>(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<int *>((local_d4 + 0x28)) != 2)))) {
hitList = GetHitEntities(this);
bVar3 = (GHIDRA_CAST<EntityList *>((hitList)))->EntityList::HitListContains(GHIDRA_CAST<Entity *>(ownerPlayer));
if (bVar3 == 0) {
pvVar8 = GetHitEntities(this);
uVar7 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(ownerPlayer))))->Entity::GetHitListIndex();
sorted_vector_insert_unique(pvVar8,uVar7);
fVar12 = (ownerPlayer->_pos).x - *GHIDRA_CAST<float *>(local_c0);
local_84 = (ownerPlayer->_pos).y - *GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((local_c0)) + 0x4))));
local_a8 = CONCAT44(fVar12,GHIDRA_CAST<GridEntity *>(local_a8));
fVar13 = sqrtf(fVar12 * fVar12 + local_84 * local_84);
fVar12 = 0.0;
if (fVar13 <= 0.0) {
fVar14 = local_84;
fVar13 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_a8)) + 0x4)));
}
else {
fVar14 = local_84 * (1.0 / fVar13);
fVar13 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((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<Entity_Player *>(0x0)) {
iVar5 = knife->_variant;
bVar3 = (GHIDRA_CAST<Entity_Pickup *>((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<int *>((extraout_EDX + 0x2c)) == 9) {
local_84 = 2.3509887e-38;
}
else {
local_84 = 0.0;
}
local_a8 = local_a8 & 0xffffffff;
virtualFn = *(code **)(*GHIDRA_CAST<int *>(ownerPlayer) + 0x20);
EntityRef::constructor
(GHIDRA_CAST<EntityRef *>((local_50 + 4)),
*GHIDRA_CAST<Entity **>((extraout_EDX + 0x3bc)));
(*virtualFn)(damage,local_84,(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_a8)) + 0x4))),local_50 + 4,0x1e);
goto LAB_0096a6a9;
}
}
}
}
else if (GHIDRA_CAST<Entity_Player *>(ownerPlayer->_parent) == player) {
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlagsCopy._l)) + 0x0))) = *GHIDRA_CAST<uint32_t *>((ownerPlayer->_priceANM2)._animDefaultName._buf);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlagsCopy._l)) + 0x4))) =
*GHIDRA_CAST<uint32_t *>(((ownerPlayer->_priceANM2)._animDefaultName._buf + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlagsCopy._h)) + 0x0))) =
*GHIDRA_CAST<uint32_t *>(((ownerPlayer->_priceANM2)._animDefaultName._buf + 8));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlagsCopy._h)) + 0x4))) =
*GHIDRA_CAST<uint32_t *>(((ownerPlayer->_priceANM2)._animDefaultName._buf + 0xc));
maskedFlags = BitSet128::operator_and
(GHIDRA_CAST<BitSet128 *>(&local_60),&tearFlagsCopy,
&g_tearFlagLudovico);
if ((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST<int *>((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) ||
(GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST<int *>((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) {
hitList = GetHitEntities(this);
bVar3 = (GHIDRA_CAST<EntityList *>((hitList)))->EntityList::HitListContains(GHIDRA_CAST<Entity *>(ownerPlayer));
if (bVar3 == 0) {
pvVar8 = GetHitEntities(this);
uVar7 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(ownerPlayer))))->Entity::GetHitListIndex();
sorted_vector_insert_unique(pvVar8,uVar7);
fVar12 = (ownerPlayer->_pos).y - *GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((local_c0)) + 0x4))));
local_84 = (ownerPlayer->_pos).x - *GHIDRA_CAST<float *>(local_c0);
local_a8 = CONCAT44(fVar12,GHIDRA_CAST<GridEntity *>(local_a8));
fVar13 = sqrtf(fVar12 * fVar12 + local_84 * local_84);
fVar12 = 0.0;
if (fVar13 <= 0.0) {
fVar14 = local_84;
fVar13 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_a8)) + 0x4)));
}
else {
fVar14 = local_84 * (1.0 / fVar13);
fVar13 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((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<EntityList *>((hitList)))->EntityList::HitListContains(GHIDRA_CAST<Entity *>(ownerPlayer));
if (bVar3 == 0) {
pvVar8 = GetHitEntities(this);
uVar7 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(ownerPlayer))))->Entity::GetHitListIndex();
sorted_vector_insert_unique(pvVar8,uVar7);
local_84 = (ownerPlayer->_pos).x - knockbackOrigin->x;
fVar12 = (ownerPlayer->_pos).y - knockbackOrigin->y;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_a8)) + 0x4))) = GHIDRA_CAST<Room *>(fVar12);
fVar13 = sqrtf(local_84 * local_84 + fVar12 * fVar12);
fVar12 = local_84;
if (0.0 < fVar13) {
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_a8)) + 0x4))) = GHIDRA_CAST<Room *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((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<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_a8)) + 0x4))) * knockbackStrength) / fVar13 +
(ownerPlayer->_velocity).y;
}
manager = g_manager;
local_a8 = CONCAT44(0x354,GHIDRA_CAST<GridEntity *>(local_a8));
seed_fart_sound_override(GHIDRA_CAST<int *>((GHIDRA_INT(&local_a8) + 4)));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(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<Entity_Player *>(0x0)) && (ownerPlayer->_dead == 0)) &&
(-50.0 < *GHIDRA_CAST<float *>((ownerPlayer->_priceANM2)._filename._buf))) {
local_84 = (ownerPlayer->_pos).y - knockbackOrigin->y;
fVar12 = (ownerPlayer->_pos).x - knockbackOrigin->x;
local_a8 = CONCAT44(fVar12,GHIDRA_CAST<GridEntity *>(local_a8));
fVar13 = sqrtf(local_84 * local_84 + fVar12 * fVar12);
fVar12 = 0.0;
if (fVar13 <= 0.0) {
fVar14 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_a8)) + 0x4)));
fVar13 = local_84;
}
else {
fVar14 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((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<Entity_Projectile *>((GHIDRA_CAST<Entity_Projectile *>(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<GridEntity *>(local_a8));
if (*piVar9 != 1) goto LAB_00969714;
iVar5 = 1;
LAB_0096972f:
if (ownerPlayer == GHIDRA_CAST<Entity_Pickup *>(this->_spawnerEntity)) goto LAB_00969f92;
LAB_0096973b:
if ((ownerPlayer->_flags & 0x20000000) != 0) goto LAB_00969f92;
hitList = GetHitEntities(this);
bVar3 = (GHIDRA_CAST<EntityList *>((hitList)))->EntityList::HitListContains(GHIDRA_CAST<Entity *>(ownerPlayer));
if (bVar3 != 0) goto LAB_0096a6af;
iVar5 = *(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<int *>(local_a8))) + 0x4)));
if ((iVar5 != 0xf5) && (iVar5 != 0x124)) {
pvVar8 = GetHitEntities(this);
uVar7 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(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<int *>(ownerPlayer) + 0x20);
(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>((local_50 + 4)))))->EntityRef::constructor(GHIDRA_CAST<Entity *>(knife->_parent));
(*virtualFn)(0x447a0000,0,0,local_50 + 4,0x1e);
isHitAnything = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(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<uint32_t *>(&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<float *>((iVar5 + 0x33c)) - (this->_pos).x;
scratchVec.y = *GHIDRA_CAST<float *>((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<uint32_t *>((GHIDRA_CAST<char *>(&(local_b8)) + 0x4))) <= 0.0) {
pvVar8 = local_94;
fVar13 = local_98;
}
else {
fVar13 = (fVar13 + 0.1) / (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(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<Entity_Player *>(0x0))) &&
(bVar3 = (GHIDRA_CAST<Entity_Player *>((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<EntityRef *>((GHIDRA_CAST<EntityRef *>((local_50 + 4)))))->EntityRef::constructor(GHIDRA_CAST<Entity *>(player));
Entity::AddKnockback
(GHIDRA_CAST<Entity *>(ownerPlayer),GHIDRA_CAST<EntityRef *>((local_50 + 4)),&local_15c,
GHIDRA_INT(dVar16),1);
this = knife;
}
}
local_a8 = 0;
local_b8 = CONCAT44(GHIDRA_UINT((*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2)) * 2 + 4,
(uint32_t)local_b8);
bVar3 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(ownerPlayer))))->Entity::IsVulnerableEnemy(GHIDRA_CAST<Entity *>(0x0));
if ((bVar3 == 0) || (player == GHIDRA_CAST<Entity_Player *>(0x0))) {
LAB_00969c8e:
local_9c = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_a8)) + 0x4)));
local_bc = GHIDRA_CAST<GridEntity *>(local_a8);
}
else {
if ((player->_hasCurseMistEffect != 0) ||
((player->_isCoopGhost != 0 || (player->_playerForms[0] < 3)))) {
bVar3 = (GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::HasCollectible(0x97,0);
if (bVar3 != 0) {
uVar7 = Random();
if (uVar7 % (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(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<Room *>(0x0);
local_bc = GHIDRA_CAST<GridEntity *>(0x4000);
}
if (this->_variant == 9) {
local_bc = GHIDRA_CAST<GridEntity *>((GHIDRA_UINT(local_bc) | 0x1000000));
}
if ((this->_flags & 0x400000000) != 0) {
local_bc = GHIDRA_CAST<GridEntity *>((GHIDRA_UINT(local_bc) | 0x20000000));
}
if (isBurningAxe != '\0') {
local_9c = GHIDRA_CAST<Room *>((GHIDRA_UINT(local_9c) | 2));
}
virtualFn = *(code **)(*GHIDRA_CAST<int *>(ownerPlayer) + 0x20);
(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>((local_50 + 4)))))->EntityRef::constructor(GHIDRA_CAST<Entity *>(knife->_parent));
cVar4 = (*virtualFn)(damage,local_bc,local_9c,local_50 + 4,0x1e);
if (cVar4 == '\0') {
pEVar10 = knife;
}
else {
bVar3 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(ownerPlayer))))->Entity::IsVulnerableEnemy(GHIDRA_CAST<Entity *>(0x0));
manager = g_manager;
if (bVar3 == 0) {
pEVar10 = knife;
}
else {
local_a8 = CONCAT44(0x4d,GHIDRA_CAST<GridEntity *>(local_a8));
seed_fart_sound_override(GHIDRA_CAST<int *>((GHIDRA_INT(&local_a8) + 4)));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(local_a8))) + 0x4))),1.0,10,0,1.5,0.0)
;
pEVar10 = knife;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags._l)) + 0x4))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(hitTearFlags._l)) + 0x4)));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags._l)) + 0x0))) = GHIDRA_UINT(hitTearFlags._l);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags._h)) + 0x0))) = GHIDRA_UINT(hitTearFlags._h);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags._h)) + 0x4))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(hitTearFlags._h)) + 0x4)));
Entity_Tear::ApplyTearFlagEffects
(GHIDRA_CAST<Entity *>(ownerPlayer),&knife->_pos,flags,GHIDRA_CAST<Entity *>(knife),damage);
if (pEVar10->_variant == 3) {
iVar5 = player->_damageCooldown;
if (iVar5 < 1) {
*GHIDRA_CAST<int *>(&player->_flags) = GHIDRA_INT(player->_flags);
puVar1 = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&player->_flags) + 4));
*puVar1 = *puVar1 | 0x10;
pEVar10 = knife;
}
local_b8 = CONCAT44(0xf,(uint32_t)local_b8);
piVar9 = GHIDRA_CAST<int *>((GHIDRA_INT(&local_b8) + 4));
if (0xe < iVar5) {
piVar9 = &player->_damageCooldown;
}
player->_damageCooldown = *piVar9;
}
if (isBurningAxe != '\0') {
(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>((local_50 + 4)))))->EntityRef::constructor(GHIDRA_CAST<Entity *>(player));
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(ownerPlayer))))->Entity::AddBurn(GHIDRA_CAST<EntityRef *>((local_50 + 4)),0x5a,0.0,0);
}
}
if ((pEVar10->_variant == 9) &&
(bVar3 = drain_notched_axe(pEVar10,2), bVar3 != 0)) {
DAT_00c7ac6c = GHIDRA_CAST<Entity_Player *>(0x0);
(GHIDRA_CAST<EntityList_Query *>((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<Entity *>(ownerPlayer),&local_100,ownerPlayer->_size,
damage,CONCAT44(local_9c,local_bc),0);
}
if ((((ownerPlayer->_pendingDamage < ownerPlayer->_health) &&
((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pEVar10)) + 0x4e9))) == '\0')) && (pEVar10->_isFlying == 0)) &&
(fVar12 = 0.0, local_d4 != 0)) {
fVar13 = *GHIDRA_CAST<float *>((local_d4 + 0x36c));
if (fVar13 != 0.0) {
*GHIDRA_CAST<float *>((local_d4 + 0x360)) =
(-local_98 * (float)local_d0) / fVar13 + *GHIDRA_CAST<float *>((local_d4 + 0x360));
*GHIDRA_CAST<float *>((local_d4 + 0x364)) =
(-(float)local_94 * (float)local_d0) / fVar13 +
*GHIDRA_CAST<float *>((local_d4 + 0x364));
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pEVar10)) + 0x4e9))) = 1;
if ((local_7d != '\0') && (*GHIDRA_CAST<int *>((local_d4 + 0x28)) != 2)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pEVar10)) + 0x466))) = 0;
isHitAnything = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(isHitAnything)) + 0x1))),1);
goto LAB_0096a6af;
}
}
fVar12 = 0.0;
isHitAnything = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(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<Entity_Player *>(0x0))) {
this = knife;
}
else {
bVar3 = (GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::HasCollectible(0x175,0);
this = knife;
if (bVar3 != 0) {
iVar5 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((knife)) + 0x4f4))));
if (iVar5 != 0) {
if (*GHIDRA_CAST<char *>((iVar5 + 0x4e4)) == '\0') {
(GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::AddDeadEyeCharge();
}
*GHIDRA_CAST<uint8_t *>((iVar5 + 0x4e4)) = 1;
}
}
}
ehState = 0xffffffff;
if (this->_variant == 9) {
DAT_00c7ac6c = GHIDRA_CAST<Entity_Player *>(0x0);
}
if (queryResults[0] == '\0') {
ehState = 1;
tracked_alloc(1,(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)queryResults)) + 0x4))),0);
ehState = 0xffffffff;
}
}
}
if (this->_subtype == 4) goto LAB_0096ae0c;
if (0 < *GHIDRA_CAST<short *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4ec))))) {
swingIndex = *GHIDRA_CAST<short *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4ee))));
if ((GHIDRA_INT(swingIndex) & 1U) == 0) {
local_d0 = GHIDRA_CAST<Entity_Player *>(this->_parent);
if ((local_d0 != GHIDRA_CAST<Entity_Player *>(0x0)) && (local_d0->_type == 8)) {
local_d0 = GHIDRA_CAST<Entity_Player *>(local_d0->_parent);
}
ownerPlayer = local_d0;
local_d4 = GHIDRA_INT(swingIndex) / 2 & 0xffffff01;
if (baseVariant == 1) {
curAnimName = ANM2::GetAnimation(GHIDRA_CAST<ANM2 *>(&(this->_sprite)._animState),GHIDRA_CAST<std_string *>(local_68))
;
local_e8 = 1.4013e-45;
puVar1 = &curAnimName->_size;
if (0xf < curAnimName->_capacity) {
curAnimName = *GHIDRA_CAST<std_string **>(curAnimName->_buf);
}
bVar3 = str_eq(GHIDRA_CAST<uint8_t *>(curAnimName),*puVar1,GHIDRA_CAST<uint8_t *>("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<msvc::string *>((local_68)))->msvc::string::_Tidy_deallocate();
}
if (local_7d != '\0') {
local_d4 = local_d4 ^ 1;
}
if (ownerPlayer != GHIDRA_CAST<Entity_Player *>(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<uint32_t *>((GHIDRA_CAST<char *>(&(auVar15)) + 0x0))) <= local_e8) {
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(auVar15)) + 0x4))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(auVar15)) + 0x4)));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar15)) + 0x0))) = local_e8;
}
swingDistance = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(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 =
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(8,this->_variant,&scratchVec,&g_vectorZero,
GHIDRA_CAST<Entity *>(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<Entity *>((GHIDRA_CAST<Entity *>(pEVar10))))->Entity::SetParent(GHIDRA_CAST<Entity *>(local_d0));
swingIndex = *GHIDRA_CAST<short *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((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<uint32_t *>((GHIDRA_CAST<char *>(&(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<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._l) + 4));
tearFlagsHigh = (this->_tearFlags)._h;
uVar18 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._h) + 4));
iVar5 = *GHIDRA_CAST<int *>(pEVar10);
*GHIDRA_CAST<int *>(&(pEVar10->_tearFlags)._l) = GHIDRA_INT((this->_tearFlags)._l);
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(pEVar10->_tearFlags)._l) + 4)) = uVar17;
*GHIDRA_CAST<int *>(&(pEVar10->_tearFlags)._h) = GHIDRA_INT(tearFlagsHigh);
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(pEVar10->_tearFlags)._h) + 4)) = uVar18;
(**(code **)(iVar5 + 0x40))(this->_collisionDamage);
(GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<EntityPtr *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pEVar10)) + 0x4f4)))))))->EntityPtr::SetReference(GHIDRA_CAST<Entity *>(this));
(GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<EntityPtr *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4f8)))))))->EntityPtr::SetReference(GHIDRA_CAST<Entity *>(pEVar10));
if (baseVariant == 1) {
anim = "Swing";
if ((char)local_d4 == '\0') {
anim = "Swing2";
}
ANM2::Play(&pEVar10->_sprite,GHIDRA_CAST<uint8_t *>(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<Entity_Player *>(0x0)) {
bVar3 = (GHIDRA_CAST<Entity_Player *>((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 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(7,2,&local_f8,&g_vectorZero,GHIDRA_CAST<Entity *>(player),3,uVar7)
;
this_01 = GHIDRA_CAST<Entity *>(__RTDynamicCast(spawnedEntity,uVar17,castSrcType,castDstType,uVar18))
;
laserColor = (GHIDRA_CAST<Entity_Player *>((ownerPlayer)))->Entity_Player::get_laser_color_copy(GHIDRA_CAST<ColorMod *>(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<Entity *>((this_01)))->Entity::SetParent(GHIDRA_CAST<Entity *>(local_c0));
iVar5 = *GHIDRA_CAST<int *>(this_01);
this_01->_renderDepthOffset = 3000.0;
uVar17 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(this->_tearFlags)._l) + 4));
tearFlagsHigh = (this->_tearFlags)._h;
iVar6 = *GHIDRA_CAST<int *>((GHIDRA_INT(&(this->_tearFlags)._h) + 4));
*GHIDRA_CAST<int *>(&this_01[1]._pendingDamageFlags) = GHIDRA_INT((this->_tearFlags)._l);
*GHIDRA_CAST<uint32_t *>((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<uint8_t *>((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<float *>(&this_01[1]._sprite._overlayAnimState._isPlaying) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_b8)) + 0x4)));
(GHIDRA_CAST<Entity *>((this_01)))->Entity::SetSpawnerEntity(GHIDRA_CAST<Entity *>(player));
this_01->Update();
pEVar10 = local_c0;
}
if (((player == local_d0) && (isToolVariant == '\0')) &&
(bVar3 = (GHIDRA_CAST<Entity_Player *>((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<uint32_t *>((GHIDRA_CAST<char *>(&(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 =
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x54,&local_f0,&local_f8,GHIDRA_CAST<Entity *>(knife->_spawnerEntity),
10,uVar7);
(GHIDRA_CAST<Entity *>((spawnedEntity)))->Entity::SetParent(GHIDRA_CAST<Entity *>(player));
}
}
}
}
*GHIDRA_CAST<short *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4ec)))) = *GHIDRA_CAST<short *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4ec)))) + -1;
swingIndex = *GHIDRA_CAST<short *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4ee))));
}
*GHIDRA_CAST<short *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4ee)))) = swingIndex + 1;
}
if ((((this->_sprite)._animState._animData == (void *)0x0) ||
((this->_sprite)._animState._isPlaying == 0)) &&
((player != GHIDRA_CAST<Entity_Player *>(0x0) && (this->_isPrimaryClub != 0)))) {
if (this->_isDeadEyeHit == 0) {
(GHIDRA_CAST<Entity_Player *>((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<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x466))) != '\0' &&
(bVar3 = AnimationState::WasEventTriggered(&(this->_sprite)._animState,GHIDRA_CAST<uint8_t *>("SwingEnd")),
bVar3 != 0)))))) {
this->_isSwinging = 0;
}
ExceptionList = savedExceptionList;
return;
}