//
// SequenceTriggerGameObject::triggerObject from 0x10038a284 to 0x10038a518 (660 bytes)
//
// 1 xrefs:
// > ??> @ 0x100800790
//
// 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 SequenceTriggerGameObject::triggerObject(
SequenceTriggerGameObject *a1,
GJBaseGameLayer *a2,
int a3,
std::vector *const a4)
{
int *end; // x8
float v8; // s8
int v9; // w22
double m_unkDouble3; // d0
float v11; // s1
float m_minInt; // s2
bool v13; // cc
float m_reset; // s2
float v15; // s8
int m_sequenceTotalCount; // w8
std::__vector_base::pointer begin; // x9
std::__vector_base::pointer v18; // x10
int v19; // w23
int m_sequenceMode; // w9
std::__vector_base::pointer v21; // x8
std::__vector_base::pointer v22; // x9
int v23; // w10
int m_groupID; // w22
std::vector __p; // [xsp+0h] [xbp-60h] BYREF
int v26; // [xsp+18h] [xbp-48h] BYREF
v26 = 0;
if ( a4 )
{
if ( a1->m_uniqueRemap )
{
end = a4->__end_;
if ( a4->__begin_ != end )
v26 = -*(end - 1);
}
}
if ( sub_100018814(&a1->m_sequenceState.m_sequenceTimes.__table_.__bucket_list_.__ptr_.__value_, &v26) )
{
__p.__begin_ = &v26;
v8 = *((float *)sub_10001D150((unsigned __int64)&a1->m_sequenceState, &v26, (__int64)&unk_100645D0A, &__p.__begin_)
+ 5);
}
else
{
v8 = -1.0;
}
__p.__begin_ = &v26;
v9 = *((_DWORD *)sub_10001D150(
(unsigned __int64)&a1->m_sequenceState.m_sequenceIndices,
&v26,
(__int64)&unk_100645D0A,
&__p.__begin_)
+ 5);
m_unkDouble3 = a2->m_gameState.m_unkDouble3;
v11 = m_unkDouble3 - v8;
m_minInt = a1->m_minInt;
if ( m_minInt <= 0.0 || (v8 >= 0.0 ? (v13 = m_minInt <= v11) : (v13 = 1), v13) )
{
if ( v9 >= 1 )
{
m_reset = a1->m_reset;
if ( m_reset > 0.0 && v8 >= 0.0 && m_reset < v11 )
{
if ( a1->m_resetMode )
v9 = (int)fmaxf((float)(unsigned int)v9 - floorf(v11 / m_reset), 0.0);
else
v9 = 0;
}
}
v15 = m_unkDouble3;
__p.__begin_ = &v26;
*((float *)sub_10001D150((unsigned __int64)&a1->m_sequenceState, &v26, (__int64)&unk_100645D0A, &__p.__begin_) + 5) = v15;
m_sequenceTotalCount = a1->m_sequenceTotalCount;
if ( m_sequenceTotalCount == -1 )
{
a1->m_sequenceTotalCount = 0;
begin = a1->m_chanceObjects.__begin_;
v18 = a1->m_chanceObjects.__end_;
if ( begin == v18 )
{
m_sequenceTotalCount = 0;
}
else
{
m_sequenceTotalCount = 0;
do
{
m_sequenceTotalCount += begin->m_chance;
++begin;
}
while ( begin != v18 );
a1->m_sequenceTotalCount = m_sequenceTotalCount;
}
}
if ( v9 >= m_sequenceTotalCount )
{
m_sequenceMode = a1->m_sequenceMode;
if ( !m_sequenceMode )
return;
if ( m_sequenceMode != 2 )
m_sequenceTotalCount = v9 + 1;
if ( m_sequenceMode == 1 )
v19 = 1;
else
v19 = m_sequenceTotalCount;
}
else
{
v19 = v9 + 1;
}
v21 = a1->m_chanceObjects.__begin_;
v22 = a1->m_chanceObjects.__end_;
if ( v21 == v22 )
{
LABEL_39:
m_groupID = 0;
}
else
{
v23 = 0;
while ( 1 )
{
v23 += v21->m_chance;
if ( v23 >= v19 )
break;
if ( ++v21 == v22 )
goto LABEL_39;
}
m_groupID = v21->m_groupID;
}
__p.__begin_ = &v26;
*((_DWORD *)sub_10001D150(
(unsigned __int64)&a1->m_sequenceState.m_sequenceIndices,
&v26,
(__int64)&unk_100645D0A,
&__p.__begin_)
+ 5) = v19;
memset(&__p, 0, sizeof(__p));
if ( a4 )
sub_100017EB4((__int64 *)&__p, a4->__begin_, (__int64)a4->__end_, a4->__end_ - a4->__begin_);
GJBaseGameLayer::spawnGroupTriggered(a2, m_groupID, 0.0, 0, &__p, a1->m_uniqueID, a1->m_controlID);
if ( __p.__begin_ )
{
__p.__end_ = __p.__begin_;
operator delete(__p.__begin_);
}
}
}