When i decompile that function then i get a bit different code.
Edit: it might be useful to make code callback function like player commands (ClientCommand).
Then you can decide in CoD if you remove the weapon or not.
Edit 2: this is the problem
PHP Code:
v3 = int(dword_8793DB8 + 8);
It should be
PHP Code:
v3 = *(_DWORD *)(dword_8793DB8 + 8);
libcod
PHP Code:
v3 = *(int *)(*(int *)0x08793DB8 + 8);
Also add a printf to test if you get the right value.
How the function gets called
PHP Code:
int __cdecl sub_8103D3C(int a1, int a2, int a3, int a4)
{
int v4; // ST14_4@1
int v6; // [sp+10h] [bp-8h]@1
v4 = -1171354717 * ((a1 - (signed int)&unk_8164C20) >> 2);
sub_8104C84(-1171354717 * ((a1 - (signed int)&unk_8164C20) >> 2), 1);
v6 = sub_811C546();
dword_859D158[sub_8103B6A()] = v6;
*(_DWORD *)(v6 + 4) = 3;
*(_DWORD *)(v6 + 140) = v4;
sub_8103CB2(a1, v6 + 360);
*(_WORD *)(v6 + 428) = v4;
The actual function in 1.0
PHP Code:
int __cdecl sub_8103B6A()
{
int v2; // [sp+14h] [bp-24h]@1
int s; // [sp+1Ch] [bp-1Ch]@3
float v4; // [sp+20h] [bp-18h]@1
float v5; // [sp+24h] [bp-14h]@9
float v6; // [sp+28h] [bp-10h]@5
int v7; // [sp+2Ch] [bp-Ch]@1
int j; // [sp+30h] [bp-8h]@5
int i; // [sp+34h] [bp-4h]@1
v7 = 0;
v4 = -1.0;
v2 = *(_DWORD *)(dword_8793DB8 + 8);
for ( i = 0; i < v2; ++i )
{
s = dword_859D158[i];
if ( !s )
return i;
v6 = 9.9999803e11;
for ( j = 0; j < dword_859B5E4; ++j )
{
if ( *(_DWORD *)(dword_859B400 + 10404 * j + 9924) == 2 )
{
if ( !*(_DWORD *)(dword_859B400 + 10404 * j + 9896) )
{
v5 = sub_80A1DB2((char *)&unk_86655B8 + 560 * j, s + 312);
if ( v6 > (long double)v5 )
v6 = v5;
}
}
}
if ( v6 > (long double)v4 )
{
v4 = v6;
v7 = i;
}
}
sub_811C9C0((void *)dword_859D158[v7]);
dword_859D158[v7] = 0;
return v7;
}