//
// GJGarageLayer::onSelect from 0x403720 to 0x403b0c (1004 bytes)
//
// 0 xrefs:
//
// 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 GJGarageLayer::onSelect(GJGarageLayer *a1, cocos2d::CCObject *a2)
{
int v4; // r0
IconType m_uID; // r5
int v6; // r4
GameManager *v7; // r0
void (__fastcall *showUnlockPopup)(GJGarageLayer *__hidden, int, UnlockType); // r7
GameManager *v9; // r0
UnlockType v10; // r0
GameManager *v11; // r0
GameManager *v12; // r9
int v13; // s15
GameManager *v14; // r0
GameManager *v15; // r9
int v16; // s15
GameManager *v17; // r0
GameManager *v18; // r9
int v19; // s15
GameManager *v20; // r0
GameManager *v21; // r9
int v22; // s15
GameManager *v23; // r0
GameManager *v24; // r9
int v25; // s15
GameManager *v26; // r0
GameManager *v27; // r9
int v28; // s15
GameManager *v29; // r9
int v30; // s15
GameManager *v31; // r0
GameManager *v32; // r9
int v33; // s15
GameManager *v34; // r9
int v35; // s15
GameManager *v36; // r0
GameManager *v37; // r9
int v38; // s15
GameManager *v39; // r0
GameManager *v40; // r9
int v41; // s15
GameManager *v42; // r0
GameManager *v43; // r9
int v44; // s15
cocos2d::CCSprite *m_cursor1; // r9
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCNode *v47; // r11
const cocos2d::CCPoint *v48; // r0
GameManager *v49; // r0
SimplePlayer *m_playerObject; // r7
void (__fastcall *setScale)(cocos2d::CCSprite *__hidden, float); // r9
float v52; // r1
void (__fastcall *v53)(GJGarageLayer *__hidden, int, UnlockType); // r7
GameManager *v54; // r0
UnlockType v55; // r0
cocos2d::CCPoint v56; // [sp+4h] [bp-10h] BYREF
v4 = a2->getTag(a2);
m_uID = a2[7].m_uID;
v6 = v4;
v7 = GameManager::sharedState();
if ( !GameManager::isIconUnlocked(v7, v6, m_uID) )
{
showUnlockPopup = a1->showUnlockPopup;
v9 = GameManager::sharedState();
v10 = GameManager::iconTypeToUnlockType(v9, m_uID);
showUnlockPopup(a1, v6, v10);
return;
}
GameManager::sharedState()->m_scoreValid = 0;
if ( m_uID == Robot )
{
v31 = GameManager::sharedState();
v31->m_playerRobot.value = v6;
v32 = v31;
v33 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
v32->m_playerRobot.seed = v33;
v32->m_playerRobot.random = v33 + v6;
}
else if ( m_uID > Robot )
{
if ( m_uID == Jetpack )
{
v39 = GameManager::sharedState();
v39->m_playerJetpack.value = v6;
v40 = v39;
v41 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
v40->m_playerJetpack.seed = v41;
v40->m_playerJetpack.random = v41 + v6;
}
else if ( m_uID > Jetpack )
{
switch ( m_uID )
{
case Special:
v36 = GameManager::sharedState();
v36->m_playerStreak.value = v6;
v37 = v36;
v38 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
v37->m_playerStreak.seed = v38;
v37->m_playerStreak.random = v38 + v6;
break;
case ShipFire:
v42 = GameManager::sharedState();
v42->m_playerShipFire.value = v6;
v43 = v42;
v44 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
v43->m_playerShipFire.seed = v44;
v43->m_playerShipFire.random = v44 + v6;
break;
case DeathEffect:
v20 = GameManager::sharedState();
v20->m_playerDeathEffect.value = v6;
v21 = v20;
v22 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
v21->m_playerDeathEffect.seed = v22;
v21->m_playerDeathEffect.random = v22 + v6;
break;
}
}
else
{
v17 = GameManager::sharedState();
if ( m_uID == Spider )
{
v17->m_playerSpider.value = v6;
v34 = v17;
v35 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
v34->m_playerSpider.seed = v35;
v34->m_playerSpider.random = v35 + v6;
}
else
{
v17->m_playerSwing.value = v6;
v18 = v17;
v19 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
v18->m_playerSwing.seed = v19;
v18->m_playerSwing.random = v19 + v6;
}
}
}
else if ( m_uID == Ball )
{
v26 = GameManager::sharedState();
v26->m_playerBall.value = v6;
v27 = v26;
v28 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
v27->m_playerBall.seed = v28;
v27->m_playerBall.random = v28 + v6;
}
else if ( m_uID > Ball )
{
v14 = GameManager::sharedState();
if ( m_uID == Ufo )
{
v14->m_playerBird.value = v6;
v29 = v14;
v30 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
v29->m_playerBird.seed = v30;
v29->m_playerBird.random = v30 + v6;
}
else
{
v14->m_playerDart.value = v6;
v15 = v14;
v16 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
v15->m_playerDart.seed = v16;
v15->m_playerDart.random = v16 + v6;
}
}
else if ( m_uID )
{
if ( m_uID == Ship )
{
v11 = GameManager::sharedState();
v11->m_playerShip.value = v6;
v12 = v11;
v13 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
v12->m_playerShip.seed = v13;
v12->m_playerShip.random = v13 + v6;
}
}
else
{
v23 = GameManager::sharedState();
v23->m_playerFrame.value = v6;
v24 = v23;
v25 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
v24->m_playerFrame.seed = v25;
v24->m_playerFrame.random = v25 + v6;
}
SimplePlayer::updateColors(a1->m_playerObject);
if ( m_uID == Special )
{
if ( v6 == 2 )
GJGarageLayer::playRainbowEffect(a1);
goto LABEL_33;
}
if ( m_uID != ShipFire )
{
LABEL_33:
m_cursor1 = a1->m_cursor1;
goto LABEL_34;
}
m_cursor1 = a1->m_cursor2;
LABEL_34:
setPosition = m_cursor1->setPosition;
v47 = (cocos2d::CCNode *)((int (__fastcall *)(cocos2d::CCObject *))a2->__vftable[6].~CCObject_0)(a2);
v48 = (const cocos2d::CCPoint *)((int (__fastcall *)(cocos2d::CCObject *))a2->__vftable[2].acceptVisitor)(a2);
cocos2d::CCNode::convertToWorldSpace(&v56, v47, v48);
setPosition(m_cursor1, &v56);
m_cursor1->setVisible(m_cursor1, 1);
if ( (unsigned int)m_uID <= Jetpack )
{
SimplePlayer::updatePlayerFrame(a1->m_playerObject, v6, a1->m_iconType);
v49 = GameManager::sharedState();
m_playerObject = a1->m_playerObject;
v49->m_playerIconType = a1->m_iconType;
setScale = m_playerObject->setScale;
if ( GameManager::sharedState()->m_playerIconType == Jetpack )
v52 = 1.5;
else
v52 = 1.6;
((void (__fastcall *)(SimplePlayer *, _DWORD))setScale)(m_playerObject, LODWORD(v52));
}
if ( a1->m_iconID == v6 && a1->m_selectedIconType == m_uID )
{
v53 = a1->showUnlockPopup;
v54 = GameManager::sharedState();
v55 = GameManager::iconTypeToUnlockType(v54, m_uID);
v53(a1, v6, v55);
}
a1->m_iconID = v6;
a1->m_selectedIconType = m_uID;
}