//
// GJBaseGameLayer::activateItemCompareTrigger from 0x1001fbe10 to 0x1001fc178 (872 bytes)
//
// 1 xrefs:
// > ItemTriggerGameObject::triggerObject @ 0x100394cf4
//
// 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)
{
int m_itemID; // w2
int m_itemID2; // w13
int m_item2Mode; // w24
int m_resultType1; // w25
int m_resultType2; // w9
int m_item1Mode; // w1
float v12; // s12
_BOOL4 v13; // w19
float m_mod2; // s11
float m_tolerance; // s10
int m_resultType3; // w26
int m_roundType1; // w23
int m_roundType2; // w28
int m_signType1; // w22
int m_signType2; // w27
double ItemValue; // d0
double v22; // d1
double v23; // d8
float v24; // s0
float v25; // s10
float v26; // s11
double v27; // d0
double v28; // d2
double v29; // d1
float v30; // s0
double v31; // d2
double v32; // d3
double v33; // d4
double v34; // d2
std::vector *v35; // x3
__int64 v36; // x1
bool v37; // cc
bool v38; // cc
unsigned int m_targetGroupID; // [xsp+8h] [xbp-98h]
int v40; // [xsp+Ch] [xbp-94h]
int v41; // [xsp+10h] [xbp-90h]
unsigned int m_centerGroupID; // [xsp+14h] [xbp-8Ch]
std::vector *v43; // [xsp+18h] [xbp-88h]
m_itemID = a2->m_itemID;
m_itemID2 = a2->m_itemID2;
m_item2Mode = a2->m_item2Mode;
if ( a2->m_resultType1 >= 1 )
m_resultType1 = a2->m_resultType1;
else
m_resultType1 = 3;
if ( a2->m_resultType2 >= 1 )
m_resultType2 = a2->m_resultType2;
else
m_resultType2 = 3;
v40 = a2->m_itemID2;
v41 = m_resultType2;
if ( a2->m_item1Mode <= 1 )
m_item1Mode = 1;
else
m_item1Mode = a2->m_item1Mode;
v12 = roundf(a2->m_mod1 * 1000.0) / 1000.0;
v43 = a3;
if ( m_item2Mode )
v13 = m_itemID2 > 0 || (unsigned int)(m_item2Mode - 3) < 2;
else
v13 = 0;
m_mod2 = a2->m_mod2;
m_tolerance = a2->m_tolerance;
m_resultType3 = a2->m_resultType3;
m_targetGroupID = a2->m_targetGroupID;
m_centerGroupID = a2->m_centerGroupID;
m_roundType1 = a2->m_roundType1;
m_roundType2 = a2->m_roundType2;
m_signType1 = a2->m_signType1;
m_signType2 = a2->m_signType2;
ItemValue = GJBaseGameLayer::getItemValue(a1, m_item1Mode, m_itemID);
v22 = v12;
v23 = 0.0;
if ( m_resultType1 > 2 )
{
if ( m_resultType1 == 3 )
{
v23 = ItemValue * v22;
}
else if ( m_resultType1 == 4 && v12 != 0.0 )
{
v23 = ItemValue / v22;
}
}
else if ( m_resultType1 == 1 )
{
v23 = ItemValue + v22;
}
else
{
v23 = ItemValue - v22;
}
switch ( m_roundType1 )
{
case 3:
v23 = ceil(v23);
break;
case 2:
v23 = floor(v23);
break;
case 1:
v23 = round(v23);
break;
}
v24 = roundf(m_mod2 * 1000.0);
if ( m_signType1 == 2 )
{
v23 = -fabs(v23);
}
else if ( m_signType1 == 1 )
{
v23 = fabs(v23);
}
v25 = roundf(m_tolerance * 1000.0);
v26 = v24 / 1000.0;
if ( v13 )
{
v27 = GJBaseGameLayer::getItemValue(a1, m_item2Mode, v40);
v28 = v26;
v29 = 0.0;
if ( v41 > 2 )
{
if ( v41 == 3 )
{
v29 = v27 * v28;
}
else if ( v41 == 4 && v26 != 0.0 )
{
v29 = v27 / v28;
}
}
else if ( v41 == 1 )
{
v29 = v27 + v28;
}
else if ( v41 == 2 )
{
v29 = v27 - v28;
}
}
else
{
v29 = v26;
}
v30 = v25 / 1000.0;
v31 = ceil(v29);
v32 = floor(v29);
v33 = round(v29);
if ( m_roundType2 == 1 )
v29 = v33;
if ( m_roundType2 == 2 )
v29 = v32;
if ( m_roundType2 == 3 )
v29 = v31;
v34 = fabs(v29);
if ( m_signType2 == 1 )
v29 = v34;
if ( m_signType2 == 2 )
v29 = -v34;
if ( m_resultType3 <= 2 )
{
if ( m_resultType3 )
{
if ( m_resultType3 != 1 )
{
if ( m_resultType3 == 2 )
{
v35 = v43;
v36 = m_centerGroupID;
if ( v23 + v30 < v29 )
goto LABEL_75;
goto LABEL_74;
}
goto LABEL_67;
}
v37 = v23 + v30 <= v29;
goto LABEL_69;
}
v38 = vabdd_f64(v23, v29) > v30;
LABEL_73:
v35 = v43;
v36 = m_centerGroupID;
if ( v38 )
goto LABEL_75;
LABEL_74:
v36 = m_targetGroupID;
goto LABEL_75;
}
switch ( m_resultType3 )
{
case 3:
v35 = v43;
v36 = m_centerGroupID;
if ( v23 - v30 >= v29 )
goto LABEL_75;
goto LABEL_74;
case 4:
v38 = v23 - v30 > v29;
goto LABEL_73;
case 5:
v37 = vabdd_f64(v23, v29) <= v30;
LABEL_69:
v35 = v43;
v36 = m_centerGroupID;
if ( v37 )
goto LABEL_75;
goto LABEL_74;
}
LABEL_67:
v35 = v43;
v36 = m_centerGroupID;
LABEL_75:
((void (__fastcall *)(GJBaseGameLayer *, __int64, _QWORD, std::vector *, _QWORD, _QWORD, double))a1->spawnGroup)(
a1,
v36,
0,
v35,
(unsigned int)a2->m_uniqueID,
(unsigned int)a2->m_controlID,
0.0);
}