Various bug fixes

This commit is contained in:
Jack Andersen 2017-11-29 15:22:46 -10:00
parent 7951cb1ee0
commit 7cd3e8f502
9 changed files with 125 additions and 81 deletions

View File

@ -95,8 +95,8 @@ void CFirstPersonCamera::CalculateGunFollowOrientationAndTransform(zeus::CTransf
if (rVecNoZ.canBeNormalized()) if (rVecNoZ.canBeNormalized())
rVecNoZ.normalize(); rVecNoZ.normalize();
gunXf = zeus::CQuaternion::lookAt(rVecNoZ, gunFrontVec, zeus::CRelAngle::FromDegrees(360.f)).toTransform() * gunXf = zeus::CQuaternion::lookAt(gunFrontVec, rVecNoZ, zeus::CRelAngle::FromDegrees(360.f)).toTransform() *
gunXf.getRotation(); x190_gunFollowXf.getRotation();
zeus::CVector3f newgunFront = gunXf.frontVector(); zeus::CVector3f newgunFront = gunXf.frontVector();
@ -104,9 +104,8 @@ void CFirstPersonCamera::CalculateGunFollowOrientationAndTransform(zeus::CTransf
newgunFront.normalize(); newgunFront.normalize();
float angle = newgunFront.dot(rVec); float angle = newgunFront.dot(rVec);
if (std::fabs(angle) > 0.f) angle = std::min(angle, 1.f);
angle = (angle > -0.f ? -1.f : 1.f); gunQ = zeus::CQuaternion::lookAt(newgunFront, rVec, zeus::clamp(0.f, std::acos(angle) / dt, 1.f) * dt);
gunQ = zeus::CQuaternion::lookAt(rVec, newgunFront, zeus::clamp(0.f, std::acos(angle) / dt, 1.f));
} }
void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt) void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
@ -130,8 +129,12 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
vec.z = std::sin(angle); vec.z = std::sin(angle);
vec.y = std::cos(-player->x3e4_freeLookYawAngle) * std::cos(angle); vec.y = std::cos(-player->x3e4_freeLookYawAngle) * std::cos(angle);
vec.x = std::sin(-player->x3e4_freeLookYawAngle) * std::cos(angle); vec.x = std::sin(-player->x3e4_freeLookYawAngle) * std::cos(angle);
if (g_tweakPlayer->GetFreeLookTurnsPlayer() && !zeus::close_enough(vec, zeus::CVector3f::skZero)) if (g_tweakPlayer->GetFreeLookTurnsPlayer())
{
vec.x = 0.f;
if (!zeus::close_enough(vec, zeus::CVector3f::skZero))
vec.normalize(); vec.normalize();
}
rVec = zeus::CQuaternion::lookAt({0.f, 1.f, 0.f}, rVec, zeus::CRelAngle::FromDegrees(360.f)).transform(vec); rVec = zeus::CQuaternion::lookAt({0.f, 1.f, 0.f}, rVec, zeus::CRelAngle::FromDegrees(360.f)).transform(vec);
} }
@ -144,11 +147,13 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
player->GetCameraBob()->SetCameraBobTransform(zeus::CTransform::Identity()); player->GetCameraBob()->SetCameraBobTransform(zeus::CTransform::Identity());
} }
if (player->GetOrbitState() == CPlayer::EPlayerOrbitState::ForcedOrbitObject || switch (player->GetOrbitState())
player->GetOrbitState() == CPlayer::EPlayerOrbitState::OrbitObject) {
case CPlayer::EPlayerOrbitState::ForcedOrbitObject:
case CPlayer::EPlayerOrbitState::OrbitObject:
{ {
const CActor* act = TCastToConstPtr<CActor>(mgr.GetObjectById(player->x310_orbitTargetId)); const CActor* act = TCastToConstPtr<CActor>(mgr.GetObjectById(player->x310_orbitTargetId));
if (act && act->GetMaterialList().Intersection(CMaterialList(EMaterialTypes::Lava)) != 0) if (act && act->GetMaterialList().HasMaterial(EMaterialTypes::Orbit))
{ {
zeus::CVector3f v = player->x314_orbitPoint.y - eyePos; zeus::CVector3f v = player->x314_orbitPoint.y - eyePos;
if (v.canBeNormalized()) if (v.canBeNormalized())
@ -156,9 +161,24 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
rVec = v; rVec = v;
} }
else
{
rVec = player->x314_orbitPoint - eyePos;
} }
else if (player->GetOrbitState() == CPlayer::EPlayerOrbitState::NoOrbit && break;
player->GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed && }
case CPlayer::EPlayerOrbitState::OrbitPoint:
case CPlayer::EPlayerOrbitState::OrbitCarcass:
{
if (!player->x3dd_lookButtonHeld)
{
rVec = player->x314_orbitPoint - eyePos;
}
break;
}
case CPlayer::EPlayerOrbitState::NoOrbit:
{
if (player->GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed &&
!player->x3dc_inFreeLook && x1c4_pitchId == kInvalidUniqueId) !player->x3dc_inFreeLook && x1c4_pitchId == kInvalidUniqueId)
{ {
if (player->x294_jumpCameraTimer > 0.f) if (player->x294_jumpCameraTimer > 0.f)
@ -178,13 +198,18 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
float angle = zeus::clamp(0.f, (player->x29c_fallCameraTimer - g_tweakPlayer->GetFallCameraPitchDownStart()) / float angle = zeus::clamp(0.f, (player->x29c_fallCameraTimer - g_tweakPlayer->GetFallCameraPitchDownStart()) /
g_tweakPlayer->GetFallCameraPitchDownFull(), 1.f) * g_tweakPlayer->GetFallCameraPitchDownFull(), 1.f) *
g_tweakPlayer->GetFallCameraPitchDownAngle(); g_tweakPlayer->GetFallCameraPitchDownAngle();
rVec.x = 0.f; //rVec.x = 0.f;
rVec.y = std::cos(angle); //rVec.y = std::cos(angle);
rVec.z = -std::sin(angle); //rVec.z = -std::sin(angle);
rVec = playerXf.rotate(rVec); //rVec = playerXf.rotate(rVec);
} }
} }
break;
}
default:
break;
}
if (rVec.canBeNormalized()) if (rVec.canBeNormalized())
rVec.normalize(); rVec.normalize();
@ -192,12 +217,33 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
zeus::CTransform gunXf = x190_gunFollowXf; zeus::CTransform gunXf = x190_gunFollowXf;
zeus::CQuaternion qGun = zeus::CQuaternion::skNoRotation; zeus::CQuaternion qGun = zeus::CQuaternion::skNoRotation;
if (player->x3dc_inFreeLook) if (!player->x3dc_inFreeLook)
{ {
if (player->GetOrbitState() == CPlayer::EPlayerOrbitState::ForcedOrbitObject || switch (player->GetOrbitState())
player->GetOrbitState() == CPlayer::EPlayerOrbitState::OrbitObject)
{ {
zeus::CVector3f gunFrontVec = gunXf.frontVector(); default:
{
CalculateGunFollowOrientationAndTransform(gunXf, qGun,
dt * g_tweakPlayer->GetFirstPersonCameraSpeed(), rVec);
break;
}
case CPlayer::EPlayerOrbitState::Grapple:
{
CalculateGunFollowOrientationAndTransform(gunXf, qGun,
dt * g_tweakPlayer->GetGrappleCameraSpeed(), rVec);
break;
}
case CPlayer::EPlayerOrbitState::OrbitPoint:
case CPlayer::EPlayerOrbitState::OrbitCarcass:
{
CalculateGunFollowOrientationAndTransform(gunXf, qGun,
dt * g_tweakPlayer->GetOrbitCameraSpeed() * 0.25f, rVec);
break;
}
case CPlayer::EPlayerOrbitState::ForcedOrbitObject:
case CPlayer::EPlayerOrbitState::OrbitObject:
{
zeus::CVector3f gunFrontVec = x190_gunFollowXf.frontVector();
if (gunFrontVec.canBeNormalized()) if (gunFrontVec.canBeNormalized())
gunFrontVec.normalize(); gunFrontVec.normalize();
@ -206,10 +252,10 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
float angle = gunFrontVec.dot(rVec); float angle = gunFrontVec.dot(rVec);
angle = zeus::clamp(-1.f, angle, 1.f); angle = zeus::clamp(-1.f, angle, 1.f);
float clampedAngle = zeus::clamp(0.f, std::acos(angle) / scaledDt, 1.f); float clampedAngle = zeus::clamp(0.f, std::acos(angle) / scaledDt, 1.f);
if (angle > 0.999f && x18c_lockCamera && !player->x374_orbitLockEstablished) if (angle > 0.999f || x18c_lockCamera || player->x374_orbitLockEstablished)
qGun = zeus::CQuaternion::lookAt(rVec, gunFrontVec, zeus::CRelAngle::FromDegrees(360.f)); qGun = zeus::CQuaternion::lookAt(gunFrontVec, rVec, zeus::CRelAngle::FromDegrees(360.f));
else else
qGun = zeus::CQuaternion::lookAt(rVec, gunFrontVec, scaledDt * clampedAngle); qGun = zeus::CQuaternion::lookAt(gunFrontVec, rVec, scaledDt * clampedAngle);
const CScriptGrapplePoint* gPoint = const CScriptGrapplePoint* gPoint =
TCastToConstPtr<CScriptGrapplePoint>(mgr.GetObjectById(player->x310_orbitTargetId)); TCastToConstPtr<CScriptGrapplePoint>(mgr.GetObjectById(player->x310_orbitTargetId));
@ -220,53 +266,42 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
gunFrontVec.normalize(); gunFrontVec.normalize();
zeus::CVector3f rVecCpy = rVec; zeus::CVector3f rVecCpy = rVec;
rVecCpy.z = 0.f;
if (rVecCpy.canBeNormalized()) if (rVecCpy.canBeNormalized())
rVecCpy.normalize(); rVecCpy.normalize();
gunXf = gunXf =
zeus::CQuaternion::lookAt(rVecCpy, gunFrontVec, zeus::CRelAngle::FromDegrees(360.f)).toTransform() * zeus::CQuaternion::lookAt(gunFrontVec, rVecCpy, zeus::CRelAngle::FromDegrees(360.f)).toTransform() *
x190_gunFollowXf.getRotation(); x190_gunFollowXf.getRotation();
gunFrontVec = gunXf.frontVector(); gunFrontVec = gunXf.frontVector();
if (gunFrontVec.canBeNormalized()) if (gunFrontVec.canBeNormalized())
gunFrontVec.normalize(); gunFrontVec.normalize();
float angle = gunFrontVec.dot(rVec); //float angle = gunFrontVec.dot(rVec);
float sdt = dt * g_tweakPlayer->GetGrappleCameraSpeed(); //float sdt = dt * g_tweakPlayer->GetGrappleCameraSpeed();
angle = zeus::clamp(-1.f, angle, 1.f); //angle = zeus::clamp(-1.f, angle, 1.f);
angle = zeus::clamp(0.f, std::acos(angle) / sdt, 1.f) * sdt; //angle = zeus::clamp(0.f, std::acos(angle) / sdt, 1.f);
qGun = zeus::CQuaternion::lookAt(rVec, gunFrontVec, angle); qGun = zeus::CQuaternion::lookAt(gunFrontVec, rVecCpy, zeus::CRelAngle::FromDegrees(360.f));
} }
break;
} }
else if (player->GetOrbitState() == CPlayer::EPlayerOrbitState::OrbitPoint ||
player->GetOrbitState() == CPlayer::EPlayerOrbitState::OrbitCarcass)
{
dt *= g_tweakPlayer->GetOrbitCameraSpeed();
CalculateGunFollowOrientationAndTransform(gunXf, qGun, dt, rVec);
}
else if (player->GetOrbitState() == CPlayer::EPlayerOrbitState::Grapple)
{
dt *= g_tweakPlayer->GetGrappleCameraSpeed();
CalculateGunFollowOrientationAndTransform(gunXf, qGun, dt, rVec);
}
else
{
dt *= g_tweakPlayer->GetFirstPersonCameraSpeed();
CalculateGunFollowOrientationAndTransform(gunXf, qGun, dt, rVec);
} }
} }
else else
{ {
zeus::CVector3f gunFront = x190_gunFollowXf.frontVector(); zeus::CVector3f gunFront = x190_gunFollowXf.frontVector();
gunFront.z = 0.f;
if (gunFront.canBeNormalized()) if (gunFront.canBeNormalized())
gunFront.normalize(); gunFront.normalize();
zeus::CVector3f rVecCpy = rVec; zeus::CVector3f rVecCpy = rVec;
rVecCpy.z = 0.f;
if (rVecCpy.canBeNormalized()) if (rVecCpy.canBeNormalized())
rVecCpy.normalize(); rVecCpy.normalize();
gunXf = zeus::CQuaternion::lookAt(rVecCpy, gunFront, zeus::CRelAngle::FromDegrees(360.f)).toTransform() * gunXf = zeus::CQuaternion::lookAt(gunFront, rVecCpy, zeus::CRelAngle::FromDegrees(360.f)).toTransform() *
x190_gunFollowXf.getRotation(); x190_gunFollowXf.getRotation();
gunFront = gunXf.frontVector(); gunFront = gunXf.frontVector();
if (gunFront.canBeNormalized()) if (gunFront.canBeNormalized())
@ -276,7 +311,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
angle = zeus::clamp(-1.f, angle, 1.f); angle = zeus::clamp(-1.f, angle, 1.f);
float sdt = dt * g_tweakPlayer->GetFreeLookSpeed(); float sdt = dt * g_tweakPlayer->GetFreeLookSpeed();
qGun = zeus::CQuaternion::lookAt( qGun = zeus::CQuaternion::lookAt(
rVec, gunFront, sdt * zeus::clamp(0.f, g_tweakPlayer->GetFreeLookDampenFactor() * gunFront, rVec, sdt * zeus::clamp(0.f, g_tweakPlayer->GetFreeLookDampenFactor() *
(std::acos(angle) / sdt), 1.f)); (std::acos(angle) / sdt), 1.f));
} }
zeus::CTransform bobXf = player->GetCameraBob()->GetCameraBobTransformation(); zeus::CTransform bobXf = player->GetCameraBob()->GetCameraBobTransformation();
@ -285,14 +320,16 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
player->GetOrbitState() == CPlayer::EPlayerOrbitState::Grapple || player->GetOrbitState() == CPlayer::EPlayerOrbitState::Grapple ||
player->GetGrappleState() == CPlayer::EGrappleState::None || player->GetGrappleState() == CPlayer::EGrappleState::None ||
mgr.GetGameState() == CStateManager::EGameState::SoftPaused || mgr.GetGameState() == CStateManager::EGameState::SoftPaused ||
mgr.GetCameraManager()->IsInCinematicCamera()) mgr.GetCameraManager()->IsInCinematicCamera() ||
x1d4_closeInTimer > 0.f)
{ {
bobXf = zeus::CTransform::Identity(); bobXf = zeus::CTransform::Identity();
player->GetCameraBob()->SetCameraBobTransform(bobXf); player->GetCameraBob()->SetCameraBobTransform(bobXf);
} }
x190_gunFollowXf = qGun.toTransform() * gunXf; x190_gunFollowXf = qGun.toTransform() * gunXf;
SetTransform(x190_gunFollowXf * bobXf.getRotation()); //SetTransform(x190_gunFollowXf * bobXf.getRotation());
SetTransform(playerXf);
x190_gunFollowXf.origin = eyePos; x190_gunFollowXf.origin = eyePos;
CActor::SetTranslation(eyePos + player->GetTransform().rotate(bobXf.origin)); CActor::SetTranslation(eyePos + player->GetTransform().rotate(bobXf.origin));
x190_gunFollowXf.orthonormalize(); x190_gunFollowXf.orthonormalize();

