CRelAngle fix

This commit is contained in:
Jack Andersen 2018-12-16 17:52:51 -10:00
parent 62d68a98da
commit b7f35e0528
14 changed files with 75 additions and 25 deletions

View File

@ -12,6 +12,25 @@
<option name="SPACE_AFTER_REFERENCE_IN_DECLARATION" value="true" /> <option name="SPACE_AFTER_REFERENCE_IN_DECLARATION" value="true" />
</Objective-C> </Objective-C>
<Objective-C-extensions> <Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions> <extensions>
<pair source="cpp" header="hpp" fileNamingConvention="NONE" /> <pair source="cpp" header="hpp" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" /> <pair source="c" header="h" fileNamingConvention="NONE" />

View File

@ -539,21 +539,28 @@ void CAutoMapper::ProcessMapRotateInput(const CFinalInput& input, const CStateMa
SetShouldRotatingSoundBePlaying(true); SetShouldRotatingSoundBePlaying(true);
zeus::CEulerAngles eulers(xa8_renderStates[0].x8_camOrientation); zeus::CEulerAngles eulers(xa8_renderStates[0].x8_camOrientation);
zeus::CRelAngle angX(eulers.x()); zeus::CRelAngle angX(eulers.x());
angX.makeRel();
zeus::CRelAngle angZ(eulers.z()); zeus::CRelAngle angZ(eulers.z());
angZ.makeRel();
float dt = deltaFrames * g_tweakAutoMapper->GetCamRotateDegreesPerFrame(); float dt = deltaFrames * g_tweakAutoMapper->GetCamRotateDegreesPerFrame();
angZ -= zeus::degToRad(dt * dirs[2]); angZ -= zeus::degToRad(dt * dirs[2]);
angZ.makeRel();
angZ += zeus::degToRad(dt * dirs[3]); angZ += zeus::degToRad(dt * dirs[3]);
angZ.makeRel();
angX -= zeus::degToRad(dt * dirs[0]); angX -= zeus::degToRad(dt * dirs[0]);
angX.makeRel();
angX += zeus::degToRad(dt * dirs[1]); angX += zeus::degToRad(dt * dirs[1]);
angX.makeRel();
float angXDeg = angX.asDegrees(); float angXDeg = angX.asDegrees();
if (angXDeg > 180.f) if (angXDeg > 180.f)
angXDeg -= 360.f; angXDeg -= 360.f;
angX = zeus::degToRad( angX = zeus::degToRad(
zeus::clamp(g_tweakAutoMapper->GetMinCamRotateX(), angXDeg, g_tweakAutoMapper->GetMaxCamRotateX())); zeus::clamp(g_tweakAutoMapper->GetMinCamRotateX(), angXDeg, g_tweakAutoMapper->GetMaxCamRotateX()));
angX.makeRel();
zeus::CQuaternion quat; zeus::CQuaternion quat;
quat.rotateZ(angZ); quat.rotateZ(angZ);
@ -767,12 +774,11 @@ void CAutoMapper::ProcessMapScreenInput(const CFinalInput& input, const CStateMa
zeus::CQuaternion CAutoMapper::GetMiniMapCameraOrientation(const CStateManager& stateMgr) const { zeus::CQuaternion CAutoMapper::GetMiniMapCameraOrientation(const CStateManager& stateMgr) const {
const CGameCamera* cam = stateMgr.GetCameraManager()->GetCurrentCamera(stateMgr); const CGameCamera* cam = stateMgr.GetCameraManager()->GetCurrentCamera(stateMgr);
zeus::CEulerAngles camAngles(zeus::CQuaternion(cam->GetTransform().buildMatrix3f())); zeus::CEulerAngles camAngles(zeus::CQuaternion(cam->GetTransform().buildMatrix3f()));
float rotMod = -(std::floor(camAngles.z() / (2.f * M_PIF)) * 2.f * M_PIF - camAngles.z()); zeus::CRelAngle angle(camAngles.z());
if (rotMod < 0.f) angle.makeRel();
rotMod += 2.f * M_PIF;
zeus::CQuaternion ret; zeus::CQuaternion ret;
ret.rotateZ(rotMod); ret.rotateZ(angle);
ret.rotateX(zeus::degToRad(g_tweakAutoMapper->GetMiniCamXAngle())); ret.rotateX(zeus::degToRad(g_tweakAutoMapper->GetMiniCamXAngle()));
return ret; return ret;
} }
@ -1356,6 +1362,7 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
std::min(0.6f * g_tweakAutoMapper->GetMaxCamDist() / g_tweakAutoMapper->GetMinCamDist(), objectScale); std::min(0.6f * g_tweakAutoMapper->GetMaxCamDist() / g_tweakAutoMapper->GetMinCamDist(), objectScale);
zeus::CEulerAngles eulers(mgr.GetCameraManager()->GetCurrentCameraTransform(mgr)); zeus::CEulerAngles eulers(mgr.GetCameraManager()->GetCurrentCameraTransform(mgr));
zeus::CRelAngle angle(eulers.z()); zeus::CRelAngle angle(eulers.z());
angle.makeRel();
zeus::CTransform playerXf(zeus::CMatrix3f::RotateZ(angle), zeus::CTransform playerXf(zeus::CMatrix3f::RotateZ(angle),
CMapArea::GetAreaPostTranslate(*x24_world, mgr.GetNextAreaId()) + CMapArea::GetAreaPostTranslate(*x24_world, mgr.GetNextAreaId()) +
mgr.GetPlayer().GetTranslation()); mgr.GetPlayer().GetTranslation());

View File

@ -102,6 +102,7 @@ void CBSProjectileAttack::Start(CBodyController& bc, CStateManager& mgr) {
zeus::CVector3f localDelta = zeus::CVector3f localDelta =
bc.GetOwner().GetTransform().transposeRotate(cmd->GetTargetPosition() - bc.GetOwner().GetTranslation()); bc.GetOwner().GetTransform().transposeRotate(cmd->GetTargetPosition() - bc.GetOwner().GetTranslation());
zeus::CRelAngle angle = std::atan2(localDelta.y(), localDelta.x()); zeus::CRelAngle angle = std::atan2(localDelta.y(), localDelta.x());
angle.makeRel();
float attackAngle = angle.asDegrees(); float attackAngle = angle.asDegrees();
CPASAnimParmData parms(18, CPASAnimParm::FromEnum(s32(cmd->GetAttackSeverity())), CPASAnimParmData parms(18, CPASAnimParm::FromEnum(s32(cmd->GetAttackSeverity())),
CPASAnimParm::FromReal32(angle.asDegrees()), CPASAnimParm::FromReal32(angle.asDegrees()),
@ -184,6 +185,7 @@ void CBSFall::Start(CBodyController& bc, CStateManager& mgr) {
const CBCKnockDownCmd* cmd = static_cast<const CBCKnockDownCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown)); const CBCKnockDownCmd* cmd = static_cast<const CBCKnockDownCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown));
zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection()); zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection());
zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.z()); zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.z());
angle.makeRel();
CPASAnimParmData parms(0, CPASAnimParm::FromReal32(angle.asDegrees()), CPASAnimParmData parms(0, CPASAnimParm::FromReal32(angle.asDegrees()),
CPASAnimParm::FromEnum(s32(cmd->GetHitSeverity()))); CPASAnimParm::FromEnum(s32(cmd->GetHitSeverity())));
std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
@ -193,7 +195,9 @@ void CBSFall::Start(CBodyController& bc, CStateManager& mgr) {
if (!knockdownState->GetAnimParmData(best.second, 2).GetBoolValue()) { if (!knockdownState->GetAnimParmData(best.second, 2).GetBoolValue()) {
float animAngle = zeus::degToRad(knockdownState->GetAnimParmData(best.second, 0).GetReal32Value()); float animAngle = zeus::degToRad(knockdownState->GetAnimParmData(best.second, 0).GetReal32Value());
zeus::CRelAngle delta1 = angle - animAngle; zeus::CRelAngle delta1 = angle - animAngle;
delta1.makeRel();
zeus::CRelAngle delta2 = animAngle - angle; zeus::CRelAngle delta2 = animAngle - angle;
delta2.makeRel();
float minAngle = std::min(float(delta1), float(delta2)); float minAngle = std::min(float(delta1), float(delta2));
x8_remTime = 0.15f * bc.GetAnimTimeRemaining(); x8_remTime = 0.15f * bc.GetAnimTimeRemaining();
float flippedAngle = (delta1 > M_PIF) ? -minAngle : minAngle; float flippedAngle = (delta1 > M_PIF) ? -minAngle : minAngle;
@ -263,6 +267,7 @@ void CBSKnockBack::Start(CBodyController& bc, CStateManager& mgr) {
const CBCKnockBackCmd* cmd = static_cast<const CBCKnockBackCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockBack)); const CBCKnockBackCmd* cmd = static_cast<const CBCKnockBackCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockBack));
zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection()); zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection());
zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x()); zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x());
angle.makeRel();
CPASAnimParmData parms(6, CPASAnimParm::FromReal32(angle.asDegrees()), CPASAnimParmData parms(6, CPASAnimParm::FromReal32(angle.asDegrees()),
CPASAnimParm::FromEnum(s32(cmd->GetHitSeverity()))); CPASAnimParm::FromEnum(s32(cmd->GetHitSeverity())));
std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
@ -272,7 +277,9 @@ void CBSKnockBack::Start(CBodyController& bc, CStateManager& mgr) {
if (!knockbackState->GetAnimParmData(best.second, 2).GetBoolValue()) { if (!knockbackState->GetAnimParmData(best.second, 2).GetBoolValue()) {
float animAngle = zeus::degToRad(knockbackState->GetAnimParmData(best.second, 0).GetReal32Value()); float animAngle = zeus::degToRad(knockbackState->GetAnimParmData(best.second, 0).GetReal32Value());
zeus::CRelAngle delta1 = angle - animAngle; zeus::CRelAngle delta1 = angle - animAngle;
delta1.makeRel();
zeus::CRelAngle delta2 = animAngle - angle; zeus::CRelAngle delta2 = animAngle - angle;
delta2.makeRel();
float minAngle = std::min(float(delta1), float(delta2)); float minAngle = std::min(float(delta1), float(delta2));
float flippedAngle = (delta1 > M_PIF) ? -minAngle : minAngle; float flippedAngle = (delta1 > M_PIF) ? -minAngle : minAngle;
xc_remTime = 0.15f * bc.GetAnimTimeRemaining(); xc_remTime = 0.15f * bc.GetAnimTimeRemaining();
@ -705,6 +712,7 @@ void CBSGroundHit::Start(CBodyController& bc, CStateManager& mgr) {
const CBCKnockBackCmd* cmd = static_cast<const CBCKnockBackCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockBack)); const CBCKnockBackCmd* cmd = static_cast<const CBCKnockBackCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockBack));
zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection()); zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection());
zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x()); zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x());
angle.makeRel();
CPASAnimParmData parms(11, CPASAnimParm::FromEnum(s32(bc.GetFallState())), CPASAnimParmData parms(11, CPASAnimParm::FromEnum(s32(bc.GetFallState())),
CPASAnimParm::FromReal32(angle.asDegrees())); CPASAnimParm::FromReal32(angle.asDegrees()));
std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); std::pair<float, s32> best = bc.GetPASDatabase().FindBestAnimation(parms, *mgr.GetActiveRandom(), -1);
@ -714,7 +722,9 @@ void CBSGroundHit::Start(CBodyController& bc, CStateManager& mgr) {
if (!groundHitState->GetAnimParmData(best.second, 2).GetBoolValue()) { if (!groundHitState->GetAnimParmData(best.second, 2).GetBoolValue()) {
float animAngle = zeus::degToRad(groundHitState->GetAnimParmData(best.second, 1).GetReal32Value()); float animAngle = zeus::degToRad(groundHitState->GetAnimParmData(best.second, 1).GetReal32Value());
zeus::CRelAngle delta1 = angle - animAngle; zeus::CRelAngle delta1 = angle - animAngle;
delta1.makeRel();
zeus::CRelAngle delta2 = animAngle - angle; zeus::CRelAngle delta2 = animAngle - angle;
delta2.makeRel();
float minAngle = std::min(float(delta1), float(delta2)); float minAngle = std::min(float(delta1), float(delta2));
float flippedAngle = (delta1 > M_PIF) ? -minAngle : minAngle; float flippedAngle = (delta1 > M_PIF) ? -minAngle : minAngle;
x8_remTime = 0.15f * bc.GetAnimTimeRemaining(); x8_remTime = 0.15f * bc.GetAnimTimeRemaining();
@ -956,6 +966,7 @@ void CBSHurled::Start(CBodyController& bc, CStateManager& mgr) {
x4_state = pas::EHurledState(cmd->GetSkipLaunchState()); x4_state = pas::EHurledState(cmd->GetSkipLaunchState());
zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection()); zeus::CVector3f localDir = bc.GetOwner().GetTransform().transposeRotate(cmd->GetHitDirection());
zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x()); zeus::CRelAngle angle = std::atan2(localDir.y(), localDir.x());
angle.makeRel();
x8_knockAngle = angle.asDegrees(); x8_knockAngle = angle.asDegrees();
CPASAnimParmData parms(14, CPASAnimParm::FromInt32(-1), CPASAnimParm::FromReal32(x8_knockAngle), CPASAnimParmData parms(14, CPASAnimParm::FromInt32(-1), CPASAnimParm::FromReal32(x8_knockAngle),
CPASAnimParm::FromEnum(s32(x4_state))); CPASAnimParm::FromEnum(s32(x4_state)));
@ -971,7 +982,9 @@ void CBSHurled::Start(CBodyController& bc, CStateManager& mgr) {
act->SetConstantForce(act->GetMass() * cmd->GetLaunchVelocity()); act->SetConstantForce(act->GetMass() * cmd->GetLaunchVelocity());
float animAngle = zeus::degToRad(hurledState->GetAnimParmData(best.second, 1).GetReal32Value()); float animAngle = zeus::degToRad(hurledState->GetAnimParmData(best.second, 1).GetReal32Value());
zeus::CRelAngle delta1 = angle - animAngle; zeus::CRelAngle delta1 = angle - animAngle;
delta1.makeRel();
zeus::CRelAngle delta2 = animAngle - angle; zeus::CRelAngle delta2 = animAngle - angle;
delta2.makeRel();
float minAngle = std::min(float(delta1), float(delta2)); float minAngle = std::min(float(delta1), float(delta2));
x14_remTime = 0.15f * bc.GetAnimTimeRemaining(); x14_remTime = 0.15f * bc.GetAnimTimeRemaining();
float flippedAngle = (delta1 > M_PIF) ? -minAngle : minAngle; float flippedAngle = (delta1 > M_PIF) ? -minAngle : minAngle;
@ -1146,7 +1159,7 @@ void CBSSlide::Start(CBodyController& bc, CStateManager& mgr) {
if (timeRem > FLT_EPSILON) { if (timeRem > FLT_EPSILON) {
const CPASAnimState* slideState = bc.GetPASDatabase().GetAnimState(15); const CPASAnimState* slideState = bc.GetPASDatabase().GetAnimState(15);
float animAngle = zeus::degToRad(slideState->GetAnimParmData(best.second, 1).GetReal32Value()); float animAngle = zeus::degToRad(slideState->GetAnimParmData(best.second, 1).GetReal32Value());
float delta1 = zeus::CRelAngle(angle - animAngle); float delta1 = zeus::CRelAngle(angle - animAngle).asRel();
float flippedAngle = (delta1 > M_PIF) ? delta1 - 2.f * M_PIF : delta1; float flippedAngle = (delta1 > M_PIF) ? delta1 - 2.f * M_PIF : delta1;
x4_rotateSpeed = flippedAngle / timeRem; x4_rotateSpeed = flippedAngle / timeRem;
} else { } else {

View File

@ -195,7 +195,7 @@ float CPASAnimState::ComputePercentErrorWeight(u32 idx, const CPASAnimParm& parm
} }
if (range > FLT_EPSILON) if (range > FLT_EPSILON)
return (val / range) - 1.0f; return 1.f - val / range;
return (val < FLT_EPSILON ? 1.f : 0.f); return (val < FLT_EPSILON ? 1.f : 0.f);
} }

View File

@ -194,6 +194,7 @@ void CCompoundTargetReticle::Update(float dt, const CStateManager& mgr) {
x204_chargeGaugeOvershootTimer = g_tweakTargeting->GetChargeGaugeOvershootDuration(); x204_chargeGaugeOvershootTimer = g_tweakTargeting->GetChargeGaugeOvershootDuration();
for (int i = 0; i < 9; ++i) { for (int i = 0; i < 9; ++i) {
zeus::CRelAngle baseAngle = g_tweakTargeting->GetOuterBeamSquareAngles(int(beam))[i]; zeus::CRelAngle baseAngle = g_tweakTargeting->GetOuterBeamSquareAngles(int(beam))[i];
baseAngle.makeRel();
SOuterItemInfo& icon = xe0_outerBeamIconSquares[i]; SOuterItemInfo& icon = xe0_outerBeamIconSquares[i];
zeus::CRelAngle offshootAngleDelta = baseAngle.asRadians() - icon.x10_rotAng; zeus::CRelAngle offshootAngleDelta = baseAngle.asRadians() - icon.x10_rotAng;
if ((i & 0x1) == 1) if ((i & 0x1) == 1)
@ -204,6 +205,7 @@ void CCompoundTargetReticle::Update(float dt, const CStateManager& mgr) {
icon.x14_baseAngle = baseAngle; icon.x14_baseAngle = baseAngle;
} }
zeus::CRelAngle baseAngle = g_tweakTargeting->GetChargeGaugeAngle(int(beam)); zeus::CRelAngle baseAngle = g_tweakTargeting->GetChargeGaugeAngle(int(beam));
baseAngle.makeRel();
float offshootAngleDelta = baseAngle.asRadians() - xc4_chargeGauge.x10_rotAng; float offshootAngleDelta = baseAngle.asRadians() - xc4_chargeGauge.x10_rotAng;
if ((rand() & 0x1) == 1) if ((rand() & 0x1) == 1)
offshootAngleDelta = offshootAngleDelta =
@ -254,8 +256,9 @@ void CCompoundTargetReticle::Update(float dt, const CStateManager& mgr) {
x1de_grapplePoint1 = kInvalidUniqueId; x1de_grapplePoint1 = kInvalidUniqueId;
} }
x1f0_xrayRetAngle = x1f0_xrayRetAngle =
zeus::CRelAngle(zeus::degToRad(g_tweakTargeting->GetXRayRetAngleSpeed() * dt) + x1f0_xrayRetAngle); zeus::CRelAngle(zeus::degToRad(g_tweakTargeting->GetXRayRetAngleSpeed() * dt) + x1f0_xrayRetAngle).asRel();
x1ec_seekerAngle = zeus::CRelAngle(zeus::degToRad(g_tweakTargeting->GetSeekerAngleSpeed() * dt) + x1ec_seekerAngle); x1ec_seekerAngle = zeus::CRelAngle(zeus::degToRad(g_tweakTargeting->GetSeekerAngleSpeed() * dt) + x1ec_seekerAngle).
asRel();
} }
void CTargetReticleRenderState::InterpolateWithClamp(const CTargetReticleRenderState& a, CTargetReticleRenderState& out, void CTargetReticleRenderState::InterpolateWithClamp(const CTargetReticleRenderState& a, CTargetReticleRenderState& out,
@ -344,10 +347,12 @@ void CCompoundTargetReticle::UpdateCurrLockOnGroup(float dt, const CStateManager
1.f - x204_chargeGaugeOvershootTimer / g_tweakTargeting->GetChargeGaugeOvershootDuration()); 1.f - x204_chargeGaugeOvershootTimer / g_tweakTargeting->GetChargeGaugeOvershootDuration());
for (int i = 0; i < 9; ++i) { for (int i = 0; i < 9; ++i) {
SOuterItemInfo& item = xe0_outerBeamIconSquares[i]; SOuterItemInfo& item = xe0_outerBeamIconSquares[i];
item.x10_rotAng = zeus::CRelAngle(item.x18_offshootAngleDelta * offshoot + item.xc_offshootBaseAngle); item.x10_rotAng = zeus::CRelAngle(item.x18_offshootAngleDelta * offshoot + item.xc_offshootBaseAngle).
asRel();
} }
xc4_chargeGauge.x10_rotAng = xc4_chargeGauge.x10_rotAng =
zeus::CRelAngle(xc4_chargeGauge.x18_offshootAngleDelta * offshoot + xc4_chargeGauge.xc_offshootBaseAngle); zeus::CRelAngle(xc4_chargeGauge.x18_offshootAngleDelta * offshoot + xc4_chargeGauge.xc_offshootBaseAngle).
asRel();
} }
} }
if (x208_lockonTimer > 0.f && x208_lockonTimer < g_tweakTargeting->GetLockonDuration()) if (x208_lockonTimer > 0.f && x208_lockonTimer < g_tweakTargeting->GetLockonDuration())

