Add view model info
This commit is contained in:
parent
ffd79ec387
commit
2d59f7eda9
@ -616,6 +616,7 @@ DefaultStyle = "Default Style"
|
|||||||
DirectionalLight = "Directional light"
|
DirectionalLight = "Directional light"
|
||||||
DirectionalMult = "Directional mult"
|
DirectionalMult = "Directional mult"
|
||||||
DisableHydrant = "Disable hydrant splash"
|
DisableHydrant = "Disable hydrant splash"
|
||||||
|
Distance = "Distance"
|
||||||
DrawMenuTitle = "Draw menu title border color"
|
DrawMenuTitle = "Draw menu title border color"
|
||||||
UnderwaterEffect = "Underwater effect"
|
UnderwaterEffect = "Underwater effect"
|
||||||
FarClip = "Far clip"
|
FarClip = "Far clip"
|
||||||
@ -681,6 +682,7 @@ RadioStationColor = "Radio station color"
|
|||||||
ResetTimecyc = "Reset timecyc"
|
ResetTimecyc = "Reset timecyc"
|
||||||
ShadowStrength = "Shadow strength"
|
ShadowStrength = "Shadow strength"
|
||||||
ShowHud = "Show HUD"
|
ShowHud = "Show HUD"
|
||||||
|
ShowModelInfo = "Show model info"
|
||||||
ShowRadar = "Show radar"
|
ShowRadar = "Show radar"
|
||||||
SkyBottom = "Sky bottom"
|
SkyBottom = "Sky bottom"
|
||||||
SkyTop = "Sky top"
|
SkyTop = "Sky top"
|
||||||
|
@ -112,6 +112,7 @@ void CheatMenu::DrawWindow()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Menu::DrawOverlay();
|
Menu::DrawOverlay();
|
||||||
|
ShowModelInfo::Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheatMenu::ProcessPages()
|
void CheatMenu::ProcessPages()
|
||||||
|
121
src/visual.cpp
121
src/visual.cpp
@ -4,6 +4,10 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "timecycle.h"
|
#include "timecycle.h"
|
||||||
|
#include "CSprite.h"
|
||||||
|
#include "CFont.h"
|
||||||
|
#include "CWorld.h"
|
||||||
|
#include "vehicle.h"
|
||||||
|
|
||||||
#ifdef GTASA
|
#ifdef GTASA
|
||||||
#include "CHudColours.h"
|
#include "CHudColours.h"
|
||||||
@ -154,6 +158,7 @@ void Visual::Init()
|
|||||||
m_nBacWeatherType = CWeather::OldWeatherType;
|
m_nBacWeatherType = CWeather::OldWeatherType;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
ShowModelInfo::Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -520,6 +525,103 @@ static void ColorPickerAddr(const char* label, int addr, ImVec4&& default_color)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShowModelInfo::Init()
|
||||||
|
{
|
||||||
|
ThiscallEvent<AddressList<BY_GAME(0x5343B2, 0x48882E, 0x474BC0), H_CALL>, PRIORITY_BEFORE, ArgPickN<CEntity*, 0>, void(CEntity*)> preRenderEntityEvent;
|
||||||
|
|
||||||
|
#ifndef GTASA
|
||||||
|
patch::Nop(BY_GAME(NULL, 0x488828, 0x474BBA), 4);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Directly drawing here seems to crash renderer?
|
||||||
|
preRenderEntityEvent += [](CEntity *pEnt)
|
||||||
|
{
|
||||||
|
CPlayerPed *player = FindPlayerPed();
|
||||||
|
if (m_bEnable)
|
||||||
|
{
|
||||||
|
CVector coord = pEnt->GetPosition();
|
||||||
|
CVector plaPos = player->GetPosition();
|
||||||
|
|
||||||
|
CColPoint outColPoint;
|
||||||
|
if (BY_GAME(pEnt->m_bIsVisible, pEnt->IsVisible(), pEnt->IsVisible()))
|
||||||
|
{
|
||||||
|
ShowModelInfo::m_EntityList.push_back(pEnt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef GTAVC
|
||||||
|
if (CModelInfo::GetModelInfo(pEnt->m_nModelIndex)->m_nNum2dEffects > 0)
|
||||||
|
{
|
||||||
|
pEnt->ProcessLightsForEntity();
|
||||||
|
}
|
||||||
|
#elif GTA3
|
||||||
|
// if (CModelInfo::ms_modelInfoPtrs[pEnt->m_nModelIndex]->m_nNum2dEffects > 0)
|
||||||
|
// {
|
||||||
|
// pEnt->ProcessLightsForEntity();
|
||||||
|
// }
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShowModelInfo::Draw()
|
||||||
|
{
|
||||||
|
if (m_bEnable)
|
||||||
|
{
|
||||||
|
ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove
|
||||||
|
| ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoNavFocus
|
||||||
|
| ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoFocusOnAppearing;
|
||||||
|
ImGui::SetNextWindowPos(ImVec2(0, 0));
|
||||||
|
ImGui::SetNextWindowSize(ImVec2(screen::GetScreenWidth(), screen::GetScreenHeight()));
|
||||||
|
ImGui::SetNextWindowBgAlpha(0.0f);
|
||||||
|
if (ImGui::Begin("##Overlay", NULL, flags))
|
||||||
|
{
|
||||||
|
ImDrawList *pDrawList = ImGui::GetWindowDrawList();
|
||||||
|
for (CEntity *pEnt : m_EntityList)
|
||||||
|
{
|
||||||
|
CVector coord = BY_GAME(,,*)pEnt->GetBoundCentre();
|
||||||
|
float distance = DistanceBetweenPoints(coord, FindPlayerPed()->GetPosition());
|
||||||
|
RwV3d screen;
|
||||||
|
CVector2D size;
|
||||||
|
if (distance < m_nDistance &&
|
||||||
|
#ifdef GTASA
|
||||||
|
CSprite::CalcScreenCoors(coord.ToRwV3d(), &screen, &size.x, &size.y, true, true)
|
||||||
|
#else
|
||||||
|
CSprite::CalcScreenCoors(coord.ToRwV3d(), &screen, &size.x, &size.y, true)
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
{
|
||||||
|
bool skip = false;
|
||||||
|
uint model = pEnt->m_nModelIndex;
|
||||||
|
std::string text = std::to_string(model);
|
||||||
|
ImU32 col = ImGui::ColorConvertFloat4ToU32(distance < m_nDistance/2 ? ImVec4(1.0f, 1.0f, 1.0f, 1.00f) : ImVec4(0.35f, 0.33f, 0.3f, 1.00f));
|
||||||
|
#ifdef GTASA
|
||||||
|
if (pEnt->m_nType == ENTITY_TYPE_VEHICLE)
|
||||||
|
{
|
||||||
|
text = std::format("{}\n{}", model, Vehicle::GetNameFromModel(model));
|
||||||
|
}
|
||||||
|
else if (pEnt->m_nType == ENTITY_TYPE_PED)
|
||||||
|
{
|
||||||
|
CPed *ped = static_cast<CPed*>(pEnt);
|
||||||
|
if (BY_GAME(ped->m_nPedFlags.bInVehicle, ped->m_bInVehicle, ped->m_bInVehicle))
|
||||||
|
{
|
||||||
|
skip = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!skip)
|
||||||
|
{
|
||||||
|
pDrawList->AddText(ImVec2(screen.x, screen.y), col, text.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_EntityList.clear();
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Visual::ShowPage()
|
void Visual::ShowPage()
|
||||||
{
|
{
|
||||||
if (ImGui::BeginTabBar("Visual", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
if (ImGui::BeginTabBar("Visual", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
||||||
@ -716,7 +818,7 @@ void Visual::ShowPage()
|
|||||||
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
|
||||||
Widget::CheckboxAddr(TEXT("Visual.HideRadar"), 0xA10AB6);
|
Widget::CheckboxAddr(TEXT("Visual.HideRadar"), 0xA10AB6);
|
||||||
Widget::Checkbox(TEXT("Visual.Lockweather"), &m_bLockWeather);
|
Widget::Checkbox(TEXT("Visual.LockWeather"), &m_bLockWeather);
|
||||||
Widget::CheckboxAddr(TEXT("Visual.ShowHud"), 0x86963A);
|
Widget::CheckboxAddr(TEXT("Visual.ShowHud"), 0x86963A);
|
||||||
|
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
@ -824,6 +926,22 @@ void Visual::ShowPage()
|
|||||||
#endif
|
#endif
|
||||||
if (ImGui::BeginChild("VisualsChild"))
|
if (ImGui::BeginChild("VisualsChild"))
|
||||||
{
|
{
|
||||||
|
if(ImGui::CollapsingHeader(TEXT("Visual.ShowModelInfo")))
|
||||||
|
{
|
||||||
|
Widget::Checkbox(TEXT("Window.Enabled"), &ShowModelInfo::m_bEnable);
|
||||||
|
|
||||||
|
ImGui::Spacing();
|
||||||
|
|
||||||
|
if (ImGui::InputInt(TEXT("Visual.Distance"), &ShowModelInfo::m_nDistance))
|
||||||
|
{
|
||||||
|
if (ShowModelInfo::m_nDistance < 0.0f)
|
||||||
|
{
|
||||||
|
ShowModelInfo::m_nDistance = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::Spacing();
|
||||||
|
ImGui::Separator();
|
||||||
|
}
|
||||||
#ifdef GTASA
|
#ifdef GTASA
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -862,6 +980,7 @@ void Visual::ShowPage()
|
|||||||
Widget::EditAddr<float>(TEXT("Visual.RadarPosY"), *(int*)0x583500, -999, 104, 999);
|
Widget::EditAddr<float>(TEXT("Visual.RadarPosY"), *(int*)0x583500, -999, 104, 999);
|
||||||
Widget::EditAddr<int>(TEXT("Visual.RadarZoom"), 0xA444A3, 0, 0, 170);
|
Widget::EditAddr<int>(TEXT("Visual.RadarZoom"), 0xA444A3, 0, 0, 170);
|
||||||
ColorPickerAddr(TEXT("Visual.RadioStationColor"), 0xBAB24C, ImVec4(150, 150, 150, 255));
|
ColorPickerAddr(TEXT("Visual.RadioStationColor"), 0xBAB24C, ImVec4(150, 150, 150, 255));
|
||||||
|
|
||||||
static std::vector<Widget::BindInfo> star_border
|
static std::vector<Widget::BindInfo> star_border
|
||||||
{
|
{
|
||||||
{TEXT("Visual.NoBorder"), 0}, {TEXT("Visual.DefaultBorder"), 1}, {TEXT("Visual.BoldBorder"), 2}
|
{TEXT("Visual.NoBorder"), 0}, {TEXT("Visual.DefaultBorder"), 1}, {TEXT("Visual.BoldBorder"), 2}
|
||||||
|
15
src/visual.h
15
src/visual.h
@ -1,10 +1,24 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
|
struct ShowModelInfo
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
static inline std::vector<CEntity*> m_EntityList;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static inline bool m_bEnable;
|
||||||
|
static inline int m_nDistance = 50.0f;
|
||||||
|
|
||||||
|
static void Init();
|
||||||
|
static void Draw();
|
||||||
|
};
|
||||||
|
|
||||||
class Visual
|
class Visual
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static inline bool m_bLockWeather;
|
static inline bool m_bLockWeather;
|
||||||
|
static inline bool m_bModelInfo;
|
||||||
|
|
||||||
#ifdef GTASA
|
#ifdef GTASA
|
||||||
static inline bool m_bInvisibleWater;
|
static inline bool m_bInvisibleWater;
|
||||||
@ -31,4 +45,5 @@ public:
|
|||||||
|
|
||||||
static void Init();
|
static void Init();
|
||||||
static void ShowPage();
|
static void ShowPage();
|
||||||
|
static void DrawModelInfo();
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user