//
// GJBaseGameLayer::activateItemEditTrigger from 0x48e66c to 0x48e87c (528 bytes)
//
// 1 xrefs:
// > ItemTriggerGameObject::triggerObject @ 0x3eea76
//
// 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::activateItemEditTrigger(GJBaseGameLayer *a1, ItemTriggerGameObject *a2)
{
int m_targetItemMode; // r10
int m_itemID; // r8
int m_itemID2; // r6
int m_item1Mode; // r9
int m_resultType2; // r3
int m_item2Mode; // r7
int m_targetGroupID; // r11
float *p_m_mod1; // r1
int v11; // r3
float v12; // s16
_BOOL4 v13; // r5
int v14; // r3
double ItemValue; // r8
double v16; // r6
double v17; // d7
int v18; // [sp+10h] [bp-2Ch]
int v19; // [sp+14h] [bp-28h]
int m_resultType1; // [sp+18h] [bp-24h]
int v21; // [sp+1Ch] [bp-20h]
int v22; // [sp+20h] [bp-1Ch]
int v23; // [sp+24h] [bp-18h]
double v24; // [sp+28h] [bp-14h]
int v25; // [sp+30h] [bp-Ch]
int v26; // [sp+34h] [bp-8h]
m_targetItemMode = a2->m_targetItemMode;
m_itemID = a2->m_itemID;
m_itemID2 = a2->m_itemID2;
m_item1Mode = a2->m_item1Mode;
m_resultType1 = a2->m_resultType1;
m_resultType2 = a2->m_resultType2;
m_item2Mode = a2->m_item2Mode;
m_targetGroupID = a2->m_targetGroupID;
p_m_mod1 = &a2->m_mod1;
if ( m_resultType2 < 1 )
m_resultType2 = 1;
v18 = m_resultType2;
v11 = *((_DWORD *)p_m_mod1 + 4);
if ( v11 < 3 )
v11 = 3;
v19 = v11;
v21 = *((_DWORD *)p_m_mod1 + 6);
v22 = *((_DWORD *)p_m_mod1 + 7);
v23 = *((_DWORD *)p_m_mod1 + 8);
v25 = *((_DWORD *)p_m_mod1 + 9);
v12 = COERCE_FLOAT(roundf()) / 1000.0;
if ( m_targetItemMode <= 0 )
{
if ( m_targetGroupID <= 0 )
return;
m_targetItemMode = 1;
}
else if ( m_targetGroupID <= 0 && m_targetItemMode != 3 )
{
return;
}
if ( m_item1Mode )
v13 = m_itemID > 0 || (unsigned int)(m_item1Mode - 3) <= 1;
else
v13 = 0;
if ( m_item2Mode && (m_itemID2 > 0 || (unsigned int)(m_item2Mode - 3) <= 1) )
{
if ( v13 )
{
v14 = 1;
}
else
{
v14 = 0;
m_item1Mode = m_item2Mode;
m_itemID = m_itemID2;
v13 = 1;
}
}
else
{
v14 = 0;
}
v26 = v14;
ItemValue = GJBaseGameLayer::getItemValue(a1, m_item1Mode, m_itemID);
v24 = GJBaseGameLayer::getItemValue(a1, m_item2Mode, m_itemID2);
v16 = GJBaseGameLayer::getItemValue(a1, m_targetItemMode, m_targetGroupID);
if ( v26 )
ItemValue = GJBaseGameLayer::performMathOperation(a1, ItemValue, v24, v18);
v17 = v12;
if ( v13 )
v17 = GJBaseGameLayer::performMathOperation(a1, ItemValue, v12, v19);
if ( v21 )
v17 = GJBaseGameLayer::performMathRounding(a1, v17, v21);
if ( v23 )
v17 = COERCE_DOUBLE(performMathSign(v17, v23));
if ( m_resultType1 )
v17 = GJBaseGameLayer::performMathOperation(a1, v16, v17, m_resultType1);
if ( v22 )
v17 = GJBaseGameLayer::performMathRounding(a1, v17, v22);
if ( v25 )
v17 = COERCE_DOUBLE(performMathSign(v17, v25));
switch ( m_targetItemMode )
{
case 2:
GJEffectManager::updateTimer(a1->m_effectManager, m_targetGroupID, v17);
break;
case 3:
a1->m_gameState.m_unkBool32 = 1;
a1->m_gameState.m_points = (int)v17;
break;
case 1:
GJEffectManager::updateCountForItem(a1->m_effectManager, m_targetGroupID, (int)v17);
GJBaseGameLayer::updateCounters(a1, m_targetGroupID, (int)v17);
break;
}
}