//
// LevelEditorLayer::rebuildDeathOverlay from 0x797cec to 0x7980dc (1008 bytes)
//
// 7 xrefs:
// > LevelEditorLayer::toggleLocalDeaths @ 0x7980f0
// > LevelEditorLayer::toggleGlobalDeaths @ 0x798108
// > LevelEditorLayer::init @ 0x7af420
// > DeathStatsPopup::onClearLocal @ 0xca7584
// > DeathStatsPopup::onClearFetched @ 0xca75ec
// > DeathStatsPopup::showResult @ 0xca8768
// > ??> @ 0xcb3f8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:53:35 +0000
//
__int64 __fastcall LevelEditorLayer::rebuildDeathOverlay(LevelEditorLayer *this)
{
__int64 v2; // x0
__int64 v3; // x0
__int64 v4; // x0
char v5; // w0
__int64 v6; // x0
_BYTE *v7; // x1
__int64 v8; // x0
_BYTE *v9; // x2
unsigned __int64 v10; // x21
__int64 i; // x20
_DWORD *v12; // x0
_DWORD *v13; // x3
_DWORD *v14; // x0
_DWORD *v15; // x0
__int64 v16; // x0
_BYTE *v17; // x1
DeathMarkerLayer *v18; // x0
DeathMarkerLayer *v19; // x0
_BYTE v21[16]; // [xsp+58h] [xbp+48h] BYREF
void *v22; // [xsp+68h] [xbp+58h] BYREF
_BYTE *v23; // [xsp+70h] [xbp+60h]
__int64 v24; // [xsp+78h] [xbp+68h]
void *v25; // [xsp+80h] [xbp+70h] BYREF
_DWORD *v26; // [xsp+88h] [xbp+78h]
_DWORD *v27; // [xsp+90h] [xbp+80h]
v2 = *((_QWORD *)this + 243);
if ( v2 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v2 + 520LL))(v2);
*((_QWORD *)this + 243) = 0;
}
v3 = *((_QWORD *)this + 244);
if ( v3 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v3 + 520LL))(v3);
*((_QWORD *)this + 244) = 0;
}
sub_786D34(*((_QWORD *)this + 490), (cocos2d::CCRect *)v21);
if ( LevelEditorLayer::s_showGlobalDeaths )
{
v4 = *((_QWORD *)this + 242);
if ( !v4 )
goto LABEL_35;
v25 = nullptr;
v26 = nullptr;
v27 = nullptr;
GJGameLevel::dtParseGlobalBlob(v4, v4 + 1760, &v25);
*((_BYTE *)this + 1969) = v5;
v6 = GJBaseGameLayer::addDeathMarkerLayer(
this,
*((_QWORD *)this + 490),
1,
&v25,
0,
v21,
0x80000000LL,
0x80000000LL,
0.0,
0.0,
0.0,
0);
v7 = v25;
*((_QWORD *)this + 244) = v6;
if ( v7 )
{
if ( v7 != (_BYTE *)v26 )
v26 += ~((unsigned __int64)((char *)(v26 - 1) - v7) >> 2);
operator delete(v7);
}
}
if ( LevelEditorLayer::s_showLocalDeaths )
{
v8 = *((_QWORD *)this + 242);
if ( v8 )
{
v22 = nullptr;
v23 = nullptr;
v24 = 0;
v25 = nullptr;
v26 = nullptr;
v27 = nullptr;
GJGameLevel::scoreStringToVector(v8, v8 + 1720, &v22);
v9 = v22;
v10 = 4;
for ( i = 8; v10 <= (v23 - v9) >> 2; v10 += 4LL )
{
v12 = v26;
v13 = v27;
if ( v26 == v27 )
{
std::vector::__push_back_slow_path((__int64)&v25, &v9[i - 8]);
v14 = v26;
v9 = v22;
v13 = v27;
}
else
{
if ( v26 )
{
*v26 = *(_DWORD *)&v9[i - 8];
v12 = v26;
v9 = v22;
v13 = v27;
}
v14 = v12 + 1;
v26 = v14;
}
if ( v14 == v13 )
{
std::vector::__push_back_slow_path((__int64)&v25, &v9[i - 4]);
v15 = v26;
v9 = v22;
v13 = v27;
}
else
{
if ( v14 )
{
*v14 = *(_DWORD *)&v9[i - 4];
v14 = v26;
v9 = v22;
v13 = v27;
}
v15 = v14 + 1;
v26 = v15;
}
if ( v15 == v13 )
{
std::vector::__push_back_slow_path((__int64)&v25, &v9[i]);
v9 = v22;
i += 16;
}
else
{
if ( v15 )
{
*v15 = *(_DWORD *)&v9[i];
v15 = v26;
v9 = v22;
}
i += 16;
v26 = v15 + 1;
}
}
v16 = GJBaseGameLayer::addDeathMarkerLayer(
this,
*((_QWORD *)this + 490),
0,
&v25,
0,
v21,
0x80000000LL,
0x80000000LL,
0.0,
0.0,
0.0,
0);
v17 = v25;
*((_QWORD *)this + 243) = v16;
if ( v17 )
{
if ( v17 != (_BYTE *)v26 )
v26 += ~((unsigned __int64)((char *)(v26 - 1) - v17) >> 2);
operator delete(v17);
}
if ( v22 )
{
if ( v22 != v23 )
v23 += 4 * ~((unsigned __int64)(v23 - 4 - (_BYTE *)v22) >> 2);
operator delete(v22);
}
}
}
LABEL_35:
v18 = *((DeathMarkerLayer **)this + 243);
if ( v18 )
DeathMarkerLayer::setLabelsVisible(v18, LevelEditorLayer::s_showDeathLabels);
v19 = *((DeathMarkerLayer **)this + 244);
if ( v19 )
DeathMarkerLayer::setLabelsVisible(v19, LevelEditorLayer::s_showDeathLabels);
return _stack_chk_guard;
}