diff --git a/Source/Contents/ActorGeometry.cpp b/Source/Contents/ActorGeometry.cpp index 5a2cb370..24887108 100644 --- a/Source/Contents/ActorGeometry.cpp +++ b/Source/Contents/ActorGeometry.cpp @@ -45,7 +45,7 @@ void CRenderObject::Face(float x, float z) { // OFFSET: 0x00CA96C0 // FUNCTION: fn_21009 -float CRenderObject::HorizontalDistance(float x, float z) const { +float CRenderObject::CalcDist(float x, float z) const { const float deltaX = x - this->render.position.x; const float deltaZ = z - this->render.position.z; return SquareRoot(deltaZ * deltaZ + deltaX * deltaX); @@ -53,7 +53,7 @@ float CRenderObject::HorizontalDistance(float x, float z) const { // OFFSET: 0x00CA9700 // FUNCTION: fn_21010 -float CRenderObject::Distance(float x, float y, float z) const { +float CRenderObject::CalcDist(float x, float y, float z) const { const float deltaX = x - this->render.position.x; const float deltaZ = z - this->render.position.z; const float deltaY = y - this->render.position.y; diff --git a/Source/Contents/Actors/RenderObject.h b/Source/Contents/Actors/RenderObject.h index 9818530e..b5867f6b 100644 --- a/Source/Contents/Actors/RenderObject.h +++ b/Source/Contents/Actors/RenderObject.h @@ -23,8 +23,8 @@ public: virtual void SetAnimation(unsigned animation, int motion, int repeat); static float __stdcall Heading(float x, float z, float targetX, float targetZ); void Face(float x, float z); - float HorizontalDistance(float x, float z) const; - float Distance(float x, float y, float z) const; + float CalcDist(float x, float z) const; + float CalcDist(float x, float y, float z) const; bool GetTargetPos(std::uint32_t targetAid, vector3d& targetPos) const; void SetAnimationSpeed(float speed); void SetActionSpeed(float speed); diff --git a/Source/Contents/Effects/EffectPrim.h b/Source/Contents/Effects/EffectPrim.h index 8c0ee448..0c3ed849 100644 --- a/Source/Contents/Effects/EffectPrim.h +++ b/Source/Contents/Effects/EffectPrim.h @@ -15,10 +15,10 @@ struct CEffectPrim : CRenderObject { bool UpdateFireWall(); bool UpdateStoneCurse(); void Prim3DCircle(); - bool UpdateHit6(); + bool Prim3DParticle(); bool UpdateCoin(); - bool UpdateDetoxication(); - bool UpdateExit(); + bool Prim3DParticleNoMaster(); + bool Prim3DParticleOrbit(); bool Prim3DParticleSpline(); void PrimBottom2(); void PrimBottom(); diff --git a/Source/Contents/Effects/EffectPrimitiveMotion.cpp b/Source/Contents/Effects/EffectPrimitiveMotion.cpp index 8b1138c0..1f583fa1 100644 --- a/Source/Contents/Effects/EffectPrimitiveMotion.cpp +++ b/Source/Contents/Effects/EffectPrimitiveMotion.cpp @@ -203,15 +203,15 @@ bool MoveEffectPrimitive(EffectPrimitiveState& particle, RenderObjectState& rend struct matrix matrix; if ((particle.flags & 0x200u) != 0) { - matrix.SetZRotation(context.cameraPitch); + matrix.MakeZRotation(context.cameraPitch); } else if ((particle.flags & 0x40u) != 0) { particle.unknown_030C = context.cameraYaw + 90.0f; particle.unknown_0314 = context.cameraPitch; matrix.MakeXRotation(GetRadian(TruncateToInt(particle.unknown_0310))); - matrix.RotateZ(GetRadian(TruncateToInt(particle.unknown_0314))); + matrix.AppendZRotation(GetRadian(TruncateToInt(particle.unknown_0314))); } else { - matrix.SetZRotation(GetRadian(TruncateToInt(particle.unknown_0314))); - matrix.RotateX(GetRadian(TruncateToInt(particle.unknown_0310))); + matrix.MakeZRotation(GetRadian(TruncateToInt(particle.unknown_0314))); + matrix.AppendXRotation(GetRadian(TruncateToInt(particle.unknown_0310))); } const float angle = (particle.flags & 0x200u) != 0 ? render.angle : particle.unknown_030C; @@ -2287,7 +2287,7 @@ void CEffectPrim::PrimWaterFall() { // OFFSET: 0x00BB6F30 // FUNCTION: fn_19779 -bool CEffectPrim::UpdateHit6() { +bool CEffectPrim::Prim3DParticle() { const CRagEffect* master = this->state.master; this->state.origin.x = master->render.position.x + this->state.velocity.x; this->state.origin.y = master->render.position.y + this->state.velocity.y; @@ -2353,8 +2353,8 @@ bool CEffectPrim::UpdateHit6() { this->state.unknown_02BC = static_cast(rand() % 35 + 15) / 100.0f; this->state.unknown_030C = static_cast(rand() % 80) + (this->state.unknown_030C - 40.0f); this->state.unknown_0310 = static_cast(rand() % 80) + (this->state.unknown_0310 - 40.0f); - reinterpret_cast(this->state.matrix1)->SetYRotation(GetRadian(static_cast(this->state.unknown_030C))); - reinterpret_cast(this->state.matrix1)->RotateX(GetRadian(static_cast(this->state.unknown_0310))); + reinterpret_cast(this->state.matrix1)->MakeYRotation(GetRadian(static_cast(this->state.unknown_030C))); + reinterpret_cast(this->state.matrix1)->AppendXRotation(GetRadian(static_cast(this->state.unknown_0310))); flags = this->state.flags; this->state.unknown_01D4 = rand() % 10 + 5; } @@ -2373,7 +2373,7 @@ bool CEffectPrim::UpdateHit6() { }; if ((this->state.flags & 0x100u) != 0) { - if (3.0f >= this->HorizontalDistance(this->state.master->state.offset[0], this->state.master->state.offset[2])) { + if (3.0f >= this->CalcDist(this->state.master->state.offset[0], this->state.master->state.offset[2])) { return false; } } @@ -2430,7 +2430,7 @@ bool CEffectPrim::UpdateCoin() { // OFFSET: 0x00BB78A0 // FUNCTION: fn_19781 -bool CEffectPrim::UpdateDetoxication() { +bool CEffectPrim::Prim3DParticleNoMaster() { float positionX = this->state.origin.x + this->state.velocity.x; const float positionY = this->state.origin.y + this->state.velocity.y; const float positionZ = this->state.origin.z + this->state.velocity.z; @@ -2494,8 +2494,8 @@ bool CEffectPrim::UpdateDetoxication() { this->state.unknown_02BC = static_cast(rand() % 35 + 15) / 100.0f; this->state.unknown_030C = static_cast(rand() % 80) + (this->state.unknown_030C - 40.0f); this->state.unknown_0310 = static_cast(rand() % 80) + (this->state.unknown_0310 - 40.0f); - reinterpret_cast(this->state.matrix1)->SetYRotation(GetRadian(static_cast(this->state.unknown_030C))); - reinterpret_cast(this->state.matrix1)->RotateX(GetRadian(static_cast(this->state.unknown_0310))); + reinterpret_cast(this->state.matrix1)->MakeYRotation(GetRadian(static_cast(this->state.unknown_030C))); + reinterpret_cast(this->state.matrix1)->AppendXRotation(GetRadian(static_cast(this->state.unknown_0310))); this->state.unknown_01D4 = rand() % 10 + 5; flags = this->state.flags; } @@ -2524,7 +2524,7 @@ bool CEffectPrim::UpdateDetoxication() { // OFFSET: 0x00BB7EC0 // FUNCTION: fn_19782 -bool CEffectPrim::UpdateExit() { +bool CEffectPrim::Prim3DParticleOrbit() { const CRagEffect* master = this->state.master; this->state.origin = {master->render.position.x, master->render.position.y, master->render.position.z}; @@ -2568,7 +2568,7 @@ bool CEffectPrim::UpdateExit() { } } - reinterpret_cast(this->state.matrix1)->SetYRotation(GetRadian(static_cast(this->state.unknown_030C))); + reinterpret_cast(this->state.matrix1)->MakeYRotation(GetRadian(static_cast(this->state.unknown_030C))); const float distance = this->state.unknown_0348; this->state.offset = Forward(distance, this->state.matrix1); @@ -2579,7 +2579,7 @@ bool CEffectPrim::UpdateExit() { this->state.scale = this->state.unknown_031C + this->state.scale; const float rotation = this->state.unknown_0334 + this->state.unknown_0310; this->state.unknown_0310 = rotation; - reinterpret_cast(this->state.matrix1)->RotateZ(rotation); + reinterpret_cast(this->state.matrix1)->AppendZRotation(rotation); this->state.ProcessAlpha(); this->ShiftSegment(); diff --git a/Source/Contents/Models/ModelActor.cpp b/Source/Contents/Models/ModelActor.cpp index 65af48e4..471d7a4e 100644 --- a/Source/Contents/Models/ModelActor.cpp +++ b/Source/Contents/Models/ModelActor.cpp @@ -96,11 +96,11 @@ void C3dActorV2::Assign(const C3dModelRes& resource) { // FUNCTION: fn_17516 void C3dActor::UpdateMatrix() { this->transform.MakeTranslate(this->offset[0], this->offset[1], this->offset[2]); - this->transform.Scale(this->scale[0], this->scale[1], this->scale[2]); + this->transform.AppendScale(this->scale[0], this->scale[1], this->scale[2]); this->transform.AppendYRotation(Radians(this->rotation[1])); - this->transform.RotateX(Radians(this->rotation[0])); - this->transform.RotateZ(Radians(this->rotation[2])); - this->transform.Translate(this->position); + this->transform.AppendXRotation(Radians(this->rotation[0])); + this->transform.AppendZRotation(Radians(this->rotation[2])); + this->transform.AppendTranslate(this->position); this->inverseTransform.MakeInverse(this->transform); this->dirty = 0; } @@ -110,11 +110,11 @@ void C3dActor::UpdateMatrix() { void C3dActorV2::UpdateMatrix() { this->transform.Identity(); this->transform.values[4] = -1.0f; - this->transform.Scale(this->scale[0], this->scale[1], this->scale[2]); + this->transform.AppendScale(this->scale[0], this->scale[1], this->scale[2]); this->transform.AppendYRotation(Radians(this->rotation[1])); - this->transform.RotateX(Radians(this->rotation[0])); - this->transform.RotateZ(Radians(this->rotation[2])); - this->transform.Translate(this->position); + this->transform.AppendXRotation(Radians(this->rotation[0])); + this->transform.AppendZRotation(Radians(this->rotation[2])); + this->transform.AppendTranslate(this->position); this->inverseTransform.MakeInverse(this->transform); this->dirty = 0; } diff --git a/Source/Contents/Models/ModelActorBounds.cpp b/Source/Contents/Models/ModelActorBounds.cpp index 0354eba2..38266b8b 100644 --- a/Source/Contents/Models/ModelActorBounds.cpp +++ b/Source/Contents/Models/ModelActorBounds.cpp @@ -37,11 +37,11 @@ void C3dActorV1::UpdateBounds() { this->offset[1] = -bounds[4]; this->offset[2] = -(bounds[5] + bounds[2]) * 0.5f; this->transform.MakeTranslate(this->offset[0], this->offset[1], this->offset[2]); - this->transform.Scale(this->scale[0], this->scale[1], this->scale[2]); + this->transform.AppendScale(this->scale[0], this->scale[1], this->scale[2]); this->transform.AppendYRotation(Radians(this->rotation[1])); - this->transform.RotateX(Radians(this->rotation[0])); - this->transform.RotateZ(Radians(this->rotation[2])); - this->transform.Translate(this->position); + this->transform.AppendXRotation(Radians(this->rotation[0])); + this->transform.AppendZRotation(Radians(this->rotation[2])); + this->transform.AppendTranslate(this->position); this->FinishBounds(bounds, false); } @@ -96,8 +96,8 @@ void C3dActor::FinishBounds(const float* bounds, bool modern) { matrix axes; axes.SetScale(this->scale[0], this->scale[1], this->scale[2]); axes.AppendYRotation(Radians(this->rotation[1])); - axes.RotateX(Radians(this->rotation[0])); - axes.RotateZ(Radians(this->rotation[2])); + axes.AppendXRotation(Radians(this->rotation[0])); + axes.AppendZRotation(Radians(this->rotation[2])); for (unsigned axis = 0; axis < 3; ++axis) { float* direction = this->oriented.axes[axis]; @@ -114,8 +114,8 @@ void C3dActor::FinishBounds(const float* bounds, bool modern) { matrix rotation; rotation.MakeXRotation(Radians(volume->rotation[0])); rotation.AppendYRotation(Radians(volume->rotation[1])); - rotation.RotateZ(Radians(volume->rotation[2])); - rotation.Translate(volume->position); + rotation.AppendZRotation(Radians(volume->rotation[2])); + rotation.AppendTranslate(volume->position); std::memcpy(volume->unknown_0084, rotation.values, sizeof(rotation.values)); matrix inverse; inverse.MakeInverse(rotation); diff --git a/Source/Contents/Sound/SoundMaker.cpp b/Source/Contents/Sound/SoundMaker.cpp index 2d2e8d95..3f8c6790 100644 --- a/Source/Contents/Sound/SoundMaker.cpp +++ b/Source/Contents/Sound/SoundMaker.cpp @@ -107,7 +107,7 @@ bool CSoundMaker::Update() { return true; } - const float distance = this->HorizontalDistance(player->render.position.x, player->render.position.z); + const float distance = this->CalcDist(player->render.position.x, player->render.position.z); if (distance - (this->radius + this->range) > 130.0f) { return true; } @@ -138,7 +138,7 @@ bool CSoundMaker::Update() { const float x = this->render.position.x + offsetX; const float z = this->render.position.z + offsetZ; - if (player->HorizontalDistance(x, z) - this->range > 75.0f || this->file.empty()) { + if (player->CalcDist(x, z) - this->range > 75.0f || this->file.empty()) { return true; } diff --git a/Source/Resource/Models/ModelResource.cpp b/Source/Resource/Models/ModelResource.cpp index dbfdb154..38d9a38d 100644 --- a/Source/Resource/Models/ModelResource.cpp +++ b/Source/Resource/Models/ModelResource.cpp @@ -712,7 +712,7 @@ granny_control* C3dGrannyModelRes::PlayAnimation(unsigned action, granny_model_i // FUNCTION: fn_08008 bool C3dGrannyModelRes::ProjectBounds(float* rect, const matrix& view, const matrix& world, const float* eye) const { matrix matrix; - matrix.SetZRotation(3.141592f); + matrix.MakeZRotation(3.141592f); const float* m = matrix.values; const float x = this->position[1] * m[3] + this->position[0] * m[0] + this->position[2] * m[6] + m[9]; const float y = this->position[0] * m[1] + this->position[1] * m[4] + this->position[2] * m[7] + m[10]; diff --git a/Source/Utility/Math/AffineMatrix.cpp b/Source/Utility/Math/AffineMatrix.cpp index 8cfc5867..0dad9d9b 100644 --- a/Source/Utility/Math/AffineMatrix.cpp +++ b/Source/Utility/Math/AffineMatrix.cpp @@ -46,7 +46,7 @@ void matrix::MakeXRotation(float radians) { // OFFSET: 0x005553D0 // FUNCTION: fn_02035 -void matrix::SetYRotation(float radians) { +void matrix::MakeYRotation(float radians) { this->Identity(); const float sine = ClientSin(radians); @@ -59,7 +59,7 @@ void matrix::SetYRotation(float radians) { // OFFSET: 0x00555440 // FUNCTION: fn_02036 -void matrix::SetZRotation(float radians) { +void matrix::MakeZRotation(float radians) { this->Identity(); const float sine = ClientSin(radians); @@ -72,7 +72,7 @@ void matrix::SetZRotation(float radians) { // OFFSET: 0x00552F70 // FUNCTION: fn_02016 -void matrix::RotateX(float radians) { +void matrix::AppendXRotation(float radians) { matrix rotation; rotation.MakeXRotation(radians); Rotate(this->values, rotation.values); @@ -82,15 +82,15 @@ void matrix::RotateX(float radians) { // FUNCTION: fn_02017 void matrix::AppendYRotation(float radians) { matrix rotation; - rotation.SetYRotation(radians); + rotation.MakeYRotation(radians); Rotate(this->values, rotation.values); } // OFFSET: 0x00553570 // FUNCTION: fn_02018 -void matrix::RotateZ(float radians) { +void matrix::AppendZRotation(float radians) { matrix rotation; - rotation.SetZRotation(radians); + rotation.MakeZRotation(radians); Rotate(this->values, rotation.values); } @@ -114,7 +114,7 @@ void matrix::SetScale(float x, float y, float z) { // OFFSET: 0x005529C0 // FUNCTION: fn_02014 -void matrix::Scale(float x, float y, float z) { +void matrix::AppendScale(float x, float y, float z) { matrix scale; scale.SetScale(x, y, z); Rotate(this->values, scale.values); @@ -122,7 +122,7 @@ void matrix::Scale(float x, float y, float z) { // OFFSET: 0x00552CA0 // FUNCTION: fn_02015 -void matrix::Translate(const float* position) { +void matrix::AppendTranslate(const float* position) { matrix translation; translation.MakeTranslate(position[0], position[1], position[2]); Rotate(this->values, translation.values); diff --git a/Source/Utility/Math/AffineMatrix.h b/Source/Utility/Math/AffineMatrix.h index e4bda095..91b92e4d 100644 --- a/Source/Utility/Math/AffineMatrix.h +++ b/Source/Utility/Math/AffineMatrix.h @@ -24,15 +24,15 @@ struct matrix { int IsIdentity() const; void MakeTransform(const float* rotaxis, float rotangle); void MakeXRotation(float radians); - void SetYRotation(float radians); - void SetZRotation(float radians); - void RotateX(float radians); + void MakeYRotation(float radians); + void MakeZRotation(float radians); + void AppendXRotation(float radians); void AppendYRotation(float radians); - void RotateZ(float radians); + void AppendZRotation(float radians); void MakeTranslate(float x, float y, float z); void SetScale(float x, float y, float z); - void Scale(float x, float y, float z); - void Translate(const float* position); + void AppendScale(float x, float y, float z); + void AppendTranslate(const float* position); void Compose(const matrix& first, const matrix& second); void MakeInverse(const matrix& source); void LookAt(const float* origin, const float* target, const float* up);