//
// SecretRewardsLayer::showLockedChest from 0xa60d58 to 0xa61130 (984 bytes)
//
// 1 xrefs:
// > ??> @ 0x80e80
//
// 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 SecretRewardsLayer::showLockedChest(SecretRewardsLayer *a1)
{
int v2; // w25
DialogObject *v3; // x0
DialogLayer *v4; // x23
void *v5; // x0
void *v6; // x0
__int64 v7; // x2
int v8; // w1
__int64 *v9; // x0
unsigned int *v10; // x1
int v11; // w2
unsigned int *v12; // x2
int v13; // w1
unsigned int *v14; // x1
int v15; // w2
__int64 v16; // [xsp+60h] [xbp+60h] BYREF
__int64 v17; // [xsp+68h] [xbp+68h] BYREF
__int64 v18; // [xsp+70h] [xbp+70h] BYREF
sub_D153B8((int)&v16, "zzz");
switch ( a1->m_lockedDialogIndex )
{
case 0:
sub_D1798C(&v16, "The chest is not ready.", 31);
goto LABEL_3;
case 1:
sub_D1798C(&v16, "It's still not ready...", 35);
goto LABEL_3;
case 2:
sub_D1798C(&v16, "Seriously, stop.", 30);
goto LABEL_3;
case 3:
sub_D1798C(&v16, "Wow it magically opened!", 24);
v2 = 17;
goto LABEL_4;
case 4:
sub_D1798C(&v16, "I was wrong.", 12);
goto LABEL_3;
case 5:
sub_D1798C(&v16, "S T O P", 33);
goto LABEL_3;
case 6:
sub_D1798C(&v16, "El cofre esta cerrado.", 22);
goto LABEL_3;
case 7:
sub_D1798C(&v16, "This is getting ridiculous.", 27);
goto LABEL_3;
case 8:
sub_D1798C(&v16, "I really can't help you.", 24);
goto LABEL_3;
case 9:
sub_D1798C(&v16, "Don't make me do it...", 22);
goto LABEL_3;
case 0xA:
sub_D1798C(
&v16,
"Roses are red. Violets are blue. This is not. 2.2",
99);
goto LABEL_3;
default:
LABEL_3:
v2 = 2;
LABEL_4:
sub_D153B8((int)&v17, "The Keymaster");
sub_D18D28(&v18);
v3 = (DialogObject *)DialogObject::create(1.0, (__int64)&v17, (__int64)&v18, v2, 0, (int)&unk_FFFFFF);
v4 = DialogLayer::create(v3, (int)&dword_0 + 2);
v5 = (void *)(v18 - 24);
if ( (__int64 *)(v18 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v18 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(_DWORD *)(v18 - 8);
*(_DWORD *)(v18 - 8) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v5);
}
v6 = (void *)(v17 - 24);
if ( (__int64 *)(v17 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v17 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *(_DWORD *)(v17 - 8);
*(_DWORD *)(v17 - 8) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v6);
}
DialogLayer::addToMainScene(v4);
DialogLayer::updateChatPlacement(v4, Center);
DialogLayer::animateInRandomSide(v4);
v7 = v16;
v8 = a1->m_lockedDialogIndex + 1;
v9 = (__int64 *)(v16 - 24);
if ( v8 > 10 )
v8 = 0;
a1->m_lockedDialogIndex = v8;
if ( v9 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v7 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *(_DWORD *)(v7 - 8);
*(_DWORD *)(v7 - 8) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v9);
}
return;
}
}