mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-11 01:48:07 +00:00
Replace Quaternion with glm math (#1868)
This commit is contained in:
@@ -93,7 +93,7 @@ void AmDrawBridge::MoveBridgeDown(Entity* self, Entity* bridge, bool down) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto forwardVect = simplePhysicsComponent->GetRotation().GetForwardVector();
|
||||
auto forwardVect = QuatUtils::Forward(simplePhysicsComponent->GetRotation());
|
||||
|
||||
auto degrees = down ? 90.0f : -90.0f;
|
||||
|
||||
|
@@ -129,7 +129,7 @@ void AmShieldGenerator::EnemyEnteredShield(Entity* self, Entity* intruder) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto dir = intruder->GetRotation().GetForwardVector() * -1;
|
||||
auto dir = QuatUtils::Forward(intruder->GetRotation()) * -1;
|
||||
dir.y += 15;
|
||||
dir.x *= 50;
|
||||
dir.z *= 50;
|
||||
|
@@ -187,7 +187,7 @@ void AmShieldGeneratorQuickbuild::EnemyEnteredShield(Entity* self, Entity* intru
|
||||
return;
|
||||
}
|
||||
|
||||
auto dir = intruder->GetRotation().GetForwardVector() * -1;
|
||||
auto dir = QuatUtils::Forward(intruder->GetRotation()) * -1;
|
||||
dir.y += 15;
|
||||
dir.x *= 50;
|
||||
dir.z *= 50;
|
||||
|
@@ -46,23 +46,23 @@ void AmSkullkinTower::SpawnLegs(Entity* self, const std::string& loc) {
|
||||
info.rot = newRot;
|
||||
|
||||
if (loc == "Right") {
|
||||
const auto dir = rot.GetForwardVector();
|
||||
const auto dir = QuatUtils::Forward(rot);
|
||||
pos.x += dir.x * offset;
|
||||
pos.z += dir.z * offset;
|
||||
info.pos = pos;
|
||||
} else if (loc == "Rear") {
|
||||
const auto dir = rot.GetRightVector();
|
||||
const auto dir = QuatUtils::Right(rot);
|
||||
pos.x += dir.x * offset;
|
||||
pos.z += dir.z * offset;
|
||||
info.pos = pos;
|
||||
} else if (loc == "Left") {
|
||||
const auto dir = rot.GetForwardVector() * -1;
|
||||
const auto dir = QuatUtils::Forward(rot) * -1;
|
||||
pos.x += dir.x * offset;
|
||||
pos.z += dir.z * offset;
|
||||
info.pos = pos;
|
||||
}
|
||||
|
||||
info.rot = NiQuaternion::LookAt(info.pos, self->GetPosition());
|
||||
info.rot = QuatUtils::LookAt(info.pos, self->GetPosition());
|
||||
|
||||
auto* entity = Game::entityManager->CreateEntity(info, nullptr, self);
|
||||
|
||||
|
@@ -21,7 +21,7 @@ void GfCaptainsCannon::OnUse(Entity* self, Entity* user) {
|
||||
);
|
||||
|
||||
auto position = self->GetPosition();
|
||||
auto forward = self->GetRotation().GetForwardVector();
|
||||
auto forward = QuatUtils::Forward(self->GetRotation());
|
||||
|
||||
position.x += forward.x * -3;
|
||||
position.z += forward.z * -3;
|
||||
|
@@ -65,7 +65,7 @@ void MastTeleport::OnTimerDone(Entity* self, std::string timerName) {
|
||||
} else if (timerName == "PlayerAnimDone") {
|
||||
GameMessages::SendStopFXEffect(player, true, "hook");
|
||||
|
||||
auto forward = self->GetRotation().GetForwardVector();
|
||||
auto forward = QuatUtils::Forward(self->GetRotation());
|
||||
|
||||
const auto degrees = -25.0f;
|
||||
|
||||
@@ -81,7 +81,7 @@ void MastTeleport::OnTimerDone(Entity* self, std::string timerName) {
|
||||
|
||||
GameMessages::SendOrientToAngle(playerId, true, rads, player->GetSystemAddress());
|
||||
|
||||
GameMessages::SendTeleport(playerId, position, NiQuaternionConstant::IDENTITY, player->GetSystemAddress());
|
||||
GameMessages::SendTeleport(playerId, position, QuatUtils::IDENTITY, player->GetSystemAddress());
|
||||
|
||||
GameMessages::SendSetStunned(playerId, eStateChangeType::POP, player->GetSystemAddress(),
|
||||
LWOOBJID_EMPTY, true, true, true, true, true, true, true
|
||||
|
@@ -45,13 +45,13 @@ void QbSpawner::OnTimerDone(Entity* self, std::string timerName) {
|
||||
if (!gate) return;
|
||||
|
||||
auto oPos = gate->GetPosition();
|
||||
auto oDir = gate->GetRotation().GetForwardVector();
|
||||
auto oDir = QuatUtils::Forward(gate->GetRotation());
|
||||
NiPoint3 newPos(
|
||||
oPos.x + (oDir.x * spawnDist),
|
||||
oPos.y,
|
||||
oPos.z + (oDir.z * spawnDist)
|
||||
);
|
||||
auto newRot = NiQuaternion::LookAt(newPos, oPos);
|
||||
auto newRot = QuatUtils::LookAt(newPos, oPos);
|
||||
|
||||
for (int i = 0; i < mobTable.size(); i++) {
|
||||
int posOffset = -10;
|
||||
|
@@ -108,7 +108,7 @@ void NtCombatChallengeServer::OnChildLoaded(Entity& self, GameMessages::ChildLoa
|
||||
auto* const child = Game::entityManager->GetEntity(childLoaded.childID);
|
||||
|
||||
if (child) {
|
||||
child->SetRotation(NiQuaternion::FromEulerAngles(child->GetRotation().GetEulerAngles() += NiPoint3(0, PI, 0))); // rotate 180 degrees
|
||||
child->SetRotation(QuatUtils::FromEuler(QuatUtils::Euler(child->GetRotation()) += NiPoint3(0, PI, 0))); // rotate 180 degrees
|
||||
}
|
||||
|
||||
self.SetVar(u"currentTargetID", child->GetObjectID());
|
||||
|
@@ -48,7 +48,7 @@ void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) {
|
||||
|
||||
RenderComponent::PlayAnimation(user, shockAnim);
|
||||
|
||||
const auto dir = self->GetRotation().GetRightVector();
|
||||
const auto dir = QuatUtils::Right(self->GetRotation());
|
||||
|
||||
GameMessages::SendKnockback(user->GetObjectID(), self->GetObjectID(), self->GetObjectID(), 0, { dir.x * 15, 5, dir.z * 15 });
|
||||
|
||||
|
@@ -18,7 +18,7 @@ void NtSentinelWalkwayServer::OnStartup(Entity* self) {
|
||||
force = 115;
|
||||
}
|
||||
|
||||
const auto forward = self->GetRotation().GetRightVector() * -1;
|
||||
const auto forward = QuatUtils::Right(self->GetRotation()) * -1;
|
||||
|
||||
phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::PUSH);
|
||||
phantomPhysicsComponent->SetDirectionalMultiplier(force);
|
||||
|
@@ -27,7 +27,7 @@ void FlameJetServer::OnCollisionPhantom(Entity* self, Entity* target) {
|
||||
|
||||
skillComponent->CalculateBehavior(726, 11723, target->GetObjectID(), true);
|
||||
|
||||
auto dir = target->GetRotation().GetForwardVector();
|
||||
auto dir = QuatUtils::Forward(target->GetRotation());
|
||||
|
||||
dir.y = 25;
|
||||
dir.x = -dir.x * 15;
|
||||
|
Reference in New Issue
Block a user