View File

@ -105,6 +105,7 @@ void CHudRadarInterface::Draw(const CStateManager& mgr, float alpha) const {
float camZ = float camZ =
zeus::CEulerAngles(zeus::CQuaternion(mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTransform().basis)).z(); zeus::CEulerAngles(zeus::CQuaternion(mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTransform().basis)).z();
zeus::CRelAngle angleZ(camZ); zeus::CRelAngle angleZ(camZ);
angleZ.makeRel();
drawParms.xc_preTranslate = zeus::CTransform::RotateY(angleZ); drawParms.xc_preTranslate = zeus::CTransform::RotateY(angleZ);
drawParms.x3c_postTranslate = x40_BaseWidget_RadarStuff->GetWorldTransform(); drawParms.x3c_postTranslate = x40_BaseWidget_RadarStuff->GetWorldTransform();
float enemyRadius = g_tweakGui->GetRadarEnemyPaintRadius(); float enemyRadius = g_tweakGui->GetRadarEnemyPaintRadius();

View File

@ -223,6 +223,7 @@ void CSamusDoll::Update(float dt, CRandom16& rand) {
if (x250_phazonIndirectTexture) { if (x250_phazonIndirectTexture) {
x260_phazonOffsetAngle += 0.03f; x260_phazonOffsetAngle += 0.03f;
x260_phazonOffsetAngle.makeRel();
g_Renderer->AllocatePhazonSuitMaskTexture(); g_Renderer->AllocatePhazonSuitMaskTexture();
} }
@ -596,23 +597,23 @@ void CSamusDoll::SetRotation(float xDelta, float zDelta, float dt) {
zeus::CEulerAngles angles(xb0_userRot); zeus::CEulerAngles angles(xb0_userRot);
zeus::CRelAngle angX(angles.x()); zeus::CRelAngle angX(angles.x());
angX.makeRel();
zeus::CRelAngle angZ(angles.z()); zeus::CRelAngle angZ(angles.z());
angZ.makeRel();
angX += xDelta; angX += xDelta;
angX.makeRel();
angZ += zDelta; angZ += zDelta;
angZ.makeRel();
float angXCenter = angX; float angXCenter = angX;
if (angXCenter > M_PIF) if (angXCenter > M_PIF)
angXCenter -= 2.f * M_PIF; angXCenter -= 2.f * M_PIF;
angXCenter = zeus::clamp(-1.555f, angXCenter, 1.555f); angXCenter = zeus::clamp(-1.555f, angXCenter, 1.555f);
float angZCenter = angZ;
if (angZCenter > M_PIF)
angZCenter -= 2.f * M_PIF;
zeus::CQuaternion quat; zeus::CQuaternion quat;
quat.rotateZ(angZCenter); quat.rotateZ(angZ);
quat.rotateX(angXCenter); quat.rotateX(zeus::CRelAngle(angXCenter).asRel());
xb0_userRot = quat; xb0_userRot = quat;
} }

View File

@ -131,7 +131,7 @@ void CPlayerGun::TakeDamage(bool bigStrike, bool notFromMetroid, CStateManager&
x364_gunStrikeCoolTimer = 0.75f; x364_gunStrikeCoolTimer = 0.75f;
if (x678_morph.GetGunState() == CGunMorph::EGunState::OutWipeDone) { if (x678_morph.GetGunState() == CGunMorph::EGunState::OutWipeDone) {
zeus::CVector3f localDamageLoc = mgr.GetPlayer().GetTransform().transposeRotate(x3dc_damageLocation); zeus::CVector3f localDamageLoc = mgr.GetPlayer().GetTransform().transposeRotate(x3dc_damageLocation);
angle = zeus::CRelAngle(std::atan2(localDamageLoc.y(), localDamageLoc.x())).asDegrees(); angle = zeus::CRelAngle(std::atan2(localDamageLoc.y(), localDamageLoc.x())).asRel().asDegrees();
hasStrikeAngle = true; hasStrikeAngle = true;
} }
} }

