//
// LevelAreaLayer::addTorch from 0x1403deb90 to 0x1403df231 (1697 bytes)
//
// 4 xrefs:
// > LevelAreaLayer::init @ 0x1403de485
// > LevelAreaInnerLayer::init @ 0x1403e02b3
// > SecretLayer5::init @ 0x14058a6ee
// > ??> @ 0x140924d88
//
// This function is hookable on this platform (idp: pc, 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 11:31:40 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall LevelAreaLayer::addTorch(
__int64 a1,
__int64 a2,
int a3,
float a4,
unsigned int a5,
char a6,
int a7,
__int64 a8)
{
const char *v11; // rdx
size_t v12; // r8
const char *v13; // rcx
struct cocos2d::CCSprite *v14; // r14
const char *v15; // rcx
struct cocos2d::CCSprite *v16; // r13
__int64 v17; // rbx
__int64 v18; // rax
BOOL v19; // esi
__int64 v20; // rcx
__int64 v21; // rcx
__int64 v22; // rax
int v23; // edi
cocos2d::CCArray *v24; // r12
cocos2d::CCArray *v25; // r15
cocos2d::CCString *v26; // rax
const char *CString; // rbx
__int64 v28; // rdx
__int64 v29; // rcx
cocos2d::CCSpriteFrameCache *v30; // rax
struct cocos2d::CCObject *v31; // rax
cocos2d::CCString *v32; // rax
const char *v33; // rbx
__int64 v34; // rdx
__int64 v35; // rcx
cocos2d::CCSpriteFrameCache *v36; // rax
struct cocos2d::CCObject *v37; // rax
struct cocos2d::CCAnimation *v38; // rax
struct cocos2d::CCActionInterval *v39; // rax
struct cocos2d::CCAction *v40; // rax
struct cocos2d::CCAnimation *v41; // rax
struct cocos2d::CCActionInterval *v42; // rax
struct cocos2d::CCAction *v43; // rax
cocos2d::CCNode *v44; // rsi
__int64 v45; // rax
__int64 v46; // rbx
__int64 v47; // rax
__int64 v48; // r15
__int64 v49; // rdx
struct cocos2d::CCActionInterval *v50; // rax
struct cocos2d::CCFiniteTimeAction *v51; // rdi
struct cocos2d::CCActionInterval *v52; // rax
struct cocos2d::CCEaseInOut *v53; // rax
struct cocos2d::CCActionInterval *v54; // rax
struct cocos2d::CCAction *v55; // rax
struct cocos2d::CCActionInterval *v56; // rax
struct cocos2d::CCFiniteTimeAction *v57; // rdi
struct cocos2d::CCActionInterval *v58; // rax
struct cocos2d::CCEaseInOut *v59; // rax
struct cocos2d::CCActionInterval *v60; // rax
struct cocos2d::CCAction *v61; // rax
cocos2d::CCArray *v62; // r12
struct cocos2d::CCSprite *v63; // rsi
__int64 v64; // rax
__int64 v65; // rdi
__int64 v66; // rax
struct cocos2d::CCObject *v67; // rsi
__int64 v68; // rax
__int64 v69; // rdi
__int64 v70; // rax
__int64 v71; // rdx
struct cocos2d::CCObject *v72; // rdi
__int16 v73; // [rsp+28h] [rbp-A1h] BYREF
char v74; // [rsp+2Ah] [rbp-9Fh]
__int64 v75; // [rsp+30h] [rbp-99h] BYREF
__int64 v76; // [rsp+38h] [rbp-91h] BYREF
void (__fastcall ***v77)(__int64, __int16 *); // [rsp+40h] [rbp-89h]
_BYTE v78[8]; // [rsp+48h] [rbp-81h] BYREF
__int64 v79; // [rsp+50h] [rbp-79h]
__int128 v80; // [rsp+58h] [rbp-71h] BYREF
__int128 v81; // [rsp+68h] [rbp-61h]
v79 = a1;
v76 = a8;
v11 = "Fire_01_looped_001.png";
if ( a3 == 2 )
v11 = "Fire_02_looped_001.png";
v80 = 0;
v81 = 0;
v12 = -1;
do
++v12;
while ( v11[v12] );
sub_14003D230(&v80, v11, v12);
v13 = (const char *)&v80;
if ( *((_QWORD *)&v81 + 1) > 0xFu )
v13 = (const char *)v80;
v14 = cocos2d::CCSprite::createWithSpriteFrameName(v13);
(*(void (__fastcall **)(__int64, struct cocos2d::CCSprite *, _QWORD))(*(_QWORD *)a1 + 456LL))(a1, v14, a5 - 2);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(*(_QWORD *)v14 + 184LL))(v14, a2);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v14 + 160LL))(v14);
v15 = (const char *)&v80;
if ( *((_QWORD *)&v81 + 1) > 0xFu )
v15 = (const char *)v80;
v16 = cocos2d::CCSprite::createWithSpriteFrameName(v15);
(*(void (__fastcall **)(__int64, struct cocos2d::CCSprite *, _QWORD))(*(_QWORD *)a1 + 456LL))(a1, v16, a5 - 3);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v14 + 168LL))(v14);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v16 + 160LL))(v16);
v17 = *(_QWORD *)v16;
v18 = (*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v14 + 200LL))(v14);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v17 + 184))(v16, v18);
v73 = 13055;
v74 = 0;
(**((void (__fastcall ***)(__int64, __int16 *))v14 + 40))((__int64)v14 + 320, &v73);
v73 = -1;
v74 = 0;
(**((void (__fastcall ***)(__int64, __int16 *))v16 + 40))((__int64)v16 + 320, &v73);
v19 = a3 == 2;
v75 = cocos2d::CCArray::create(v20);
v22 = cocos2d::CCArray::create(v21);
v23 = 1;
v24 = (cocos2d::CCArray *)v75;
v25 = (cocos2d::CCArray *)v22;
do
{
v26 = cocos2d::CCString::createWithFormat("Fire_0%i_looped_%03i.png", v19 + 1, v23);
CString = cocos2d::CCString::getCString(v26);
v30 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v29, v28);
v31 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v30, CString);
cocos2d::CCArray::addObject(v24, v31);
v32 = cocos2d::CCString::createWithFormat("Fire_0%i_2_looped_%03i.png", v19 + 1, v23);
v33 = cocos2d::CCString::getCString(v32);
v36 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v35, v34);
v37 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v36, v33);
cocos2d::CCArray::addObject(v25, v37);
++v23;
}
while ( v23 <= 9 );
v38 = cocos2d::CCAnimation::createWithSpriteFrames(v24, 0.079999998);
v39 = cocos2d::CCAnimate::create(v38);
v40 = cocos2d::CCRepeatForever::create(v39);
cocos2d::CCNode::runAction(v14, v40);
v41 = cocos2d::CCAnimation::createWithSpriteFrames(v25, 0.079999998);
v42 = cocos2d::CCAnimate::create(v41);
v43 = cocos2d::CCRepeatForever::create(v42);
cocos2d::CCNode::runAction(v16, v43);
v44 = cocos2d::CCSprite::createWithSpriteFrameName("towerShine.png");
v77 = (void (__fastcall ***)(__int64, __int16 *))v44;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v78, 0.0, -10.0);
v46 = v45;
v47 = (*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v14 + 200LL))(v14);
cocos2d::CCPoint::operator+(v47, &v75, v46);
(*(void (__fastcall **)(cocos2d::CCNode *, __int64 *))(*(_QWORD *)v44 + 184LL))(v44, &v75);
v48 = v79;
(*(void (__fastcall **)(__int64, cocos2d::CCNode *, _QWORD))(*(_QWORD *)v79 + 456LL))(v79, v44, a5 - 1);
(*(void (__fastcall **)(cocos2d::CCNode *))(*(_QWORD *)v44 + 160LL))(v44);
v75 = 0x100000302LL;
(**((void (__fastcall ***)(__int64, __int64))v44 + 43))((__int64)v44 + 344, 0x100000302LL);
LOBYTE(v49) = -116;
(*(void (__fastcall **)(__int64, __int64))(*((_QWORD *)v44 + 40) + 40LL))((__int64)v44 + 320, v49);
v73 = -14081;
v74 = 0;
(**((void (__fastcall ***)(__int64, __int16 *))v44 + 40))((__int64)v44 + 320, &v73);
v50 = cocos2d::CCFadeTo::create(1.6, 0x70u);
v51 = cocos2d::CCEaseInOut::create(v50, 1.3);
v52 = cocos2d::CCFadeTo::create(1.6, 0x9Du);
v53 = cocos2d::CCEaseInOut::create(v52, 1.3);
v54 = cocos2d::CCSequence::create(v51, v53, 0);
v55 = cocos2d::CCRepeatForever::create(v54);
cocos2d::CCNode::runAction(v44, v55);
v56 = cocos2d::CCScaleTo::create(1.0, a4 + a4);
v57 = cocos2d::CCEaseInOut::create(v56, 1.5);
v58 = cocos2d::CCScaleTo::create(1.0, (float)(a4 + a4) * 1.2);
v59 = cocos2d::CCEaseInOut::create(v58, 1.5);
v60 = cocos2d::CCSequence::create(v57, v59, 0);
v61 = cocos2d::CCRepeatForever::create(v60);
cocos2d::CCNode::runAction(v44, v61);
v62 = (cocos2d::CCArray *)v76;
if ( !a6 )
{
v63 = cocos2d::CCSprite::createWithSpriteFrameName("towerTorch_001.png");
(*(void (__fastcall **)(__int64, struct cocos2d::CCSprite *, _QWORD))(*(_QWORD *)v48 + 456LL))(v48, v63, a5);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v78, 0.5, -18.0);
v65 = v64;
v66 = (*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v14 + 200LL))(v14);
cocos2d::CCPoint::operator+(v66, &v76, v65);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64 *))(*(_QWORD *)v63 + 184LL))(v63, &v76);
}
v67 = cocos2d::CCSprite::createWithSpriteFrameName("towerShine.png");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v78, 0.0, -14.0);
v69 = v68;
v70 = (*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v14 + 200LL))(v14);
cocos2d::CCPoint::operator+(v70, &v76, v69);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64 *))(*(_QWORD *)v67 + 184LL))(v67, &v76);
(*(void (__fastcall **)(__int64, struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v48 + 456LL))(v48, v67, a5 + 1);
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v67 + 160LL))(v67);
(**((void (__fastcall ***)(__int64, __int64))v67 + 43))((__int64)v67 + 344, 0x100000302LL);
LOBYTE(v71) = 122;
(*(void (__fastcall **)(__int64, __int64))(*((_QWORD *)v67 + 40) + 40LL))((__int64)v67 + 320, v71);
v73 = -26881;
v74 = 0;
(**((void (__fastcall ***)(__int64, __int16 *))v67 + 40))((__int64)v67 + 320, &v73);
if ( a7 == 1 )
{
v73 = 50;
v74 = 127;
(**((void (__fastcall ***)(__int64, __int16 *))v14 + 40))((__int64)v14 + 320, &v73);
v73 = 10837;
v74 = -40;
(**((void (__fastcall ***)(__int64, __int16 *))v16 + 40))((__int64)v16 + 320, &v73);
v73 = 12950;
v74 = -1;
v72 = (struct cocos2d::CCObject *)v77;
(*v77[40])((__int64)(v77 + 40), &v73);
v73 = 130;
v74 = -1;
(**((void (__fastcall ***)(__int64, __int16 *))v67 + 40))((__int64)v67 + 320, &v73);
}
else
{
v72 = (struct cocos2d::CCObject *)v77;
}
if ( v62 )
{
cocos2d::CCArray::addObject(v62, v14);
cocos2d::CCArray::addObject(v62, v16);
cocos2d::CCArray::addObject(v62, v72);
cocos2d::CCArray::addObject(v62, v67);
}
sub_14003D310((__int64)&v80);
}