mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
fps_patches: fix Egg Dragoon drill missile rotating incorrectly (#378)
Co-authored-by: Skyth (Asilkan) <19259897+blueskythlikesclouds@users.noreply.github.com>
This commit is contained in:
parent
86b346e037
commit
a13fdc136b
9 changed files with 138 additions and 0 deletions
27
UnleashedRecomp/api/Hedgehog/Math/Matrix.h
Normal file
27
UnleashedRecomp/api/Hedgehog/Math/Matrix.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
|
||||
#include <SWA.inl>
|
||||
|
||||
namespace Hedgehog::Math
|
||||
{
|
||||
class CMatrix
|
||||
{
|
||||
public:
|
||||
be<float> m_M00;
|
||||
be<float> m_M01;
|
||||
be<float> m_M02;
|
||||
be<float> m_M03;
|
||||
be<float> m_M10;
|
||||
be<float> m_M11;
|
||||
be<float> m_M12;
|
||||
be<float> m_M13;
|
||||
be<float> m_M20;
|
||||
be<float> m_M21;
|
||||
be<float> m_M22;
|
||||
be<float> m_M23;
|
||||
be<float> m_M30;
|
||||
be<float> m_M31;
|
||||
be<float> m_M32;
|
||||
be<float> m_M33;
|
||||
};
|
||||
}
|
||||
15
UnleashedRecomp/api/Hedgehog/Math/Quaternion.h
Normal file
15
UnleashedRecomp/api/Hedgehog/Math/Quaternion.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
#include <SWA.inl>
|
||||
|
||||
namespace Hedgehog::Math
|
||||
{
|
||||
class CQuaternion
|
||||
{
|
||||
public:
|
||||
be<float> X;
|
||||
be<float> Y;
|
||||
be<float> Z;
|
||||
be<float> W;
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include <SWA.inl>
|
||||
|
||||
namespace Hedgehog::Mirage
|
||||
{
|
||||
class CMatrixNodeListener;
|
||||
|
||||
class CMatrixNode : public Base::CObject
|
||||
{
|
||||
public:
|
||||
SWA_INSERT_PADDING(0x60);
|
||||
};
|
||||
|
||||
SWA_ASSERT_SIZEOF(CMatrixNode, 0x60);
|
||||
}
|
||||
19
UnleashedRecomp/api/Hedgehog/MirageCore/Misc/hhTransform.h
Normal file
19
UnleashedRecomp/api/Hedgehog/MirageCore/Misc/hhTransform.h
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#pragma once
|
||||
|
||||
#include <SWA.inl>
|
||||
|
||||
namespace Hedgehog::Mirage
|
||||
{
|
||||
class CTransform
|
||||
{
|
||||
public:
|
||||
Math::CQuaternion m_Rotation;
|
||||
Math::CVector m_Position;
|
||||
Math::CMatrix m_Matrix;
|
||||
};
|
||||
|
||||
SWA_ASSERT_OFFSETOF(CTransform, m_Rotation, 0x00);
|
||||
SWA_ASSERT_OFFSETOF(CTransform, m_Position, 0x10);
|
||||
SWA_ASSERT_OFFSETOF(CTransform, m_Matrix, 0x20);
|
||||
SWA_ASSERT_SIZEOF(CTransform, 0x60);
|
||||
}
|
||||
|
|
@ -27,7 +27,11 @@
|
|||
#include "Hedgehog/Base/Type/hhSharedString.h"
|
||||
#include "Hedgehog/Base/hhObject.h"
|
||||
#include "Hedgehog/Database/System/hhDatabaseData.h"
|
||||
#include "Hedgehog/Math/Matrix.h"
|
||||
#include "Hedgehog/Math/Quaternion.h"
|
||||
#include "Hedgehog/Math/Vector.h"
|
||||
#include "Hedgehog/MirageCore/MatrixNode/hhMatrixNode.h"
|
||||
#include "Hedgehog/MirageCore/Misc/hhTransform.h"
|
||||
#include "Hedgehog/MirageCore/Misc/hhVertexDeclarationPtr.h"
|
||||
#include "Hedgehog/MirageCore/RenderData/hhMaterialData.h"
|
||||
#include "Hedgehog/MirageCore/RenderData/hhMeshData.h"
|
||||
|
|
@ -55,6 +59,7 @@
|
|||
#include "SWA/Achievement/AchievementID.h"
|
||||
#include "SWA/Achievement/AchievementManager.h"
|
||||
#include "SWA/Achievement/AchievementTest.h"
|
||||
#include "SWA/Boss/EggDragoon/Object/BossEggDragoonDrillMissile.h"
|
||||
#include "SWA/CSD/CsdDatabaseWrapper.h"
|
||||
#include "SWA/CSD/CsdProject.h"
|
||||
#include "SWA/CSD/CsdTexListMirage.h"
|
||||
|
|
@ -116,6 +121,7 @@
|
|||
#include "SWA/System/GameParameter.h"
|
||||
#include "SWA/System/GammaController.h"
|
||||
#include "SWA/System/InputState.h"
|
||||
#include "SWA/System/MatrixNodeTransform.h"
|
||||
#include "SWA/System/PadState.h"
|
||||
#include "SWA/System/World.h"
|
||||
#include "boost/smart_ptr/make_shared_object.h"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include <SWA.inl>
|
||||
#include "SWA/System/MatrixNodeTransform.h"
|
||||
|
||||
namespace SWA::Boss::EggDragoon::DrillMissile
|
||||
{
|
||||
class CMissile
|
||||
{
|
||||
public:
|
||||
SWA_INSERT_PADDING(0xC4);
|
||||
xpointer<CMatrixNodeTransform> m_pMatrixNodeTransform;
|
||||
SWA_INSERT_PADDING(0x68);
|
||||
be<float> m_Speed;
|
||||
};
|
||||
}
|
||||
17
UnleashedRecomp/api/SWA/System/MatrixNodeTransform.h
Normal file
17
UnleashedRecomp/api/SWA/System/MatrixNodeTransform.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#pragma once
|
||||
|
||||
#include <SWA.inl>
|
||||
|
||||
namespace SWA
|
||||
{
|
||||
class CMatrixNodeTransform : public Hedgehog::Mirage::CMatrixNode
|
||||
{
|
||||
public:
|
||||
Hedgehog::Mirage::CTransform m_Transform;
|
||||
Hedgehog::Math::CMatrix m_WorldMatrix;
|
||||
};
|
||||
|
||||
SWA_ASSERT_OFFSETOF(CMatrixNodeTransform, m_Transform, 0x60);
|
||||
SWA_ASSERT_OFFSETOF(CMatrixNodeTransform, m_WorldMatrix, 0xC0);
|
||||
SWA_ASSERT_SIZEOF(CMatrixNodeTransform, 0x100);
|
||||
}
|
||||
|
|
@ -171,6 +171,23 @@ PPC_FUNC(sub_82B00D00)
|
|||
*pElapsedTime = std::max(*pElapsedTime, 0.0f);
|
||||
}
|
||||
|
||||
// Fix for Egg Dragoon's drill missile attack rotating 90 degrees at HFR.
|
||||
void BossEggDragoonDrillMissileCMissileSetRotationMidAsmHook(PPCRegister& r4)
|
||||
{
|
||||
auto pRotation = (Hedgehog::Math::CQuaternion*)g_memory.Translate(r4.u32);
|
||||
auto magnitude = std::sqrt(pRotation->X * pRotation->X + pRotation->Y * pRotation->Y + pRotation->Z * pRotation->Z + pRotation->W * pRotation->W);
|
||||
|
||||
if (magnitude < 0.0f)
|
||||
return;
|
||||
|
||||
auto magnitudeNrm = 1.0f / magnitude;
|
||||
|
||||
pRotation->X = pRotation->X * magnitudeNrm;
|
||||
pRotation->Y = pRotation->Y * magnitudeNrm;
|
||||
pRotation->Z = pRotation->Z * magnitudeNrm;
|
||||
pRotation->W = pRotation->W * magnitudeNrm;
|
||||
}
|
||||
|
||||
bool SparkleLocusMidAsmHook()
|
||||
{
|
||||
// There is an epsilon check in sparkle locus particle code that seems to never pass at high frame rates, which causes vertex corruption.
|
||||
|
|
|
|||
|
|
@ -979,3 +979,8 @@ jump_address_on_true = 0x82E96808
|
|||
name = "HighFrameRateDeltaTimeFixVectorMidAsmHook"
|
||||
address = 0x827673CC
|
||||
registers = ["v62"]
|
||||
|
||||
[[midasm_hook]]
|
||||
name = "BossEggDragoonDrillMissileCMissileSetRotationMidAsmHook"
|
||||
address = 0x82A9BADC
|
||||
registers = ["r4"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue