mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-11 09:58:05 +00:00
Replace Quaternion with glm math (#1868)
This commit is contained in:
@@ -88,7 +88,7 @@ void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdra
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SetColGroup", 10, 0, 0, "", UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
//First rotate for anim
|
||||
NiQuaternion rot = NiQuaternionConstant::IDENTITY;
|
||||
NiQuaternion rot = QuatUtils::IDENTITY;
|
||||
|
||||
controllable->SetStatic(false);
|
||||
|
||||
@@ -405,7 +405,7 @@ void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string tim
|
||||
const auto withdrawn = self->GetBoolean(u"isWithdrawn");
|
||||
if (!withdrawn) return;
|
||||
|
||||
NiQuaternion rot = NiQuaternionConstant::IDENTITY;
|
||||
NiQuaternion rot = QuatUtils::IDENTITY;
|
||||
|
||||
//First rotate for anim
|
||||
controllable->SetStatic(false);
|
||||
@@ -600,12 +600,12 @@ void BossSpiderQueenEnemyServer::OnUpdate(Entity* self) {
|
||||
|
||||
if (!isWithdrawn) return;
|
||||
|
||||
if (controllable->GetRotation() == NiQuaternionConstant::IDENTITY) {
|
||||
if (controllable->GetRotation() == QuatUtils::IDENTITY) {
|
||||
return;
|
||||
}
|
||||
|
||||
controllable->SetStatic(false);
|
||||
controllable->SetRotation(NiQuaternionConstant::IDENTITY);
|
||||
controllable->SetRotation(QuatUtils::IDENTITY);
|
||||
controllable->SetStatic(true);
|
||||
|
||||
Game::entityManager->SerializeEntity(self);
|
||||
|
@@ -52,7 +52,7 @@ private:
|
||||
ControllablePhysicsComponent* controllable = nullptr;
|
||||
BaseCombatAIComponent* combat = nullptr;
|
||||
|
||||
NiQuaternion originRotation;
|
||||
NiQuaternion originRotation = QuatUtils::IDENTITY;
|
||||
|
||||
int m_CurrentBossStage = 0;
|
||||
int m_DeathCounter = 0;
|
||||
|
@@ -76,7 +76,7 @@ void AmDarklingDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
|
||||
self->AddTimer("timeToStunLoop", 1.0f);
|
||||
|
||||
auto position = self->GetPosition();
|
||||
auto forward = self->GetRotation().GetForwardVector();
|
||||
auto forward = QuatUtils::Forward(self->GetRotation());
|
||||
auto backwards = forward * -1;
|
||||
|
||||
forward.x *= 10;
|
||||
|
@@ -92,7 +92,7 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
|
||||
self->AddTimer("timeToStunLoop", 1.0f);
|
||||
|
||||
auto position = self->GetPosition();
|
||||
auto forward = self->GetRotation().GetForwardVector();
|
||||
auto forward = QuatUtils::Forward(self->GetRotation());
|
||||
auto backwards = forward * -1;
|
||||
|
||||
forward.x *= 10;
|
||||
|
@@ -66,7 +66,7 @@ void BaseEnemyApe::OnTimerDone(Entity* self, std::string timerName) {
|
||||
const auto position = self->GetPosition();
|
||||
const auto rotation = self->GetRotation();
|
||||
|
||||
const auto backwardVector = rotation.GetForwardVector() * -1;
|
||||
const auto backwardVector = QuatUtils::Forward(rotation) * -1;
|
||||
const auto objectPosition = NiPoint3(
|
||||
position.GetX() - (backwardVector.GetX() * 8),
|
||||
position.GetY(),
|
||||
|
@@ -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