//
// GJGarageLayer::onSelect from 0x140277170 to 0x140277804 (1684 bytes)
//
// 2 xrefs:
// > GJGarageLayer::getItems @ 0x1402768e0
// > ??> @ 0x1406d0fa4
//
// 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
//
// Hidden C++ exception states: #wind=18
void GJGarageLayer::onSelect(GJGarageLayer *a1, cocos2d::CCObject *a2)
{
unsigned int v4; // ebp
__int64 m_uID; // r14
GameManager *v6; // rcx
GameManager *v7; // rcx
UnlockType v8; // eax
__int64 v9; // r10
__int64 v10; // rbx
float v11; // xmm0_4
cocos2d::CCSprite *m_cursor2; // r15
cocos2d::CCSprite_vtbl *v13; // rdi
cocos2d::CCNode *v14; // rax
struct cocos2d::CCPoint v15; // rax
_BOOL8 v16; // rdx
GameManager *v17; // rcx
float v18; // xmm0_4
float v19; // xmm0_4
float v20; // xmm0_4
float v21; // xmm0_4
float v22; // xmm0_4
float v23; // xmm0_4
float v24; // xmm0_4
float v25; // xmm0_4
float v26; // xmm0_4
float v27; // xmm0_4
float v28; // xmm0_4
__int64 v29; // rcx
UnlockType v30; // eax
__int64 v31; // r10
struct cocos2d::CCPoint v32; // [rsp+58h] [rbp+10h] BYREF
v4 = a2->getTag(a2);
m_uID = (int)a2[9].m_uID;
v6 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v32 = (struct cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v32);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v6 = (GameManager *)qword_1406C2ED8;
}
if ( !GameManager::isIconUnlocked(v6, v4, (IconType)m_uID) )
{
if ( !qword_1406C2ED8 )
{
v32 = (struct cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v32);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
}
v8 = GameManager::iconTypeToUnlockType(v7, (IconType)m_uID);
(*(void (__fastcall **)(CharacterColorDelegate *, _QWORD, _QWORD))(v9 + 8))(
&a1->CharacterColorDelegate,
v4,
(unsigned int)v8);
return;
}
v10 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v32 = (struct cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v32);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v10 = qword_1406C2ED8;
}
*(_BYTE *)(v10 + 648) = 0;
switch ( m_uID )
{
case 0LL:
*(_DWORD *)(v10 + 716) = v4;
v11 = (float)((float)rand() / 32767.0) * 1000.0;
*(_DWORD *)(v10 + 712) = (int)v11;
*(_DWORD *)(v10 + 708) = v4 + (int)v11;
goto LABEL_11;
case 1LL:
*(_DWORD *)(v10 + 728) = v4;
v18 = (float)((float)rand() / 32767.0) * 1000.0;
*(_DWORD *)(v10 + 724) = (int)v18;
*(_DWORD *)(v10 + 720) = v4 + (int)v18;
goto LABEL_11;
case 2LL:
*(_DWORD *)(v10 + 740) = v4;
v19 = (float)((float)rand() / 32767.0) * 1000.0;
*(_DWORD *)(v10 + 736) = (int)v19;
*(_DWORD *)(v10 + 732) = v4 + (int)v19;
goto LABEL_11;
case 3LL:
*(_DWORD *)(v10 + 752) = v4;
v20 = (float)((float)rand() / 32767.0) * 1000.0;
*(_DWORD *)(v10 + 748) = (int)v20;
*(_DWORD *)(v10 + 744) = v4 + (int)v20;
goto LABEL_11;
case 4LL:
*(_DWORD *)(v10 + 764) = v4;
v21 = (float)((float)rand() / 32767.0) * 1000.0;
*(_DWORD *)(v10 + 760) = (int)v21;
*(_DWORD *)(v10 + 756) = v4 + (int)v21;
goto LABEL_11;
case 5LL:
*(_DWORD *)(v10 + 776) = v4;
v22 = (float)((float)rand() / 32767.0) * 1000.0;
*(_DWORD *)(v10 + 772) = (int)v22;
*(_DWORD *)(v10 + 768) = v4 + (int)v22;
goto LABEL_11;
case 6LL:
*(_DWORD *)(v10 + 788) = v4;
v23 = (float)((float)rand() / 32767.0) * 1000.0;
*(_DWORD *)(v10 + 784) = (int)v23;
*(_DWORD *)(v10 + 780) = v4 + (int)v23;
goto LABEL_11;
case 7LL:
*(_DWORD *)(v10 + 800) = v4;
v24 = (float)((float)rand() / 32767.0) * 1000.0;
*(_DWORD *)(v10 + 796) = (int)v24;
*(_DWORD *)(v10 + 792) = v4 + (int)v24;
goto LABEL_11;
case 8LL:
*(_DWORD *)(v10 + 884) = v4;
v27 = (float)((float)rand() / 32767.0) * 1000.0;
*(_DWORD *)(v10 + 880) = (int)v27;
*(_DWORD *)(v10 + 876) = v4 + (int)v27;
goto LABEL_11;
case 98LL:
*(_DWORD *)(v10 + 872) = v4;
v26 = (float)((float)rand() / 32767.0) * 1000.0;
*(_DWORD *)(v10 + 868) = (int)v26;
*(_DWORD *)(v10 + 864) = v4 + (int)v26;
LABEL_11:
SimplePlayer::updateColors(a1->m_playerObject);
goto LABEL_12;
case 99LL:
*(_DWORD *)(v10 + 848) = v4;
v25 = (float)((float)rand() / 32767.0) * 1000.0;
*(_DWORD *)(v10 + 844) = (int)v25;
*(_DWORD *)(v10 + 840) = v4 + (int)v25;
SimplePlayer::updateColors(a1->m_playerObject);
goto LABEL_26;
case 101LL:
*(_DWORD *)(v10 + 860) = v4;
v28 = (float)((float)rand() / 32767.0) * 1000.0;
*(_DWORD *)(v10 + 856) = (int)v28;
*(_DWORD *)(v10 + 852) = v4 + (int)v28;
SimplePlayer::updateColors(a1->m_playerObject);
m_cursor2 = a1->m_cursor2;
goto LABEL_13;
default:
SimplePlayer::updateColors(a1->m_playerObject);
if ( (_DWORD)m_uID == 99 )
{
LABEL_26:
if ( v4 == 2 )
GJGarageLayer::playRainbowEffect(a1);
goto LABEL_12;
}
if ( (_DWORD)m_uID != 101 )
{
LABEL_12:
m_cursor2 = a1->m_cursor1;
goto LABEL_13;
}
m_cursor2 = a1->m_cursor2;
LABEL_13:
v13 = m_cursor2->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a2->__vftable[2].getTag(a2);
v14 = (cocos2d::CCNode *)((__int64 (__fastcall *)(cocos2d::CCObject *))a2->__vftable[6].getTag)(a2);
v15 = cocos2d::CCNode::convertToWorldSpace(v14, &v32);
((void (__fastcall *)(cocos2d::CCSprite *, struct cocos2d::CCPoint))v13->setPosition_0)(m_cursor2, v15);
LOBYTE(v16) = 1;
m_cursor2->setVisible(m_cursor2, v16);
switch ( m_uID )
{
case 0LL:
case 1LL:
case 2LL:
case 3LL:
case 4LL:
case 5LL:
case 6LL:
case 7LL:
case 8LL:
SimplePlayer::updatePlayerFrame(a1->m_playerObject, v4, a1->m_iconType);
v29 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v32 = (struct cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v32);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v29 = qword_1406C2ED8;
}
*(_DWORD *)(v29 + 908) = a1->m_iconType;
((void (__fastcall *)(SimplePlayer *))a1->m_playerObject->setScale_0)(a1->m_playerObject);
break;
default:
break;
}
if ( a1->m_iconID == v4 && a1->m_selectedIconType == (_DWORD)m_uID )
{
if ( !qword_1406C2ED8 )
{
v32 = (struct cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v32);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
}
v30 = GameManager::iconTypeToUnlockType(v17, (IconType)m_uID);
(*(void (__fastcall **)(CharacterColorDelegate *, _QWORD, _QWORD))(v31 + 8))(
&a1->CharacterColorDelegate,
v4,
(unsigned int)v30);
}
a1->m_iconID = v4;
a1->m_selectedIconType = m_uID;
return;
}
}