//
// GJShopLayer::showCantAffordMessage from 0x1003250a0 to 0x1003253c7 (807 bytes)
//
// 1 xrefs:
// > GJShopLayer::onSelectItem @ 0x100324c42
//
// 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 __fastcall GJShopLayer::showCantAffordMessage(GJShopLayer *a1, GJStoreItem *a2)
{
double v2; // xmm0_8
bool v3; // zf
_BOOL8 v4; // r14
const char *v5; // rsi
size_t v6; // rdx
int m_affordDialogIndex; // eax
const std::string::value_type *v8; // rsi
unsigned int v9; // r14d
DialogObject *v10; // rax
DialogLayer *v11; // r14
std::string *v12; // rax
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v13; // r14
std::string::value_type v14; // r15
std::string::size_type v15; // r12
std::string *v16; // rax
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v17; // r14
std::string::value_type v18; // r15
std::string::size_type v19; // r12
__int128 v20; // [rsp+0h] [rbp-B0h] BYREF
void *__p; // [rsp+10h] [rbp-A0h]
char v22; // [rsp+18h] [rbp-98h] BYREF
_BYTE __dst[15]; // [rsp+19h] [rbp-97h] BYREF
void *v24; // [rsp+28h] [rbp-88h]
char v25; // [rsp+30h] [rbp-80h] BYREF
_BYTE v26[23]; // [rsp+31h] [rbp-7Fh] BYREF
std::string v27; // [rsp+48h] [rbp-68h] BYREF
std::string v28; // [rsp+60h] [rbp-50h] BYREF
_BYTE v29[14]; // [rsp+78h] [rbp-38h]
*(_WORD *)&v28.__r_.__value_.__l.0 = 0;
v3 = a2->m_shopType == Diamond;
v4 = v3;
v5 = "Mana Orbs";
if ( v3 )
v5 = "Diamond Shards";
v6 = 5LL * v3 + 17;
v22 = 2 * v6;
memcpy(__dst, v5, v6);
*((_BYTE *)&v24 + 5 * v4 + 2) = 0;
m_affordDialogIndex = a1->m_affordDialogIndex;
if ( m_affordDialogIndex >= 3 )
{
a1->m_affordDialogIndex = 0;
goto LABEL_5;
}
if ( m_affordDialogIndex == 2 )
{
std::operator+(&v27, "You do not have enough ", &v22);
v16 = std::string::append(&v27, ".");
v17 = v16->__r_.__value_.__s.0;
v18 = v16->__r_.__value_.__s.__data_[0];
*(_QWORD *)&v29[6] = v16->__r_.__value_.__l.__size_;
*(_QWORD *)v29 = *(std::string::size_type *)((char *)v16->__r_.__value_.__r.__words + 2);
v19 = v16->__r_.__value_.__r.__words[2];
v2 = 0.0;
*(_OWORD *)&v16->__r_.__value_.__l.0 = 0;
v16->__r_.__value_.__r.__words[2] = 0;
if ( (*(_BYTE *)&v28.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v28.__r_.__value_.__l.__data_);
v28.__r_.__value_.__s.0 = v17;
v28.__r_.__value_.__s.__data_[0] = v18;
*(std::string::size_type *)((char *)v28.__r_.__value_.__r.__words + 2) = *(_QWORD *)v29;
v28.__r_.__value_.__l.__size_ = *(_QWORD *)&v29[6];
v28.__r_.__value_.__r.__words[2] = v19;
if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v27.__r_.__value_.__l.__data_);
v9 = 6;
}
else
{
if ( m_affordDialogIndex != 1 )
{
if ( m_affordDialogIndex )
{
v8 = " ";
goto LABEL_6;
}
LABEL_5:
v8 = "You cannot afford that item.";
LABEL_6:
v9 = 5;
std::string::assign(&v28, v8);
goto LABEL_7;
}
std::operator+(&v27, "Collect more ", &v22);
v12 = std::string::append(&v27, ".");
v13 = v12->__r_.__value_.__s.0;
v14 = v12->__r_.__value_.__s.__data_[0];
*(_QWORD *)&v29[6] = v12->__r_.__value_.__l.__size_;
*(_QWORD *)v29 = *(std::string::size_type *)((char *)v12->__r_.__value_.__r.__words + 2);
v15 = v12->__r_.__value_.__r.__words[2];
v2 = 0.0;
*(_OWORD *)&v12->__r_.__value_.__l.0 = 0;
v12->__r_.__value_.__r.__words[2] = 0;
if ( (*(_BYTE *)&v28.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v28.__r_.__value_.__l.__data_);
v28.__r_.__value_.__s.0 = v13;
v28.__r_.__value_.__s.__data_[0] = v14;
*(std::string::size_type *)((char *)v28.__r_.__value_.__r.__words + 2) = *(_QWORD *)v29;
v28.__r_.__value_.__l.__size_ = *(_QWORD *)&v29[6];
v28.__r_.__value_.__r.__words[2] = v15;
if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v27.__r_.__value_.__l.__data_);
v9 = 5;
}
LABEL_7:
v25 = 28;
strcpy(v26, "The Shopkeeper");
if ( (*(_BYTE *)&v28.__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(&v20, v28.__r_.__value_.__l.__data_, v28.__r_.__value_.__l.__size_, v2);
}
else
{
__p = v28.__r_.__value_.__l.__data_;
v20 = *(_OWORD *)&v28.__r_.__value_.__l.0;
}
v10 = (DialogObject *)DialogObject::create(&v25, &v20, v9, 0, 0xFFFFFF, 1.0);
v11 = DialogLayer::create(v10, 2);
if ( (v20 & 1) != 0 )
operator delete(__p);
if ( (v25 & 1) != 0 )
operator delete(*(void **)&v26[15]);
((void (__fastcall *)(GJShopLayer *, DialogLayer *, __int64))a1->addChild_0)(a1, v11, 100);
DialogLayer::updateChatPlacement(v11, Center);
DialogLayer::animateIn(v11, FromCenter);
++a1->m_affordDialogIndex;
if ( (v22 & 1) == 0 )
{
if ( (*(_BYTE *)&v28.__r_.__value_.__s.0 & 1) == 0 )
return;
LABEL_22:
operator delete(v28.__r_.__value_.__l.__data_);
return;
}
operator delete(v24);
if ( (*(_BYTE *)&v28.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_22;
}