Various bug fixes

This commit is contained in:
Jack Andersen 2019-02-07 15:08:15 -10:00
parent 5600bf5172
commit 5f8b65e3b5
7 changed files with 27 additions and 27 deletions

View File

@ -50,7 +50,7 @@ zeus::CTransform CMappableObject::AdjustTransformForType() {
orientation.origin = {-0.49f * doorCenterX, 0.f, -1.f * doorCenterZ}; orientation.origin = {-0.49f * doorCenterX, 0.f, -1.f * doorCenterZ};
orientation.rotateLocalY(zeus::degToRad(90.f)); orientation.rotateLocalY(zeus::degToRad(90.f));
return x10_transform * orientation; return x10_transform * orientation;
} else if (x0_type >= EMappableObjectType::BlueDoor || x0_type <= EMappableObjectType::PlasmaDoorFloor2) { } else if (x0_type >= EMappableObjectType::BlueDoor && x0_type <= EMappableObjectType::PlasmaDoorFloor2) {
return x10_transform; return x10_transform;
} }
return zeus::CTransform::Translate(x10_transform.origin); return zeus::CTransform::Translate(x10_transform.origin);

View File

@ -1888,13 +1888,13 @@ CBSWallWalkerLocomotion::CBSWallWalkerLocomotion(CActor& actor) : CBSBiPedLocomo
float CBSWallWalkerLocomotion::ApplyLocomotionPhysics(float dt, CBodyController& bc) { float CBSWallWalkerLocomotion::ApplyLocomotionPhysics(float dt, CBodyController& bc) {
if (TCastToPtr<CPhysicsActor> act = bc.GetOwner()) { if (TCastToPtr<CPhysicsActor> act = bc.GetOwner()) {
float maxSpeed = bc.GetBodyStateInfo().GetMaxSpeed(); float maxSpeed = bc.GetBodyStateInfo().GetMaxSpeed();
zeus::CVector3f x40 = bc.GetCommandMgr().GetMoveVector() * maxSpeed; zeus::CVector3f scaledMove = bc.GetCommandMgr().GetMoveVector() * maxSpeed;
if ((zeus::CVector3f::getAngleDiff(bc.GetCommandMgr().GetFaceVector(), x40) < (M_PIF / 2.f) if ((zeus::CVector3f::getAngleDiff(bc.GetCommandMgr().GetFaceVector(), scaledMove) < (M_PIF / 2.f)
? x40 ? scaledMove
: bc.GetCommandMgr().GetFaceVector()) : bc.GetCommandMgr().GetFaceVector())
.canBeNormalized()) .canBeNormalized())
bc.FaceDirection3D(x40.normalized(), act->GetTransform().basis[1], dt); bc.FaceDirection3D(scaledMove.normalized(), act->GetTransform().basis[1], dt);
zeus::CVector3f impulse = act->GetMoveToORImpulseWR(act->GetTransform().transposeRotate(x40 * dt), dt); zeus::CVector3f impulse = act->GetMoveToORImpulseWR(act->GetTransform().transposeRotate(scaledMove * dt), dt);
impulse = act->GetMass() > FLT_EPSILON ? impulse / act->GetMass() impulse = act->GetMass() > FLT_EPSILON ? impulse / act->GetMass()
: zeus::CVector3f(0.f, act->GetVelocity().magnitude(), 0.f); : zeus::CVector3f(0.f, act->GetVelocity().magnitude(), 0.f);
if (maxSpeed > FLT_EPSILON) if (maxSpeed > FLT_EPSILON)

View File

@ -17,7 +17,9 @@ bool CCollidableOBBTree::LineIntersectsLeaf(const COBBTree::CLeafData& leaf, CRa
for (int i = 0; i < leaf.GetSurfaceVector().size(); ++i) { for (int i = 0; i < leaf.GetSurfaceVector().size(); ++i) {
u16 surfIdx = leaf.GetSurfaceVector()[i]; u16 surfIdx = leaf.GetSurfaceVector()[i];
CCollisionSurface surface = x10_tree->GetSurface(surfIdx); CCollisionSurface surface = x10_tree->GetSurface(surfIdx);
if (info.GetMaterialFilter().Passes(GetMaterial())) { CMaterialList matList = GetMaterial();
matList.Add(surface.GetSurfaceFlags());
if (info.GetMaterialFilter().Passes(matList)) {
if (CollisionUtil::RayTriangleIntersection(info.GetRay().start, info.GetRay().dir, surface.GetVerts(), if (CollisionUtil::RayTriangleIntersection(info.GetRay().start, info.GetRay().dir, surface.GetVerts(),
info.Magnitude())) { info.Magnitude())) {
intersectIdx = surfIdx; intersectIdx = surfIdx;

View File

@ -4210,19 +4210,15 @@ void CPlayer::UpdateOrbitInput(const CFinalInput& input, CStateManager& mgr) {
case EPlayerOrbitState::NoOrbit: case EPlayerOrbitState::NoOrbit:
/* Disabled transitions directly from NoOrbit to OrbitObject for better keyboard handling */ /* Disabled transitions directly from NoOrbit to OrbitObject for better keyboard handling */
#if 0 #if 0
if (ControlMapper::GetPressInput(ControlMapper::ECommands::OrbitObject, input)) if (ControlMapper::GetPressInput(ControlMapper::ECommands::OrbitObject, input)) {
{ SetOrbitTargetId(x33c_orbitNextTargetId, mgr);
SetOrbitTargetId(x33c_orbitNextTargetId, mgr); if (x310_orbitTargetId != kInvalidUniqueId) {
if (x310_orbitTargetId != kInvalidUniqueId) if (ValidateAimTargetId(x310_orbitTargetId, mgr))
{ ResetAimTargetPrediction(x310_orbitTargetId);
if (ValidateAimTargetId(x310_orbitTargetId, mgr)) SetOrbitState(EPlayerOrbitState::OrbitObject, mgr);
ResetAimTargetPrediction(x310_orbitTargetId); UpdateOrbitPosition(g_tweakPlayer->GetOrbitNormalDistance(int(x308_orbitType)), mgr);
SetOrbitState(EPlayerOrbitState::OrbitObject, mgr); }
UpdateOrbitPosition(g_tweakPlayer->GetOrbitNormalDistance(int(x308_orbitType)), mgr); } else {
}
}
else
{
#else #else
m_deferredOrbitObject = ControlMapper::GetPressInput(ControlMapper::ECommands::OrbitObject, input); m_deferredOrbitObject = ControlMapper::GetPressInput(ControlMapper::ECommands::OrbitObject, input);
#endif #endif
@ -4231,7 +4227,7 @@ void CPlayer::UpdateOrbitInput(const CFinalInput& input, CStateManager& mgr) {
if (ControlMapper::GetPressInput(ControlMapper::ECommands::OrbitClose, input)) if (ControlMapper::GetPressInput(ControlMapper::ECommands::OrbitClose, input))
OrbitPoint(EPlayerOrbitType::Close, mgr); OrbitPoint(EPlayerOrbitType::Close, mgr);
#if 0 #if 0
} }
#endif #endif
break; break;
case EPlayerOrbitState::Grapple: case EPlayerOrbitState::Grapple:

View File

@ -59,7 +59,7 @@ CScriptEffect::CScriptEffect(TUniqueId uid, std::string_view name, const CEntity
newXf.origin = zeus::CVector3f::skZero; newXf.origin = zeus::CVector3f::skZero;
x104_particleSystem->SetOrientation(newXf); x104_particleSystem->SetOrientation(newXf);
x104_particleSystem->SetGlobalTranslation(xf.origin); x104_particleSystem->SetGlobalTranslation(xf.origin);
x104_particleSystem->SetLocalScale(scale); x104_particleSystem->SetGlobalScale(scale);
x104_particleSystem->SetParticleEmission(active); x104_particleSystem->SetParticleEmission(active);
x104_particleSystem->SetModulationColor(lParms.GetNoLightsAmbient()); x104_particleSystem->SetModulationColor(lParms.GetNoLightsAmbient());
x104_particleSystem->SetModelsUseLights(x138_actorLights != nullptr); x104_particleSystem->SetModelsUseLights(x138_actorLights != nullptr);
@ -72,7 +72,7 @@ CScriptEffect::CScriptEffect(TUniqueId uid, std::string_view name, const CEntity
newXf.origin = zeus::CVector3f::skZero; newXf.origin = zeus::CVector3f::skZero;
xf4_electric->SetOrientation(newXf); xf4_electric->SetOrientation(newXf);
xf4_electric->SetGlobalTranslation(xf.origin); xf4_electric->SetGlobalTranslation(xf.origin);
xf4_electric->SetLocalScale(scale); xf4_electric->SetGlobalScale(scale);
xf4_electric->SetParticleEmission(active); xf4_electric->SetParticleEmission(active);
} }
xe7_29_drawEnabled = true; xe7_29_drawEnabled = true;
@ -94,7 +94,7 @@ void CScriptEffect::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt
newXf.origin = zeus::CVector3f::skZero; newXf.origin = zeus::CVector3f::skZero;
x104_particleSystem->SetOrientation(newXf); x104_particleSystem->SetOrientation(newXf);
x104_particleSystem->SetGlobalTranslation(GetTranslation()); x104_particleSystem->SetGlobalTranslation(GetTranslation());
x104_particleSystem->SetLocalScale(scale); x104_particleSystem->SetGlobalScale(scale);
x104_particleSystem->SetParticleEmission(oldActive); x104_particleSystem->SetParticleEmission(oldActive);
x104_particleSystem->SetModulationColor(color); x104_particleSystem->SetModulationColor(color);
x104_particleSystem->SetModelsUseLights(x138_actorLights != nullptr); x104_particleSystem->SetModelsUseLights(x138_actorLights != nullptr);
@ -108,7 +108,7 @@ void CScriptEffect::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt
newXf.origin = zeus::CVector3f::skZero; newXf.origin = zeus::CVector3f::skZero;
xf4_electric->SetOrientation(newXf); xf4_electric->SetOrientation(newXf);
xf4_electric->SetGlobalTranslation(GetTranslation()); xf4_electric->SetGlobalTranslation(GetTranslation());
xf4_electric->SetLocalScale(scale); xf4_electric->SetGlobalScale(scale);
xf4_electric->SetParticleEmission(oldActive); xf4_electric->SetParticleEmission(oldActive);
xf4_electric->SetModulationColor(color); xf4_electric->SetModulationColor(color);
} }

View File

@ -65,7 +65,9 @@ void CWallWalker::AlignToFloor(CStateManager& mgr, float radius, const zeus::CVe
for (u16 i = 0; i < triArr.GetSize(); ++i) { for (u16 i = 0; i < triArr.GetSize(); ++i) {
u16 triIdx = triArr.GetAt(i); u16 triIdx = triArr.GetAt(i);
CCollisionSurface surf = leaf.GetOctTree().GetMasterListTriangle(triIdx); CCollisionSurface surf = leaf.GetOctTree().GetMasterListTriangle(triIdx);
if (std::fabs(surf.GetPlane().pointToPlaneDist(newPos)) < margin && PointOnSurface(surf, newPos)) { float dist = std::fabs(surf.GetPlane().pointToPlaneDist(newPos));
if (dist < margin && PointOnSurface(surf, newPos)) {
margin = dist;
x568_alignNormal = surf; x568_alignNormal = surf;
hasSurface = true; hasSurface = true;
} }

2
amuse

@ -1 +1 @@
Subproject commit fc2f8542c1d822901e2f6048ded1714020287490 Subproject commit 54ef2dd73bd606f00a27192f23e66fbc6d896207