Code:
#define ADDR_LTCLIENTSHELL 0x014372E0
#define ADDR_ILTMODEL 0x01433ACC
#define OFFSET_PLAYERSIZE 0xD78
#define OFFSET_PLAYERSTART 0x1F8
#define OFFSET_ME 0x204
CPlayer *getPlayerByIndex( DWORD dw_LTClientShell, int i )
{
DWORD dw_CPlayerStart = ( dw_LTClientShell + OFFSET_PLAYERSTART );
if( !dw_CPlayerStart )
return nullptr;
return ( CPlayer * ) ( dw_CPlayerStart + OFFSET_PLAYERSIZE * i );
}
unsigned int getNodeTransform( int *Obj, unsigned int iNodeNumber, CTransform *pTransForm )
{
char *strCShell = "CShell.dll";
__asm
{
PUSH strCShell
CALL DWORD PTR DS:[ GetModuleHandle ]
ADD EAX, ADDR_ILTMODEL
MOV ECX, DWORD PTR DS:[ EAX ]
MOV EDX, DWORD PTR DS:[ ECX ]
MOV EDX, DWORD PTR DS:[ EDX + 0x3C ]
PUSH 1
PUSH pTransForm
PUSH iNodeNumber
PUSH Obj
CALL EDX
}
}
const D3DXVECTOR3 getBoneVector( int *Obj, unsigned int iNodeNumber )
{
CTransform objBoneTransform = CTransform( );
unsigned int iRet = getNodeTransform( Obj, iNodeNumber, &objBoneTransform );
return objBoneTransform.Pos;
}
const bool bIsValidPlayer( CPlayer *p )
{
return ( p != 0 && p->Object != 0 &&
p->CharacterFX != 0 && p->Health > 0 );
}
void playerLoop( void )
{
DWORD dw_ClientFX = ( DWORD ) GetModuleHandle( "ClientFX.fxd" );
if( !dw_ClientFX )
return;
DWORD dw_CShell = ( DWORD ) GetModuleHandle( "CShell.dll" );
if( !dw_CShell )
return;
DWORD dw_LTClientShell = *( DWORD * ) ( dw_CShell + ADDR_LTCLIENTSHELL );
if( !dw_LTClientShell )
return;
CPlayer *pLocal = getPlayerByIndex( dw_LTClientShell, *( int * ) ( dw_LTClientShell + OFFSET_ME ) );
if( !pLocal )
return;
for( int i = 0; i < 16; i++ )
{
CPlayer *pPlayer = getPlayerByIndex( dw_LTClientShell, i );
if( !bIsValidPlayer( pPlayer ) )
continue;
D3DXVECTOR3 vHead = getBoneVector( pPlayer->Object, 8 );
}
}