Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CGame::RenderUIElements()
- {
- // Render Images
- float fX, fY, sX, sY;
- CIVScript_NativeInvoke::Invoke<unsigned int>(CIVScript::NATIVE_GET_VIEWPORT_POS_AND_SIZE, 3, &fX, &fY, &sX, &sY);
- D3DVIEWPORT9 viewport;
- g_pCore->GetGraphics()->GetDevice()->GetViewport(&viewport);
- g_pCore->GetGraphics()->GetSprite()->Begin(0);
- D3DXVECTOR2 spriteCentre = D3DXVECTOR2(0, 0);
- D3DXVECTOR2 trans= D3DXVECTOR2(viewport.Width * fX 6.5, viewport.Height * fY 6.5);
- D3DXMATRIX mat;
- D3DXVECTOR2 scaling2((viewport.Width * sX) / 990, (viewport.Height*sY) / 460);
- float rotation=0.0f;
- D3DXMatrixTransformation2D(&mat,NULL,0.0,&scaling2,&spriteCentre,rotation,&trans);
- g_pCore>GetGraphics()->GetSprite()->SetTransform(&mat);
- g_pCore>GetGraphics()->GetSprite()->Draw(g_pCore->GetGraphics()->m_pRadarOverlayTexture,NULL, NULL,&D3DXVECTOR3(0.0f, 0.0f, 0.0f), D3DCOLOR_ARGB(255,255,255,255));
- // Draw health bar
- float fxPos = viewport.Width * fX 6.5;
- float fyPos = viewport.Height * fY 6.5;
- float fWidth = viewport.Width/12.4;
- float fHeight = viewport.Height/50;
- D3DXVECTOR2 scaling3((viewport.Width * sX) / 1000, (viewport.Height*sY) / 460);
- CVector3 vecScreen = CVector3(trans.x, (trans.y+scaling3.y), 0.0f);
- vecScreen.fY += (viewport.Height/10)*2;
- if(m_pLocalPlayer && m_pLocalPlayer>IsSpawned()) {
- g_pCore>GetGraphics()->DrawBox(((vecScreen.fX + 6)), (vecScreen.fY + 18), (fWidth 4), (fHeight 4), D3DCOLOR_ARGB(120, 125, 157, 120) );
- g_pCore>GetGraphics()->DrawBox(((vecScreen.fX + 6)), (vecScreen.fY + 18), (((Math::Clamp( 0.0f, m_pLocalPlayer>GetHealth(), 720.0f ) * 100.0f) / 720.0f) / 100 * (fWidth 4)), (fHeight 4), D3DCOLOR_ARGB(255, 125, 157, 120) );
- vecScreen.fX += fWidth;
- g_pCore>GetGraphics()->DrawBox(((vecScreen.fX + 6)), (vecScreen.fY + 18), (fWidth 4), (fHeight 4), D3DCOLOR_ARGB(210, 0, 79, 96) );
- g_pCore>GetGraphics()->DrawBox(((vecScreen.fX + 6)), (vecScreen.fY + 18), (((Math::Clamp( 0.0f, m_pLocalPlayer>GetHealth(), 720.0f ) * 100.0f) / 720.0f) / 100 * (fWidth 4)), (fHeight 4), D3DCOLOR_ARGB(255, 0, 79, 96) );
- g_pCore>GetGraphics()->GetSprite()>Flush();
- g_pCore>GetGraphics()->GetSprite()>End();
- }
- Vector2 * v12;
- Vector2 * pViewportSize = new Vector2();
- float center;
- int bAbsolut;
- #define MIN_X 0.025f
- #define MAX_X 0.975f
- #define MIN_Y 0.025f
- #define MAX_Y 0.975f
- #define ZERO 0.0f
- float fOriginalX;
- float fOriginalY;
- void _declspec(naked) Keks()
- {
- _asm mov v12, edx;
- _asm push eax; get absolute flag
- _asm mov eax, [ebp+14h] ; 3th parameter
- _asm mov bAbsolut, eax;
- _asm pop eax;
- fOriginalX = v12->fX;
- fOriginalY = v12->fY;
- // Calculate and check our coordinates
- if(!bAbsolut) {
- if(v12->fX < MAX_X && v12->fX > MIN_X) { // Check if the X axis is smaller than 1, but still positive
- if(v12->fY < MAX_Y && v12->fY > MIN_Y) // Check if the Y Acis is smaller than 1, but still positive
- {
- goto out; // Let GTA calc the position on itself
- }
- else {
- if(v12->fY > MAX_Y) // Check if the Y Axis is bigger than 1 (set it 0.05 so it's not cutted of)
- v12->fY = MAX_Y;
- if(v12->fY < MIN_Y) // Check if the Y Axis is smaller than 0 (set it +0.05 so it's not cutted of)
- v12->fY = MIN_Y;
- }
- goto out;
- }
- else
- {
- if(v12->fX > MAX_X)
- v12->fX = MAX_X; // Check if the X Axis is bigger than 1 (set it 0.05 so it's not cutted of)
- if(v12->fX < MIN_X)
- v12->fX = MIN_X; // Check if the X Axis is smaller than 0 (set it +0.05 so it's not cutted of)
- }
- if(v12->fY < MAX_Y && v12->fY > MIN_Y) { // Check if the Y Acis is smaller than 1, but still positive
- if(v12->fX < MAX_X && v12->fX > MIN_X)// Check if the X axis is smaller than 1, but still positive
- {
- goto out;
- }
- else
- {
- if(v12->fX > MAX_X) // Check if the X Axis is bigger than 1 (set it 0.05 so it's not cutted of)
- v12>fX = MAX_X;
- if(v12->fX < 0) // Check if the X Axis is smaller than 0 (set it +0.05 so it's not cutted of)
- v12>fX = MIN_X;
- }
- goto out;
- }
- else {
- if(v12->fY > MAX_Y) // Check if the Y Axis is bigger than 1 (set it 0.05 so it's not cutted of)
- v12>fY = MAX_Y;
- if(v12->fY < MIN_Y) // Check if the Y Axis is smaller than 0 (set it +0.05 so it's not cutted of)
- v12>fY = MIN_Y;
- }
- goto out;
- }
- out:
- _asm mov esp, ebp;
- _asm pop ebp;
- _asm retn;
- }
- DWORD ResizeMapJmpBack;
- int a1, a2, a3;
- _declspec(naked) signed int ResizeMap()
- {
- _asm push eax;
- _asm mov eax, [ebp+4];
- _asm mov a1, eax;
- _asm mov eax, [ebp+8];
- _asm mov a2, eax;
- _asm mov eax, [ebp+0Ch];
- _asm mov a3, eax;
- _asm pushad;
- ResizeMapJmpBack = (g_pCore->GetBase() + 0x8364D7);
- _asm popad;
- _asm pop eax;
- _asm jmp ResizeMapJmpBack;
- }
- DWORD sub_849BC0;
- _declspec(naked) void RenderMap()
- {
- sub_849BC0 = (g_pCore->GetBase() + 0x849BC0);
- _asm call sub_849BC0;
- _asm add esp, 4;
- _asm popad;
- g_pCore->GetGame()->SetRadarVisible(true);
- _asm pushad;
- _asm retn;
- }
- // Other section
- // Change calc from circle to square(blips)
- *(BYTE*)(g_pCore->GetBase() + 0x8385E7 + 0x6) = 0x1;
- PatchAddress(false, g_pCore->GetBase() + 0x8386AB, (DWORD)Keks); // E9
- // Enable square map(instead of circle map)
- PatchAddress(false, g_pCore->GetBase() + 0xA22C53, g_pCore->GetBase() + 0xA22EF3); // E9
- // Enable big radar
- *(BYTE *)(g_pCore->GetBase() + 0x08364D0 + 0x6) = 0x1;
- // Hook resize map function
- PatchAddress(false, (g_pCore->GetBase() + 0x8364D0), (DWORD)ResizeMap); // E9
- *(WORD *)(g_pCore->GetBase() + 0x8364D0 + 0x5) = 0x9090;
- // Make blip small
- *(BYTE *)(g_pCore->GetBase() + 0x4B516F + 0x6) = 0x1; // cmp VAR_DEVMODE, 1
- *(BYTE *)(g_pCore->GetBase() + 0x4B516F + 0x6) = 0x1; // cmp VAR_DEVMODE, 1
- // Hook render map function
- PatchAddress(true,(g_pCore->GetBase() + 0xA22E71), (DWORD)RenderMap); // E8
- // Example for call and jump:
- /*
- void PatchAddress(bool bJmp, DWORD dwAddress, DWORD dwNewAddress)
- {
- if(bJmp)
- *(BYTE *)(dwAddress) = 0xE9; // jmp
- else
- *(BYTE *)(dwAddress) = 0xE8; // call
- *(DWORD *)(dwAddress + 0x1) = (DWORD)dwNewAddress;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement