Bug fixes

This commit is contained in:
Jack Andersen 2017-11-28 00:06:40 -10:00
parent 5ed7bd7c45
commit 7951cb1ee0
10 changed files with 36 additions and 30 deletions

View File

@ -177,15 +177,21 @@ u16 CSfxManager::CSfxEmitterWrapper::GetSfxId() const
void CSfxManager::CSfxEmitterWrapper::UpdateEmitterSilent() void CSfxManager::CSfxEmitterWrapper::UpdateEmitterSilent()
{ {
x50_emitterHandle->setVectors(x24_parmData.x0_pos.v, x24_parmData.xc_dir.v); if (x50_emitterHandle)
x50_emitterHandle->setMaxVol(1.f / 127.f); {
x50_emitterHandle->setVectors(x24_parmData.x0_pos.v, x24_parmData.xc_dir.v);
x50_emitterHandle->setMaxVol(1.f / 127.f);
}
x55_cachedMaxVol = x24_parmData.x26_maxVol; x55_cachedMaxVol = x24_parmData.x26_maxVol;
} }
void CSfxManager::CSfxEmitterWrapper::UpdateEmitter() void CSfxManager::CSfxEmitterWrapper::UpdateEmitter()
{ {
x50_emitterHandle->setVectors(x24_parmData.x0_pos.v, x24_parmData.xc_dir.v); if (x50_emitterHandle)
x50_emitterHandle->setMaxVol(x55_cachedMaxVol); {
x50_emitterHandle->setVectors(x24_parmData.x0_pos.v, x24_parmData.xc_dir.v);
x50_emitterHandle->setMaxVol(x55_cachedMaxVol);
}
} }
void CSfxManager::CSfxEmitterWrapper::SetReverb(float rev) void CSfxManager::CSfxEmitterWrapper::SetReverb(float rev)

View File

@ -79,8 +79,7 @@ zeus::CTransform CGameCamera::ValidateCameraTransform(const zeus::CTransform& a,
if ((a.rightVector().magnitude() - 1.f) >= epsilon || (a.frontVector().magnitude() - 1.f) >= epsilon || if ((a.rightVector().magnitude() - 1.f) >= epsilon || (a.frontVector().magnitude() - 1.f) >= epsilon ||
(a.upVector().magnitude() - 1.f) >= epsilon) (a.upVector().magnitude() - 1.f) >= epsilon)
xfCpy.orthonormalize(); xfCpy.orthonormalize();
float f2 = zeus::CVector3f::skUp.x + a.upVector().x * a.upVector().y * a.upVector().z * float f2 = a.basis[1].dot(zeus::CVector3f::skUp);
zeus::CVector3f::skUp.y + zeus::CVector3f::skUp.z;
if (std::fabs(f2) > 1.0f) if (std::fabs(f2) > 1.0f)
f2 = (f2 >= -0.f ? -1.0f : 1.0f); f2 = (f2 >= -0.f ? -1.0f : 1.0f);
if (std::fabs(f2) > 0.999f) if (std::fabs(f2) > 0.999f)
@ -89,7 +88,7 @@ zeus::CTransform CGameCamera::ValidateCameraTransform(const zeus::CTransform& a,
if (xfCpy.upVector().z < -0.2f) if (xfCpy.upVector().z < -0.2f)
xfCpy = zeus::CQuaternion::fromAxisAngle(xfCpy.frontVector(), M_PIF).toTransform() * xfCpy; xfCpy = zeus::CQuaternion::fromAxisAngle(xfCpy.frontVector(), M_PIF).toTransform() * xfCpy;
if (std::fabs(xfCpy.rightVector().z - 0.f) >= 0.000009f && std::fabs(xfCpy.upVector().z - 0.f) > 0.000009f) if (std::fabs(xfCpy.rightVector().z) >= 0.000009f && std::fabs(xfCpy.upVector().z) > 0.000009f)
{ {
if (xfCpy.frontVector().canBeNormalized()) if (xfCpy.frontVector().canBeNormalized())
xfCpy = zeus::lookAt(zeus::CUnitVector3f(xfCpy.frontVector(), true), zeus::CVector3f::skZero); xfCpy = zeus::lookAt(zeus::CUnitVector3f(xfCpy.frontVector(), true), zeus::CVector3f::skZero);

View File

@ -594,8 +594,8 @@ void CGroundMovement::MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor&
result.x8_collision.emplace(collisionInfo); result.x8_collision.emplace(collisionInfo);
} }
if (!result.x8_collision->IsValid() || if (!collisionInfo.IsValid() ||
!CGameCollision::CanBlock(result.x8_collision->GetMaterialLeft(), result.x8_collision->GetNormalLeft())) !CGameCollision::CanBlock(collisionInfo.GetMaterialLeft(), collisionInfo.GetNormalLeft()))
{ {
if (zOffset > 0.f) if (zOffset > 0.f)
{ {
@ -603,7 +603,7 @@ void CGroundMovement::MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor&
xf.origin -= zeus::CVector3f(0.f, 0.f, zOffset); xf.origin -= zeus::CVector3f(0.f, 0.f, zOffset);
} }
if (result.x8_collision->IsValid()) if (collisionInfo.IsValid())
player.x9c5_28_slidingOnWall = true; player.x9c5_28_slidingOnWall = true;
CheckFalling(actor, mgr, dt); CheckFalling(actor, mgr, dt);
player.SetLastFloorPlaneNormal({}); player.SetLastFloorPlaneNormal({});
@ -615,8 +615,8 @@ void CGroundMovement::MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor&
actor.SetTranslation(actor.GetTranslation() - zeus::CVector3f(0.f, 0.f, stepDown)); actor.SetTranslation(actor.GetTranslation() - zeus::CVector3f(0.f, 0.f, stepDown));
if (TCastToPtr<CScriptPlatform> plat = mgr.ObjectById(id)) if (TCastToPtr<CScriptPlatform> plat = mgr.ObjectById(id))
mgr.SendScriptMsg(plat.GetPtr(), actor.GetUniqueId(), EScriptObjectMessage::AddPlatformRider); mgr.SendScriptMsg(plat.GetPtr(), actor.GetUniqueId(), EScriptObjectMessage::AddPlatformRider);
CGameCollision::SendMaterialMessage(mgr, result.x8_collision->GetMaterialLeft(), actor); CGameCollision::SendMaterialMessage(mgr, collisionInfo.GetMaterialLeft(), actor);
actor.SetLastFloorPlaneNormal({result.x8_collision->GetNormalLeft()}); actor.SetLastFloorPlaneNormal({collisionInfo.GetNormalLeft()});
} }
} }