View File

@ -36,7 +36,7 @@ CActorLights::CActorLights(u32 areaUpdateFramePeriod, const zeus::CVector3f& act
void CActorLights::BuildConstantAmbientLighting() void CActorLights::BuildConstantAmbientLighting()
{ {
x299_26_ = true; x299_26_ambientOnly = true;
x298_24_dirty = true; x298_24_dirty = true;
x29c_shadowLightArrIdx = -1; x29c_shadowLightArrIdx = -1;
x2a0_shadowLightIdx = -1; x2a0_shadowLightIdx = -1;
@ -44,7 +44,7 @@ void CActorLights::BuildConstantAmbientLighting()
void CActorLights::BuildConstantAmbientLighting(const zeus::CColor& color) void CActorLights::BuildConstantAmbientLighting(const zeus::CColor& color)
{ {
x299_26_ = false; x299_26_ambientOnly = false;
x288_ambientColor = color; x288_ambientColor = color;
x294_aid = kInvalidAreaId; x294_aid = kInvalidAreaId;
x298_24_dirty = true; x298_24_dirty = true;
@ -454,7 +454,7 @@ bool CActorLights::BuildAreaLightList(const CStateManager& mgr, const CGameArea&
void CActorLights::BuildDynamicLightList(const CStateManager& mgr, const zeus::CAABox& aabb) void CActorLights::BuildDynamicLightList(const CStateManager& mgr, const zeus::CAABox& aabb)
{ {
UpdateBrightLight(); UpdateBrightLight();
x299_26_ = false; x299_26_ambientOnly = false;
x144_dynamicLights.clear(); x144_dynamicLights.clear();
if (!x29a_findNearestDynamicLights) if (!x29a_findNearestDynamicLights)
@ -506,7 +506,10 @@ void CActorLights::BuildDynamicLightList(const CStateManager& mgr, const zeus::C
std::vector<CLight> CActorLights::BuildLightVector() const std::vector<CLight> CActorLights::BuildLightVector() const
{ {
std::vector<CLight> lights; std::vector<CLight> lights;
lights.push_back(CLight::BuildLocalAmbient(zeus::CVector3f::skZero, x288_ambientColor));
zeus::CColor ambColor = x288_ambientColor;
ambColor.a = 1.f;
lights.push_back(CLight::BuildLocalAmbient(zeus::CVector3f::skZero, ambColor));
if (x0_areaLights.size()) if (x0_areaLights.size())
{ {
@ -543,9 +546,10 @@ void CActorLights::ActivateLights(CBooModel& model) const
if (x298_28_inArea) if (x298_28_inArea)
{ {
if (!x298_26_hasAreaLights || !x299_26_) if (!x298_26_hasAreaLights || x299_26_ambientOnly)
{ {
g_Renderer->SetAmbientColor(zeus::CColor::skWhite); //g_Renderer->SetAmbientColor(zeus::CColor::skWhite);
lights.push_back(CLight::BuildLocalAmbient(zeus::CVector3f::skZero, zeus::CColor::skWhite));
model.ActivateLights(lights); model.ActivateLights(lights);
return; return;
} }

View File

@ -35,7 +35,7 @@ class CActorLights
bool x298_31_disableWorldLights : 1; bool x298_31_disableWorldLights : 1;
bool x299_24_inBrightLight : 1; bool x299_24_inBrightLight : 1;
bool x299_25_useBrightLightLag : 1; bool x299_25_useBrightLightLag : 1;
bool x299_26_ : 1; bool x299_26_ambientOnly : 1;
}; };
u16 _dummy = 0; u16 _dummy = 0;
}; };

View File

@ -188,7 +188,7 @@ static FloatReturnFn skAnalogFuncs[] =
nullptr nullptr
}; };
#define kCommandFilterCount 65 #define kCommandFilterCount 67
static bool skCommandFilterFlag[kCommandFilterCount] = {true}; static bool skCommandFilterFlag[kCommandFilterCount] = {true};
void ControlMapper::SetCommandFiltered(ECommands cmd, bool filtered) void ControlMapper::SetCommandFiltered(ECommands cmd, bool filtered)

View File

@ -77,7 +77,7 @@ void CLogBookScreen::UpdateRightTitles()
{ {
std::vector<std::pair<CAssetId, bool>>& category = std::vector<std::pair<CAssetId, bool>>& category =
x19c_scanCompletes[x70_tablegroup_leftlog->GetUserSelection()]; x19c_scanCompletes[x70_tablegroup_leftlog->GetUserSelection()];
for (int i=0 ; xd8_textpane_titles.size() ; ++i) for (int i=0 ; i<xd8_textpane_titles.size() ; ++i)
{ {
std::u16string string; std::u16string string;
size_t scanIndex = x18_firstViewRightSel + i; size_t scanIndex = x18_firstViewRightSel + i;

View File

@ -14,7 +14,7 @@ COptionsScreen::COptionsScreen(const CStateManager& mgr, CGuiFrame& frame,
const CStringTable& pauseStrg) const CStringTable& pauseStrg)
: CPauseScreenBase(mgr, frame, pauseStrg) : CPauseScreenBase(mgr, frame, pauseStrg)
{ {
x1a0_gameCube = std::unique_ptr<CGameCubeDoll>(); x1a0_gameCube = std::make_unique<CGameCubeDoll>();
x2a0_24_inOptionBody = false; x2a0_24_inOptionBody = false;
} }

View File

@ -28,6 +28,7 @@ CPauseScreen::CPauseScreen(ESubScreen subscreen,
x5c_frmePauseScreenBuf.reset(new u8[x58_frmePauseScreenBufSz]); x5c_frmePauseScreenBuf.reset(new u8[x58_frmePauseScreenBufSz]);
x60_loadTok = g_ResFactory->LoadResourceAsync(frmeTag, x5c_frmePauseScreenBuf.get()); x60_loadTok = g_ResFactory->LoadResourceAsync(frmeTag, x5c_frmePauseScreenBuf.get());
CSfxManager::SfxStart(1435, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); CSfxManager::SfxStart(1435, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
x7c_screens.resize(2);
} }
std::unique_ptr<CPauseScreenBase> CPauseScreen::BuildPauseSubScreen(ESubScreen subscreen, std::unique_ptr<CPauseScreenBase> CPauseScreen::BuildPauseSubScreen(ESubScreen subscreen,
@ -113,11 +114,12 @@ void CPauseScreen::StartTransition(float time, const CStateManager& mgr, ESubScr
return; return;
xc_nextSubscreen = subscreen; xc_nextSubscreen = subscreen;
x4_ = b; x4_ = b;
std::unique_ptr<CPauseScreenBase>& newScreenSlot = x7c_screens[x78_activeIdx]; x10_alphaInterp = time;
std::unique_ptr<CGuiFrame>& newScreenInst = x64_frameInsts[x78_activeIdx]; std::unique_ptr<CPauseScreenBase>& newScreenSlot = x7c_screens[1 - x78_activeIdx];
std::unique_ptr<CGuiFrame>& newScreenInst = x64_frameInsts[1 - x78_activeIdx];
newScreenSlot = BuildPauseSubScreen(xc_nextSubscreen, mgr, *newScreenInst); newScreenSlot = BuildPauseSubScreen(xc_nextSubscreen, mgr, *newScreenInst);
if (x7c_screens[1 - x78_activeIdx]) if (x7c_screens[x78_activeIdx])
x7c_screens[1 - x78_activeIdx]->TransitioningAway(); x7c_screens[x78_activeIdx]->TransitioningAway();
x91_initialTransition = false; x91_initialTransition = false;
} }

View File

@ -100,7 +100,8 @@ void CPhysicsActor::AddMotionState(const CMotionState& mst)
{ {
zeus::CNUQuaternion q{x34_transform.buildMatrix3f()}; zeus::CNUQuaternion q{x34_transform.buildMatrix3f()};
q += mst.xc_orientation; q += mst.xc_orientation;
SetTransform(zeus::CTransform(zeus::CQuaternion::fromNUQuaternion(q), x34_transform.origin)); zeus::CQuaternion quat = zeus::CQuaternion::fromNUQuaternion(q);
SetTransform(zeus::CTransform(quat, x34_transform.origin));
SetTranslation(x34_transform.origin + mst.x0_translation); SetTranslation(x34_transform.origin + mst.x0_translation);
@ -241,7 +242,7 @@ void CPhysicsActor::ComputeDerivedQuantities()
{ {
x138_velocity = xec_massRecip * xfc_constantForce; x138_velocity = xec_massRecip * xfc_constantForce;
x114_ = x34_transform.buildMatrix3f(); x114_ = x34_transform.buildMatrix3f();
x144_angularVelocity = xf0_inertiaTensor * x108_angularMomentum; x144_angularVelocity = xf4_inertiaTensorRecip * x108_angularMomentum;
} }
bool CPhysicsActor::WillMove(const CStateManager&) bool CPhysicsActor::WillMove(const CStateManager&)
@ -311,7 +312,7 @@ CMotionState CPhysicsActor::PredictLinearMotion(float dt) const
CMotionState CPhysicsActor::PredictAngularMotion(float dt) const CMotionState CPhysicsActor::PredictAngularMotion(float dt) const
{ {
const zeus::CVector3f v1 = xf4_inertiaTensorRecip * (x180_angularImpulse + x198_moveAngularImpulse); const zeus::CVector3f v1 = xf4_inertiaTensorRecip * (x180_angularImpulse + x198_moveAngularImpulse);
zeus::CNUQuaternion q = 0.5f * zeus::CNUQuaternion(0.f, x144_angularVelocity + v1); zeus::CNUQuaternion q = 0.5f * zeus::CNUQuaternion(0.f, x144_angularVelocity.getVector() + v1);
CMotionState ret = {zeus::CVector3f::skZero, q * zeus::CNUQuaternion(x34_transform.buildMatrix3f()) * dt, CMotionState ret = {zeus::CVector3f::skZero, q * zeus::CNUQuaternion(x34_transform.buildMatrix3f()) * dt,
zeus::CVector3f::skZero, (x174_torque * dt) + x180_angularImpulse}; zeus::CVector3f::skZero, (x174_torque * dt) + x180_angularImpulse};
return ret; return ret;

@ -1 +1 @@
Subproject commit 410ab94d7f5d5d6c5081af90ae9c217b10978db1 Subproject commit d78b1bf64087bf82133b1de71bfca9f9128fbf78