//
// LevelEditorLayer::activateTriggerEffect from 0x66d254 to 0x66d7e0 (1420 bytes)
//
// 5 xrefs:
// > LevelEditorLayer::spawnGroupPreview @ 0x66d968
// > LevelEditorLayer::spawnGroupPreview @ 0x66da24
// > LevelEditorLayer::updateGameObjects @ 0x67b8a0
// > LevelEditorLayer::updateGameObjects @ 0x67ba78
// > ??> @ 0x90288
//
// 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 LevelEditorLayer::activateTriggerEffect(
LevelEditorLayer *a1,
EffectGameObject *a2,
float a3,
float a4,
float a5,
bool a6)
{
_BOOL4 v8; // w23
float m_spawnTriggerDelay; // s9
float v13; // s12
int m_objectID; // w0
float m_fScaleX; // s0
float v16; // s0
char m_previewMode; // w21
bool v18; // w3
float m_fadeInDuration; // s0
float m_holdDuration; // s1
float m_fadeOutDuration; // s2
PulseEffectType v23; // w3
bool v24; // zf
unsigned __int64 v25; // x6
GLubyte g; // w2
GLubyte b; // w0
int m_uniqueID; // w9
int m_controlID; // w8
bool m_pulseExclusive; // w11
bool m_legacyHSV; // w10
bool absoluteBrightness; // w4
int m_targetGroupID; // w1
int m_copyColorID; // w7
bool v36; // w2
ShaderLayer *m_shaderLayer; // x0
OpacityEffectAction *OpacityActionForGroup; // x0
float m_durationRelated; // s0
float v40; // s0
OpacityEffectAction *v41; // x0
float v42; // s0
OpacityEffectAction *v43; // [xsp+98h] [xbp+68h]
int v44; // [xsp+98h] [xbp+68h]
cocos2d::CCPoint v45; // [xsp+A0h] [xbp+70h] BYREF
cocos2d::ccHSVValue v46; // 0:x5.16
v8 = a6;
if ( a2->m_isGroupDisabled || a2->m_isTouchTriggered && !a2->hasBeenActivated(a2) )
return 1;
m_spawnTriggerDelay = a2->m_spawnTriggerDelay;
v13 = (float)(a3 - m_spawnTriggerDelay) - a5;
if ( a2->m_isColorTrigger )
{
m_previewMode = a1->m_previewMode;
if ( m_previewMode )
{
v18 = 0;
if ( (float)(a4 - (float)(m_spawnTriggerDelay + a2->m_duration)) <= 5.0 )
v18 = (float)(a5 - (float)(a3 - m_spawnTriggerDelay)) > 0.2;
if ( !LevelEditorLayer::runColorEffect(a1, a2, a2->m_targetColor, a2->m_spawnTriggerDelay, v13, v18) )
return 0;
if ( a2->m_objectID == 29 && a2->m_tintGround )
{
LevelEditorLayer::runColorEffect(a1, a2, 1001, m_spawnTriggerDelay, v13, 0);
return m_previewMode;
}
}
return 1;
}
m_objectID = a2->m_objectID;
if ( m_objectID == 2907 )
goto LABEL_66;
if ( m_objectID > 2907 )
{
if ( m_objectID == 2999 )
{
m_previewMode = 1;
cocos2d::CCPoint::CCPoint(&v45, &a2->m_moveOffset);
GJBaseGameLayer::updateMGOffsetY(a1, v45.y, 0.0, 0, 0.0, -1, -1);
return m_previewMode;
}
if ( m_objectID > 2999 )
{
if ( m_objectID == 3605 )
{
if ( v8 )
{
m_previewMode = 1;
GJBaseGameLayer::activateSongEditTrigger(a1, (SongTriggerGameObject *)a2);
return m_previewMode;
}
}
else
{
if ( m_objectID > 3605 )
{
if ( m_objectID == 3606 )
{
m_previewMode = 1;
GJBaseGameLayer::updateBGArtSpeed(a1, a2->m_moveModX, a2->m_moveModY);
return m_previewMode;
}
if ( m_objectID == 3612 )
{
m_previewMode = 1;
GJBaseGameLayer::updateMGArtSpeed(a1, a2->m_moveModX, a2->m_moveModY);
return m_previewMode;
}
return 1;
}
if ( m_objectID == 3602 )
{
if ( v8 )
{
m_previewMode = 1;
GJBaseGameLayer::activateSFXTrigger(a1, (SFXTriggerGameObject *)a2);
return m_previewMode;
}
}
else
{
if ( m_objectID != 3603 )
return 1;
if ( v8 )
{
m_previewMode = 1;
GJBaseGameLayer::activateSFXEditTrigger(a1, (SFXTriggerGameObject *)a2);
return m_previewMode;
}
}
}
LABEL_32:
if ( a1->m_playbackActive )
{
m_previewMode = a1->m_activateAudioTriggers;
if ( m_previewMode )
{
a1->activatedAudioTrigger(a1, (SFXTriggerGameObject *)a2);
return m_previewMode;
}
}
return 1;
}
if ( m_objectID < 2909 || m_objectID > 2917 && (unsigned int)(m_objectID - 2919) > 5 )
return 1;
LABEL_66:
m_previewMode = a1->m_previewShaders;
if ( m_previewMode && !BYTE2(a2[1].m_fScaleY) )
{
m_shaderLayer = a1->m_shaderLayer;
if ( m_shaderLayer && m_shaderLayer->m_timesyncShaderActions )
m_shaderLayer->m_state.m_time = m_shaderLayer->m_state.m_startTime + m_spawnTriggerDelay;
GJBaseGameLayer::triggerShaderCommand(a1, (ShaderGameObject *)a2);
return m_previewMode;
}
return 1;
}
if ( m_objectID == 1616 )
{
if ( !a2[1].m_uID )
{
m_previewMode = 1;
LevelEditorLayer::stopTriggersInGroup(a1, a2->m_targetGroupID, a2->m_spawnTriggerDelay);
return m_previewMode;
}
return 1;
}
if ( m_objectID > 1616 )
{
if ( m_objectID == 2903 )
{
m_previewMode = 1;
GJBaseGameLayer::triggerGradientCommand(a1, (GradientTriggerObject *)a2);
return m_previewMode;
}
if ( m_objectID <= 2903 )
{
if ( m_objectID != 1934 )
{
if ( m_objectID == 2900 && LOBYTE(a2[1].m_nTag) )
{
m_previewMode = 1;
a1->m_gameState.m_currentChannel = a2[1].m_uReference;
return m_previewMode;
}
return 1;
}
if ( v8 )
{
m_previewMode = 1;
GJBaseGameLayer::activateSongTrigger(a1, (SongTriggerGameObject *)a2);
return m_previewMode;
}
goto LABEL_32;
}
if ( m_objectID > 2905 )
return 1;
goto LABEL_66;
}
if ( m_objectID == 1007 )
{
m_previewMode = a1->m_previewMode;
if ( m_previewMode )
{
OpacityActionForGroup = GJEffectManager::getOpacityActionForGroup(a1->m_effectManager, a2->m_targetGroupID);
if ( OpacityActionForGroup )
{
m_durationRelated = OpacityActionForGroup->m_durationRelated;
if ( m_durationRelated != 0.0 )
{
v40 = m_spawnTriggerDelay - m_durationRelated;
if ( v40 != 0.0 )
{
v43 = OpacityActionForGroup;
OpacityActionForGroup->m_deltaTimeRelated = 0.0;
OpacityActionForGroup->m_deltaTime = 0.0;
OpacityEffectAction::step(OpacityActionForGroup, v40);
GJEffectManager::updateOpacityAction(a1->m_effectManager, v43);
}
}
}
v41 = GJEffectManager::runOpacityActionOnGroup(
a1->m_effectManager,
a2->m_targetGroupID,
a2->m_duration,
a2->m_opacity,
a2->m_uniqueID,
a2->m_controlID);
v41->m_durationRelated = m_spawnTriggerDelay;
v41->m_deltaTimeRelated = v13;
return m_previewMode;
}
return 1;
}
if ( m_objectID <= 1007 )
{
if ( m_objectID == 1006 )
{
m_previewMode = a1->m_previewMode;
if ( m_previewMode )
{
m_fadeInDuration = a2->m_fadeInDuration;
m_holdDuration = a2->m_holdDuration;
m_fadeOutDuration = a2->m_fadeOutDuration;
if ( a4 <= (float)((float)((float)(m_spawnTriggerDelay + m_fadeInDuration) + m_holdDuration) + m_fadeOutDuration) )
{
if ( a2->m_pulseMode )
v23 = Hsv;
else
v23 = 2;
v24 = a2->m_pulseTargetType == 1;
v25 = LODWORD(a2->m_hsvValue.v) | ((unsigned __int64)a2->m_hsvValue.absoluteSaturation << 32);
g = a2->m_triggerTargetColor.g;
b = a2->m_triggerTargetColor.b;
*(_QWORD *)&v46.h = *(_QWORD *)&a2->m_hsvValue.h;
m_uniqueID = a2->m_uniqueID;
m_controlID = a2->m_controlID;
m_pulseExclusive = a2->m_pulseExclusive;
m_legacyHSV = a2->m_legacyHSV;
absoluteBrightness = a2->m_hsvValue.absoluteBrightness;
m_targetGroupID = a2->m_targetGroupID;
LOBYTE(v45.x) = a2->m_triggerTargetColor.r;
*(_QWORD *)&v46.v = v25 & 0xFFFF00FFFFFFFFFFLL | ((unsigned __int64)absoluteBrightness << 40);
m_copyColorID = a2->m_copyColorID;
BYTE1(v45.x) = g;
v36 = v24;
BYTE2(v45.x) = b;
GJEffectManager::runPulseEffect(
a1->m_effectManager,
m_targetGroupID,
v36,
m_fadeInDuration,
m_holdDuration,
m_fadeOutDuration,
v23,
*(cocos2d::ccColor3B *)&v45.x,
v46,
m_copyColorID,
a2->m_pulseMainOnly,
a2->m_pulseDetailOnly,
m_pulseExclusive,
m_legacyHSV,
m_uniqueID,
m_controlID)->m_startTime = v13;
return m_previewMode;
}
}
}
return 1;
}
if ( m_objectID == 1049 )
{
m_previewMode = 1;
LevelEditorLayer::toggleGroupPreview(a1, a2->m_targetGroupID, a2->m_activateGroup);
return m_previewMode;
}
if ( m_objectID != 1268 || a2->m_previewDisable )
return 1;
m_fScaleX = a2[1].m_fScaleX;
if ( m_fScaleX <= 0.0 )
{
m_previewMode = 1;
v44 = a2->m_targetGroupID;
v42 = a2->spawnXPosition(a2);
LevelEditorLayer::spawnGroupPreview(a1, v44, v42, a2->m_spawnTriggerDelay, a3, a4, a5, a2->m_spawnOrdered, v8);
return m_previewMode;
}
v16 = m_spawnTriggerDelay + m_fScaleX;
if ( a4 < v16 )
return 1;
m_previewMode = 1;
LevelEditorLayer::addDelayedSpawn(a1, a2, v16);
return m_previewMode;
}