//
// CharacterColorPage::onMode from 0x1400895a0 to 0x140089840 (672 bytes)
//
// 2 xrefs:
// > CharacterColorPage::init @ 0x1400888d1
// > ??> @ 0x1406c6d08
//
// 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=3
void CharacterColorPage::onMode(CharacterColorPage *a1, cocos2d::CCObject *a2)
{
int v3; // ebx
GameManager *v4; // rcx
char *v5; // rsi
_QWORD *v6; // rax
int v7; // r9d
DialogObject *v8; // rax
DialogLayer *DialogLayer; // rdi
__int64 v10; // rcx
cocos2d::CCDirector *v11; // rax
cocos2d::CCLayer_vtbl *v12; // rbx
const cocos2d::CCPoint *v13; // rax
__int16 v14; // [rsp+30h] [rbp-49h] BYREF
char v15; // [rsp+32h] [rbp-47h]
__int128 *v16; // [rsp+40h] [rbp-39h]
char v17[16]; // [rsp+48h] [rbp-31h] BYREF
__int64 v18; // [rsp+58h] [rbp-21h]
__int64 v19; // [rsp+60h] [rbp-19h]
__int128 v20; // [rsp+68h] [rbp-11h] BYREF
__int64 v21; // [rsp+78h] [rbp-1h]
__int64 v22; // [rsp+80h] [rbp+7h]
cocos2d::CCPoint v23; // [rsp+88h] [rbp+Fh] BYREF
__int128 v24; // [rsp+90h] [rbp+17h]
__int64 v25; // [rsp+A0h] [rbp+27h]
__int64 v26; // [rsp+A8h] [rbp+2Fh]
v3 = a2->getTag(a2);
if ( v3 != 2 )
goto LABEL_6;
v4 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v16 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v4 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::isIconUnlocked(v4, 2, Special) )
{
LABEL_6:
CharacterColorPage::updateColorMode(a1, v3);
}
else
{
v24 = 0;
v5 = (char *)sub_14003AA10(0x40u);
*(_QWORD *)&v24 = v5;
v25 = 61;
v26 = 63;
strcpy(v5, "Complete 10 Map Packs to unlock Glow.");
v16 = &v20;
v14 = -1;
v15 = -1;
v20 = 0;
v21 = 0;
v22 = 15;
v6 = sub_14003AA10(0x40u);
*(_QWORD *)&v20 = v6;
v21 = 61;
v22 = 63;
*(_OWORD *)v6 = *(_OWORD *)v5;
*((_OWORD *)v6 + 1) = *((_OWORD *)v5 + 1);
*((_OWORD *)v6 + 2) = *((_OWORD *)v5 + 2);
v6[6] = *((_QWORD *)v5 + 6);
*((_DWORD *)v6 + 14) = *((_DWORD *)v5 + 14);
*((_WORD *)v6 + 30) = *((_WORD *)v5 + 30);
v17[15] = 0;
v18 = 14;
v19 = 15;
strcpy(v17, "The Shopkeeper");
v8 = (DialogObject *)DialogObject::create((unsigned int)v17, (unsigned int)&v20, 5, v7, 0, (__int64)&v14);
DialogLayer = DialogLayer::createDialogLayer(v8, nullptr, 2);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, DialogLayer, 100);
v11 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11);
v12 = DialogLayer->m_mainLayer->__vftable;
cocos2d::CCPoint::CCPoint(&v23, *(float *)&v16 * 0.5, *((float *)&v16 + 1) * 0.5);
v12->setPosition_0(DialogLayer->m_mainLayer, v13);
DialogLayer::animateInRandomSide(DialogLayer);
j_j_free(v5);
}
}