//
// SetupPulsePopup::determineStartValues from 0x14043b1c0 to 0x14043b650 (1168 bytes)
//
// 4 xrefs:
// > ??> @ 0x1405eb808
// > ??> @ 0x1406a1954
// > ??> @ 0x1406a1a0c
// > ??> @ 0x1406d9e9c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void SetupPulsePopup::determineStartValues(SetupPulsePopup *a1)
{
__int64 v2; // rcx
cocos2d::CCArray *m_gameObjects; // rbp
cocos2d::ccHSVValue v4; // xmm0
char v5; // r12
char v6; // r13
char v7; // r14
unsigned int v8; // r15d
float v9; // xmm6_4
float v10; // xmm7_4
float v11; // xmm8_4
int v12; // edi
int v13; // esi
struct cocos2d::CCObject *v14; // rax
struct cocos2d::CCObject *v15; // rdx
int m_unknown5; // eax
__int16 v17; // ax
GLubyte m_uID_high; // cl
__m128 v19; // xmm2
__m128i v20; // xmm2
__m128 v21; // xmm1
int m_targetGroupID; // ecx
int m_uAutoReleaseCount; // eax
int m_copyColorID; // ecx
int m_uReference; // eax
int v26; // ecx
int v27; // eax
cocos2d::ccHSVValue v28; // [rsp+20h] [rbp-B8h]
float v29; // [rsp+3Ch] [rbp-9Ch]
char v30; // [rsp+E0h] [rbp+8h]
SetupTriggerPopup::determineStartValues(a1);
if ( a1->m_gameObject )
{
m_gameObjects = (cocos2d::CCArray *)cocos2d::CCArray::create(v2);
cocos2d::CCArray::addObject(m_gameObjects, a1->m_gameObject);
}
else
{
m_gameObjects = a1->m_gameObjects;
}
if ( m_gameObjects && cocos2d::CCArray::count(m_gameObjects) )
{
v4 = (cocos2d::ccHSVValue)unk_1406BA260;
v5 = 1;
v6 = 0;
v7 = 1;
v8 = 0;
*(_WORD *)&a1->m_currentColor.r = -1;
a1->m_currentColor.b = -1;
v30 = 0;
v9 = -1.0;
v10 = -1.0;
*(_WORD *)&a1->m_groupMainOnly = 257;
v11 = -1.0;
a1->m_pulseExclusive = 1;
a1->m_staticHSV = 1;
v12 = -1;
v13 = -1;
*(_QWORD *)&a1->m_targetGroupID = -1;
for ( a1->m_hsv = v4; v8 < cocos2d::CCArray::count(m_gameObjects); ++v8 )
{
v14 = cocos2d::CCArray::objectAtIndex(m_gameObjects, v8);
v15 = v14;
if ( !BYTE1(v14[29].m_uAutoReleaseCount) )
a1->m_groupMainOnly = 0;
if ( !BYTE2(v14[29].m_uAutoReleaseCount) )
a1->m_groupSecondaryOnly = 0;
if ( !HIBYTE(v14[29].m_uAutoReleaseCount) )
a1->m_pulseExclusive = 0;
if ( !LOBYTE(v14[29].m_eObjType) )
a1->m_staticHSV = 0;
if ( v9 == -1.0 )
{
v9 = *(float *)&v14[28].m_unknown2;
}
else if ( v9 != *(float *)&v14[28].m_unknown2 )
{
v9 = -2.0;
}
if ( v10 == -1.0 )
{
v10 = *(float *)&v14[28].m_nZOrder;
}
else if ( v10 != *(float *)&v14[28].m_nZOrder )
{
v10 = -2.0;
}
if ( v11 == -1.0 )
{
v11 = *(float *)&v14[28].m_uOrderOfArrival;
}
else if ( v11 != *(float *)&v14[28].m_uOrderOfArrival )
{
v11 = -2.0;
}
m_unknown5 = v14[28].m_unknown5;
if ( v12 == -1 )
{
v12 = m_unknown5;
}
else if ( v12 != m_unknown5 )
{
v12 = -2;
}
if ( v13 == -1 )
{
v13 = (int)v15[29].__vftable;
}
else if ( v13 != LODWORD(v15[29].__vftable) )
{
v13 = -2;
}
if ( !v30 )
{
v17 = *(_WORD *)((char *)&v15[26].m_uID + 1);
m_uID_high = HIBYTE(v15[26].m_uID);
if ( v5 )
{
*(_WORD *)&a1->m_currentColor.r = v17;
a1->m_currentColor.b = m_uID_high;
}
else if ( *(_WORD *)&a1->m_currentColor.r != v17 || a1->m_currentColor.b != m_uID_high )
{
*(_WORD *)&a1->m_currentColor.r = -1;
a1->m_currentColor.b = -1;
v30 = 1;
}
v5 = 0;
}
if ( !v6 )
{
if ( v7 )
{
a1->m_hsv = *(cocos2d::ccHSVValue *)((char *)&v15[29].__vftable + 4);
}
else
{
v19 = *(__m128 *)((char *)&v15[29].__vftable + 4);
if ( a1->m_hsv.h != v19.m128_f32[0]
|| a1->m_hsv.s != _mm_shuffle_ps(v19, v19, 85).m128_f32[0]
|| a1->m_hsv.v != _mm_shuffle_ps(v19, v19, 170).m128_f32[0]
|| (v20 = _mm_srli_si128((__m128i)v19, 8), a1->m_hsv.absoluteSaturation != v20.m128i_i8[4])
|| a1->m_hsv.absoluteBrightness != v20.m128i_i8[5] )
{
v28.h = -0.001;
v6 = 1;
*(_QWORD *)&v28.s = 0;
LOWORD(v29) = 0;
v21 = _mm_shuffle_ps((__m128)v28, (__m128)v28, 147);
v21.m128_f32[0] = v29;
v28 = (cocos2d::ccHSVValue)_mm_shuffle_ps(v21, v21, 57);
a1->m_hsv = v28;
}
}
v7 = 0;
}
m_targetGroupID = a1->m_targetGroupID;
m_uAutoReleaseCount = v15[26].m_uAutoReleaseCount;
if ( m_targetGroupID == -1 )
{
a1->m_targetGroupID = m_uAutoReleaseCount;
}
else if ( m_targetGroupID != m_uAutoReleaseCount )
{
a1->m_targetGroupID = 0;
}
m_copyColorID = a1->m_copyColorID;
m_uReference = v15[29].m_uReference;
if ( m_copyColorID == -1 )
{
a1->m_copyColorID = m_uReference;
}
else if ( m_copyColorID != m_uReference )
{
a1->m_copyColorID = 0;
}
}
if ( v9 < 0.0 )
v9 = -0.1;
a1->m_fadeInTime = v9;
if ( v10 < 0.0 )
v10 = -0.1;
a1->m_holdTime = v10;
if ( v11 < 0.0 )
v11 = -0.1;
a1->m_fadeOutTime = v11;
v26 = -1;
v27 = -1;
if ( v12 >= 0 )
v27 = v12;
a1->m_pulseMode = v27;
if ( v13 >= 0 )
v26 = v13;
a1->m_pulseTargetType = v26;
}
}