//
// GJBaseGameLayer::activateItemCompareTrigger from 0x10014cc00 to 0x10014d289 (1673 bytes)
//
// 1 xrefs:
// > ItemTriggerGameObject::triggerObject @ 0x1001e5405
//
// 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 __fastcall GJBaseGameLayer::activateItemCompareTrigger(
GJBaseGameLayer *a1,
ItemTriggerGameObject *a2,
std::vector *const a3)
{
double v3; // xmm1_8
int m_itemID2; // esi
int m_item2Mode; // r15d
int m_resultType1; // r12d
int m_resultType2; // r8d
int m_item1Mode; // eax
__m128 v11; // xmm5
__m128 m_mod2_low; // xmm9
bool v13; // dl
__m128 m_mod1_low; // xmm2
__m128 v15; // xmm8
__m128 m_tolerance_low; // xmm7
unsigned int m_resultType3; // r9d
int m_roundType1; // ebx
int m_signType2; // r11d
int m_targetGroupID; // r8d
unsigned int m_centerGroupID; // r10d
__m128d v22; // xmm6
__m128d v23; // xmm0
int m_signType1; // r13d
int m_itemID; // esi
int v26; // eax
int v27; // esi
double v28; // kr10_8
double v29; // kr20_8
__m128 v30; // xmm1
double v31; // xmm2_8
double v32; // xmm1_8
__m128d v33; // xmm0
float v34; // xmm9_4
float v35; // xmm9_4
__m128d v36; // xmm3
__m128d v37; // xmm0
std::vector *v38; // r12
unsigned int v39; // r13d
int v40; // ebx
int v41; // eax
int v42; // eax
__m128d v43; // xmm0
__int64 v44; // kr50_8
float v45; // xmm0_4
std::vector *v46; // r12
unsigned int v47; // r13d
int v48; // ebx
double v49; // kr60_8
int v50; // [rsp+8h] [rbp-B8h]
bool v51; // [rsp+40h] [rbp-80h]
std::vector *v52; // [rsp+58h] [rbp-68h]
std::vector *v53; // [rsp+58h] [rbp-68h]
int v54; // [rsp+78h] [rbp-48h]
int v55; // [rsp+78h] [rbp-48h]
int v56; // [rsp+7Ch] [rbp-44h]
int v57; // [rsp+7Ch] [rbp-44h]
int m_roundType2; // [rsp+88h] [rbp-38h]
int v59; // [rsp+8Ch] [rbp-34h]
int v60; // [rsp+90h] [rbp-30h]
int v61; // [rsp+90h] [rbp-30h]
unsigned int v62; // [rsp+90h] [rbp-30h]
unsigned int v63; // [rsp+90h] [rbp-30h]
int v64; // [rsp+94h] [rbp-2Ch]
int v65; // [rsp+94h] [rbp-2Ch]
int v66; // [rsp+94h] [rbp-2Ch]
int v67; // [rsp+94h] [rbp-2Ch]
m_itemID2 = a2->m_itemID2;
m_item2Mode = a2->m_item2Mode;
m_resultType1 = a2->m_resultType1;
m_resultType2 = a2->m_resultType2;
if ( m_resultType1 <= 0 )
m_resultType1 = 3;
if ( m_resultType2 <= 0 )
m_resultType2 = 3;
v50 = m_resultType2;
m_item1Mode = 1;
if ( a2->m_item1Mode >= 2 )
m_item1Mode = a2->m_item1Mode;
v11 = (__m128)xmmword_1008150B0;
m_mod2_low = (__m128)LODWORD(a2->m_mod2);
m_mod2_low.f32[0] = m_mod2_low.f32[0] * 1000.0;
v59 = m_itemID2;
if ( m_item2Mode )
{
v13 = 1;
if ( m_itemID2 <= 0 )
v13 = (unsigned int)(m_item2Mode - 3) < 2;
}
else
{
v13 = 0;
}
v51 = v13;
m_mod1_low = (__m128)LODWORD(a2->m_mod1);
m_mod1_low.f32[0] = m_mod1_low.f32[0] * 1000.0;
v15 = (__m128)xmmword_1008150C0;
m_tolerance_low = (__m128)LODWORD(a2->m_tolerance);
m_tolerance_low.f32[0] = m_tolerance_low.f32[0] * 1000.0;
m_resultType3 = a2->m_resultType3;
m_roundType1 = a2->m_roundType1;
m_roundType2 = a2->m_roundType2;
m_signType2 = a2->m_signType2;
m_targetGroupID = a2->m_targetGroupID;
m_centerGroupID = a2->m_centerGroupID;
v22 = 0;
v23 = 0;
m_signType1 = a2->m_signType1;
m_itemID = a2->m_itemID;
switch ( m_item1Mode )
{
case 1:
v52 = a3;
v54 = a2->m_centerGroupID;
v56 = a2->m_targetGroupID;
v60 = a2->m_resultType3;
v64 = a2->m_signType2;
v26 = GJEffectManager::countForItem(a1->m_effectManager, m_itemID);
m_signType2 = v64;
v15 = (__m128)xmmword_1008150C0;
m_resultType3 = v60;
v22 = 0;
v11 = (__m128)xmmword_1008150B0;
m_targetGroupID = v56;
m_centerGroupID = v54;
a3 = v52;
v23 = 0;
v23.f64[0] = (double)v26;
goto LABEL_17;
case 2:
v53 = a3;
v55 = a2->m_centerGroupID;
v57 = a2->m_targetGroupID;
v61 = a2->m_resultType3;
v65 = a2->m_signType2;
v23.f64[0] = GJEffectManager::timeForItem(a1->m_effectManager, m_itemID);
m_signType2 = v65;
v15 = (__m128)xmmword_1008150C0;
m_resultType3 = v61;
v22 = 0;
v11 = (__m128)xmmword_1008150B0;
m_targetGroupID = v57;
m_centerGroupID = v55;
a3 = v53;
goto LABEL_17;
case 3:
v23 = 0;
v23.f64[0] = (double)a1->m_gameState.m_points;
goto LABEL_17;
case 4:
v23 = (__m128d)*(unsigned __int64 *)&a1->m_timePlayed;
goto LABEL_17;
case 5:
v23 = 0;
v23.f64[0] = (double)a1->m_attempts;
LABEL_17:
v27 = m_signType1;
break;
default:
v27 = a2->m_signType1;
break;
}
v28 = v3;
v29 = *(double *)m_mod1_low.i64;
v30 = _mm_or_ps(_mm_and_ps(m_mod1_low, v11), v15);
v30.f32[0] = v30.f32[0] + m_mod1_low.f32[0];
*(_QWORD *)&v31 = _mm_round_ss((__m128)0LL, v30, 11).u64[0];
*(float *)&v31 = *(float *)&v31 / 1000.0;
v32 = *(float *)&v31;
switch ( m_resultType1 )
{
case 1:
v23.f64[0] = v23.f64[0] + v32;
goto LABEL_24;
case 2:
v23.f64[0] = v23.f64[0] - v32;
goto LABEL_24;
case 3:
v23.f64[0] = v23.f64[0] * v32;
goto LABEL_24;
case 4:
if ( *(float *)&v31 == 0.0 )
goto LABEL_25;
v23.f64[0] = v23.f64[0] / v32;
LABEL_24:
v22 = v23;
LABEL_25:
m_mod2_low.f32[0] = m_mod2_low.f32[0] + COERCE_FLOAT(m_mod2_low.i32[0] & 0x80000000 | v15.i32[0]);
if ( m_roundType1 == 3 )
{
v22.f64[0] = _mm_round_sd(v22, v22, 10).f64[0];
v34 = _mm_round_ss(m_mod2_low, m_mod2_low, 11).f32[0];
if ( v27 == 2 )
goto LABEL_38;
LABEL_32:
if ( v27 == 1 )
v22.f64[0] = fabs(v22.f64[0]);
v35 = v34 / 1000.0;
if ( !v51 )
goto LABEL_39;
goto LABEL_35;
}
if ( m_roundType1 == 2 )
{
v22.f64[0] = _mm_round_sd(v22, v22, 9).f64[0];
LABEL_31:
v34 = _mm_round_ss(m_mod2_low, m_mod2_low, 11).f32[0];
if ( v27 == 2 )
goto LABEL_38;
goto LABEL_32;
}
if ( m_roundType1 != 1 )
goto LABEL_31;
v33 = _mm_or_pd(_mm_and_pd((__m128d)xmmword_100816590, v22), (__m128d)xmmword_100816960);
v33.f64[0] = v33.f64[0] + v22.f64[0];
v22.f64[0] = _mm_round_sd((__m128d)0LL, v33, 11).f64[0];
v34 = _mm_round_ss(m_mod2_low, m_mod2_low, 11).f32[0];
if ( v27 != 2 )
goto LABEL_32;
LABEL_38:
*(_QWORD *)&v22.f64[0] |= 0x8000000000000000LL;
v35 = v34 / 1000.0;
if ( !v51 )
{
LABEL_39:
v36 = 0;
v36.f64[0] = v35;
LABEL_40:
v42 = m_roundType2;
goto LABEL_41;
}
LABEL_35:
v36 = 0;
v37 = 0;
switch ( m_item2Mode )
{
case 1:
v38 = a3;
v39 = m_centerGroupID;
v40 = m_targetGroupID;
v62 = m_resultType3;
v66 = m_signType2;
v41 = GJEffectManager::countForItem(a1->m_effectManager, v59);
v36 = 0;
m_signType2 = v66;
v15 = (__m128)xmmword_1008150C0;
m_resultType3 = v62;
v11 = (__m128)xmmword_1008150B0;
m_targetGroupID = v40;
m_centerGroupID = v39;
a3 = v38;
v37 = 0;
v37.f64[0] = (double)v41;
break;
case 2:
v46 = a3;
v47 = m_centerGroupID;
v48 = m_targetGroupID;
v63 = m_resultType3;
v67 = m_signType2;
v37.f64[0] = GJEffectManager::timeForItem(a1->m_effectManager, v59);
v36 = 0;
m_signType2 = v67;
v15 = (__m128)xmmword_1008150C0;
m_resultType3 = v63;
v11 = (__m128)xmmword_1008150B0;
m_targetGroupID = v48;
m_centerGroupID = v47;
a3 = v46;
break;
case 3:
v37 = 0;
v37.f64[0] = (double)a1->m_gameState.m_points;
break;
case 4:
v37 = (__m128d)*(unsigned __int64 *)&a1->m_timePlayed;
break;
case 5:
v37 = 0;
v37.f64[0] = (double)a1->m_attempts;
break;
default:
break;
}
v49 = v32;
v32 = v35;
switch ( v50 )
{
case 1:
v37.f64[0] = v37.f64[0] + v32;
v36 = v37;
goto LABEL_40;
case 2:
v37.f64[0] = v37.f64[0] - v32;
v36 = v37;
goto LABEL_40;
case 3:
v37.f64[0] = v37.f64[0] * v32;
v36 = v37;
goto LABEL_40;
case 4:
v31 = 0.0;
v42 = m_roundType2;
if ( v35 != 0.0 )
{
v37.f64[0] = v37.f64[0] / v32;
v36 = v37;
}
break;
default:
v32 = v49;
goto LABEL_40;
}
LABEL_41:
if ( v42 == 3 )
{
v36.f64[0] = _mm_round_sd(v36, v36, 10).f64[0];
if ( m_signType2 != 2 )
goto LABEL_48;
LABEL_53:
*(_QWORD *)&v36.f64[0] |= 0x8000000000000000LL;
LABEL_54:
v44 = v11.i64[0];
v11 = _mm_or_ps(_mm_and_ps(v11, m_tolerance_low), v15);
v11.f32[0] = v11.f32[0] + m_tolerance_low.f32[0];
v45 = _mm_round_ss((__m128)0LL, v11, 11).f32[0] / 1000.0;
switch ( m_resultType3 )
{
case 0u:
v22.f64[0] = fabs(v22.f64[0] - v36.f64[0]);
if ( v45 >= v22.f64[0] )
goto LABEL_58;
break;
case 1u:
v22.f64[0] = v22.f64[0] + v45;
if ( v22.f64[0] > v36.f64[0] )
goto LABEL_58;
break;
case 2u:
v22.f64[0] = v22.f64[0] + v45;
if ( v22.f64[0] >= v36.f64[0] )
goto LABEL_58;
break;
case 3u:
v22.f64[0] = v22.f64[0] - v45;
if ( v36.f64[0] > v22.f64[0] )
goto LABEL_58;
break;
case 4u:
v22.f64[0] = v22.f64[0] - v45;
if ( v36.f64[0] >= v22.f64[0] )
goto LABEL_58;
break;
case 5u:
v22.f64[0] = fabs(v22.f64[0] - v36.f64[0]);
if ( v22.f64[0] > v45 )
LABEL_58:
m_centerGroupID = m_targetGroupID;
break;
default:
v11.i64[0] = v44;
break;
}
goto LABEL_59;
}
if ( v42 == 2 )
{
v36.f64[0] = _mm_round_sd(v36, v36, 9).f64[0];
LABEL_47:
if ( m_signType2 != 2 )
goto LABEL_48;
goto LABEL_53;
}
if ( v42 != 1 )
goto LABEL_47;
v43 = (__m128d)_mm_or_ps(_mm_and_ps((__m128)xmmword_100816590, (__m128)v36), (__m128)xmmword_100816960);
v43.f64[0] = v43.f64[0] + v36.f64[0];
v36.f64[0] = _mm_round_sd((__m128d)0LL, v43, 11).f64[0];
if ( m_signType2 == 2 )
goto LABEL_53;
LABEL_48:
if ( m_signType2 == 1 )
v36.f64[0] = fabs(v36.f64[0]);
if ( m_resultType3 <= 5 )
goto LABEL_54;
LABEL_59:
((void (__fastcall *)(GJBaseGameLayer *, _QWORD, _QWORD, std::vector *const, _QWORD, _QWORD, double, double, double, double, double, double, double, double))a1->spawnGroup)(
a1,
m_centerGroupID,
0,
a3,
(unsigned int)a2->m_uniqueID,
(unsigned int)a2->m_controlID,
0.0,
v32,
v31,
v36.f64[0],
COERCE_DOUBLE(1148846080),
*(double *)v11.i64,
v22.f64[0],
*(double *)m_tolerance_low.i64);
return;
default:
v31 = v29;
v32 = v28;
goto LABEL_25;
}
}