diff --git a/Runtime/CSortedLists.cpp b/Runtime/CSortedLists.cpp index 57d68a380..1b171ede1 100644 --- a/Runtime/CSortedLists.cpp +++ b/Runtime/CSortedLists.cpp @@ -213,7 +213,7 @@ s16 CSortedListManager::CalculateIntersections(ESortedList la, ESortedList lb, s for (int i=0 ; i aabb[int(lb)]) + if (AccessElement(x0_nodes, id).x4_box[int(lb)] > aabb[int(lb)]) AddToLinkedList(id, headId, tailId); } } @@ -222,7 +222,7 @@ s16 CSortedListManager::CalculateIntersections(ESortedList la, ESortedList lb, s for (int i=d ; i& out, const zeus::CVector3f& v1, - const zeus::CVector3f& v2, float f1, const CMaterialFilter& filter, +void CSortedListManager::BuildNearList(rstl::reserved_vector& out, const zeus::CVector3f& pos, + const zeus::CVector3f& dir, float mag, const CMaterialFilter& filter, const CActor* actor) const { - if (f1 == 0.f) - f1 = 8000.f; - zeus::CVector3f mul = v2 * f1; - zeus::CVector3f sum = mul + v1; - zeus::CVector3f maxs(std::max(v1.z, sum.z), std::max(v1.y, sum.y), std::max(v1.x, sum.x)); - zeus::CVector3f mins(std::min(sum.z, v1.z), std::min(sum.y, v1.y), std::min(sum.y, v1.y)); + if (mag == 0.f) + mag = 8000.f; + zeus::CVector3f ray = dir * mag; + zeus::CVector3f sum = ray + pos; + zeus::CVector3f maxs(std::max(pos.z, sum.z), std::max(pos.y, sum.y), std::max(pos.x, sum.x)); + zeus::CVector3f mins(std::min(sum.z, pos.z), std::min(sum.y, pos.y), std::min(sum.y, pos.y)); BuildNearList(out, zeus::CAABox(mins, maxs), filter, actor); } diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index 5b263e862..b97fd9a9e 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -2339,7 +2339,18 @@ void CStateManager::RemoveObject(TUniqueId uid) if (CEntity* ent = GetAllObjectList().GetValidObjectById(uid)) { if (ent->GetEditorId() != kInvalidEditorId) - x890_scriptIdMap.erase(ent->GetEditorId()); + { + auto search = x890_scriptIdMap.equal_range(ent->GetEditorId()); + for (auto it = search.first; it != search.second;) + { + if (it->second == uid) + { + it = x890_scriptIdMap.erase(it); + continue; + } + ++it; + } + } if (ent->GetAreaIdAlways() != kInvalidAreaId) { CGameArea* area = x850_world->GetArea(ent->GetAreaIdAlways()); diff --git a/Runtime/World/CScriptColorModulate.hpp b/Runtime/World/CScriptColorModulate.hpp index eef618114..65f29be48 100644 --- a/Runtime/World/CScriptColorModulate.hpp +++ b/Runtime/World/CScriptColorModulate.hpp @@ -27,7 +27,7 @@ public: private: TUniqueId x34_parent = kInvalidUniqueId; EFadeState x38_fadeState = EFadeState::A2B; - float x3c_curTime; + float x3c_curTime = 0.f; zeus::CColor x40_colorA; zeus::CColor x44_colorB; EBlendMode x48_blendMode; diff --git a/Runtime/World/CScriptDebris.cpp b/Runtime/World/CScriptDebris.cpp index 758d48dd7..824eda949 100644 --- a/Runtime/World/CScriptDebris.cpp +++ b/Runtime/World/CScriptDebris.cpp @@ -396,7 +396,7 @@ void CScriptDebris::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) if (t < x2a4_colorInT) t = x2a4_colorInT > 0.f ? 1.f - x270_curTime / (x274_duration * x2a4_colorInT) : 0.f; else if (t > x2a8_colorOutT) - t = (x270_curTime - x274_duration * x2a8_colorOutT) / x274_duration * (1.f - x2a8_colorOutT); + t = (x270_curTime - x274_duration * x2a8_colorOutT) / (x274_duration * (1.f - x2a8_colorOutT)); else t = 0.f;