mirror of https://github.com/AxioDL/metaforce.git
Actor highlighting on selection
This commit is contained in:
parent
65e00a701a
commit
c968e73f21
|
@ -120,6 +120,22 @@ static void ShowMenuGame() {
|
|||
}
|
||||
}
|
||||
|
||||
static void ImGuiStringViewText(std::string_view text) {
|
||||
ImGui::TextUnformatted(text.begin(), text.end());
|
||||
}
|
||||
|
||||
static void LerpActorColor(CActor* act) {
|
||||
act->m_debugAddColorTime += 1.f / 60.f;
|
||||
float lerp = act->m_debugAddColorTime;
|
||||
if (lerp > 2.f) {
|
||||
lerp = 0.f;
|
||||
act->m_debugAddColorTime = 0.f;
|
||||
} else if (lerp > 1.f) {
|
||||
lerp = 2.f - lerp;
|
||||
}
|
||||
act->m_debugAddColor = zeus::CColor::lerp(zeus::skClear, zeus::skBlue, lerp);
|
||||
}
|
||||
|
||||
static void ShowInspectWindow(bool* isOpen) {
|
||||
if (ImGui::Begin("Inspect", isOpen)) {
|
||||
if (ImGui::BeginTable("Entities", 4,
|
||||
|
@ -167,13 +183,21 @@ static void ShowInspectWindow(bool* isOpen) {
|
|||
ImGui::PushID(uid.Value());
|
||||
ImGui::TableNextRow();
|
||||
if (ImGui::TableNextColumn()) {
|
||||
ImGui::Text("%x", uid.Value());
|
||||
auto text = fmt::format(FMT_STRING("{:x}"), uid.Value());
|
||||
if (TCastToPtr<CActor> act = item) {
|
||||
ImGui::Selectable(text.c_str(), &act->m_debugSelected, ImGuiSelectableFlags_SpanAllColumns);
|
||||
if (act->m_debugSelected) {
|
||||
LerpActorColor(act);
|
||||
}
|
||||
} else {
|
||||
ImGui::TextUnformatted(text.c_str());
|
||||
}
|
||||
}
|
||||
if (ImGui::TableNextColumn()) {
|
||||
ImGui::Text("%s", item->ImGuiType().data());
|
||||
ImGuiStringViewText(item->ImGuiType());
|
||||
}
|
||||
if (ImGui::TableNextColumn()) {
|
||||
ImGui::Text("%s", item->GetName().data());
|
||||
ImGuiStringViewText(item->GetName());
|
||||
}
|
||||
if (ImGui::TableNextColumn()) {
|
||||
if (ImGui::SmallButton("View")) {
|
||||
|
|
|
@ -221,6 +221,9 @@ void CActor::RenderInternal(const CStateManager& mgr) const {
|
|||
|
||||
zeus::CColor mulColor(mulMag * xb4_drawFlags.x4_color.a(), xb4_drawFlags.x4_color.a());
|
||||
zeus::CColor addColor(addMag, xb4_drawFlags.x4_color.a() / 4.f);
|
||||
if (m_debugSelected) {
|
||||
addColor += m_debugAddColor;
|
||||
}
|
||||
x64_modelData->RenderThermal(x34_transform, mulColor, addColor, xb4_drawFlags);
|
||||
return;
|
||||
} else if (mgr.GetThermalColdScale2() > 0.00001f && !xb4_drawFlags.x0_blendMode) {
|
||||
|
@ -231,11 +234,18 @@ void CActor::RenderInternal(const CStateManager& mgr) const {
|
|||
1.f),
|
||||
1.f);
|
||||
CModelFlags flags(2, xb4_drawFlags.x1_matSetIdx, xb4_drawFlags.x2_flags, color);
|
||||
if (m_debugSelected) {
|
||||
flags.addColor += m_debugAddColor;
|
||||
}
|
||||
x64_modelData->Render(mgr, x34_transform, x90_actorLights.get(), flags);
|
||||
return;
|
||||
}
|
||||
}
|
||||
x64_modelData->Render(which, x34_transform, x90_actorLights.get(), xb4_drawFlags);
|
||||
CModelFlags flags = xb4_drawFlags;
|
||||
if (m_debugSelected) {
|
||||
flags.addColor += m_debugAddColor;
|
||||
}
|
||||
x64_modelData->Render(which, x34_transform, x90_actorLights.get(), flags);
|
||||
}
|
||||
|
||||
bool CActor::IsModelOpaque(const CStateManager& mgr) const {
|
||||
|
|
|
@ -83,6 +83,10 @@ protected:
|
|||
bool IsModelOpaque(const CStateManager& mgr) const;
|
||||
|
||||
public:
|
||||
bool m_debugSelected = false;
|
||||
zeus::CColor m_debugAddColor = zeus::skClear;
|
||||
float m_debugAddColorTime = 0.f;
|
||||
|
||||
enum class EFluidState { EnteredFluid, InFluid, LeftFluid };
|
||||
|
||||
enum class EScanState {
|
||||
|
|
Loading…
Reference in New Issue