diff --git a/Runtime/CRandom16.cpp b/Runtime/CRandom16.cpp index 4cf44ec54..31b3921ab 100644 --- a/Runtime/CRandom16.cpp +++ b/Runtime/CRandom16.cpp @@ -6,9 +6,12 @@ CRandom16* CRandom16::g_randomNumber = nullptr; // &DefaultRandom CGlobalRandom* CGlobalRandom::g_currentGlobalRandom = nullptr; //&DefaultGlobalRandom; namespace { u32 g_numNextCalls = 0; +u32 g_lastSeed = 0; }; void CRandom16::IncrementNumNextCalls() { ++g_numNextCalls; } u32 CRandom16::GetNumNextCalls() { return g_numNextCalls; } void CRandom16::ResetNumNextCalls() { g_numNextCalls = 0; } +u32 CRandom16::GetLastSeed() { return g_lastSeed; } +void CRandom16::SetLastSeed(u32 seed) { g_lastSeed = seed; } } // namespace metaforce diff --git a/Runtime/CRandom16.hpp b/Runtime/CRandom16.hpp index 1a8e9ff05..1ddfacd3a 100644 --- a/Runtime/CRandom16.hpp +++ b/Runtime/CRandom16.hpp @@ -14,6 +14,7 @@ public: s32 Next() { IncrementNumNextCalls(); m_seed = (m_seed * 0x41c64e6d) + 0x00003039; + SetLastSeed(m_seed); return (m_seed >> 16) & 0xffff; } @@ -32,6 +33,8 @@ public: static void IncrementNumNextCalls(); static u32 GetNumNextCalls(); static void ResetNumNextCalls(); + static u32 GetLastSeed(); + static void SetLastSeed(u32 seed); }; class CGlobalRandom { diff --git a/Runtime/Character/CModelData.cpp b/Runtime/Character/CModelData.cpp index 7c5e5c51d..edb68451f 100644 --- a/Runtime/Character/CModelData.cpp +++ b/Runtime/Character/CModelData.cpp @@ -360,6 +360,21 @@ void CModelData::Render(EWhichModel which, const zeus::CTransform& xf, const CAc x14_24_renderSorted = false; } +void CModelData::FlatDraw(EWhichModel which, const zeus::CTransform& xf, bool unsortedOnly, const CModelFlags& flags) { + g_Renderer->SetModelMatrix(xf * zeus::CTransform::Scale(x0_scale)); + CGraphics::DisableAllLights(); + if (!x10_animData) { + g_Renderer->DrawModelFlat(*PickStaticModel(which), flags, unsortedOnly, nullptr, nullptr); + } else { + auto model = PickAnimatedModel(which); + x10_animData->SetupRender(model, nullptr, nullptr); + model.DoDrawCallback([=](TConstVectorRef positions, TConstVectorRef normals) { + auto m = model.GetModel(); + g_Renderer->DrawModelFlat(*m, flags, unsortedOnly, positions, normals); + }); + } +} + void CModelData::MultiLightingDraw(EWhichModel which, const zeus::CTransform& xf, const CActorLights* lights, const zeus::CColor& alphaColor, const zeus::CColor& additiveColor) { CModel* model = nullptr; diff --git a/Runtime/Character/CModelData.hpp b/Runtime/Character/CModelData.hpp index 46f37b511..ce9bf2ba2 100644 --- a/Runtime/Character/CModelData.hpp +++ b/Runtime/Character/CModelData.hpp @@ -121,6 +121,7 @@ public: void Render(const CStateManager& stateMgr, const zeus::CTransform& xf, const CActorLights* lights, const CModelFlags& drawFlags); void Render(EWhichModel, const zeus::CTransform& xf, const CActorLights* lights, const CModelFlags& drawFlags); + void FlatDraw(EWhichModel which, const zeus::CTransform& xf, bool unsortedOnly, const CModelFlags& flags); void MultiLightingDraw(EWhichModel which, const zeus::CTransform& xf, const CActorLights* lights, const zeus::CColor& alphaColor, const zeus::CColor& additiveColor); diff --git a/Runtime/ImGuiConsole.cpp b/Runtime/ImGuiConsole.cpp index 34236e1fd..b8d118862 100644 --- a/Runtime/ImGuiConsole.cpp +++ b/Runtime/ImGuiConsole.cpp @@ -941,6 +941,7 @@ void ImGuiConsole::ShowDebugOverlay() { ImGuiStringViewText( fmt::format(FMT_STRING("CRandom16::Next calls: {}\n"), metaforce::CRandom16::GetNumNextCalls())); + ImGuiStringViewText(fmt::format(FMT_STRING("CRandom16::LastSeed: 0x{:08X}\n"), CRandom16::GetLastSeed())); } if (m_resourceStats && g_SimplePool != nullptr) { if (hasPrevious) { diff --git a/Runtime/Weapon/CGunWeapon.cpp b/Runtime/Weapon/CGunWeapon.cpp index f3c93627d..b3cb91c1e 100644 --- a/Runtime/Weapon/CGunWeapon.cpp +++ b/Runtime/Weapon/CGunWeapon.cpp @@ -7,6 +7,7 @@ #include "Runtime/CGameState.hpp" #include "Runtime/CSimplePool.hpp" #include "Runtime/GameGlobalObjects.hpp" +#include "Runtime/Graphics/CCubeRenderer.hpp" #include "Runtime/Graphics/CSkinnedModel.hpp" #include "Runtime/Graphics/CVertexMorphEffect.hpp" #include "Runtime/Weapon/CEnergyProjectile.hpp" @@ -503,17 +504,15 @@ void CGunWeapon::DrawHologram(const CStateManager& mgr, const zeus::CTransform& // TODO if (x218_29_drawHologram) { CModelFlags useFlags = flags; - // useFlags.m_extendedShader = EExtendedShader::Flat; - x60_holoModelData->Render(CModelData::EWhichModel::Normal, xf, nullptr, useFlags); + x60_holoModelData->FlatDraw(CModelData::EWhichModel::Normal, xf, false, useFlags); } else { CGraphics::SetModelMatrix(xf * zeus::CTransform::Scale(x10_solidModelData->GetScale())); - // CGraphics::DisableAllLights(); - // g_Renderer->SetAmbientColor(zeus::skWhite); + CGraphics::DisableAllLights(); + g_Renderer->SetAmbientColor(zeus::skWhite); CSkinnedModel& model = *x60_holoModelData->GetAnimationData()->GetModelData(); - // model.GetModelInst()->ActivateLights({CLight::BuildLocalAmbient({}, zeus::skWhite)}); x10_solidModelData->GetAnimationData()->Render(model, flags, nullptr, nullptr); - // g_Renderer->SetAmbientColor(zeus::skWhite); - // CGraphics::DisableAllLights(); + g_Renderer->SetAmbientColor(zeus::skWhite); + CGraphics::DisableAllLights(); } }