//
// SetupSequenceTriggerPopup::onAddChance from 0x140444ca0 to 0x140444dda (314 bytes)
//
// 4 xrefs:
// > SetupSequenceTriggerPopup::init @ 0x140443a10
// > ??> @ 0x1406a23b4
// > ??> @ 0x1406a23c4
// > ??> @ 0x1406da4fc
//
// 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 SetupSequenceTriggerPopup::onAddChance(SetupSequenceTriggerPopup *a1, cocos2d::CCObject *a2)
{
int v3; // esi
float v4; // xmm0_4
CCMenuItemSpriteExtra *m_selectedButton; // rcx
int v6; // ebx
int v7; // eax
EffectGameObject *v8; // r8
EffectGameObject_vtbl *v9; // rcx
char *v10; // rdx
int v11; // ecx
EffectGameObject *m_gameObject; // rbp
__int64 v13; // rdx
int v14; // [rsp+40h] [rbp+8h] BYREF
int v15; // [rsp+50h] [rbp+18h] BYREF
v3 = (int)a1->getValue(a1, -1);
v4 = a1->getValue(a1, -2);
m_selectedButton = a1->m_selectedButton;
v6 = (int)v4;
if ( !m_selectedButton )
{
if ( v3 <= 0 || v6 <= 0 )
return;
m_gameObject = a1->m_gameObject;
v15 = v3;
v14 = (int)v4;
v13 = *(_QWORD *)&m_gameObject[1].m_uID;
if ( v13 == *(_QWORD *)&m_gameObject[1].m_nTag )
{
sub_14043F020(
(const void **)&m_gameObject[1].EnhancedGameObject::GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable,
(_BYTE *)v13,
&v15,
&v14);
}
else
{
*(_DWORD *)v13 = v3;
*(_DWORD *)(v13 + 4) = v3;
*(_DWORD *)(v13 + 8) = v6;
*(_DWORD *)(v13 + 12) = 0;
*(_QWORD *)&m_gameObject[1].m_uID += 16LL;
}
m_gameObject[1].m_sInverse.b = NAN;
LABEL_15:
SetupSequenceTriggerPopup::updateGroupIDButtons(a1);
return;
}
if ( !v6 )
return;
v7 = m_selectedButton->getTag(m_selectedButton);
v8 = a1->m_gameObject;
if ( v7 < 0 )
goto LABEL_15;
v9 = v8[1].EnhancedGameObject::GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v7 > (unsigned __int64)(((__int64)(*(_QWORD *)&v8[1].m_uID - (_QWORD)v9) >> 4) - 1)
|| v9 == *(EffectGameObject_vtbl **)&v8[1].m_uID )
{
goto LABEL_15;
}
v10 = (char *)v9 + 16 * v7;
v11 = v6 + *((_DWORD *)v10 + 2);
if ( v11 < 1 )
v11 = 1;
*((_DWORD *)v10 + 2) = v11;
v8[1].m_sInverse.b = NAN;
SetupSequenceTriggerPopup::updateGroupIDButtons(a1);
}