Quantcast

Jump to content

» «
Photo

GTA V HUD to GTA IV EFLC

7 replies to this topic
XForceP
  • XForceP

    C++ Evangelist

  • Members
  • Joined: 04 Sep 2013
  • Germany

#1

Posted 06 September 2013 - 08:39 PM

Hey,
 
so the current work from FRiChicken and me :)
we're still working on this due the problem that it's hard to convert the blips viewport positions from circle to square .... 
 
 
View it in action:
 
Code(if you want to use it, just rebuild some parts(like Math::Clamp, you'll find a funtion example via google ;)):
void 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  pushad;
 
  g_pCore>GetGame()>SetRadarVisible(true);
  
  _asm  popad;
  _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;
}
Preview:
 
utj3a8uc.png
 
6degpvm3.png
 
rem4psmh.png
  • Frank.s, _DK, Jordiath. and 3 others like this

_DK
  • _DK

    Homie

  • Feroci Racing
  • Joined: 12 Apr 2009
  • Ukraine

#2

Posted 07 September 2013 - 07:08 AM

Nice to see you did it in this way.

Did you work on HUD researching before or that just random finds? If second, how much time it got?


EdyTheViper
  • EdyTheViper

    The Viper

  • Members
  • Joined: 05 Nov 2009
  • Romania

#3

Posted 07 September 2013 - 08:59 AM

Good job!


XForceP
  • XForceP

    C++ Evangelist

  • Members
  • Joined: 04 Sep 2013
  • Germany

#4

Posted 07 September 2013 - 12:02 PM Edited by XForceP, 07 September 2013 - 12:08 PM.

Two days ago FriChicken and me thought that we want the GTA V minimap in GTA IV. So we started to find how they draw all of the map and then we found the ways to modify it that way.


Jordiath.
  • Jordiath.

    Crackhead

  • Members
  • Joined: 06 Jun 2009
  • None

#5

Posted 07 September 2013 - 03:29 PM

Very good work, keep it up.

 

Will you be working on making it the sort of "2.5D" like the GTAV one is, which sort of faces at an angle rather than straight down?

  • Jordiath likes this

XForceP
  • XForceP

    C++ Evangelist

  • Members
  • Joined: 04 Sep 2013
  • Germany

#6

Posted 07 September 2013 - 04:16 PM Edited by XForceP, 07 September 2013 - 07:13 PM.

Very good work, keep it up.

 

Will you be working on making it the sort of "2.5D" like the GTAV one is, which sort of faces at an angle rather than straight down?

Maybe but this will be very hard. But its possible so i will add this later.


Michael Wojtanis
  • Michael Wojtanis

    Rinepim

  • Members
  • Joined: 17 Jul 2013

#7

Posted 22 September 2013 - 06:54 PM

2,5D - that is nice, but they must include all matematic from zero. Because this not just 2D position of map, but also angle of ped.


VaultBoy101
  • VaultBoy101

    Player Hater

  • Members
  • Joined: 12 Oct 2013

#8

Posted 15 October 2013 - 08:54 AM

Awesome! Any update on the progress? :lol:





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users