Bug fixes
This commit is contained in:
parent
da9ab62a27
commit
d57c12e1a2
@ -150,17 +150,30 @@ void Paint::NodeWrapperRecursive(RwFrame* frame, CVehicle* pVeh, std::function<v
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Paint::GenerateNodeList(CVehicle* pVeh, std::vector<std::string>& names_vec)
|
void Paint::GenerateNodeList(CVehicle* pVeh, std::vector<std::string>& names_vec, std::string& selected)
|
||||||
{
|
{
|
||||||
|
static int vehModel = 0;
|
||||||
|
if (vehModel == pVeh->m_nModelIndex)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset to default
|
||||||
|
names_vec.clear();
|
||||||
|
names_vec.push_back("Default");
|
||||||
|
selected = "Default";
|
||||||
|
|
||||||
RwFrame* frame = (RwFrame*)pVeh->m_pRwClump->object.parent;
|
RwFrame* frame = (RwFrame*)pVeh->m_pRwClump->object.parent;
|
||||||
|
|
||||||
NodeWrapperRecursive(frame, pVeh, [&](RwFrame* frame)
|
NodeWrapperRecursive(frame, pVeh, [&](RwFrame* frame)
|
||||||
{
|
{
|
||||||
const std::string name = GetFrameNodeName(frame);
|
const std::string name = GetFrameNodeName(frame);
|
||||||
|
|
||||||
if (!(std::find(names_vec.begin(), names_vec.end(), name) != names_vec.end()))
|
if (!(std::find(names_vec.begin(), names_vec.end(), name) != names_vec.end()))
|
||||||
|
{
|
||||||
names_vec.push_back(name);
|
names_vec.push_back(name);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
vehModel = pVeh->m_nModelIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Paint::SetNodeColor(CVehicle* pVeh, std::string node_name, CRGBA color, bool filter_mat)
|
void Paint::SetNodeColor(CVehicle* pVeh, std::string node_name, CRGBA color, bool filter_mat)
|
||||||
|
@ -77,7 +77,7 @@ public:
|
|||||||
static inline ResourceStore m_TextureData { "textures", eResourceType::TYPE_IMAGE, ImVec2(100, 80) };
|
static inline ResourceStore m_TextureData { "textures", eResourceType::TYPE_IMAGE, ImVec2(100, 80) };
|
||||||
|
|
||||||
static void InjectHooks();
|
static void InjectHooks();
|
||||||
static void GenerateNodeList(CVehicle* pVeh, std::vector<std::string>& names_vec);
|
static void GenerateNodeList(CVehicle* pVeh, std::vector<std::string>& names_vec, std::string& selected);
|
||||||
static void SetNodeColor(CVehicle* pVeh, std::string node_name, CRGBA color, bool filter_mat = false);
|
static void SetNodeColor(CVehicle* pVeh, std::string node_name, CRGBA color, bool filter_mat = false);
|
||||||
static void SetNodeTexture(CVehicle* pVeh, std::string node_name, std::string texturename, bool filter_mat = false);
|
static void SetNodeTexture(CVehicle* pVeh, std::string node_name, std::string texturename, bool filter_mat = false);
|
||||||
static void ResetNodeColor(CVehicle* veh, std::string node_name);
|
static void ResetNodeColor(CVehicle* veh, std::string node_name);
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "psapi.h"
|
#include "psapi.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
float Util::RoundFloat(float val)
|
||||||
|
{
|
||||||
|
return roundf(val * 100) / 100;
|
||||||
|
}
|
||||||
|
|
||||||
bool Util::IsInVehicle(CPed *pPed)
|
bool Util::IsInVehicle(CPed *pPed)
|
||||||
{
|
{
|
||||||
|
@ -35,4 +35,5 @@ public:
|
|||||||
static bool IsInVehicle(CPed *pPed = FindPlayerPed());
|
static bool IsInVehicle(CPed *pPed = FindPlayerPed());
|
||||||
static void RainbowValues(int& r, int& g, int& b, float speed);
|
static void RainbowValues(int& r, int& g, int& b, float speed);
|
||||||
static void SetCarForwardSpeed(CVehicle *pVeh, float speed);
|
static void SetCarForwardSpeed(CVehicle *pVeh, float speed);
|
||||||
|
static float RoundFloat(float val);
|
||||||
};
|
};
|
||||||
|
@ -1043,7 +1043,7 @@ void Vehicle::ShowPage()
|
|||||||
if (ImGui::BeginTabItem(TEXT("Vehicle.Color")))
|
if (ImGui::BeginTabItem(TEXT("Vehicle.Color")))
|
||||||
{
|
{
|
||||||
#ifdef GTASA
|
#ifdef GTASA
|
||||||
Paint::GenerateNodeList(veh, m_Paint::m_vecNames);
|
Paint::GenerateNodeList(veh, m_Paint::m_vecNames, m_Paint::m_Selected);
|
||||||
|
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
if (ImGui::Button(TEXT("Vehicle.ResetColor"), ImVec2(Ui::GetSize())))
|
if (ImGui::Button(TEXT("Vehicle.ResetColor"), ImVec2(Ui::GetSize())))
|
||||||
@ -1115,6 +1115,7 @@ void Vehicle::ShowPage()
|
|||||||
{
|
{
|
||||||
if (ImGui::BeginTabItem(TEXT("Vehicle.NeonsTab")))
|
if (ImGui::BeginTabItem(TEXT("Vehicle.NeonsTab")))
|
||||||
{
|
{
|
||||||
|
int model = veh->m_nModelIndex;
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
if (ImGui::Button(TEXT("Vehicle.RemoveNeon"), ImVec2(Ui::GetSize())))
|
if (ImGui::Button(TEXT("Vehicle.RemoveNeon"), ImVec2(Ui::GetSize())))
|
||||||
{
|
{
|
||||||
@ -1140,8 +1141,11 @@ void Vehicle::ShowPage()
|
|||||||
|
|
||||||
if (ImGui::ColorEdit3(TEXT("Vehicle.ColorPicker"), m_Neon::m_fColorPicker))
|
if (ImGui::ColorEdit3(TEXT("Vehicle.ColorPicker"), m_Neon::m_fColorPicker))
|
||||||
{
|
{
|
||||||
Neon::Install(veh, m_Neon::m_fColorPicker[0] * 255, m_Neon::m_fColorPicker[1] * 255,
|
int r = static_cast<int>(m_Neon::m_fColorPicker[0] * 255);
|
||||||
m_Neon::m_fColorPicker[2] * 255);
|
int g = static_cast<int>(m_Neon::m_fColorPicker[1] * 255);
|
||||||
|
int b = static_cast<int>(m_Neon::m_fColorPicker[2] * 255);
|
||||||
|
|
||||||
|
Neon::Install(veh, r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1158,10 +1162,14 @@ void Vehicle::ShowPage()
|
|||||||
|
|
||||||
for (int color_id = 0; color_id < count; ++color_id)
|
for (int color_id = 0; color_id < count; ++color_id)
|
||||||
{
|
{
|
||||||
if (Ui::ColorButton(color_id, m_CarcolsColorData[color_id], ImVec2(btnSize, btnSize)))
|
auto& color = m_CarcolsColorData[color_id];
|
||||||
|
if (Ui::ColorButton(color_id, color, ImVec2(btnSize, btnSize)))
|
||||||
{
|
{
|
||||||
std::vector<float>& color = m_CarcolsColorData[color_id];
|
int r = static_cast<int>(color[0] * 255);
|
||||||
Neon::Install(veh, color[0] * 255, color[1] * 255, color[2] * 255);
|
int g = static_cast<int>(color[1] * 255);
|
||||||
|
int b = static_cast<int>(color[2] * 255);
|
||||||
|
|
||||||
|
Neon::Install(veh, r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((color_id + 1) % btnsInRow != 0)
|
if ((color_id + 1) % btnsInRow != 0)
|
||||||
@ -1175,7 +1183,7 @@ void Vehicle::ShowPage()
|
|||||||
}
|
}
|
||||||
if (ImGui::BeginTabItem(TEXT("Vehicle.TextureTab")))
|
if (ImGui::BeginTabItem(TEXT("Vehicle.TextureTab")))
|
||||||
{
|
{
|
||||||
Paint::GenerateNodeList(veh, m_Paint::m_vecNames);
|
Paint::GenerateNodeList(veh, m_Paint::m_vecNames, m_Paint::m_Selected);
|
||||||
|
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
if (ImGui::Button(TEXT("Vehicle.ResetTexture"), ImVec2(Ui::GetSize())))
|
if (ImGui::Button(TEXT("Vehicle.ResetTexture"), ImVec2(Ui::GetSize())))
|
||||||
@ -1188,29 +1196,41 @@ void Vehicle::ShowPage()
|
|||||||
Ui::ListBoxStr(TEXT("Vehicle.Component"), m_Paint::m_vecNames, m_Paint::m_Selected);
|
Ui::ListBoxStr(TEXT("Vehicle.Component"), m_Paint::m_vecNames, m_Paint::m_Selected);
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
|
|
||||||
|
ImGui::Columns(2, NULL, false);
|
||||||
|
ImGui::Checkbox(TEXT("Vehicle.MatFilter"), &m_Paint::m_bMatFilter);
|
||||||
|
ImGui::NextColumn();
|
||||||
int maxpjob, curpjob;
|
int maxpjob, curpjob;
|
||||||
Command<Commands::GET_NUM_AVAILABLE_PAINTJOBS>(hveh, &maxpjob);
|
Command<Commands::GET_NUM_AVAILABLE_PAINTJOBS>(hveh, &maxpjob);
|
||||||
|
|
||||||
if (maxpjob > 0)
|
if (maxpjob > 0)
|
||||||
{
|
{
|
||||||
Command<Commands::GET_CURRENT_VEHICLE_PAINTJOB>(hveh, &curpjob);
|
Command<Commands::GET_CURRENT_VEHICLE_PAINTJOB>(hveh, &curpjob);
|
||||||
|
|
||||||
if (ImGui::InputInt(TEXT("Vehicle.Paintjob"), &curpjob))
|
if (ImGui::ArrowButton("Left", ImGuiDir_Left))
|
||||||
{
|
{
|
||||||
if (curpjob > maxpjob)
|
curpjob -= 1;
|
||||||
curpjob = -1;
|
|
||||||
if (curpjob < -1)
|
if (curpjob < -1)
|
||||||
curpjob = maxpjob - 1;
|
{
|
||||||
|
curpjob = maxpjob - 1;
|
||||||
|
}
|
||||||
|
Command<Commands::GIVE_VEHICLE_PAINTJOB>(hveh, curpjob);
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Text("%s: %d",TEXT("Vehicle.Paintjob"), curpjob+2);
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::ArrowButton("Right", ImGuiDir_Right))
|
||||||
|
{
|
||||||
|
curpjob += 1;
|
||||||
|
if (curpjob > maxpjob)
|
||||||
|
{
|
||||||
|
curpjob = -1;
|
||||||
|
}
|
||||||
Command<Commands::GIVE_VEHICLE_PAINTJOB>(hveh, curpjob);
|
Command<Commands::GIVE_VEHICLE_PAINTJOB>(hveh, curpjob);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
}
|
}
|
||||||
|
ImGui::Columns(1);
|
||||||
ImGui::Spacing();
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::Checkbox(TEXT("Vehicle.MatFilter"), &m_Paint::m_bMatFilter);
|
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
Ui::DrawImages(Paint::m_TextureData,
|
Ui::DrawImages(Paint::m_TextureData,
|
||||||
[](std::string& str)
|
[](std::string& str)
|
||||||
|
Loading…
Reference in New Issue
Block a user