* Revert "change DragInt to SliderInt (#3378)" This reverts outfit changes from commitc1f68cb632
. * Revert "Redesigned outfit editor (#3376)" This reverts commit5b82fc06fa
. * fix components text and draw should not be -1
This commit is contained in:
parent
c15c57335f
commit
c22314c2c0
@ -38,20 +38,20 @@ namespace big::outfit
|
|||||||
{7, "OUTFIT_WRIST"_T.data()}};
|
{7, "OUTFIT_WRIST"_T.data()}};
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void check_bounds_drawable(outfit_t* item)
|
inline void check_bounds_drawable(outfit_t* item, const int lower)
|
||||||
{
|
{
|
||||||
if(item->drawable_id > item->drawable_id_max)
|
if(item->drawable_id > item->drawable_id_max)
|
||||||
item->drawable_id = item->drawable_id_max;
|
item->drawable_id = item->drawable_id_max;
|
||||||
if(item->drawable_id < 0)
|
if(item->drawable_id < lower)
|
||||||
item->drawable_id = 0;
|
item->drawable_id = lower;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void check_bounds_texture(outfit_t* item)
|
inline void check_bounds_texture(outfit_t* item, const int lower)
|
||||||
{
|
{
|
||||||
if(item->texture_id > item->texture_id_max)
|
if(item->texture_id > item->texture_id_max)
|
||||||
item->texture_id = item->texture_id_max;
|
item->texture_id = item->texture_id_max;
|
||||||
if(item->texture_id < 0)
|
if(item->texture_id < lower)
|
||||||
item->texture_id = 0;
|
item->texture_id = lower;
|
||||||
}
|
}
|
||||||
|
|
||||||
// usually each update increases 1//
|
// usually each update increases 1//
|
||||||
|
@ -106,17 +106,14 @@ namespace big
|
|||||||
for (auto& item : components.items)
|
for (auto& item : components.items)
|
||||||
{
|
{
|
||||||
ImGui::SetNextItemWidth(120);
|
ImGui::SetNextItemWidth(120);
|
||||||
if (item.drawable_id_max <= 0)
|
if (ImGui::InputInt(std::format("{} [0,{}]##1", item.label, item.drawable_id_max).c_str(), &item.drawable_id))
|
||||||
ImGui::BeginDisabled();
|
|
||||||
if (ImGui::SliderInt(std::format("{} [0,{}]##1", item.label, item.drawable_id_max).c_str(), &item.drawable_id, 0, item.drawable_id_max))
|
|
||||||
{
|
{
|
||||||
//outfit::check_bounds_drawable(&item); // The game does this on its own, but seems to crash if we call OOB values to fast. (-1 is not a valid scenario)
|
outfit::check_bounds_drawable(&item, 0); // The game does this on it's own but seems to crash if we call OOB values to fast.
|
||||||
|
|
||||||
g_fiber_pool->queue_job([item] {
|
g_fiber_pool->queue_job([item] {
|
||||||
PED::SET_PED_COMPONENT_VARIATION(self::ped, item.id, item.drawable_id, 0, PED::GET_PED_PALETTE_VARIATION(self::ped, item.id));
|
PED::SET_PED_COMPONENT_VARIATION(self::ped, item.id, item.drawable_id, 0, PED::GET_PED_PALETTE_VARIATION(self::ped, item.id));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (item.drawable_id_max <= 0)
|
|
||||||
ImGui::EndDisabled();
|
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
|
|
||||||
@ -126,17 +123,14 @@ namespace big
|
|||||||
for (auto& item : components.items)
|
for (auto& item : components.items)
|
||||||
{
|
{
|
||||||
ImGui::SetNextItemWidth(120);
|
ImGui::SetNextItemWidth(120);
|
||||||
if (item.texture_id_max <= 0)
|
if (ImGui::InputInt(std::format("{} {} [0,{}]##2", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), &item.texture_id))
|
||||||
ImGui::BeginDisabled();
|
|
||||||
if (ImGui::SliderInt(std::format("{} {} [0,{}]##2", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), &item.texture_id, 0, item.texture_id_max))
|
|
||||||
{
|
{
|
||||||
//outfit::check_bounds_drawable(&item); // The game does this on its own, but seems to crash if we call OOB values to fast. (-1 is not a valid scenario)
|
outfit::check_bounds_texture(&item, 0); // The game does this on it's own but seems to crash if we call OOB values to fast.
|
||||||
|
|
||||||
g_fiber_pool->queue_job([item] {
|
g_fiber_pool->queue_job([item] {
|
||||||
PED::SET_PED_COMPONENT_VARIATION(self::ped, item.id, item.drawable_id, item.texture_id, PED::GET_PED_PALETTE_VARIATION(self::ped, item.id));
|
PED::SET_PED_COMPONENT_VARIATION(self::ped, item.id, item.drawable_id, item.texture_id, PED::GET_PED_PALETTE_VARIATION(self::ped, item.id));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (item.texture_id_max <= 0)
|
|
||||||
ImGui::EndDisabled();
|
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
|
|
||||||
@ -146,11 +140,10 @@ namespace big
|
|||||||
for (auto& item : props.items)
|
for (auto& item : props.items)
|
||||||
{
|
{
|
||||||
ImGui::SetNextItemWidth(120);
|
ImGui::SetNextItemWidth(120);
|
||||||
if (item.drawable_id_max <= 0)
|
if (ImGui::InputInt(std::format("{} [0,{}]##3", item.label, item.drawable_id_max).c_str(), &item.drawable_id))
|
||||||
ImGui::BeginDisabled();
|
|
||||||
if (ImGui::SliderInt(std::format("{} [0,{}]##3", item.label, item.drawable_id_max).c_str(), &item.drawable_id, -1, item.drawable_id_max))
|
|
||||||
{
|
{
|
||||||
//outfit::check_bounds_drawable(&item); // The game does this on its own, but seems to crash if we call OOB values to fast. (-1 is only used here as a magic number to signal the removal of the prop.)
|
outfit::check_bounds_drawable(&item, -1); // The game does this on it's own but seems to crash if we call OOB values to fast.
|
||||||
|
|
||||||
g_fiber_pool->queue_job([item] {
|
g_fiber_pool->queue_job([item] {
|
||||||
if (item.drawable_id == -1)
|
if (item.drawable_id == -1)
|
||||||
PED::CLEAR_PED_PROP(self::ped, item.id, 1);
|
PED::CLEAR_PED_PROP(self::ped, item.id, 1);
|
||||||
@ -158,8 +151,6 @@ namespace big
|
|||||||
PED::SET_PED_PROP_INDEX(self::ped, item.id, item.drawable_id, 0, TRUE, 1);
|
PED::SET_PED_PROP_INDEX(self::ped, item.id, item.drawable_id, 0, TRUE, 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (item.drawable_id_max <= 0)
|
|
||||||
ImGui::EndDisabled();
|
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
|
|
||||||
@ -169,17 +160,14 @@ namespace big
|
|||||||
for (auto& item : props.items)
|
for (auto& item : props.items)
|
||||||
{
|
{
|
||||||
ImGui::SetNextItemWidth(120);
|
ImGui::SetNextItemWidth(120);
|
||||||
if (item.texture_id_max <= 0)
|
if (ImGui::InputInt(std::format("{} {} [0,{}]##4", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), &item.texture_id))
|
||||||
ImGui::BeginDisabled();
|
|
||||||
if (ImGui::SliderInt(std::format("{} {} [0,{}]##4", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), &item.texture_id, 0, item.texture_id_max))
|
|
||||||
{
|
{
|
||||||
//outfit::check_bounds_drawable(&item); // The game does this on its own, but seems to crash if we call OOB values to fast. (-1 is not a valid scenario)
|
outfit::check_bounds_texture(&item, -1); // The game does this on it's own but seems to crash if we call OOB values to fast.
|
||||||
|
|
||||||
g_fiber_pool->queue_job([item] {
|
g_fiber_pool->queue_job([item] {
|
||||||
PED::SET_PED_PROP_INDEX(self::ped, item.id, item.drawable_id, item.texture_id, TRUE, 1);
|
PED::SET_PED_PROP_INDEX(self::ped, item.id, item.drawable_id, item.texture_id, TRUE, 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (item.texture_id_max <= 0)
|
|
||||||
ImGui::EndDisabled();
|
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ namespace big
|
|||||||
for (auto& item : components.items)
|
for (auto& item : components.items)
|
||||||
{
|
{
|
||||||
ImGui::SetNextItemWidth(120);
|
ImGui::SetNextItemWidth(120);
|
||||||
ImGui::SliderInt(std::format("{} [0,{}]##1", item.label, item.drawable_id_max).c_str(), outfit::get_component_drawable_id_address(slot, item.id), 0, item.drawable_id_max);
|
ImGui::InputInt(std::format("{} [0,{}]##1", item.label, item.drawable_id_max).c_str(), outfit::get_component_drawable_id_address(slot, item.id));
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ namespace big
|
|||||||
for (auto& item : components.items)
|
for (auto& item : components.items)
|
||||||
{
|
{
|
||||||
ImGui::SetNextItemWidth(120);
|
ImGui::SetNextItemWidth(120);
|
||||||
ImGui::SliderInt(std::format("{} {} [0,{}]##2", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), outfit::get_component_texture_id_address(slot, item.id), 0, item.texture_id_max);
|
ImGui::InputInt(std::format("{} {} [0,{}]##2", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), outfit::get_component_texture_id_address(slot, item.id));
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ namespace big
|
|||||||
for (auto& item : props.items)
|
for (auto& item : props.items)
|
||||||
{
|
{
|
||||||
ImGui::SetNextItemWidth(120);
|
ImGui::SetNextItemWidth(120);
|
||||||
ImGui::SliderInt(std::format("{} [0,{}]##3", item.label, item.drawable_id_max).c_str(), outfit::get_prop_drawable_id_address(slot, item.id), 0, item.drawable_id_max);
|
ImGui::InputInt(std::format("{} [0,{}]##3", item.label, item.drawable_id_max).c_str(), outfit::get_prop_drawable_id_address(slot, item.id));
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ namespace big
|
|||||||
for (auto& item : props.items)
|
for (auto& item : props.items)
|
||||||
{
|
{
|
||||||
ImGui::SetNextItemWidth(120);
|
ImGui::SetNextItemWidth(120);
|
||||||
ImGui::SliderInt(std::format("{} {} [0,{}]##4", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), outfit::get_prop_texture_id_address(slot, item.id), 0, item.texture_id_max);
|
ImGui::InputInt(std::format("{} {} [0,{}]##4", item.label, "OUTFIT_TEX"_T, item.texture_id_max).c_str(), outfit::get_prop_texture_id_address(slot, item.id));
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user