Add square radar & fullscreen menu map

This commit is contained in:
Grinch_ 2022-07-06 05:53:10 +06:00
parent a477cf29da
commit fa3d257c81
5 changed files with 229 additions and 2 deletions

Binary file not shown.

View File

@ -627,6 +627,8 @@ FluffyClouds = "Fluffy clouds"
FogEffect = "Fog effect" FogEffect = "Fog effect"
FogStart = "Fog start" FogStart = "Fog start"
FreezeGameTime = "Freeze game time" FreezeGameTime = "Freeze game time"
FullscreenMap = "Fullscreen map"
FullscreenMapTip = "Removes the black borders in menu map"
GenerateFile = "Generate timecyc file" GenerateFile = "Generate timecyc file"
GrainEffect = "Grain Effect" GrainEffect = "Grain Effect"
GrayRadar = "Gray radar" GrayRadar = "Gray radar"
@ -687,6 +689,7 @@ SkyBottom = "Sky bottom"
SkyTop = "Sky top" SkyTop = "Sky top"
SpriteBrightness = "Sprite brightness" SpriteBrightness = "Sprite brightness"
SpriteSize = "Sprite size" SpriteSize = "Sprite size"
SquareRadar = "Suqare radar"
Style1 = "Style 1" Style1 = "Style 1"
Style2 = "Style 2" Style2 = "Style 2"
SunCore = "Sun core" SunCore = "Sun core"
@ -709,8 +712,8 @@ WantedPosY = "Wanted posY"
WantedStarBorder = "Wanted star border" WantedStarBorder = "Wanted star border"
Water = "Water" Water = "Water"
WaterFogAlpha = "Water fog alpha" WaterFogAlpha = "Water fog alpha"
WeaponAmmoPosX = "Weapon icon posX" WeaponAmmoPosX = "Weapon ammo posX"
WeaponAmmoPosY = "Weapon icon posY" WeaponAmmoPosY = "Weapon ammo posY"
WeaponIconPosX = "Weapon icon posX" WeaponIconPosX = "Weapon icon posX"
WeaponIconPosY = "Weapon icon posY" WeaponIconPosY = "Weapon icon posY"
WhiteScanlines = "White scanlines" WhiteScanlines = "White scanlines"

View File

@ -460,6 +460,25 @@ void Player::ShowPage()
pPlayer->m_nPhysicalFlags.bExplosionProof = m_bGodMode; pPlayer->m_nPhysicalFlags.bExplosionProof = m_bGodMode;
pPlayer->m_nPhysicalFlags.bFireProof = m_bGodMode; pPlayer->m_nPhysicalFlags.bFireProof = m_bGodMode;
pPlayer->m_nPhysicalFlags.bMeleeProof = m_bGodMode; pPlayer->m_nPhysicalFlags.bMeleeProof = m_bGodMode;
// if (m_bGodMode)
// {
// // patch::PutRetn(0x639900);
// // patch::PutRetn(0x6398F0);
// patch::PutRetn(0x630600);
// patch::Nop(0x637590, 0xA);
// patch::Nop(0x63070C, 0xA);
// //patch::SetRaw(0x639900, (void*)"\xC2\x04\x00", 3);
// }
// else
// {
// patch::SetRaw(0x637590, (void*)"\xC7\x87\x40\x05\x00\x00\x00\x00\x00\x00", 0xA);
// patch::SetRaw(0x63070C, (void*)"\xC7\x86\x40\x05\x00\x00\x00\x00\x00\x00", 0xA);
// patch::SetUChar(0x630600, 0x6A);
// // patch::SetUChar(0x6398F0, 0xE9);
// // patch::SetUChar(0x6397E0, 0x64);
// // patch::SetRaw(0x639900, (void*)"\xC2\x04\x00", 3);
// }
#elif GTAVC #elif GTAVC
pPlayer->m_nFlags.bBulletProof = m_bGodMode; pPlayer->m_nFlags.bBulletProof = m_bGodMode;
pPlayer->m_nFlags.bCollisionProof = m_bGodMode; pPlayer->m_nFlags.bCollisionProof = m_bGodMode;

View File

