//
// EditorSFXManager::playAction from 0x1401855c0 to 0x140185a4e (1166 bytes)
//
// 73 xrefs:
// > DeathMarkerLayer::init @ 0x140116c1c
// > DeathMarkerLayer::playMarkerSound @ 0x140118fcf
// > DeathMarkerLayer::playPendingLabelSound @ 0x14011906f
// > EditButtonBar::onRight @ 0x140177b2f
// > EditButtonBar::onLeft @ 0x140177b6f
// > EditButtonBar::onDotClicked @ 0x140177c0c
// > EditorPauseLayer::onResume @ 0x140182503
// > EditorPauseLayer::onExitEditor @ 0x140182baa
// > GJTransformControl::ccTouchMoved @ 0x1401a7604
// > EditorUI::onSettings @ 0x1401ac53f
// > EditorUI::onPause @ 0x1401acd07
// > EditorUI::onPause @ 0x1401acd70
// > EditorUI::clickOnPosition @ 0x1401adb63
// > EditorUI::toggleMode @ 0x1401afdcd
// > EditorUI::onDelete @ 0x1401b02cc
// > EditorUI::onDeleteSelected @ 0x1401b09d1
// > EditorUI::onCreateButton @ 0x1401b2120
// > EditorUI::playSoundForCreatedObject @ 0x1401b27b0
// > EditorUI::toggleSwipe @ 0x1401b34b0
// > EditorUI::toggleFreeMove @ 0x1401b3583
// > EditorUI::toggleSnap @ 0x1401b3693
// > EditorUI::toggleEnableRotate @ 0x1401b3774
// > EditorUI::undoLastAction @ 0x1401b3bd6
// > EditorUI::redoLastAction @ 0x1401b3c46
// > EditorUI::onHideUIBtn @ 0x1401b3cfa
// > EditorUI::onShowUIBtn @ 0x1401b3e0a
// > EditorUI::onPlaytest @ 0x1401b47a8
// > EditorUI::onStopPlaytest @ 0x1401b49a6
// > EditorUI::zoomIn @ 0x1401b4b1b
// > EditorUI::zoomOut @ 0x1401b4b9b
// > EditorUI::selectBuildTab @ 0x1401b5774
// > EditorUI::editObject @ 0x1401bb45c
// > EditorUI::editObjectSpecial @ 0x1401bd51a
// > EditorUI::editObjectSpecial @ 0x1401bdc11
// > EditorUI::editObjectSpecial @ 0x1401bdcdb
// > EditorUI::editGroup @ 0x1401be7ba
// > EditorUI::triggerSwipeMode @ 0x1401bf831
// > EditorUI::ccTouchMoved @ 0x1401c09c2
// > EditorUI::ccTouchEnded @ 0x1401c15b5
// > EditorUI::ccTouchEnded @ 0x1401c1610
// > EditorUI::ccTouchEnded @ 0x1401c191c
// > EditorUI::handleAction @ 0x1401c1dae
// > EditorUI::handleEditorAction @ 0x1401c2307
// > EditorUI::handleEditorAction @ 0x1401c232f
// > EditorUI::handleEditorAction @ 0x1401c23b0
// > EditorUI::handleEditorAction @ 0x1401c2428
// > EditorUI::handleEditorAction @ 0x1401c2b65
// > EditorUI::handleEditorAction @ 0x1401c2f52
// > EditorUI::handleEditorAction @ 0x1401c3396
// > EditorUI::handleEditorAction @ 0x1401c3bc3
// > EditorUI::handleEditorAction @ 0x1401c3da1
// > EditorUI::handleEditorAction @ 0x1401c3f97
// > EditorUI::handleEditorAction @ 0x1401c4362
// > EditorUI::handleEditorAction @ 0x1401c4416
// > sub_1401C4B40 @ 0x1401c4c71
// > sub_1401C4B40 @ 0x1401c5059
// > EditorUI::onDuplicate @ 0x1401c5570
// > EditorUI::onCopy @ 0x1401c5c81
// > EditorUI::onPaste @ 0x1401c5e7e
// > EditorUI::onCopyState @ 0x1401c706d
// > EditorUI::onPasteState @ 0x1401c7145
// > EditorUI::onPasteColor @ 0x1401c730f
// > EditorUI::onDeselectAll @ 0x1401c9901
// > EditorUI::onDpadStep @ 0x1401f3fd9
// > EditorUI::moveObjectCall_1 @ 0x1401febb6
// > EditorUI::moveObjectCall_1 @ 0x1401fec1d
// > EditorUI::transformObjectCall_1 @ 0x1401ff3ed
// > EditorUI::activateScaleControl @ 0x140202c0e
// > EditorUI::activateTransformControl @ 0x1402032e1
// > LevelEditorLayer::saveLevel @ 0x1403ff5c4
// > LevelEditorLayer::doAutoSave @ 0x14040927a
// > LevelEditorLayer::doAutoBackup @ 0x140409718
// > ??> @ 0x140918df4
//
// 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:27:38 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall EditorSFXManager::playAction(__int64 a1, int a2)
{
cocos2d::CCArray **Binding; // rax
cocos2d::CCArray **v4; // rbx
double v5; // xmm6_8
unsigned __int64 v6; // r11
__int64 v7; // r10
__int64 v8; // rcx
__int64 v9; // r9
double v10; // xmm2_8
__int64 v11; // r10
__int64 v12; // rcx
__int64 v13; // r9
float v14; // xmm0_4
__int64 v15; // rsi
unsigned int v16; // r8d
cocos2d::CCArray *v17; // rax
signed int v18; // eax
signed int v19; // ecx
signed int v20; // ebp
cocos2d::CCArray *v21; // rdx
unsigned int v22; // eax
unsigned __int64 i; // rdx
int v24; // eax
cocos2d::CCArray *v25; // rcx
int v26; // edx
__int64 v27; // rcx
cocos2d::CCArray *v28; // rdx
struct cocos2d::CCObject *v29; // rax
struct cocos2d::CCObject *v30; // rbx
__int64 v31; // rax
__int64 v32; // rcx
float v33; // xmm1_4
float v34; // xmm6_4
float v35; // xmm7_4
int v36; // edi
char v37; // si
int v38; // [rsp+20h] [rbp-13F8h] BYREF
LARGE_INTEGER PerformanceCount; // [rsp+28h] [rbp-13F0h] BYREF
int v40; // [rsp+40h] [rbp-13D8h] BYREF
_DWORD v41[1251]; // [rsp+44h] [rbp-13D4h]
v38 = a2;
if ( *(_BYTE *)(a1 + 268) )
return;
Binding = (cocos2d::CCArray **)EditorSFXManager::findBinding((_QWORD *)a1, a2);
v4 = Binding;
if ( !Binding || !*Binding || !cocos2d::CCArray::count(*Binding) )
return;
if ( !byte_14090C0B8 )
{
QueryPerformanceFrequency(&Frequency);
byte_14090C0B8 = 1;
}
QueryPerformanceCounter(&PerformanceCount);
v5 = (double)(int)PerformanceCount.LowPart / (double)(int)Frequency.LowPart;
v6 = 0x100000001B3LL * ((unsigned __int8)v38 ^ 0xCBF29CE484222325uLL);
v7 = *(_QWORD *)(a1 + 88);
v8 = *(_QWORD *)(v7
+ 16
* (*(_QWORD *)(a1 + 112)
& (0x100000001B3LL
* (HIBYTE(v38) ^ (0x100000001B3LL * (BYTE2(v38) ^ (0x100000001B3LL * (v6 ^ BYTE1(v38))))))))
+ 8);
v9 = *(_QWORD *)(a1 + 72);
if ( v8 != v9 )
{
if ( v38 == *(_DWORD *)(v8 + 16) )
goto LABEL_13;
while ( v8 != *(_QWORD *)(v7
+ 16
* (*(_QWORD *)(a1 + 112)
& (0x100000001B3LL
* (HIBYTE(v38) ^ (0x100000001B3LL * (BYTE2(v38) ^ (0x100000001B3LL * (v6 ^ BYTE1(v38))))))))) )
{
v8 = *(_QWORD *)(v8 + 8);
if ( v38 == *(_DWORD *)(v8 + 16) )
goto LABEL_13;
}
}
v8 = 0;
LABEL_13:
if ( v8 )
v9 = v8;
if ( v9 == *(_QWORD *)(a1 + 72) )
v10 = 0.0;
else
v10 = *(double *)(v9 + 24);
v11 = *(_QWORD *)(a1 + 152);
v12 = *(_QWORD *)(v11
+ 16
* (*(_QWORD *)(a1 + 176)
& (0x100000001B3LL
* (HIBYTE(v38) ^ (0x100000001B3LL * (BYTE2(v38) ^ (0x100000001B3LL * (v6 ^ BYTE1(v38))))))))
+ 8);
v13 = *(_QWORD *)(a1 + 136);
if ( v12 != v13 )
{
if ( v38 == *(_DWORD *)(v12 + 16) )
goto LABEL_24;
while ( v12 != *(_QWORD *)(v11
+ 16
* (*(_QWORD *)(a1 + 176)
& (0x100000001B3LL
* (HIBYTE(v38) ^ (0x100000001B3LL * (BYTE2(v38) ^ (0x100000001B3LL * (v6 ^ BYTE1(v38))))))))) )
{
v12 = *(_QWORD *)(v12 + 8);
if ( v38 == *(_DWORD *)(v12 + 16) )
goto LABEL_24;
}
}
v12 = 0;
LABEL_24:
if ( v12 )
v13 = v12;
if ( v13 == *(_QWORD *)(a1 + 136) )
v14 = 0.050000001;
else
v14 = *(float *)(v13 + 20);
if ( v14 <= v5 - v10 )
{
v15 = (int)cocos2d::CCArray::count(*v4);
if ( *((_DWORD *)v4 + 2) == 1 )
{
v16 = *((_DWORD *)v4 + 3) % (int)v15;
*((_DWORD *)v4 + 3) = (*((_DWORD *)v4 + 3) + 1) % (int)v15;
LABEL_55:
v29 = cocos2d::CCArray::objectAtIndex(*v4, v16);
v30 = v29;
if ( v29 )
{
if ( *((int *)v29 + 472) > 0 )
{
v31 = sub_14018C8D0(a1 + 64, &PerformanceCount, &v38);
v32 = *(_QWORD *)v31;
*(double *)(*(_QWORD *)v31 + 24LL) = v5;
v33 = *(float *)(a1 + 264);
if ( v33 > 0.0 )
{
v34 = *((float *)v30 + 477);
v35 = *((float *)v30 + 504);
v36 = *((_DWORD *)v30 + 494);
v37 = *((_BYTE *)v30 + 1969);
*((float *)v30 + 477) = v33 * v34;
*((float *)v30 + 504) = v35 * *(float *)(a1 + 264);
*((_DWORD *)v30 + 494) = -999999;
*((_BYTE *)v30 + 1969) = 1;
if ( !qword_14090BFD0 )
{
PerformanceCount.QuadPart = (LONGLONG)operator new(0x6E8u);
qword_14090BFD0 = ((__int64 (__fastcall *)(_QWORD))GameManager::GameManager)((LARGE_INTEGER)PerformanceCount.QuadPart);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
}
GameManager::playSFXTrigger(v32, v30);
*((float *)v30 + 477) = v34;
*((float *)v30 + 504) = v35;
*((_DWORD *)v30 + 494) = v36;
*((_BYTE *)v30 + 1969) = v37;
}
}
}
return;
}
v17 = v4[6];
if ( v17 == v4[7] )
{
if ( *((_DWORD *)v4 + 20) == (_DWORD)v15 )
{
LABEL_37:
if ( v17 != v4[7] )
v4[7] = v17;
sub_14018C580(v4 + 6, v15);
v18 = 0;
PerformanceCount.LowPart = 0;
if ( (int)v15 > 0 )
{
v19 = 0;
v20 = 0;
do
{
v21 = v4[7];
if ( v21 == v4[8] )
{
sub_140069B30((const void **)v4 + 6, v21, &PerformanceCount);
v19 = v20;
}
else
{
*(_DWORD *)v21 = v18;
v4[7] = (cocos2d::CCArray *)((char *)v4[7] + 4);
}
v18 = v19 + 1;
PerformanceCount.LowPart = v18;
++v19;
v20 = v18;
}
while ( v18 < (int)v15 );
}
v22 = rand();
v41[1248] = -1;
v41[0] = v22;
for ( i = 1; i < 0x270; ++i )
{
v22 = i + 1812433253 * (v22 ^ (v22 >> 30));
v41[i] = v22;
}
v40 = 624;
sub_14018C300(v4[6], v4[7], &v40);
if ( (int)v15 > 1 )
{
v24 = *((_DWORD *)v4 + 19);
if ( v24 >= 0 )
{
v25 = v4[6];
v26 = *(_DWORD *)v25;
if ( *(_DWORD *)v25 == v24 )
{
*(_DWORD *)v25 = *((_DWORD *)v25 + 1);
*((_DWORD *)v25 + 1) = v26;
}
}
}
*((_DWORD *)v4 + 18) = 0;
*((_DWORD *)v4 + 20) = v15;
goto LABEL_52;
}
}
else if ( *((_DWORD *)v4 + 20) == (_DWORD)v15 )
{
LABEL_52:
v27 = *((int *)v4 + 18);
v28 = v4[6];
v16 = *((_DWORD *)v28 + v27);
LODWORD(v27) = v27 + 1;
*((_DWORD *)v4 + 18) = v27;
if ( (int)v27 >= (int)((v4[7] - v28) >> 2) )
{
*((_DWORD *)v4 + 19) = v16;
if ( v28 != v4[7] )
v4[7] = v28;
}
goto LABEL_55;
}
*((_DWORD *)v4 + 19) = -1;
goto LABEL_37;
}
}