//
// GameObject::colorForMode from 0x771c00 to 0x771d08 (264 bytes)
//
// 9 xrefs:
// > PlayLayer::manualUpdateObjectColors @ 0x6f2a80
// > PlayLayer::manualUpdateObjectColors @ 0x6f2aa4
// > PlayLayer::updateVisibility @ 0x70134c
// > PlayLayer::updateVisibility @ 0x701844
// > GameObject::updateMainColor @ 0x771d28
// > GameObject::updateMainColorOnly @ 0x771d74
// > GameObject::updateSecondaryColor @ 0x771de0
// > GameObject::updateSecondaryColorOnly @ 0x771e48
// > ??> @ 0x797f8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:53:13 +0000
//
unsigned __int8 *__fastcall GameObject::colorForMode(GameObject *this, int a2, unsigned __int8 a3)
{
int v4; // w21
unsigned __int8 *v5; // x20
char *ActiveColorForMode; // x0
unsigned __int8 v7; // w2
__int64 v8; // x0
__int64 v10; // x1
unsigned __int64 v11; // x0
v4 = a3;
v5 = (unsigned __int8 *)this + 637;
if ( a2 <= 0 )
{
*((_BYTE *)this + 637) = -1;
*((_BYTE *)this + 638) = -1;
*((_BYTE *)this + 639) = -1;
}
else
{
ActiveColorForMode = GameObject::getActiveColorForMode(this, a2, a3);
*(_WORD *)v5 = *(_WORD *)ActiveColorForMode;
v5[2] = ActiveColorForMode[2];
}
if ( *((__int16 *)this + 592) > 0 )
{
if ( v4 )
{
v7 = 1;
if ( !*((_BYTE *)this + 1038) )
{
LABEL_7:
v8 = GameObject::groupColor((__int64)this, (__int64)v5, v7);
*(_WORD *)v5 = *(_WORD *)v8;
v5[2] = *(_BYTE *)(v8 + 2);
goto LABEL_8;
}
}
else if ( *((_DWORD *)this + 165) == 1012 )
{
goto LABEL_12;
}
v7 = 0;
goto LABEL_7;
}
LABEL_8:
if ( !v4 )
{
LABEL_12:
if ( !*((_BYTE *)this + 665) )
return v5;
v10 = *((_QWORD *)this + 138);
goto LABEL_16;
}
if ( !*((_BYTE *)this + 664) )
return v5;
v10 = *((_QWORD *)this + 137);
LABEL_16:
v11 = GameToolbox::transformColor(v5, *(_QWORD *)(v10 + 16), *(_QWORD *)(v10 + 24));
*((_BYTE *)this + 637) = v11;
v5[1] = BYTE1(v11);
v5[2] = BYTE2(v11);
return v5;
}