//
// LevelAreaLayer::addTorch from 0x56c098 to 0x56c514 (1148 bytes)
//
// 3 xrefs:
// > LevelAreaLayer::init @ 0x56cfcc
// > LevelAreaInnerLayer::init @ 0x56d618
// > SecretLayer5::init @ 0x59f67a
//
// 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 LevelAreaLayer::addTorch(
cocos2d::CCNode *a1,
cocos2d::CCPoint a2,
int a3,
float a4,
int a5,
bool a6,
int a7,
cocos2d::CCArray *a8)
{
float x; // r5
float y; // r9
char *v12; // r1
cocos2d::CCSprite *v13; // r4
cocos2d::CCSprite *v14; // r6
void (__fastcall *setScale)(cocos2d::CCSprite *__hidden, float); // r5
float v16; // r0
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r5
int v18; // r0
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r3
void (__fastcall *v20)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r3
cocos2d::CCArray *v21; // r0
const char *v22; // r11
cocos2d::CCArray *v23; // r8
cocos2d::CCArray *v24; // r10
int i; // r5
cocos2d::CCSpriteFrameCache *v26; // r9
cocos2d::CCString *v27; // r0
const char *CString; // r0
cocos2d::CCSpriteFrame *v29; // r0
cocos2d::CCSpriteFrameCache *v30; // r9
cocos2d::CCString *v31; // r0
const char *v32; // r0
cocos2d::CCSpriteFrame *v33; // r0
cocos2d::CCAnimation *v34; // r0
cocos2d::CCAnimate *v35; // r0
cocos2d::CCRepeatForever *v36; // r0
cocos2d::CCAnimation *v37; // r0
cocos2d::CCAnimate *v38; // r0
cocos2d::CCRepeatForever *v39; // r0
cocos2d::CCSprite *v40; // r5
void (__fastcall *v41)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
int v42; // r11
float v43; // s16
void (__fastcall *setBlendFunc)(cocos2d::CCSprite *__hidden, cocos2d::ccBlendFunc); // r12
void (__fastcall *v45)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r3
cocos2d::CCFadeTo *v46; // r0
cocos2d::CCEaseInOut *v47; // r9
cocos2d::CCFadeTo *v48; // r0
cocos2d::CCEaseInOut *v49; // r0
cocos2d::CCActionInterval *v50; // r0
cocos2d::CCRepeatForever *v51; // r0
float v52; // r2
cocos2d::CCActionInterval *v53; // r0
cocos2d::CCEaseInOut *v54; // r9
float v55; // r2
cocos2d::CCActionInterval *v56; // r0
cocos2d::CCEaseInOut *v57; // r0
cocos2d::CCActionInterval *v58; // r0
cocos2d::CCRepeatForever *v59; // r0
cocos2d::CCSprite *v60; // r9
int v61; // r11
cocos2d::CCSprite *v62; // r8
int v63; // r11
void (__fastcall *v64)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r3
void (__fastcall *v65)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r3
void (__fastcall *v66)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r3
void (__fastcall *v67)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r3
void (__fastcall *v68)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r3
cocos2d::CCString *v69; // [sp+8h] [bp-2Ch]
cocos2d::CCString *v70; // [sp+8h] [bp-2Ch]
cocos2d::CCSprite *v71; // [sp+10h] [bp-24h] BYREF
int v72; // [sp+14h] [bp-20h] BYREF
int v73; // [sp+18h] [bp-1Ch]
cocos2d::CCPoint v74; // [sp+1Ch] [bp-18h] BYREF
char v75; // [sp+24h] [bp-10h] BYREF
char v76; // [sp+25h] [bp-Fh]
char v77; // [sp+26h] [bp-Eh]
x = a2.x;
y = a2.y;
if ( LODWORD(a2.y) == 2 )
v12 = "Fire_02_looped_001.png";
else
v12 = "Fire_01_looped_001.png";
sub_776584((int)&v71, v12);
v13 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v71);
a1->addChild_0(a1, v13, LODWORD(a4) - 2);
((void (__fastcall *)(cocos2d::CCSprite *, float))v13->setPosition)(v13, COERCE_FLOAT(LODWORD(x)));
((void (__fastcall *)(cocos2d::CCSprite *, int))v13->setScale)(v13, a3);
v14 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v71);
a1->addChild_0(a1, v14, LODWORD(a4) - 3);
setScale = v14->setScale;
v16 = COERCE_FLOAT(((int (__fastcall *)(cocos2d::CCSprite *))v13->getScale)(v13));
((void (__fastcall *)(cocos2d::CCSprite *, _DWORD))setScale)(v14, v16 + v16);
setPosition = v14->setPosition;
v18 = (int)v13->getPosition(v13);
setPosition(v14, (const cocos2d::CCPoint *)v18);
setColor = v13->setColor;
v76 = 50;
v75 = -1;
v77 = 0;
setColor(v13, (const cocos2d::ccColor3B *)&v75);
v20 = v14->setColor;
v75 = -1;
v76 = -1;
v77 = 0;
v21 = (cocos2d::CCArray *)((int (__fastcall *)(cocos2d::CCSprite *, char *))v20)(v14, &v75);
if ( LODWORD(y) == 2 )
v22 = (_BYTE *)(&dword_0 + 2);
else
v22 = (_BYTE *)(&dword_0 + 1);
v23 = (cocos2d::CCArray *)cocos2d::CCArray::create(v21);
v24 = (cocos2d::CCArray *)cocos2d::CCArray::create(v23);
for ( i = 1; i != 10; ++i )
{
v26 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v27 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Fire_0%i_looped_%03i.png",
v22,
i);
CString = cocos2d::CCString::getCString(v27);
v29 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v26, CString);
cocos2d::CCArray::addObject(v23, v29);
v30 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v31 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Fire_0%i_2_looped_%03i.png",
v22,
i);
v32 = cocos2d::CCString::getCString(v31);
v33 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v30, v32);
cocos2d::CCArray::addObject(v24, v33);
}
v34 = cocos2d::CCAnimation::createWithSpriteFrames(v23, 0.08);
v35 = cocos2d::CCAnimate::create(v34);
v36 = cocos2d::CCRepeatForever::create(v35);
cocos2d::CCNode::runAction(v13, v36);
v37 = cocos2d::CCAnimation::createWithSpriteFrames(v24, 0.08);
v38 = cocos2d::CCAnimate::create(v37);
v39 = cocos2d::CCRepeatForever::create(v38);
cocos2d::CCNode::runAction(v14, v39);
v40 = cocos2d::CCSprite::createWithSpriteFrameName("towerShine.png");
v41 = v40->setPosition;
v42 = (int)v13->getPosition(v13);
cocos2d::CCPoint::CCPoint(&v74, 0.0, -10.0);
cocos2d::CCPoint::operator+(&v75, v42, &v74);
v41(v40, (const cocos2d::CCPoint *)&v75);
a1->addChild_0(a1, v40, LODWORD(a4) - 1);
v43 = *(float *)&a3 + *(float *)&a3;
((void (__fastcall *)(cocos2d::CCSprite *, _DWORD))v40->setScale)(v40, v43 * 1.2);
setBlendFunc = v40->setBlendFunc;
v72 = 770;
v73 = 1;
((void (__fastcall *)(cocos2d::CCSprite *, int, int, int *))setBlendFunc)(v40, 770, 1, &v72);
v40->setOpacity(v40, 140);
v45 = v40->setColor;
v75 = -1;
v76 = -56;
v77 = 0;
v45(v40, (const cocos2d::ccColor3B *)&v75);
v46 = cocos2d::CCFadeTo::create(1.6, 0x70u);
v47 = cocos2d::CCEaseInOut::create(v46, 1.3);
v48 = cocos2d::CCFadeTo::create(1.6, 0x9Du);
v49 = cocos2d::CCEaseInOut::create(v48, 1.3);
v50 = (cocos2d::CCActionInterval *)cocos2d::CCSequence::create((cocos2d::CCSequence *)v47, v49, 0);
v51 = cocos2d::CCRepeatForever::create(v50);
cocos2d::CCNode::runAction(v40, v51);
v53 = (cocos2d::CCActionInterval *)cocos2d::CCScaleTo::create((cocos2d::CCScaleTo *)0x3F800000, v43, v52);
v54 = cocos2d::CCEaseInOut::create(v53, 1.5);
v56 = (cocos2d::CCActionInterval *)cocos2d::CCScaleTo::create((cocos2d::CCScaleTo *)0x3F800000, v43 * 1.2, v55);
v57 = cocos2d::CCEaseInOut::create(v56, 1.5);
v58 = (cocos2d::CCActionInterval *)cocos2d::CCSequence::create((cocos2d::CCSequence *)v54, v57, 0);
v59 = cocos2d::CCRepeatForever::create(v58);
cocos2d::CCNode::runAction(v40, v59);
if ( !(_BYTE)a5 )
{
v60 = cocos2d::CCSprite::createWithSpriteFrameName("towerTorch_001.png");
a1->addChild_0(a1, v60, LODWORD(a4));
v69 = (cocos2d::CCString *)v60->setPosition;
v61 = (int)v13->getPosition(v13);
cocos2d::CCPoint::CCPoint(&v74, 0.5, -18.0);
cocos2d::CCPoint::operator+(&v75, v61, &v74);
((void (__fastcall *)(cocos2d::CCSprite *, char *))v69)(v60, &v75);
}
v62 = cocos2d::CCSprite::createWithSpriteFrameName("towerShine.png");
v70 = (cocos2d::CCString *)v62->setPosition;
v63 = (int)v13->getPosition(v13);
cocos2d::CCPoint::CCPoint(&v74, 0.0, -14.0);
cocos2d::CCPoint::operator+(&v75, v63, &v74);
((void (__fastcall *)(cocos2d::CCSprite *, char *))v70)(v62, &v75);
a1->addChild_0(a1, v62, LODWORD(a4) + 1);
((void (__fastcall *)(cocos2d::CCSprite *, _DWORD))v62->setScale)(v62, v43 * 0.6);
((void (__fastcall *)(cocos2d::CCSprite *, int, int))v62->setBlendFunc)(v62, v72, v73);
v62->setOpacity(v62, 122);
v64 = v62->setColor;
v75 = -1;
v76 = -106;
v77 = 0;
v64(v62, (const cocos2d::ccColor3B *)&v75);
if ( a6 )
{
v65 = v13->setColor;
v75 = 50;
v76 = 0;
v77 = 127;
v65(v13, (const cocos2d::ccColor3B *)&v75);
v66 = v14->setColor;
v75 = 85;
v76 = 42;
v77 = -40;
v66(v14, (const cocos2d::ccColor3B *)&v75);
v67 = v40->setColor;
v75 = -106;
v76 = 50;
v77 = -1;
v67(v40, (const cocos2d::ccColor3B *)&v75);
v68 = v62->setColor;
v75 = -126;
v76 = 0;
v77 = -1;
v68(v62, (const cocos2d::ccColor3B *)&v75);
}
if ( a7 )
{
cocos2d::CCArray::addObject((cocos2d::CCArray *)a7, v13);
cocos2d::CCArray::addObject((cocos2d::CCArray *)a7, v14);
cocos2d::CCArray::addObject((cocos2d::CCArray *)a7, v40);
cocos2d::CCArray::addObject((cocos2d::CCArray *)a7, v62);
}
sub_774008(&v71);
}