//
// GJBaseGameLayer::activateItemCompareTrigger from 0x4761d0 to 0x476412 (578 bytes)
//
// 1 xrefs:
// > ItemTriggerGameObject::triggerObject @ 0x3eea96
//
// 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; // r11
int m_resultType2; // r6
int m_itemID2; // r10
int m_itemID; // r2
int m_roundType2; // r3
int m_item1Mode; // r1
int m_item2Mode; // r7
int m_centerGroupID; // r8
float v13; // s18
float v14; // s16
float v15; // s20
_BOOL4 v16; // r5
double ItemValue; // r0
double v18; // r0
double v19; // d9
double v20; // d8
double v21; // r0
double v22; // d7
double v23; // d10
double v24; // d7
bool v25; // fcf
bool v26; // fzf
double v27; // d9
bool v28; // fzf
bool v29; // fnf
_BOOL4 v30; // r3
double v31; // d6
double v32; // d7
int m_roundType1; // [sp+18h] [bp-2Ch]
int v34; // [sp+1Ch] [bp-28h]
int m_signType1; // [sp+20h] [bp-24h]
int m_signType2; // [sp+24h] [bp-20h]
int m_resultType3; // [sp+28h] [bp-1Ch]
int m_targetGroupID; // [sp+2Ch] [bp-18h]
int v40; // [sp+34h] [bp-10h]
int v41; // [sp+38h] [bp-Ch]
m_resultType1 = a2->m_resultType1;
m_resultType2 = a2->m_resultType2;
m_itemID2 = a2->m_itemID2;
m_resultType3 = a2->m_resultType3;
if ( m_resultType1 <= 0 )
m_resultType1 = 3;
m_itemID = a2->m_itemID;
m_roundType1 = a2->m_roundType1;
if ( m_resultType2 <= 0 )
m_resultType2 = 3;
m_roundType2 = a2->m_roundType2;
m_item1Mode = a2->m_item1Mode;
v41 = m_itemID;
v34 = m_roundType2;
if ( m_item1Mode < 1 )
m_item1Mode = 1;
v40 = m_item1Mode;
m_signType1 = a2->m_signType1;
m_item2Mode = a2->m_item2Mode;
m_signType2 = a2->m_signType2;
m_centerGroupID = a2->m_centerGroupID;
m_targetGroupID = a2->m_targetGroupID;
v13 = COERCE_FLOAT(roundf()) / 1000.0;
v14 = COERCE_FLOAT(roundf()) / 1000.0;
v15 = COERCE_FLOAT(roundf()) / 1000.0;
if ( m_item2Mode )
v16 = m_itemID2 > 0 || (unsigned int)(m_item2Mode - 3) <= 1;
else
v16 = 0;
ItemValue = GJBaseGameLayer::getItemValue(a1, v40, v41);
v18 = GJBaseGameLayer::performMathOperation(a1, ItemValue, v13, m_resultType1);
v19 = v18;
if ( m_roundType1 )
v19 = GJBaseGameLayer::performMathRounding(a1, v18, m_roundType1);
if ( m_signType1 )
v19 = COERCE_DOUBLE(performMathSign(v19, m_signType1));
v20 = v14;
if ( v16 )
{
v21 = GJBaseGameLayer::getItemValue(a1, m_item2Mode, m_itemID2);
v22 = GJBaseGameLayer::performMathOperation(a1, v21, v20, m_resultType2);
}
else
{
v22 = v20;
}
if ( v34 )
v22 = GJBaseGameLayer::performMathRounding(a1, v22, v34);
if ( m_signType2 )
v22 = COERCE_DOUBLE(performMathSign(v22, m_signType2));
switch ( m_resultType3 )
{
case 0:
v23 = v15;
v24 = fabs(v19 - v22);
v26 = v24 == v23;
v25 = v24 >= v23;
goto LABEL_29;
case 1:
v27 = v19 + v15;
v28 = v27 == v22;
v29 = v27 < v22;
goto LABEL_33;
case 2:
v30 = v19 + v15 >= v22;
goto LABEL_36;
case 3:
v30 = v19 - v15 < v22;
goto LABEL_36;
case 4:
v31 = v19 - v15;
v26 = v31 == v22;
v25 = v31 >= v22;
LABEL_29:
v30 = v26 || !v25;
goto LABEL_36;
case 5:
v32 = fabs(v19 - v22);
v28 = v32 == v15;
v29 = v32 < v15;
LABEL_33:
v30 = !v29 && !v28;
LABEL_36:
if ( v30 )
m_centerGroupID = m_targetGroupID;
break;
default:
break;
}
((void (__fastcall *)(GJBaseGameLayer *, int, _DWORD, void (__fastcall *)(GJBaseGameLayer *__hidden, int, bool, double, const std::vector *, int, int), _DWORD, _DWORD, std::vector *const, int, int))a1->spawnGroup)(
a1,
m_centerGroupID,
0,
a1->spawnGroup,
0,
0,
a3,
a2->m_uniqueID,
a2->m_controlID);
}