View File

@ -9,10 +9,16 @@
namespace urde { namespace urde {
CProjectileInfo::CProjectileInfo(urde::CInputStream& in) CProjectileInfo::CProjectileInfo(urde::CInputStream& in)
: x0_weaponDescription(g_SimplePool->GetObj({SBIG('WPSC'), CAssetId(in)})), xc_damageInfo(in) {} : x0_weaponDescription(g_SimplePool->GetObj({SBIG('WPSC'), CAssetId(in)})), xc_damageInfo(in) {
if (x0_weaponDescription.GetObjectTag()->id == 0xB4CB4495)
printf("");
}
CProjectileInfo::CProjectileInfo(CAssetId proj, const CDamageInfo& dInfo) CProjectileInfo::CProjectileInfo(CAssetId proj, const CDamageInfo& dInfo)
: x0_weaponDescription(g_SimplePool->GetObj({SBIG('WPSC'), proj})), xc_damageInfo(dInfo) {} : x0_weaponDescription(g_SimplePool->GetObj({SBIG('WPSC'), proj})), xc_damageInfo(dInfo) {
if (x0_weaponDescription.GetObjectTag()->id == 0xB4CB4495)
printf("");
}
zeus::CVector3f CProjectileInfo::PredictInterceptPos(const zeus::CVector3f& gunPos, const zeus::CVector3f& aimPos, zeus::CVector3f CProjectileInfo::PredictInterceptPos(const zeus::CVector3f& gunPos, const zeus::CVector3f& aimPos,
const CPlayer& player, bool gravity, float speed, float dt) { const CPlayer& player, bool gravity, float speed, float dt) {

View File

@ -185,8 +185,6 @@ void CPhysicsActor::MoveToWR(const zeus::CVector3f& trans, float d) {
zeus::CAxisAngle CPhysicsActor::GetRotateToORAngularMomentumWR(const zeus::CQuaternion& q, float d) const { zeus::CAxisAngle CPhysicsActor::GetRotateToORAngularMomentumWR(const zeus::CQuaternion& q, float d) const {
if (q.w() > 0.99999976) if (q.w() > 0.99999976)
return zeus::CAxisAngle::skZero; return zeus::CAxisAngle::skZero;
if (GetEditorId().Id() == 0x77)
printf("%f\n", q.yaw());
return (xf0_inertiaTensor * return (xf0_inertiaTensor *
(((2.f * std::acos(q.w())) * (1.f / d)) * x34_transform.rotate(q.getImaginary()).normalized())); (((2.f * std::acos(q.w())) * (1.f / d)) * x34_transform.rotate(q.getImaginary()).normalized()));
} }

View File

@ -109,7 +109,7 @@ void CScriptPickup::Think(float dt, CStateManager& mgr) {
if (chargeFactor > CPlayerGun::skTractorBeamFactor) { if (chargeFactor > CPlayerGun::skTractorBeamFactor) {
zeus::CVector3f posVec = zeus::CVector3f posVec =
(GetTranslation() - mgr.GetCameraManager()->GetFirstPersonCamera()->GetTranslation()).normalized(); (GetTranslation() - mgr.GetCameraManager()->GetFirstPersonCamera()->GetTranslation()).normalized();
float relFov = zeus::CRelAngle(zeus::degToRad(g_tweakGame->GetFirstPersonFOV())); float relFov = zeus::CRelAngle(zeus::degToRad(g_tweakGame->GetFirstPersonFOV())).asRel();
if (mgr.GetCameraManager()->GetFirstPersonCamera()->GetTransform().upVector().dot(posVec) > std::cos(relFov) && if (mgr.GetCameraManager()->GetFirstPersonCamera()->GetTransform().upVector().dot(posVec) > std::cos(relFov) &&
posVec.magSquared() < (30.f * 30.f)) { posVec.magSquared() < (30.f * 30.f)) {
x28c_25_ = true; x28c_25_ = true;

View File

@ -226,7 +226,7 @@ void CScriptPlayerActor::Think(float dt, CStateManager& mgr) {
if (x338_phazonIndirectTexture) { if (x338_phazonIndirectTexture) {
x34c_phazonOffsetAngle += 0.03f; x34c_phazonOffsetAngle += 0.03f;
x34c_phazonOffsetAngle = zeus::CRelAngle::FromRadians(x34c_phazonOffsetAngle); x34c_phazonOffsetAngle = zeus::CRelAngle(x34c_phazonOffsetAngle).asRel();
} }
CScriptActor::Think(dt, mgr); CScriptActor::Think(dt, mgr);

2
hecl

@ -1 +1 @@
Subproject commit ce11625af079a4449796b129b463f7d78d6a39d5 Subproject commit ef8806b1d3789f992beb86c29679ffe36a9a25d6

@ -1 +1 @@
Subproject commit 9ea12bded618ec4ac3198e86cb1937dece17239b Subproject commit 8da97f6c95872fb3fe7211c8bd6cf6a0f13050a6