@ -11,6 +11,142 @@
#ifdef GTASA #ifdef GTASA
#define TOTAL_WEATHERS 23 #define TOTAL_WEATHERS 23
// taken from vHud (_AG)
static bool IsTouchingRect(CVector2D& point, CRect rect1, CRect rect2)
{
float vroot;
float v12;
float v13;
float v14;
float v15;
float w1;
float h1;
float w2;
float v19;
float h2;
float w;
float h;
if (rect1.right == rect1.left && rect1.bottom == rect1.top || rect2.right == rect2.left && rect2.bottom == rect2.top)
{
return false;
}
if (rect2.left == rect1.left && rect2.top == rect1.top || rect2.left == rect1.right && rect2.top == rect1.bottom || rect2.right == rect1.left && rect2.bottom == rect1.top || rect2.right == rect1.right && rect2.bottom == rect1.bottom)
{
return false;
}
w1 = rect1.right - rect1.left;
h1 = rect1.bottom - rect1.top;
w2 = rect2.left - rect1.left;
h2 = rect2.top - rect1.top;
w = rect2.right - rect1.left;
h = rect2.bottom - rect1.top;
vroot = sqrtf(w1 * w1 + h1 * h1);
v12 = h2 * (w1 / vroot) - w2 * (h1 / vroot);
v19 = h1 / vroot * h2 + w1 / vroot * w2;
v14 = h * (w1 / vroot) - w * (h1 / vroot);
if (v12 < 0.0f && v14 < 0.0f || v12 >= 0.0f && v14 >= 0.0f)
{
return false;
}
v13 = h1 / vroot * h + w1 / vroot * w;
v15 = v13 + (v19 - v13) * v14 / (v14 - v12);
if (v15 < 0.0f)
{
return false;
}
if (v15 > vroot)
{
return false;
}
point.x = w1 / vroot * v15 + rect1.left;
point.y = v15 * (h1 / vroot) + rect1.top;
return true;
}
static float LimitRadarPoint(CVector2D& point)
{
if (FrontEndMenuManager.m_bDrawRadarOrMap)
{
return point.Magnitude();
}
if (point.x >= -1.0f && point.x <= 1.0f && point.y >= -1.0f && point.y <= 1.0f)
{
return 0.99f;
}
CVector2D temp;
CRect rect[4] =
{
{-1.0f, 1.0f, 1.0f, 1.0f},
{-1.0f, 1.0f, -1.0f, -1.0f},
{-1.0f, -1.0f, 1.0f, -1.0f},
{1.0f, 1.0f, 1.0f, -1.0f}
};
for (int i = 0; i <= 4; i++)
{
if (IsTouchingRect(temp, rect[i], CRect(0.0f, 0.0f, point.x, point.y)))
{
point.x = temp.x;
point.y = temp.y;
break;
}
}
return 1.1f;
}
static double __cdecl LimitRadarPoint2(CVector2D *pos)
{
float vroot = pos->Magnitude();
if (FrontEndMenuManager.m_bDrawRadarOrMap)
{
return vroot;
}
if (vroot > 1.0)
{
if (pos->x > -1.0 && pos->x < 1.0 && pos->y > -1.0 && pos->y < 1.0)
{
return 0.99;
}
float posYd = pos->y * 57.295779513;
if (posYd > 45.0 || posYd <= -45.0)
{
pos->x = cos(posYd / 57.295779513) * sqrt(2);
if (posYd > 45.0 && posYd <= 135.0)
{
pos->y = 1.0;
return vroot;
}
if (posYd <= 135.0 && posYd > -135.0)
{
pos->y = -1.0;
return vroot;
}
pos->x = -1.0;
}
else
{
pos->x = 1.0;
}
pos->y = sin(posYd / 57.295779513) * sqrt(2);
}
return vroot;
}
#elif GTAVC #elif GTAVC
#define TOTAL_WEATHERS 7 #define TOTAL_WEATHERS 7
#else #else
@ -453,6 +589,43 @@ void Visual::ShowPage()
} }
} }
Widget::CheckboxAddr(TEXT("Visual.FogEffect"), 0xC402C6); Widget::CheckboxAddr(TEXT("Visual.FogEffect"), 0xC402C6);
if (Widget::Checkbox(TEXT("Visual.FullscreenMap"), &m_bFullScreenMap, TEXT("Visual.FullscreenMapTip")))
{
if (m_bFullScreenMap)
{
// NOP CSprite2d::DrawRect calls
patch::Nop(0x575BF6, 5);
patch::Nop(0x575C40, 5);
patch::Nop(0x575C84, 5);
patch::Nop(0x575CCE, 5);
patch::Nop(0x575D1F, 5);
patch::Nop(0x575D6F, 5);
patch::Nop(0x575DC2, 5);
patch::Nop(0x575E12, 5);
// Remove screen width height scaling
patch::Nop(0x5754EC, 6);
patch::Nop(0x575537, 6);
patch::Nop(0x575311, 6);
patch::Nop(0x575361, 6);
}
else
{
// restore
plugin::patch::SetRaw(0x575BF6, (char*)"\xE8\x65\x1F\x1B\x00", 5);
plugin::patch::SetRaw(0x575C40, (char*)"\xE8\x1B\x1F\x1B\x00", 5);
plugin::patch::SetRaw(0x575C84, (char*)"\xE8\xD7\x1E\x1B\x00", 5);
plugin::patch::SetRaw(0x575CCE, (char*)"\xE8\x8D\x1E\x1B\x00", 5);
plugin::patch::SetRaw(0x575D1F, (char*)"\xE8\x3C\x1E\x1B\x00", 5);
plugin::patch::SetRaw(0x575D6F, (char*)"\xE8\xEC\x1D\x1B\x00", 5);
plugin::patch::SetRaw(0x575DC2, (char*)"\xE8\x99\x1D\x1B\x00", 5);
plugin::patch::SetRaw(0x575E12, (char*)"\xE8\x49\x1D\x1B\x00", 5);
plugin::patch::SetRaw(0x5754EC, (char*)"\xD8\x0D\x20\x95\x85\x00", 6);
plugin::patch::SetRaw(0x575537, (char*)"\xD8\x0D\x24\x95\x85\x00", 6);
plugin::patch::SetRaw(0x575311, (char*)"\xD8\x0D\x70\x53\x86\x00", 6);
plugin::patch::SetRaw(0x575361, (char*)"\xD8\x0D\x6C\x53\x86\x00", 6);
}
}
Widget::CheckboxAddr(TEXT("Visual.GrainEffect"), 0xC402B4); Widget::CheckboxAddr(TEXT("Visual.GrainEffect"), 0xC402B4);
Widget::CheckboxAddr(TEXT("Visual.GrayRadar"), 0xA444A4); Widget::CheckboxAddr(TEXT("Visual.GrayRadar"), 0xA444A4);
Widget::CheckboxAddr(TEXT("Visual.HealthBorder"), 0x589353); Widget::CheckboxAddr(TEXT("Visual.HealthBorder"), 0x589353);
@ -550,6 +723,35 @@ void Visual::ShowPage()
} }
Widget::CheckboxAddr(TEXT("Visual.ShowHud"), 0xBA6769); Widget::CheckboxAddr(TEXT("Visual.ShowHud"), 0xBA6769);
if (Widget::Checkbox(TEXT("Visual.SquareRadar"), &m_bSquareRadar))
{
if (m_bSquareRadar)
{
static float var = 0.000001f;
static CSprite2d sprite;
sprite.m_pTexture = m_MiscData.m_ImagesList[0]->m_pRwTexture;
// rediect to our texture
patch::Set(0x58A8C9, &sprite);
patch::Set(0x58A973, &sprite);
patch::Set(0x58AA21, &sprite);
patch::Set(0x58A81F, &sprite);
patch::Set(0x58585C, &var);
patch::ReplaceFunction(0x401EC5, &LimitRadarPoint);
}
else
{
patch::Set(0x58A8C9, 0xBAB208);
patch::Set(0x58A973, 0xBAB208);
patch::Set(0x58AA21, 0xBAB208);
patch::Set(0x58A81F, 0xBAB208);
// Only has 1 image atm
patch::SetRaw(0x58585C, (void*)"\x1C\x8F\x85\x00", 4);
patch::SetRaw(0x401EC5, (void*)"\xA0\xA1\x67\xBA\x00", 5);
}
}
Widget::CheckboxAddr(TEXT("Visual.UnderwaterEffect"), 0xC402D3); Widget::CheckboxAddr(TEXT("Visual.UnderwaterEffect"), 0xC402D3);
Widget::CheckboxAddrRaw(TEXT("Visual.UnfogMap"), 0xBA372C, 1, "\x50", "\x00", TEXT("Visual.UnfogMapText")); Widget::CheckboxAddrRaw(TEXT("Visual.UnfogMap"), 0xBA372C, 1, "\x50", "\x00", TEXT("Visual.UnfogMapText"));
#elif GTAVC #elif GTAVC

View File

@ -14,6 +14,9 @@ private:
static inline bool m_bNoPartciles; static inline bool m_bNoPartciles;
static inline bool m_bNoPostFX; static inline bool m_bNoPostFX;
static inline bool m_bNoTextures; static inline bool m_bNoTextures;
static inline bool m_bFullScreenMap;
static inline bool m_bSquareRadar;
static inline ResourceStore m_MiscData { "misc", eResourceType::TYPE_IMAGE, ImVec2(100, 80) };
#endif #endif
template<typename T> template<typename T>