diff --git a/Editor/ViewManager.cpp b/Editor/ViewManager.cpp index 7e99c35c6..aafe46f73 100644 --- a/Editor/ViewManager.cpp +++ b/Editor/ViewManager.cpp @@ -365,14 +365,13 @@ bool ViewManager::proc() { } void ViewManager::stop() { - m_videoVoice.reset(); + m_mainWindow->getCommandQueue()->stopRenderer(); m_projManager.shutdown(); CDvdFile::Shutdown(); DestroyIcons(); DestroyBadging(); m_viewResources.destroyResData(); m_fontCache.destroyAtlases(); - m_mainWindow->getCommandQueue()->stopRenderer(); } } // namespace urde diff --git a/Editor/ViewManager.hpp b/Editor/ViewManager.hpp index a7ca299b1..6762f9e31 100644 --- a/Editor/ViewManager.hpp +++ b/Editor/ViewManager.hpp @@ -120,7 +120,6 @@ class ViewManager final : public specter::IViewManager { }; std::unique_ptr m_testGameView; std::unique_ptr m_voiceEngine; - std::unique_ptr m_videoVoice; std::optional m_amuseAllocWrapper; hecl::SystemString m_recentProjectsPath; diff --git a/Runtime/CRandom16.hpp b/Runtime/CRandom16.hpp index 08a614393..aa66b60fb 100644 --- a/Runtime/CRandom16.hpp +++ b/Runtime/CRandom16.hpp @@ -5,20 +5,20 @@ namespace urde { class CRandom16 { - u32 m_seed; + s32 m_seed; static CRandom16* g_randomNumber; public: - CRandom16(u32 p = 99) : m_seed(p) {} + CRandom16(s32 p = 99) : m_seed(p) {} - u32 Next() { + s32 Next() { m_seed = (m_seed * 0x41c64e6d) + 0x00003039; - return m_seed >> 16; + return (m_seed >> 16) & 0xffff; } - u32 GetSeed() const { return m_seed; } + s32 GetSeed() const { return m_seed; } - void SetSeed(u32 p) { m_seed = p; } + void SetSeed(s32 p) { m_seed = p; } float Float() { return Next() * 0.000015259022f; } diff --git a/Runtime/MP1/World/CBabygoth.cpp b/Runtime/MP1/World/CBabygoth.cpp index eb6db49a4..b2aa6a040 100644 --- a/Runtime/MP1/World/CBabygoth.cpp +++ b/Runtime/MP1/World/CBabygoth.cpp @@ -146,6 +146,8 @@ void CBabygoth::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateM case EScriptObjectMessage::InitializedInArea: { x6ec_pathSearch.SetArea(mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways())->GetPostConstructed()->x10bc_pathArea); x7d0_approachPathSearch.SetArea(mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways())->GetPostConstructed()->x10bc_pathArea); + if (x6e8_teamMgr == kInvalidUniqueId) + x6e8_teamMgr = CTeamAiMgr::GetTeamAiMgr(*this, mgr); break; } case EScriptObjectMessage::Touched: { @@ -1075,7 +1077,7 @@ bool CBabygoth::Leash(CStateManager& mgr, float) { } bool CBabygoth::IsDestinationObstructed(CStateManager& mgr) { - for (auto obj : mgr.GetListeningAiObjectList()) { + for (CEntity* obj : mgr.GetListeningAiObjectList()) { if (TCastToPtr ai = obj) { if (ai->GetAreaIdAlways() == GetAreaIdAlways()) { if ((x8b8_backupDestPos - ai->GetTranslation()).magSquared() <= 10.f) @@ -1128,9 +1130,9 @@ float CBabygoth::CalculateShellCrackHP(EShellState state) { if (state == EShellState::Default) return x570_babyData.GetShellHitPoints(); else if (state == EShellState::CrackOne) - return 0.66666669f * x570_babyData.GetShellHitPoints(); + return (2.f / 3.f) * x570_babyData.GetShellHitPoints(); else if (state == EShellState::CrackTwo) - return 0.33333334f * x570_babyData.GetShellHitPoints(); + return (1.f / 3.f) * x570_babyData.GetShellHitPoints(); return 0.f; } @@ -1139,7 +1141,7 @@ bool CBabygoth::ShouldTurn(CStateManager& mgr, float arg) { const float speedScale = GetModelData()->GetAnimationData()->GetSpeedScale(); zeus::CVector3f aimPos = mgr.GetPlayer().GetAimPosition(mgr, (speedScale > 0.f ? 1.f / speedScale : 0.f)); return zeus::CVector2f::getAngleDiff(GetTransform().basis[1].toVec2f(), (aimPos - GetTranslation()).toVec2f()) > - (arg == 0.f ? 0.78539819f : arg); + (arg == 0.f ? zeus::degToRad(45.f) : arg); } bool CBabygoth::ShouldAttack(CStateManager& mgr, float arg) { diff --git a/Runtime/Particle/CFlameWarp.cpp b/Runtime/Particle/CFlameWarp.cpp index 8672ee8c3..8f0c130d1 100644 --- a/Runtime/Particle/CFlameWarp.cpp +++ b/Runtime/Particle/CFlameWarp.cpp @@ -44,7 +44,7 @@ void CFlameWarp::ModifyParticles(std::vector& particles) { if (result.IsValid()) { float dist = result.GetPlane().pointToPlaneDist(particle.x4_pos); if (dist <= 0.f) { - particle.x4_pos = -result.GetPlane().normal() * dist; + particle.x4_pos -= result.GetPlane().normal() * dist; if (result.GetPlane().normal().dot(particle.x1c_vel) < 0.f) { zeus::CVector3f prevStepPos = particle.x4_pos - particle.x1c_vel; particle.x4_pos +=