//
// GJBaseGameLayer::activateItemCompareTrigger from 0x865588 to 0x86580c (644 bytes)
//
// 2 xrefs:
// > ItemTriggerGameObject::triggerObject @ 0x770c08
// > ??> @ 0x55ce0
//
// 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 GJBaseGameLayer::activateItemCompareTrigger(
GJBaseGameLayer *a1,
ItemTriggerGameObject *a2,
std::vector *const a3)
{
int m_resultType1; // w4
int m_resultType2; // w27
float m_tolerance; // s8
float m_mod1; // s1
float m_mod2; // s0
int m_itemID2; // w0
int m_item1Mode; // w1
float v12; // s0
float v13; // s2
float v14; // s10
int m_item2Mode; // w23
float v16; // s0
int m_resultType3; // w22
_BOOL4 v18; // w21
int m_roundType2; // w25
int m_signType1; // w26
int m_signType2; // w24
float v22; // s10
unsigned int m_centerGroupID; // w20
float v24; // s8
float v25; // s9
double ItemValue; // d0
double v27; // d0
double v28; // d10
double v29; // d0
_BOOL4 v30; // w0
double v31; // d0
int m_roundType1; // [xsp+80h] [xbp+80h]
int v33; // [xsp+88h] [xbp+88h]
int v35; // [xsp+98h] [xbp+98h]
int m_targetGroupID; // [xsp+9Ch] [xbp+9Ch]
m_resultType1 = a2->m_resultType1;
m_resultType2 = a2->m_resultType2;
m_tolerance = a2->m_tolerance;
m_mod1 = a2->m_mod1;
if ( m_resultType1 <= 0 )
m_resultType1 = 3;
m_mod2 = a2->m_mod2;
m_itemID2 = a2->m_itemID2;
m_item1Mode = a2->m_item1Mode;
v12 = m_mod2 * 1000.0;
v13 = roundf(m_tolerance * 1000.0);
v14 = roundf(m_mod1 * 1000.0);
if ( m_resultType2 <= 0 )
m_resultType2 = 3;
m_item2Mode = a2->m_item2Mode;
v35 = m_itemID2;
v16 = roundf(v12);
m_resultType3 = a2->m_resultType3;
if ( m_item1Mode <= 0 )
m_item1Mode = 1;
v18 = 0;
m_roundType2 = a2->m_roundType2;
m_signType1 = a2->m_signType1;
m_signType2 = a2->m_signType2;
m_targetGroupID = a2->m_targetGroupID;
v22 = v14 / 1000.0;
m_centerGroupID = a2->m_centerGroupID;
v24 = v16 / 1000.0;
v25 = v13 / 1000.0;
if ( m_item2Mode )
{
v18 = 1;
if ( m_itemID2 <= 0 )
v18 = (unsigned int)(m_item2Mode - 3) <= 1;
}
m_roundType1 = a2->m_roundType1;
v33 = m_resultType1;
ItemValue = GJBaseGameLayer::getItemValue(a1, m_item1Mode, a2->m_itemID);
v27 = GJBaseGameLayer::performMathOperation(a1, ItemValue, v22, v33);
v28 = v27;
if ( m_roundType1 )
{
v28 = GJBaseGameLayer::performMathRounding(a1, v27, m_roundType1);
if ( !m_signType1 )
{
LABEL_12:
if ( !v18 )
goto LABEL_13;
goto LABEL_23;
}
}
else if ( !m_signType1 )
{
goto LABEL_12;
}
v28 = performMathSign(v28, m_signType1);
if ( !v18 )
{
LABEL_13:
v29 = v24;
if ( !m_roundType2 )
goto LABEL_14;
LABEL_20:
v29 = GJBaseGameLayer::performMathRounding(a1, v29, m_roundType2);
if ( !m_signType2 )
goto LABEL_15;
goto LABEL_21;
}
LABEL_23:
v31 = GJBaseGameLayer::getItemValue(a1, m_item2Mode, v35);
v29 = GJBaseGameLayer::performMathOperation(a1, v31, v24, m_resultType2);
if ( m_roundType2 )
goto LABEL_20;
LABEL_14:
if ( !m_signType2 )
goto LABEL_15;
LABEL_21:
v29 = performMathSign(v29, m_signType2);
LABEL_15:
switch ( m_resultType3 )
{
case 0:
v30 = vabdd_f64(v28, v29) <= v25;
goto LABEL_17;
case 1:
v30 = v25 + v28 > v29;
goto LABEL_17;
case 2:
v30 = v25 + v28 >= v29;
goto LABEL_17;
case 3:
v30 = v28 - v25 < v29;
goto LABEL_17;
case 4:
v30 = v28 - v25 <= v29;
goto LABEL_17;
case 5:
v30 = vabdd_f64(v28, v29) > v25;
LABEL_17:
if ( v30 )
m_centerGroupID = m_targetGroupID;
break;
default:
break;
}
((void (__fastcall *)(GJBaseGameLayer *, _QWORD, _QWORD, std::vector *const, _QWORD, _QWORD, double))a1->spawnGroup)(
a1,
m_centerGroupID,
0,
a3,
(unsigned int)a2->m_uniqueID,
(unsigned int)a2->m_controlID,
0.0);
}