View File

@ -77,23 +77,23 @@ public:
CMaterialList(u64 flags) : x0_list(flags) {} CMaterialList(u64 flags) : x0_list(flags) {}
CMaterialList(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, EMaterialTypes t5, EMaterialTypes t6) CMaterialList(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, EMaterialTypes t5, EMaterialTypes t6)
: CMaterialList(t1, t2, t3, t4, t5) : CMaterialList(t1, t2, t3, t4, t5)
{ x0_list = 1ull << u64(t6); } { x0_list |= 1ull << u64(t6); }
CMaterialList(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, EMaterialTypes t5) CMaterialList(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, EMaterialTypes t5)
: CMaterialList(t1, t2, t3, t4) : CMaterialList(t1, t2, t3, t4)
{ x0_list = 1ull << u64(t5); } { x0_list |= 1ull << u64(t5); }
CMaterialList(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4) CMaterialList(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4)
: CMaterialList(t1, t2, t3) : CMaterialList(t1, t2, t3)
{ x0_list = 1ull << u64(t4); } { x0_list |= 1ull << u64(t4); }
CMaterialList(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3) CMaterialList(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3)
: CMaterialList(t1, t2) : CMaterialList(t1, t2)
{ x0_list = 1ull << u64(t3); } { x0_list |= 1ull << u64(t3); }
CMaterialList(EMaterialTypes t1, EMaterialTypes t2) CMaterialList(EMaterialTypes t1, EMaterialTypes t2)
: CMaterialList(t1) : CMaterialList(t1)
{ x0_list = 1ull << u64(t2); } { x0_list |= 1ull << u64(t2); }
CMaterialList(EMaterialTypes t1) CMaterialList(EMaterialTypes t1)
: x0_list(1ull << u64(t1)) : x0_list(1ull << u64(t1))

View File

@ -105,6 +105,7 @@ void CPhysicsActor::AddMotionState(const CMotionState& mst)
SetTranslation(x34_transform.origin + mst.x0_translation); SetTranslation(x34_transform.origin + mst.x0_translation);
xfc_constantForce += mst.x1c_velocity; xfc_constantForce += mst.x1c_velocity;
x108_angularMomentum += mst.x28_angularMomentum;
ComputeDerivedQuantities(); ComputeDerivedQuantities();
} }

View File

