//
// GJShopLayer::showCantAffordMessage from 0x4e4674 to 0x4e483a (454 bytes)
//
// 1 xrefs:
// > GJShopLayer::onSelectItem @ 0x4e48e4
//
// 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 GJShopLayer::showCantAffordMessage(GJShopLayer *a1, GJStoreItem *a2)
{
char *v4; // r1
int m_affordDialogIndex; // r3
char *v6; // r1
int *v7; // r0
std::string v8; // r11
int *v9; // r0
DialogObject *v10; // r0
DialogLayer *v11; // r8
int v12; // [sp+4h] [bp-28h]
_BYTE v13[4]; // [sp+Ch] [bp-20h] BYREF
int v14; // [sp+10h] [bp-1Ch] BYREF
int v15; // [sp+14h] [bp-18h] BYREF
int v16; // [sp+18h] [bp-14h] BYREF
char v17; // [sp+1Ch] [bp-10h] BYREF
int v18; // [sp+20h] [bp-Ch] BYREF
sub_776584((int)v13, (char *)&unk_939830);
if ( a2->m_shopType == Diamond )
v4 = "Diamond Shards";
else
v4 = "Mana Orbs";
sub_776584((int)&v14, v4);
if ( a1->m_affordDialogIndex > 2 )
a1->m_affordDialogIndex = 0;
m_affordDialogIndex = a1->m_affordDialogIndex;
if ( m_affordDialogIndex == 1 )
{
sub_2EDF90(&v15, "Collect more ", &v14);
v7 = (int *)sub_774544((int)&v15, ".");
v18 = *v7;
*v7 = (int)&unk_ACDDA8;
sub_774794(v13, &v18);
sub_774008(&v18);
sub_774008(&v15);
}
else
{
if ( m_affordDialogIndex == 2 )
{
sub_2EDF90(&v16, "You do not have enough ", &v14);
v9 = (int *)sub_774544((int)&v16, ".");
v18 = *v9;
*v9 = (int)&unk_ACDDA8;
sub_774794(v13, &v18);
v8.m_data.m_data = (stl::StringData::Internal *)&byte_6;
sub_774008(&v18);
sub_774008(&v16);
goto LABEL_15;
}
if ( m_affordDialogIndex )
v6 = " ";
else
v6 = "You cannot afford that item.";
sub_7753D4((int)v13, v6);
}
v8.m_data.m_data = (stl::StringData::Internal *)&byte_5;
LABEL_15:
sub_776584((int)&v17, "The Shopkeeper");
sub_775C20(&v18);
LOWORD(v12) = -1;
BYTE2(v12) = -1;
v10 = (DialogObject *)DialogObject::create((DialogObject *)&v17, (std::string)&v18, v8, 1065353216, 0.0, v12);
v11 = DialogLayer::create(v10, (int)&dword_0 + 2);
sub_774008(&v18);
sub_774008(&v17);
a1->addChild_0(a1, v11, 100);
DialogLayer::updateChatPlacement(v11, Center);
DialogLayer::animateIn(v11, FromCenter);
++a1->m_affordDialogIndex;
sub_774008(&v14);
sub_774008(v13);
}