//
// CurrencySprite::init from 0x100321cc4 to 0x1003224e8 (2084 bytes)
//
// 1 xrefs:
// > CurrencySprite::create @ 0x100320398
//
// 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
//
bool __fastcall CurrencySprite::init(CurrencySprite *a1, CurrencySpriteType a2, bool a3)
{
__int16 v6; // w8
float v7; // s8
int v8; // w8
__int16 v9; // w9
__int16 v10; // w8
std::string *v11; // x1
_BOOL4 v12; // w22
std::string *v13; // x0
cocos2d::CCSprite *v14; // x0
cocos2d::CCSprite *m_burstSprite; // x21
float v16; // s0
cocos2d::CCSprite *v17; // x21
float v18; // s8
unsigned int v19; // w0
cocos2d::CCRotateBy *v20; // x0
cocos2d::CCRepeatForever *v21; // x0
unsigned int v22; // w0
unsigned int v23; // w0
cocos2d::CCSprite *v24; // x23
unsigned int v25; // w0
cocos2d::CCRotateBy *v26; // x0
cocos2d::CCRepeatForever *v27; // x0
std::string *v28; // x0
cocos2d::CCSprite *v29; // x21
cocos2d::CCFadeOut *v30; // x0
cocos2d::CCEaseIn *v31; // x0
_BYTE v33[8]; // [xsp+Ch] [xbp-84h] BYREF
__int16 v34; // [xsp+14h] [xbp-7Ch] BYREF
char v35; // [xsp+16h] [xbp-7Ah]
__int16 v36; // [xsp+18h] [xbp-78h] BYREF
char v37; // [xsp+1Ah] [xbp-76h]
__int16 v38; // [xsp+1Ch] [xbp-74h] BYREF
char v39; // [xsp+1Eh] [xbp-72h]
std::string v40; // [xsp+20h] [xbp-70h] BYREF
std::string v41; // [xsp+38h] [xbp-58h] BYREF
cocos2d::CCPoint v42; // 0:kr00_8.8
cocos2d::CCPoint v43; // 0:kr08_8.8
cocos2d::CCPoint v44; // 0:kr10_8.8
memset(&v41, 0, sizeof(v41));
memset(&v40, 0, sizeof(v40));
v39 = -1;
v38 = -1;
v37 = -1;
v36 = -1;
v35 = -1;
v34 = -1;
switch ( a2 )
{
case 2:
std::string::assign(&v41, "GJ_bigStar_noShadow_001.png");
std::string::assign(&v40, "GJ_bigStar_glow_001.png");
v39 = 0;
v38 = -26881;
v37 = 0;
v36 = -26881;
v35 = 0;
v6 = -14081;
goto LABEL_23;
case 3:
std::string::assign(&v41, "GJ_bigDiamond_noShadow_001.png");
std::string::assign(&v40, "GJ_bigDiamond_glow_001.png");
v39 = -1;
v38 = (int)(float)((float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 125.0) + 130.0) | 0xFF00;
v37 = -1;
v36 = (int)(float)((float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 125.0) + 130.0) | 0xFF00;
v8 = (int)(float)((float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 175.0) + 80.0) | 0xFF00;
goto LABEL_13;
case 4:
std::string::assign(&v41, "fireShardBig_001.png");
std::string::assign(&v40, "shard_glow_001.png");
v39 = 0;
v38 = -26881;
v37 = 0;
v10 = -1;
goto LABEL_17;
case 5:
std::string::assign(&v41, "iceShardBig_001.png");
std::string::assign(&v40, "shard_glow_001.png");
v39 = -1;
v38 = -56;
v37 = -1;
v36 = -256;
v35 = -1;
v6 = -27136;
goto LABEL_23;
case 6:
std::string::assign(&v41, "poisonShardBig_001.png");
std::string::assign(&v40, "shard_glow_001.png");
v39 = 0;
v38 = -106;
v37 = 0;
v36 = -106;
v35 = 0;
v6 = -156;
goto LABEL_23;
case 7:
std::string::assign(&v41, "shadowShardBig_001.png");
std::string::assign(&v40, "shard_glow_001.png");
v6 = 255;
v39 = -1;
v38 = 255;
v37 = -1;
v36 = 100;
v35 = -1;
goto LABEL_23;
case 8:
std::string::assign(&v41, "lavaShardBig_001.png");
std::string::assign(&v40, "shard_glow_001.png");
v39 = 0;
v38 = -26881;
v37 = 0;
v10 = 13055;
LABEL_17:
v36 = v10;
v35 = 0;
v6 = 25855;
goto LABEL_23;
case 9:
std::string::assign(&v41, "GJ_bigKey_001.png");
std::string::assign(&v40, "GJ_bigKey_glow_001.png");
v39 = -1;
v38 = -1;
v37 = -1;
v36 = -1;
v35 = -1;
v7 = 1.5;
goto LABEL_19;
case 10:
std::string::assign(&v41, "shard0201ShardBig_001.png");
std::string::assign(&v40, "shard2_glow_001.png");
v39 = 0;
v6 = -26881;
v38 = -26881;
v37 = 0;
v9 = -14081;
goto LABEL_21;
case 11:
std::string::assign(&v41, "shard0202ShardBig_001.png");
std::string::assign(&v40, "shard2_glow_001.png");
v39 = 0;
v6 = 255;
v38 = 255;
v37 = 0;
v9 = 13055;
LABEL_21:
v36 = v9;
goto LABEL_22;
case 12:
std::string::assign(&v41, "shard0203ShardBig_001.png");
std::string::assign(&v40, "shard2_glow_001.png");
v39 = -1;
v38 = -1;
v37 = -1;
v36 = -1;
v35 = -1;
v7 = 1.0;
LABEL_19:
v34 = -1;
break;
case 13:
std::string::assign(&v41, "shard0204ShardBig_001.png");
std::string::assign(&v40, "shard2_glow_001.png");
v39 = 0;
v6 = -1;
v38 = -1;
v37 = 50;
v36 = -1;
LABEL_22:
v35 = 0;
goto LABEL_23;
case 14:
std::string::assign(&v41, "shard0205ShardBig_001.png");
std::string::assign(&v40, "shard2_glow_001.png");
v38 = -26881;
v39 = 50;
LOWORD(v8) = 175;
v37 = -81;
v36 = 255;
LABEL_13:
v35 = -1;
v34 = v8;
v7 = 1.0;
break;
case 15:
std::string::assign(&v41, "GJ_bigMoon_noShadow_001.png");
std::string::assign(&v40, "GJ_bigMoon_glow_001.png");
v39 = -1;
v38 = -27136;
v37 = -1;
v36 = -27136;
v35 = -1;
v6 = -14336;
LABEL_23:
v7 = 1.0;
v34 = v6;
break;
case 16:
std::string::assign(&v41, "GJ_bigGoldKey_001.png");
std::string::assign(&v40, "GJ_bigGoldKey_glow_001.png");
v38 = -26881;
v39 = 50;
v36 = -26881;
v37 = 50;
v35 = 50;
v34 = -14081;
v7 = 1.5;
break;
default:
v7 = 1.0;
std::string::assign(&v41, "currencyOrb_001.png");
break;
}
if ( (v41.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v11 = &v41;
else
v11 = (std::string *)v41.__r_.__value_.__r.__words[0];
v12 = cocos2d::CCSprite::initWithSpriteFrameName(a1, (const char *)v11);
if ( v12 )
{
if ( SHIBYTE(v40.__r_.__value_.__r.__words[2]) < 0 )
{
if ( v40.__r_.__value_.__l.__size_ && !a3 )
{
v13 = (std::string *)v40.__r_.__value_.__r.__words[0];
goto LABEL_35;
}
}
else if ( *((_BYTE *)&v40.__r_.__value_.__s + 23) && !a3 )
{
v13 = &v40;
LABEL_35:
v14 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v13);
a1->m_burstSprite = v14;
((void (__fastcall *)(cocos2d::CCSprite *, float))v14->setScale)(v14, flt_100645090[a2 == (Star|Orb)]);
m_burstSprite = a1->m_burstSprite;
v16 = ((float (__fastcall *)(cocos2d::CCSprite *))m_burstSprite->getScale)(m_burstSprite);
((void (__fastcall *)(cocos2d::CCSprite *, float))m_burstSprite->setScale)(m_burstSprite, v7 * v16);
cocos2d::CCObject::retain(a1->m_burstSprite);
((void (__fastcall *)(cocos2d::CCSprite *, __int16 *))a1->m_burstSprite->setColor)(a1->m_burstSprite, &v38);
v17 = cocos2d::CCSprite::createWithSpriteFrameName("shineBurst_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSprite *))a1->m_burstSprite->addChild)(
a1->m_burstSprite,
v17);
v42 = cocos2d::CCNode::convertToNodeSpace(a1->m_burstSprite, &stru_10086E040);
((void (__fastcall *)(cocos2d::CCSprite *, _BYTE *, float, float))v17->setPosition)(v17, v33, v42.x, v42.y);
if ( vcvts_n_f32_s32(rand(), 0x1Fu) <= 0.5 )
v18 = -1.0;
else
v18 = 1.0;
v19 = rand();
v20 = cocos2d::CCRotateBy::create_1(
1.0,
v18 * (float)((float)((float)(vcvts_n_f32_s32(v19, 0x1Fu) * 0.5) + 0.5) * 180.0));
v21 = cocos2d::CCRepeatForever::create(v20);
cocos2d::CCNode::runAction(v17, v21);
v22 = rand();
((void (__fastcall *)(cocos2d::CCSprite *, float))v17->setScale)(v17, vcvts_n_f32_s32(v22, 0x1Fu) + 1.8);
v23 = rand();
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))v17->setOpacity)(
v17,
(unsigned int)(int)(float)((float)((float)(vcvts_n_f32_s32(v23, 0x1Fu) * 0.4) + 0.6) * 255.0));
((void (__fastcall *)(cocos2d::CCSprite *, __int16 *))v17->setColor)(v17, &v36);
v24 = cocos2d::CCSprite::createWithSpriteFrameName("shineBurst_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSprite *))v17->addChild)(v17, v24);
v43 = cocos2d::CCNode::convertToNodeSpace(v17, &stru_10086E040);
((void (__fastcall *)(cocos2d::CCSprite *, _BYTE *, float, float))v24->setPosition)(v24, v33, v43.x, v43.y);
((void (__fastcall *)(cocos2d::CCSprite *, float))v24->setScale)(v24, 0.8);
((void (__fastcall *)(cocos2d::CCSprite *, __int16 *))v24->setColor)(v24, &v34);
v25 = rand();
v26 = cocos2d::CCRotateBy::create_1(
1.0,
(float)((float)((float)(vcvts_n_f32_s32(v25, 0x1Fu) * 0.5) + 0.5) * -180.0) * v18);
v27 = cocos2d::CCRepeatForever::create(v26);
cocos2d::CCNode::runAction(v24, v27);
if ( (v40.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v28 = &v40;
else
v28 = (std::string *)v40.__r_.__value_.__r.__words[0];
v29 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v28);
((void (__fastcall *)(CurrencySprite *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v29, 10);
v44 = cocos2d::CCNode::convertToNodeSpace(a1, &stru_10086E040);
((void (__fastcall *)(cocos2d::CCSprite *, _BYTE *, float, float))v29->setPosition)(v29, v33, v44.x, v44.y);
v30 = cocos2d::CCFadeOut::create(0.5);
v31 = cocos2d::CCEaseIn::create(v30, 1.3);
cocos2d::CCNode::runAction(v29, v31);
}
a1->m_spriteType = a2;
}
if ( SHIBYTE(v40.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v40.__r_.__value_.__l.__data_);
if ( SHIBYTE(v41.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v41.__r_.__value_.__l.__data_);
return v12;
}