@ -184,7 +184,7 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr)
} }
} }
if ((x12c_flags & ETriggerFlags::DetectPlayerIfInside) != ETriggerFlags::None || x148_24_playerInside) if ((x12c_flags & ETriggerFlags::DetectCamera) != ETriggerFlags::None || x148_24_detectCamera)
{ {
CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr); CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr);
bool camInTrigger = GetTriggerBoundsWR().pointInside(cam->GetTranslation()); bool camInTrigger = GetTriggerBoundsWR().pointInside(cam->GetTranslation());
@ -193,7 +193,7 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr)
if (!camInTrigger) if (!camInTrigger)
{ {
x148_25_camSubmerged = false; x148_25_camSubmerged = false;
if ((x12c_flags & ETriggerFlags::DetectPlayerIfInside) != ETriggerFlags::None) if ((x12c_flags & ETriggerFlags::DetectCamera) != ETriggerFlags::None)
{ {
sendExited = true; sendExited = true;
InhabitantExited(*cam, mgr); InhabitantExited(*cam, mgr);
@ -201,7 +201,7 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr)
} }
else else
{ {
if ((x12c_flags & ETriggerFlags::DetectPlayerIfInside) != ETriggerFlags::None) if ((x12c_flags & ETriggerFlags::DetectCamera) != ETriggerFlags::None)
{ {
InhabitantIdle(*cam, mgr); InhabitantIdle(*cam, mgr);
sendInside = true; sendInside = true;
@ -213,10 +213,10 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr)
if (camInTrigger) if (camInTrigger)
{ {
x148_25_camSubmerged = true; x148_25_camSubmerged = true;
if ((x12c_flags & ETriggerFlags::DetectPlayerIfInside) != ETriggerFlags::None) if ((x12c_flags & ETriggerFlags::DetectCamera) != ETriggerFlags::None)
{ {
InhabitantAdded(*cam, mgr); InhabitantAdded(*cam, mgr);
SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::Activate); //SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::Activate);
} }
} }
} }
@ -224,12 +224,12 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr)
if (sendInside) if (sendInside)
{ {
SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::Activate); //SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::Activate);
} }
if (sendExited) if (sendExited)
{ {
SendScriptMsgs(EScriptObjectState::Exited, mgr, EScriptObjectMessage::Activate); //SendScriptMsgs(EScriptObjectState::Exited, mgr, EScriptObjectMessage::Activate);
if (x148_27_deactivateOnExited) if (x148_27_deactivateOnExited)
{ {
mgr.SendScriptMsg(GetUniqueId(), mgr.GetEditorIdForUniqueId(GetUniqueId()), mgr.SendScriptMsg(GetUniqueId(), mgr.GetEditorIdForUniqueId(GetUniqueId()),
@ -318,7 +318,7 @@ void CScriptTrigger::Touch(CActor& act, CStateManager& mgr)
} }
} }
SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::None); //SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::None);
if (x148_26_deactivateOnEntered) if (x148_26_deactivateOnEntered)
{ {

View File

@ -25,7 +25,7 @@ enum class ETriggerFlags : u32
KillOnEnter = (1 << 11), KillOnEnter = (1 << 11),
DetectMorphedPlayer = (1 << 12), DetectMorphedPlayer = (1 << 12),
UseCollisionImpulses = (1 << 13), UseCollisionImpulses = (1 << 13),
DetectPlayerIfInside = (1 << 14), DetectCamera = (1 << 14),
UseBooleanIntersection = (1 << 15), UseBooleanIntersection = (1 << 15),
DetectUnmorphedPlayer = (1 << 16), DetectUnmorphedPlayer = (1 << 16),
BlockEnvironmentalEffects = (1 << 17) BlockEnvironmentalEffects = (1 << 17)
@ -57,7 +57,7 @@ protected:
union { union {
struct struct
{ {
bool x148_24_playerInside : 1; bool x148_24_detectCamera : 1;
bool x148_25_camSubmerged : 1; bool x148_25_camSubmerged : 1;
bool x148_26_deactivateOnEntered : 1; bool x148_26_deactivateOnEntered : 1;
bool x148_27_deactivateOnExited : 1; bool x148_27_deactivateOnExited : 1;

View File

@ -86,7 +86,7 @@ CScriptWater::CScriptWater(CStateManager& mgr, TUniqueId uid, std::string_view n
x90_actorLights->SetCastShadows(false); x90_actorLights->SetCastShadows(false);
x90_actorLights->SetAmbientChannelOverflow(false); x90_actorLights->SetAmbientChannelOverflow(false);
x90_actorLights->SetFindNearestDynamicLights(true); x90_actorLights->SetFindNearestDynamicLights(true);
x148_24_playerInside = true; x148_24_detectCamera = true;
CalculateRenderBounds(); CalculateRenderBounds();
xe6_27_renderVisorFlags = u8(thermalCold ? 2 : 1); xe6_27_renderVisorFlags = u8(thermalCold ? 2 : 1);
if (!x30_24_active) if (!x30_24_active)

2
amuse

@ -1 +1 @@
Subproject commit b890a76e2048ba7ae781af0bfb8fdf2e7ab159f9 Subproject commit 89233e98b59e6e720641af2f6d5f2d29f9c79864

2
hecl

@ -1 +1 @@
Subproject commit b8043f6369bd2057112cc77df5d9ad9652995489 Subproject commit 97c3a4918e32015988328fda625a46e925fa2764