//
// GJGarageLayer::updatePlayerColors from 0x140380480 to 0x1403805fc (380 bytes)
//
// 3 xrefs:
// > GJGarageLayer::init @ 0x14037c2b6
// > GJGarageLayer::playerColorChanged @ 0x140380479
// > ??> @ 0x1409228ec
//
// This function is hookable on this platform (idp: pc, 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 11:31:05 +0000
//
// Hidden C++ exception states: #wind=8
double __fastcall GJGarageLayer::updatePlayerColors(__int64 a1)
{
__int64 v2; // rbp
int v3; // ebx
char *v4; // rdi
char *v5; // rax
__int64 v6; // rbx
__int64 v7; // rcx
int v8; // r8d
char *v9; // rax
__int64 v10; // rdx
void *v12; // [rsp+40h] [rbp+8h] BYREF
char v13; // [rsp+48h] [rbp+10h] BYREF
void *v14; // [rsp+50h] [rbp+18h] BYREF
v2 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v12 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v2 = qword_14090BFD0;
}
*(_BYTE *)(*(_QWORD *)(a1 + 472) + 660LL) = *(_BYTE *)(v2 + 944);
v3 = *(_DWORD *)(v2 + 844) - *(_DWORD *)(v2 + 848);
v4 = GameManager::colorForIdx(v2, (char *)&v12, *(_DWORD *)(v2 + 856) - *(_DWORD *)(v2 + 860));
v5 = GameManager::colorForIdx(v2, &v13, v3);
v6 = *(_QWORD *)(a1 + 472);
(**(void (__fastcall ***)(__int64, char *))(*(_QWORD *)(v6 + 600) + 320LL))(*(_QWORD *)(v6 + 600) + 320LL, v5);
(**(void (__fastcall ***)(__int64, char *))(*(_QWORD *)(v6 + 608) + 320LL))(*(_QWORD *)(v6 + 608) + 320LL, v4);
SimplePlayer::updateColors(v6);
v7 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v14 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v7 = qword_14090BFD0;
}
v8 = *(_DWORD *)(v7 + 868) - *(_DWORD *)(v7 + 872);
if ( v8 < 0 )
{
*(_BYTE *)(*(_QWORD *)(a1 + 472) + 668LL) = 0;
}
else
{
v9 = GameManager::colorForIdx(v7, (char *)&v14, v8);
v10 = *(_QWORD *)(a1 + 472);
*(_BYTE *)(v10 + 668) = 1;
*(_WORD *)(v10 + 669) = *(_WORD *)v9;
*(_BYTE *)(v10 + 671) = v9[2];
}
return SimplePlayer::updateColors(*(_QWORD *)(a1 + 472));
}