diff --git a/saco/d3dhook/IDirect3DDevice9Hook.cpp b/saco/d3dhook/IDirect3DDevice9Hook.cpp index 7fd95ab..7475b30 100644 --- a/saco/d3dhook/IDirect3DDevice9Hook.cpp +++ b/saco/d3dhook/IDirect3DDevice9Hook.cpp @@ -13,11 +13,20 @@ #include "../main.h" extern IDirect3DDevice9 *pD3DDevice; +extern CNetGame *pNetGame; D3DXMATRIX matView, matProj, matWorld; +int dword_101A25F8; +int dword_101A25FC; +int dword_10140D60; +int dword_1026EBA0; +int dword_101516D8; + void sub_1009D8B0(); // .text:1009D8B0 void sub_100C3F50(); // .text:100C3F50 void sub_100C41B0(); // .text:100C41B0 +int sub_100A4470(); // .text:100A4470 +int sub_100C3E20(int a1, int a2); // .text:100C3E20 //------------------------------------------- @@ -370,7 +379,36 @@ HRESULT __stdcall IDirect3DDevice9Hook::GetTexture(DWORD Stage, IDirect3DBaseTex HRESULT __stdcall IDirect3DDevice9Hook::SetTexture(DWORD Stage, IDirect3DBaseTexture9* pTexture) { - // TODO: IDirect3DDevice9Hook::SetTexture + if(dword_101A25F8 && dword_101A25FC) + { + for(dword_10140D60 = 0; dword_10140D60 != 16; dword_10140D60++) + { + if(*(DWORD *)(dword_101A25FC + 4 * dword_10140D60 + 0x110B) == (DWORD)pTexture && + *(DWORD *)(dword_101A25FC + 4 * dword_10140D60 + 0x114B)) + { + return pD3DDevice->SetTexture(Stage, + (IDirect3DBaseTexture9 *)*(DWORD *)(dword_101A25FC + 4 * dword_10140D60 + 0x114B)); + } + } + } + + int v4 = sub_100A4470(); + if(v4 && v4 == (int)pTexture && pNetGame && pNetGame->GetVehiclePool()) + { + CVehiclePool *pVehiclePool = pNetGame->GetVehiclePool(); + short v5 = pVehiclePool->FUNC_1001EB90(dword_101516D8); + int v7 = pVehiclePool->FUNC_10001120(v5); + if(v7 && *(DWORD *)(v7 + 0x8F)) + { + sub_100C3E20(9, 2); + return pD3DDevice->SetTexture(Stage, (IDirect3DBaseTexture9 *)*(DWORD *)(v7 + 0x8F)); + } + if(*(DWORD *)(dword_1026EBA0 + 0x20)) + { + sub_100C3E20(9, 2); + return pD3DDevice->SetTexture(Stage, (IDirect3DBaseTexture9 *)*(DWORD *)(dword_1026EBA0 + 0x20)); + } + } return pD3DDevice->SetTexture(Stage, pTexture); } diff --git a/saco/net/netgame.h b/saco/net/netgame.h index 1f2f591..73ac7e6 100644 --- a/saco/net/netgame.h +++ b/saco/net/netgame.h @@ -75,6 +75,7 @@ public: int GetGameState() { return m_iGameState; }; BOOL GetWalkStyle() { return field_3D5->bUseCJWalk; }; + CVehiclePool * GetVehiclePool() { return m_pPools->pVehiclePool; }; CPlayerPool * GetPlayerPool() { return m_pPools->pPlayerPool; }; CGangZonePool * GetGangZonePool() { return m_pPools->pGangZonePool; }; RakClientInterface * GetRakClient() { return m_pRakClient; }; diff --git a/saco/net/vehiclepool.h b/saco/net/vehiclepool.h index 2022a1f..cdf53f9 100644 --- a/saco/net/vehiclepool.h +++ b/saco/net/vehiclepool.h @@ -23,6 +23,10 @@ public: int field_17894; + short FUNC_1001EB90(int a1); // .text:1001EB90 + + int FUNC_10001120(unsigned short a1); // .text:10001120 + CVehiclePool(); };