//
// ArtTriggerGameObject::triggerObject from 0x1404c23f0 to 0x1404c27b0 (960 bytes)
//
// 2 xrefs:
// > ??> @ 0x140614758
// > ??> @ 0x1406dcf68
//
// 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
//
// local variable allocation has failed, the output may be wrong!
// Hidden C++ exception states: #wind=8
void ArtTriggerGameObject::triggerObject(
ArtTriggerGameObject *a1,
GJBaseGameLayer *a2,
int a3,
std::vector *const a4)
{
__int64 v5; // rdx
int v6; // edi
__int64 v7; // rbp
GJMGLayer *m_middleground; // rcx
int v9; // eax
int v10; // esi
cocos2d::CCString *v11; // rax
const char *v12; // rbx
__int64 v13; // rax
cocos2d::CCString *v14; // rax
const char *CString; // rbx
__int64 v16; // rax
void (*v17)(GameManager *, cocos2d::CCObject *); // r9
__int64 v18; // r8
int v19; // edi
__int64 v20; // rbp
int v21; // ecx
int v22; // eax
cocos2d::CCString *v23; // rax
const char *v24; // rbx
__int64 v25; // rax
cocos2d::CCString *v26; // rax
int m_artIndex; // esi
__int64 v28; // rdi
int v29; // ecx
int v30; // eax
cocos2d::CCString *v31; // rax
void *v32; // [rsp+40h] [rbp+8h]
void *v33; // [rsp+40h] [rbp+8h]
void *v34; // [rsp+40h] [rbp+8h]
if ( a1->m_objectID == 3029 )
{
m_artIndex = a1->m_artIndex;
a2->m_gameState.m_background = m_artIndex;
if ( a2->m_skipArtReload )
return;
v28 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v34 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v34);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v28 = qword_1406C2ED8;
}
v29 = *(_DWORD *)(v28 + 960);
if ( v29 == m_artIndex )
{
GJBaseGameLayer::createBackground(a2, m_artIndex);
GJBaseGameLayer::updateLevelColors(a2);
return;
}
v30 = 59;
if ( m_artIndex < 59 )
v30 = m_artIndex;
v10 = 1;
if ( v30 > 1 )
v10 = v30;
if ( !*(_BYTE *)(v28 + 980) && v10 != v29 )
{
*(_BYTE *)(v28 + 980) = 1;
v31 = cocos2d::CCString::createWithFormat("game_bg_%02d_001.png", v10);
CString = cocos2d::CCString::getCString(v31);
v16 = cocos2d::CCTextureCache::sharedTextureCache();
v17 = GameManager::finishedLoadingBGAsync;
v18 = v28;
goto LABEL_45;
}
}
else
{
v5 = (unsigned int)(a1->m_objectID - 3030);
if ( a1->m_objectID == 3030 )
{
v19 = a1->m_artIndex;
a2->m_gameState.m_ground = v19;
if ( !a2->m_skipArtReload )
{
v20 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v33 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v33);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v20 = qword_1406C2ED8;
}
v21 = *(_DWORD *)(v20 + 964);
if ( v21 != v19 )
{
v22 = 22;
if ( v19 < 22 )
v22 = v19;
v10 = 1;
if ( v22 > 1 )
v10 = v22;
if ( !*(_BYTE *)(v20 + 981) && v10 != v21 )
{
*(_BYTE *)(v20 + 981) = 1;
*(_BYTE *)(v20 + 983) = 0;
*(_BYTE *)(v20 + 984) = (unsigned int)(v10 - 8) > 3;
v23 = cocos2d::CCString::createWithFormat("groundSquare_%02d_001.png", v10);
v24 = cocos2d::CCString::getCString(v23);
v25 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImageAsync(v25, v24, v20, GameManager::finishedLoadingGAsync1, v10, 0);
if ( (unsigned int)(v10 - 8) <= 3 )
{
v26 = cocos2d::CCString::createWithFormat("groundSquare_%02d_2_001.png", v10);
CString = cocos2d::CCString::getCString(v26);
v16 = cocos2d::CCTextureCache::sharedTextureCache();
v17 = GameManager::finishedLoadingGAsync2;
v18 = v20;
goto LABEL_45;
}
}
}
}
}
else
{
if ( a1->m_objectID != 3031 )
return;
v6 = a1->m_artIndex;
a2->m_gameState.m_middleground = v6;
if ( a2->m_skipArtReload )
return;
v7 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v32 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v32);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v7 = qword_1406C2ED8;
}
if ( *(_DWORD *)(v7 + 968) == v6 )
{
if ( v6 > 0 && !a2->m_middleground )
{
GJBaseGameLayer::createMiddleground(a2, v6);
GJBaseGameLayer::updateLevelColors(a2);
}
return;
}
if ( !v6 )
{
m_middleground = a2->m_middleground;
if ( m_middleground )
{
((void (__fastcall *)(GJMGLayer *, __int64, _QWORD, std::vector *const))m_middleground->removeFromParent)(
m_middleground,
v5,
*(_QWORD *)&a3,
a4);
a2->m_middleground = nullptr;
}
return;
}
v9 = 3;
if ( v6 < 3 )
v9 = v6;
v10 = 1;
if ( v9 > 1 )
v10 = v9;
if ( !*(_BYTE *)(v7 + 982) && v10 != *(_DWORD *)(v7 + 968) )
{
*(_BYTE *)(v7 + 982) = 1;
*(_WORD *)(v7 + 985) = 0;
v11 = cocos2d::CCString::createWithFormat("fg_%02d_001.png", v10);
v12 = cocos2d::CCString::getCString(v11);
v13 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImageAsync(v13, v12, v7, GameManager::finishedLoadingMGAsync1, v10, 0);
v14 = cocos2d::CCString::createWithFormat("fg_%02d_2_001.png", v10);
CString = cocos2d::CCString::getCString(v14);
v16 = cocos2d::CCTextureCache::sharedTextureCache();
v17 = GameManager::finishedLoadingMGAsync2;
v18 = v7;
LABEL_45:
cocos2d::CCTextureCache::addImageAsync(v16, CString, v18, v17, v10, 0);
}
}
}
}