In summary, switching to DirectXMath in a game utilizing DX9Ex (such as in Metin2 infrastructures) does not directly turn the game into DirectX 11 or 12 (graphical rendering still operates via DX9Ex); however, it offloads the background mathematical processing burden from the CPU to provide hardware-accelerated performance and enables seamless compilation on modern compilers without errors.
actorisntnacesync.cpp
Code:
#include "StdAfx.h"
#include "ActorInstance.h"
#include "RaceData.h"
#include <DirectXMath.h> // DirectXMath kütüphanesi
void CActorInstance::__Push(int x, int y)
{
const TPixelPosition& c_rv3Src = GetPosition();
// TPixelPosition verisini DirectXMath vektör yazmacına yüklüyoruz
DirectX::XMVECTOR vSrc = DirectX::XMLoadFloat3(reinterpret_cast<const DirectX::XMFLOAT3*>(&c_rv3Src));
DirectX::XMVECTOR vDst = DirectX::XMVectorSet(static_cast<float>(x), static_cast<float>(-y), c_rv3Src.z, 0.0f);
DirectX::XMVECTOR vDelta = DirectX::XMVectorSubtract(vDst, vSrc);
constexpr float LoopValue = 100.0f;
DirectX::XMVECTOR vInc = DirectX::XMVectorScale(vDelta, 1.0f / LoopValue);
DirectX::XMVECTOR vMovement = DirectX::XMVectorZero();
IPhysicsWorld* pWorld = IPhysicsWorld::GetPhysicsWorld();
if (!pWorld)
return;
for (int i = 0; i < static_cast<int>(LoopValue); ++i)
{
DirectX::XMVECTOR vCheckPos = DirectX::XMVectorAdd(vSrc, vMovement);
// Fizik motorunun kabul etmesi için vektörü TPixelPosition formatına geri aktarıyoruz
TPixelPosition checkPos;
DirectX::XMStoreFloat3(reinterpret_cast<DirectX::XMFLOAT3*>(&checkPos), vCheckPos);
if (pWorld->isPhysicalCollision(checkPos))
{
ResetBlendingPosition();
return;
}
vMovement = DirectX::XMVectorAdd(vMovement, vInc);
}
TPixelPosition dstPos;
DirectX::XMStoreFloat3(reinterpret_cast<DirectX::XMFLOAT3*>(&dstPos), vDst);
SetBlendingPosition(dstPos);
if (IsResistFallen()) // @fixme033 check moved here
return;
if (!IsUsingSkill())
{
// Karekök hesaplaması yerine DirectXMath optimize 2D uzunluk fonksiyonu
DirectX::XMVECTOR vLength2D = DirectX::XMVector2Length(vDelta);
const float len = DirectX::XMVectorGetX(vLength2D);
if (len > 150.0f)
{
InterceptOnceMotion(CRaceMotionData::NAME_DAMAGE_FLYING);
PushOnceMotion(CRaceMotionData::NAME_STAND_UP);
}
}
}
void CActorInstance::TEMP_Push(int x, int y)
{
__Push(x, y);
}
bool CActorInstance::__IsSyncing()
{
if (IsDead())
return TRUE;
if (IsStun())
return TRUE;
if (IsPushing())
return TRUE;
return FALSE;
}
bool CActorInstance::IsPushing()
{
return m_PhysicsObject.isBlending();
}

