refactor: allow usage of NiPoint3 and NiQuaternion in constexpr context (#1414)

* allow usage of NiPoint3 and NiQuaternion in constexpr context

* removed .cpp files entirely

* moving circular dependency circumvention stuff to an .inl file

* real world usage!!!!!

* reverting weird branch cross-pollination

* removing more weird branch cross-pollination

* remove comment

* added inverse header guard to inl file

* Update NiPoint3.inl

* trying different constructor syntax

* reorganize into .inl files for readability

* uncomment include

* moved non-constexpr definitions to cpp file

* moved static definitions back to inl files

* testing fix

* moved constants into seperate namespace

* Undo change in build-and-test.yml

* nodiscard
This commit is contained in:
jadebenn
2024-01-29 01:53:12 -06:00
committed by GitHub
parent 2f247b1fc9
commit a0d51e21ca
41 changed files with 509 additions and 533 deletions

View File

@@ -451,7 +451,7 @@ void Character::LoadXmlRespawnCheckpoints() {
auto* r = points->FirstChildElement("r");
while (r != nullptr) {
int32_t map = 0;
NiPoint3 point = NiPoint3::ZERO;
NiPoint3 point = NiPoint3Constant::ZERO;
r->QueryAttribute("w", &map);
r->QueryAttribute("x", &point.x);
@@ -513,7 +513,7 @@ void Character::SetRespawnPoint(LWOMAPID map, const NiPoint3& point) {
const NiPoint3& Character::GetRespawnPoint(LWOMAPID map) const {
const auto& pair = m_WorldRespawnCheckpoints.find(map);
if (pair == m_WorldRespawnCheckpoints.end()) return NiPoint3::ZERO;
if (pair == m_WorldRespawnCheckpoints.end()) return NiPoint3Constant::ZERO;
return pair->second;
}

View File

@@ -1857,7 +1857,7 @@ const NiPoint3& Entity::GetPosition() const {
return vehicel->GetPosition();
}
return NiPoint3::ZERO;
return NiPoint3Constant::ZERO;
}
const NiQuaternion& Entity::GetRotation() const {
@@ -1885,7 +1885,7 @@ const NiQuaternion& Entity::GetRotation() const {
return vehicel->GetRotation();
}
return NiQuaternion::IDENTITY;
return NiQuaternionConstant::IDENTITY;
}
void Entity::SetPosition(const NiPoint3& position) {
@@ -2086,9 +2086,9 @@ void Entity::ProcessPositionUpdate(PositionUpdate& update) {
havokVehiclePhysicsComponent->SetIsOnGround(update.onGround);
havokVehiclePhysicsComponent->SetIsOnRail(update.onRail);
havokVehiclePhysicsComponent->SetVelocity(update.velocity);
havokVehiclePhysicsComponent->SetDirtyVelocity(update.velocity != NiPoint3::ZERO);
havokVehiclePhysicsComponent->SetDirtyVelocity(update.velocity != NiPoint3Constant::ZERO);
havokVehiclePhysicsComponent->SetAngularVelocity(update.angularVelocity);
havokVehiclePhysicsComponent->SetDirtyAngularVelocity(update.angularVelocity != NiPoint3::ZERO);
havokVehiclePhysicsComponent->SetDirtyAngularVelocity(update.angularVelocity != NiPoint3Constant::ZERO);
havokVehiclePhysicsComponent->SetRemoteInputInfo(update.remoteInputInfo);
} else {
// Need to get the mount's controllable physics
@@ -2099,17 +2099,17 @@ void Entity::ProcessPositionUpdate(PositionUpdate& update) {
possessedControllablePhysicsComponent->SetIsOnGround(update.onGround);
possessedControllablePhysicsComponent->SetIsOnRail(update.onRail);
possessedControllablePhysicsComponent->SetVelocity(update.velocity);
possessedControllablePhysicsComponent->SetDirtyVelocity(update.velocity != NiPoint3::ZERO);
possessedControllablePhysicsComponent->SetDirtyVelocity(update.velocity != NiPoint3Constant::ZERO);
possessedControllablePhysicsComponent->SetAngularVelocity(update.angularVelocity);
possessedControllablePhysicsComponent->SetDirtyAngularVelocity(update.angularVelocity != NiPoint3::ZERO);
possessedControllablePhysicsComponent->SetDirtyAngularVelocity(update.angularVelocity != NiPoint3Constant::ZERO);
}
Game::entityManager->SerializeEntity(possassableEntity);
}
}
if (!updateChar) {
update.velocity = NiPoint3::ZERO;
update.angularVelocity = NiPoint3::ZERO;
update.velocity = NiPoint3Constant::ZERO;
update.angularVelocity = NiPoint3Constant::ZERO;
}
// Handle statistics
@@ -2123,9 +2123,9 @@ void Entity::ProcessPositionUpdate(PositionUpdate& update) {
controllablePhysicsComponent->SetIsOnGround(update.onGround);
controllablePhysicsComponent->SetIsOnRail(update.onRail);
controllablePhysicsComponent->SetVelocity(update.velocity);
controllablePhysicsComponent->SetDirtyVelocity(update.velocity != NiPoint3::ZERO);
controllablePhysicsComponent->SetDirtyVelocity(update.velocity != NiPoint3Constant::ZERO);
controllablePhysicsComponent->SetAngularVelocity(update.angularVelocity);
controllablePhysicsComponent->SetDirtyAngularVelocity(update.angularVelocity != NiPoint3::ZERO);
controllablePhysicsComponent->SetDirtyAngularVelocity(update.angularVelocity != NiPoint3Constant::ZERO);
auto* ghostComponent = GetComponent<GhostComponent>();
if (ghostComponent) ghostComponent->SetGhostReferencePoint(update.position);

View File

@@ -229,8 +229,8 @@ public:
void TriggerEvent(eTriggerEventType event, Entity* optionalTarget = nullptr);
void ScheduleDestructionAfterUpdate() { m_ShouldDestroyAfterUpdate = true; }
virtual const NiPoint3& GetRespawnPosition() const { return NiPoint3::ZERO; }
virtual const NiQuaternion& GetRespawnRotation() const { return NiQuaternion::IDENTITY; }
virtual const NiPoint3& GetRespawnPosition() const { return NiPoint3Constant::ZERO; }
virtual const NiQuaternion& GetRespawnRotation() const { return NiQuaternionConstant::IDENTITY; }
void Sleep();
void Wake();

View File

@@ -33,7 +33,7 @@ void ProjectileAttackBehavior::Handle(BehaviorContext* context, RakNet::BitStrea
}
if (m_useMouseposit && !branch.isSync) {
NiPoint3 targetPosition = NiPoint3::ZERO;
NiPoint3 targetPosition = NiPoint3Constant::ZERO;
if (!bitStream->Read(targetPosition)) {
LOG("Unable to read targetPosition from bitStream, aborting Handle! %i", bitStream->GetNumberOfUnreadBits());
return;

View File

@@ -185,7 +185,7 @@ void BaseCombatAIComponent::Update(const float deltaTime) {
bool stunnedThisFrame = m_Stunned;
CalculateCombat(deltaTime); // Putting this here for now
if (m_StartPosition == NiPoint3::ZERO) {
if (m_StartPosition == NiPoint3Constant::ZERO) {
m_StartPosition = m_Parent->GetPosition();
}

View File

@@ -56,7 +56,7 @@ void BuildBorderComponent::OnUse(Entity* originator) {
4,
0,
-1,
NiPoint3::ZERO,
NiPoint3Constant::ZERO,
0
);
} else {

View File

@@ -1,8 +1,8 @@
#include "GhostComponent.h"
GhostComponent::GhostComponent(Entity* parent) : Component(parent) {
m_GhostReferencePoint = NiPoint3::ZERO;
m_GhostOverridePoint = NiPoint3::ZERO;
m_GhostReferencePoint = NiPoint3Constant::ZERO;
m_GhostOverridePoint = NiPoint3Constant::ZERO;
m_GhostOverride = false;
}

View File

@@ -2,8 +2,8 @@
#include "EntityManager.h"
HavokVehiclePhysicsComponent::HavokVehiclePhysicsComponent(Entity* parent) : PhysicsComponent(parent) {
m_Velocity = NiPoint3::ZERO;
m_AngularVelocity = NiPoint3::ZERO;
m_Velocity = NiPoint3Constant::ZERO;
m_AngularVelocity = NiPoint3Constant::ZERO;
m_IsOnGround = true;
m_IsOnRail = false;
m_DirtyPosition = true;

View File

@@ -1223,7 +1223,7 @@ void InventoryComponent::SpawnPet(Item* item) {
EntityInfo info{};
info.lot = item->GetLot();
info.pos = m_Parent->GetPosition();
info.rot = NiQuaternion::IDENTITY;
info.rot = NiQuaternionConstant::IDENTITY;
info.spawnerID = m_Parent->GetObjectID();
auto* pet = Game::entityManager->CreateEntity(info);

View File

@@ -43,7 +43,7 @@ MovementAIComponent::MovementAIComponent(Entity* parent, MovementAIInfo info) :
m_NextWaypoint = m_Parent->GetPosition();
m_Acceleration = 0.4f;
m_PullingToPoint = false;
m_PullPoint = NiPoint3::ZERO;
m_PullPoint = NiPoint3Constant::ZERO;
m_HaltDistance = 0;
m_TimeToTravel = 0;
m_TimeTravelled = 0;
@@ -88,7 +88,7 @@ void MovementAIComponent::Update(const float deltaTime) {
SetPosition(source);
NiPoint3 velocity = NiPoint3::ZERO;
NiPoint3 velocity = NiPoint3Constant::ZERO;
if (m_Acceleration > 0 && m_BaseSpeed > 0 && AdvanceWaypointIndex()) // Do we have another waypoint to seek?
{
@@ -203,7 +203,7 @@ void MovementAIComponent::Stop() {
SetPosition(ApproximateLocation());
SetVelocity(NiPoint3::ZERO);
SetVelocity(NiPoint3Constant::ZERO);
m_TimeToTravel = 0;
m_TimeTravelled = 0;

View File

@@ -84,7 +84,7 @@ PetComponent::PetComponent(Entity* parentEntity, uint32_t componentId) : Compone
m_DatabaseId = LWOOBJID_EMPTY;
m_Status = 67108866; // Tamable
m_Ability = ePetAbilityType::Invalid;
m_StartPosition = NiPoint3::ZERO;
m_StartPosition = NiPoint3Constant::ZERO;
m_MovementAI = nullptr;
m_TresureTime = 0;
m_Preconditions = nullptr;
@@ -312,7 +312,7 @@ void PetComponent::OnUse(Entity* originator) {
}
void PetComponent::Update(float deltaTime) {
if (m_StartPosition == NiPoint3::ZERO) {
if (m_StartPosition == NiPoint3Constant::ZERO) {
m_StartPosition = m_Parent->GetPosition();
}
@@ -447,7 +447,7 @@ void PetComponent::Update(float deltaTime) {
if (distance < 5 * 5) {
m_Interaction = closestTresure->GetObjectID();
Command(NiPoint3::ZERO, LWOOBJID_EMPTY, 1, 202, true);
Command(NiPoint3Constant::ZERO, LWOOBJID_EMPTY, 1, 202, true);
m_TresureTime = 2;
} else if (distance < 10 * 10) {
@@ -531,7 +531,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
EntityInfo info{};
info.lot = cached->second.puzzleModelLot;
info.pos = position;
info.rot = NiQuaternion::IDENTITY;
info.rot = NiQuaternionConstant::IDENTITY;
info.spawnerID = tamer->GetObjectID();
auto* modelEntity = Game::entityManager->CreateEntity(info);
@@ -591,9 +591,9 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
LWOOBJID_EMPTY,
false,
ePetTamingNotifyType::NAMINGPET,
NiPoint3::ZERO,
NiPoint3::ZERO,
NiQuaternion::IDENTITY,
NiPoint3Constant::ZERO,
NiPoint3Constant::ZERO,
NiQuaternionConstant::IDENTITY,
UNASSIGNED_SYSTEM_ADDRESS
);
@@ -671,9 +671,9 @@ void PetComponent::RequestSetPetName(std::u16string name) {
m_Tamer,
false,
ePetTamingNotifyType::SUCCESS,
NiPoint3::ZERO,
NiPoint3::ZERO,
NiQuaternion::IDENTITY,
NiPoint3Constant::ZERO,
NiPoint3Constant::ZERO,
NiQuaternionConstant::IDENTITY,
UNASSIGNED_SYSTEM_ADDRESS
);
@@ -712,9 +712,9 @@ void PetComponent::ClientExitTamingMinigame(bool voluntaryExit) {
m_Tamer,
false,
ePetTamingNotifyType::QUIT,
NiPoint3::ZERO,
NiPoint3::ZERO,
NiQuaternion::IDENTITY,
NiPoint3Constant::ZERO,
NiPoint3Constant::ZERO,
NiQuaternionConstant::IDENTITY,
UNASSIGNED_SYSTEM_ADDRESS
);
@@ -763,9 +763,9 @@ void PetComponent::ClientFailTamingMinigame() {
m_Tamer,
false,
ePetTamingNotifyType::FAILED,
NiPoint3::ZERO,
NiPoint3::ZERO,
NiQuaternion::IDENTITY,
NiPoint3Constant::ZERO,
NiPoint3Constant::ZERO,
NiQuaternionConstant::IDENTITY,
UNASSIGNED_SYSTEM_ADDRESS
);

View File

@@ -164,7 +164,7 @@ PhantomPhysicsComponent::PhantomPhysicsComponent(Entity* parent) : PhysicsCompon
dpWorld::AddEntity(m_dpEntity);
} else if (info->physicsAsset == "miscellaneous\\misc_phys_640x640.hkx") {
// Move this down by 13.521004 units so it is still effectively at the same height as before
m_Position = m_Position - NiPoint3::UNIT_Y * 13.521004f;
m_Position = m_Position - NiPoint3Constant::UNIT_Y * 13.521004f;
// TODO Fix physics simulation to do simulation at high velocities due to bullet through paper problem...
m_dpEntity = new dpEntity(m_Parent->GetObjectID(), 1638.4f, 13.521004f * 2.0f, 1638.4f);

View File

@@ -1,8 +1,8 @@
#include "PhysicsComponent.h"
PhysicsComponent::PhysicsComponent(Entity* parent) : Component(parent) {
m_Position = NiPoint3::ZERO;
m_Rotation = NiQuaternion::IDENTITY;
m_Position = NiPoint3Constant::ZERO;
m_Rotation = NiQuaternionConstant::IDENTITY;
m_DirtyPosition = false;
}

View File

@@ -297,7 +297,7 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
const auto modelLOT = item->GetLot();
if (rotation != NiQuaternion::IDENTITY) {
if (rotation != NiQuaternionConstant::IDENTITY) {
rotation = { rotation.w, rotation.z, rotation.y, rotation.x };
}
@@ -481,7 +481,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
GameMessages::SendGetModelsOnProperty(entity->GetObjectID(), GetModels(), UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::SendPlaceModelResponse(entity->GetObjectID(), entity->GetSystemAddress(), NiPoint3::ZERO, LWOOBJID_EMPTY, 16, NiQuaternion::IDENTITY);
GameMessages::SendPlaceModelResponse(entity->GetObjectID(), entity->GetSystemAddress(), NiPoint3Constant::ZERO, LWOOBJID_EMPTY, 16, NiQuaternionConstant::IDENTITY);
if (spawner != nullptr) {
Game::zoneManager->RemoveSpawner(spawner->m_Info.spawnerID);
@@ -534,7 +534,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
GameMessages::SendGetModelsOnProperty(entity->GetObjectID(), GetModels(), UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::SendPlaceModelResponse(entity->GetObjectID(), entity->GetSystemAddress(), NiPoint3::ZERO, LWOOBJID_EMPTY, 16, NiQuaternion::IDENTITY);
GameMessages::SendPlaceModelResponse(entity->GetObjectID(), entity->GetSystemAddress(), NiPoint3Constant::ZERO, LWOOBJID_EMPTY, 16, NiQuaternionConstant::IDENTITY);
if (spawner != nullptr) {
Game::zoneManager->RemoveSpawner(spawner->m_Info.spawnerID);

View File

@@ -253,13 +253,13 @@ void QuickBuildComponent::OnUse(Entity* originator) {
}
void QuickBuildComponent::SpawnActivator() {
if (!m_SelfActivator || m_ActivatorPosition != NiPoint3::ZERO) {
if (!m_SelfActivator || m_ActivatorPosition != NiPoint3Constant::ZERO) {
if (!m_Activator) {
EntityInfo info;
info.lot = 6604;
info.spawnerID = m_Parent->GetObjectID();
info.pos = m_ActivatorPosition == NiPoint3::ZERO ? m_Parent->GetPosition() : m_ActivatorPosition;
info.pos = m_ActivatorPosition == NiPoint3Constant::ZERO ? m_Parent->GetPosition() : m_ActivatorPosition;
m_Activator = Game::entityManager->CreateEntity(info, nullptr, m_Parent);
if (m_Activator) {

View File

@@ -242,7 +242,7 @@ private:
/**
* The position that the quickbuild activator is spawned at
*/
NiPoint3 m_ActivatorPosition = NiPoint3::ZERO;
NiPoint3 m_ActivatorPosition = NiPoint3Constant::ZERO;
/**
* The entity that represents the quickbuild activator

View File

@@ -119,8 +119,8 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player,
GeneralUtils::UTF16ToWTF8(m_PathName));
auto spawnPointEntities = Game::entityManager->GetEntitiesByLOT(4843);
auto startPosition = NiPoint3::ZERO;
auto startRotation = NiQuaternion::IDENTITY;
auto startPosition = NiPoint3Constant::ZERO;
auto startRotation = NiQuaternionConstant::IDENTITY;
const std::string placementAsString = std::to_string(positionNumber);
for (auto entity : spawnPointEntities) {
if (!entity) continue;
@@ -818,7 +818,7 @@ void RacingControlComponent::Update(float deltaTime) {
// Some offset up to make they don't fall through the terrain on a
// respawn, seems to fix itself to the track anyhow
player.respawnPosition = position + NiPoint3::UNIT_Y * 5;
player.respawnPosition = position + NiPoint3Constant::UNIT_Y * 5;
player.respawnRotation = vehicle->GetRotation();
player.respawnIndex = respawnIndex;

View File

@@ -87,12 +87,12 @@ private:
/**
* The current velocity of the entity
*/
NiPoint3 m_Velocity = NiPoint3::ZERO;
NiPoint3 m_Velocity = NiPoint3Constant::ZERO;
/**
* The current angular velocity of the entity
*/
NiPoint3 m_AngularVelocity = NiPoint3::ZERO;
NiPoint3 m_AngularVelocity = NiPoint3Constant::ZERO;
/**
* Whether or not the velocity has changed

View File

@@ -218,7 +218,7 @@ void TriggerComponent::HandleMoveObject(Entity* targetEntity, std::vector<std::s
if (argArray.size() <= 2) return;
auto position = targetEntity->GetPosition();
NiPoint3 offset = NiPoint3::ZERO;
NiPoint3 offset = NiPoint3Constant::ZERO;
GeneralUtils::TryParse(argArray.at(0), argArray.at(1), argArray.at(2), offset);
position += offset;
@@ -228,7 +228,7 @@ void TriggerComponent::HandleMoveObject(Entity* targetEntity, std::vector<std::s
void TriggerComponent::HandleRotateObject(Entity* targetEntity, std::vector<std::string> argArray){
if (argArray.size() <= 2) return;
NiPoint3 vector = NiPoint3::ZERO;
NiPoint3 vector = NiPoint3Constant::ZERO;
GeneralUtils::TryParse(argArray.at(0), argArray.at(1), argArray.at(2), vector);
NiQuaternion rotation = NiQuaternion::FromEulerAngles(vector);
@@ -246,7 +246,7 @@ void TriggerComponent::HandlePushObject(Entity* targetEntity, std::vector<std::s
phantomPhysicsComponent->SetPhysicsEffectActive(true);
phantomPhysicsComponent->SetEffectType(ePhysicsEffectType::PUSH);
phantomPhysicsComponent->SetDirectionalMultiplier(1);
NiPoint3 direction = NiPoint3::ZERO;
NiPoint3 direction = NiPoint3Constant::ZERO;
GeneralUtils::TryParse(argArray.at(0), argArray.at(1), argArray.at(2), direction);
phantomPhysicsComponent->SetDirection(direction);
@@ -382,7 +382,7 @@ void TriggerComponent::HandleSetPhysicsVolumeEffect(Entity* targetEntity, std::v
phantomPhysicsComponent->SetEffectType(effectType);
phantomPhysicsComponent->SetDirectionalMultiplier(std::stof(argArray.at(1)));
if (argArray.size() > 4) {
NiPoint3 direction = NiPoint3::ZERO;
NiPoint3 direction = NiPoint3Constant::ZERO;
GeneralUtils::TryParse(argArray.at(2), argArray.at(3), argArray.at(4), direction);
phantomPhysicsComponent->SetDirection(direction);
}

View File

@@ -13,13 +13,13 @@ public:
bUsedMouse = false;
fCasterLatency = 0.0f;
iCastType = 0;
lastClickedPosit = NiPoint3::ZERO;
lastClickedPosit = NiPoint3Constant::ZERO;
optionalTargetID = LWOOBJID_EMPTY;
originatorRot = NiQuaternion::IDENTITY;
originatorRot = NiQuaternionConstant::IDENTITY;
uiSkillHandle = 0;
}
EchoStartSkill(LWOOBJID _optionalOriginatorID, std::string _sBitStream, TSkillID _skillID, bool _bUsedMouse = false, float _fCasterLatency = 0.0f, int32_t _iCastType = 0, NiPoint3 _lastClickedPosit = NiPoint3::ZERO, LWOOBJID _optionalTargetID = LWOOBJID_EMPTY, NiQuaternion _originatorRot = NiQuaternion::IDENTITY, uint32_t _uiSkillHandle = 0) {
EchoStartSkill(LWOOBJID _optionalOriginatorID, std::string _sBitStream, TSkillID _skillID, bool _bUsedMouse = false, float _fCasterLatency = 0.0f, int32_t _iCastType = 0, NiPoint3 _lastClickedPosit = NiPoint3Constant::ZERO, LWOOBJID _optionalTargetID = LWOOBJID_EMPTY, NiQuaternion _originatorRot = NiQuaternionConstant::IDENTITY, uint32_t _uiSkillHandle = 0) {
bUsedMouse = _bUsedMouse;
fCasterLatency = _fCasterLatency;
iCastType = _iCastType;
@@ -50,16 +50,16 @@ public:
stream->Write(iCastType != 0);
if (iCastType != 0) stream->Write(iCastType);
stream->Write(lastClickedPosit != NiPoint3::ZERO);
if (lastClickedPosit != NiPoint3::ZERO) stream->Write(lastClickedPosit);
stream->Write(lastClickedPosit != NiPoint3Constant::ZERO);
if (lastClickedPosit != NiPoint3Constant::ZERO) stream->Write(lastClickedPosit);
stream->Write(optionalOriginatorID);
stream->Write(optionalTargetID != LWOOBJID_EMPTY);
if (optionalTargetID != LWOOBJID_EMPTY) stream->Write(optionalTargetID);
stream->Write(originatorRot != NiQuaternion::IDENTITY);
if (originatorRot != NiQuaternion::IDENTITY) stream->Write(originatorRot);
stream->Write(originatorRot != NiQuaternionConstant::IDENTITY);
if (originatorRot != NiQuaternionConstant::IDENTITY) stream->Write(originatorRot);
uint32_t sBitStreamLength = sBitStream.length();
stream->Write(sBitStreamLength);

View File

@@ -385,8 +385,8 @@ void GameMessages::SendPlatformResync(Entity* entity, const SystemAddress& sysAd
float fIdleTimeElapsed = 0.0f;
float fMoveTimeElapsed = 0.0f;
float fPercentBetweenPoints = 0.0f;
NiPoint3 ptUnexpectedLocation = NiPoint3::ZERO;
NiQuaternion qUnexpectedRotation = NiQuaternion::IDENTITY;
NiPoint3 ptUnexpectedLocation = NiPoint3Constant::ZERO;
NiQuaternion qUnexpectedRotation = NiQuaternionConstant::IDENTITY;
bitStream.Write(bReverse);
bitStream.Write(bStopAtDesiredWaypoint);
@@ -403,8 +403,8 @@ void GameMessages::SendPlatformResync(Entity* entity, const SystemAddress& sysAd
bitStream.Write(ptUnexpectedLocation.y);
bitStream.Write(ptUnexpectedLocation.z);
bitStream.Write(qUnexpectedRotation != NiQuaternion::IDENTITY);
if (qUnexpectedRotation != NiQuaternion::IDENTITY) {
bitStream.Write(qUnexpectedRotation != NiQuaternionConstant::IDENTITY);
if (qUnexpectedRotation != NiQuaternionConstant::IDENTITY) {
bitStream.Write(qUnexpectedRotation.x);
bitStream.Write(qUnexpectedRotation.y);
bitStream.Write(qUnexpectedRotation.z);
@@ -770,7 +770,7 @@ void GameMessages::SendSetCurrency(Entity* entity, int64_t currency, int lootTyp
bitStream.Write(lootType != LOOTTYPE_NONE);
if (lootType != LOOTTYPE_NONE) bitStream.Write(lootType);
bitStream.Write(NiPoint3::ZERO);
bitStream.Write(NiPoint3Constant::ZERO);
bitStream.Write(sourceLOT != LOT_NULL);
if (sourceLOT != LOT_NULL) bitStream.Write(sourceLOT);
@@ -1079,7 +1079,7 @@ void GameMessages::SendDropClientLoot(Entity* entity, const LWOOBJID& sourceID,
entity->RegisterCoinDrop(currency);
}
if (spawnPos != NiPoint3::ZERO) {
if (spawnPos != NiPoint3Constant::ZERO) {
bUsePosition = true;
//Calculate where the loot will go:
@@ -1101,8 +1101,8 @@ void GameMessages::SendDropClientLoot(Entity* entity, const LWOOBJID& sourceID,
bitStream.Write(bUsePosition);
bitStream.Write(finalPosition != NiPoint3::ZERO);
if (finalPosition != NiPoint3::ZERO) bitStream.Write(finalPosition);
bitStream.Write(finalPosition != NiPoint3Constant::ZERO);
if (finalPosition != NiPoint3Constant::ZERO) bitStream.Write(finalPosition);
bitStream.Write(currency);
bitStream.Write(item);
@@ -1110,8 +1110,8 @@ void GameMessages::SendDropClientLoot(Entity* entity, const LWOOBJID& sourceID,
bitStream.Write(owner);
bitStream.Write(sourceID);
bitStream.Write(spawnPos != NiPoint3::ZERO);
if (spawnPos != NiPoint3::ZERO) bitStream.Write(spawnPos);
bitStream.Write(spawnPos != NiPoint3Constant::ZERO);
if (spawnPos != NiPoint3Constant::ZERO) bitStream.Write(spawnPos);
auto* team = TeamManager::Instance()->GetTeam(owner);
@@ -1170,7 +1170,7 @@ void GameMessages::SendPlayerReachedRespawnCheckpoint(Entity* entity, const NiPo
bitStream.Write(position.y);
bitStream.Write(position.z);
const bool bIsNotIdentity = rotation != NiQuaternion::IDENTITY;
const bool bIsNotIdentity = rotation != NiQuaternionConstant::IDENTITY;
bitStream.Write(bIsNotIdentity);
if (bIsNotIdentity) {
@@ -1646,8 +1646,8 @@ void GameMessages::SendNotifyClientShootingGalleryScore(LWOOBJID objectId, const
void GameMessages::HandleUpdateShootingGalleryRotation(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
float angle = 0.0f;
NiPoint3 facing = NiPoint3::ZERO;
NiPoint3 muzzlePos = NiPoint3::ZERO;
NiPoint3 facing = NiPoint3Constant::ZERO;
NiPoint3 muzzlePos = NiPoint3Constant::ZERO;
inStream->Read(angle);
inStream->Read(facing);
inStream->Read(muzzlePos);
@@ -2103,8 +2103,8 @@ void GameMessages::SendPlaceModelResponse(LWOOBJID objectId, const SystemAddress
bitStream.Write(objectId);
bitStream.Write(eGameMessageType::PLACE_MODEL_RESPONSE);
bitStream.Write(position != NiPoint3::ZERO);
if (position != NiPoint3::ZERO) {
bitStream.Write(position != NiPoint3Constant::ZERO);
if (position != NiPoint3Constant::ZERO) {
bitStream.Write(position);
}
@@ -2118,8 +2118,8 @@ void GameMessages::SendPlaceModelResponse(LWOOBJID objectId, const SystemAddress
bitStream.Write(response);
}
bitStream.Write(rotation != NiQuaternion::IDENTITY);
if (rotation != NiQuaternion::IDENTITY) {
bitStream.Write(rotation != NiQuaternionConstant::IDENTITY);
if (rotation != NiQuaternionConstant::IDENTITY) {
bitStream.Write(response);
}
@@ -2271,7 +2271,7 @@ void GameMessages::HandleSetBuildMode(RakNet::BitStream* inStream, Entity* entit
bool modePaused{};
int modeValue = 1;
LWOOBJID playerId{};
NiPoint3 startPosition = NiPoint3::ZERO;
NiPoint3 startPosition = NiPoint3Constant::ZERO;
inStream->Read(start);
@@ -2290,7 +2290,7 @@ void GameMessages::HandleSetBuildMode(RakNet::BitStream* inStream, Entity* entit
auto* player = Game::entityManager->GetEntity(playerId);
if (startPosition == NiPoint3::ZERO) {
if (startPosition == NiPoint3Constant::ZERO) {
startPosition = player->GetPosition();
}
@@ -2384,13 +2384,13 @@ void GameMessages::HandlePlacePropertyModel(RakNet::BitStream* inStream, Entity*
inStream->Read(model);
PropertyManagementComponent::Instance()->UpdateModelPosition(model, NiPoint3::ZERO, NiQuaternion::IDENTITY);
PropertyManagementComponent::Instance()->UpdateModelPosition(model, NiPoint3Constant::ZERO, NiQuaternionConstant::IDENTITY);
}
void GameMessages::HandleUpdatePropertyModel(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
LWOOBJID model;
NiPoint3 position;
NiQuaternion rotation = NiQuaternion::IDENTITY;
NiQuaternion rotation = NiQuaternionConstant::IDENTITY;
inStream->Read(model);
inStream->Read(position);
@@ -2612,7 +2612,7 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
IPropertyContents::Model model;
model.id = newIDL;
model.ugcId = blueprintIDSmall;
model.position = NiPoint3::ZERO;
model.position = NiPoint3Constant::ZERO;
model.rotation = NiQuaternion(0.0f, 0.0f, 0.0f, 0.0f);
model.lot = 14;
Database::Get()->InsertNewPropertyModel(propertyId, model, "Objects_14_name");
@@ -3393,7 +3393,7 @@ void GameMessages::SendNotifyPetTamingMinigame(LWOOBJID objectId, LWOOBJID petId
bitStream.Write(petsDestPos);
bitStream.Write(telePos);
const bool hasDefault = teleRot != NiQuaternion::IDENTITY;
const bool hasDefault = teleRot != NiQuaternionConstant::IDENTITY;
bitStream.Write(hasDefault);
if (hasDefault) bitStream.Write(teleRot);
@@ -4218,7 +4218,7 @@ void GameMessages::HandleVehicleNotifyHitImaginationServer(RakNet::BitStream* in
LWOOBJID pickupObjID = LWOOBJID_EMPTY;
LWOOBJID pickupSpawnerID = LWOOBJID_EMPTY;
int32_t pickupSpawnerIndex = -1;
NiPoint3 vehiclePosition = NiPoint3::ZERO;
NiPoint3 vehiclePosition = NiPoint3Constant::ZERO;
if (inStream->ReadBit()) inStream->Read(pickupObjID);
if (inStream->ReadBit()) inStream->Read(pickupSpawnerID);

View File

@@ -55,14 +55,14 @@ namespace GameMessages {
const SystemAddress& sysAddr,
bool bFirstTime = true,
const LWOOBJID& buildAreaID = LWOOBJID_EMPTY,
NiPoint3 buildStartPOS = NiPoint3::ZERO,
NiPoint3 buildStartPOS = NiPoint3Constant::ZERO,
int sourceBAG = 0,
const LWOOBJID& sourceID = LWOOBJID_EMPTY,
LOT sourceLOT = 0,
int sourceTYPE = 8,
const LWOOBJID& targetID = 0,
LOT targetLOT = 0,
NiPoint3 targetPOS = NiPoint3::ZERO,
NiPoint3 targetPOS = NiPoint3Constant::ZERO,
int targetTYPE = 0
);
@@ -122,7 +122,7 @@ namespace GameMessages {
void SendStop2DAmbientSound(Entity* entity, bool force, std::string audioGUID, bool result = false);
void SendPlay2DAmbientSound(Entity* entity, std::string audioGUID, bool result = false);
void SendSetNetworkScriptVar(Entity* entity, const SystemAddress& sysAddr, std::string data);
void SendDropClientLoot(Entity* entity, const LWOOBJID& sourceID, LOT item, int currency, NiPoint3 spawnPos = NiPoint3::ZERO, int count = 1);
void SendDropClientLoot(Entity* entity, const LWOOBJID& sourceID, LOT item, int currency, NiPoint3 spawnPos = NiPoint3Constant::ZERO, int count = 1);
void SendSetPlayerControlScheme(Entity* entity, eControlScheme controlScheme);
void SendPlayerReachedRespawnCheckpoint(Entity* entity, const NiPoint3& position, const NiQuaternion& rotation);
@@ -239,7 +239,7 @@ namespace GameMessages {
void SendLockNodeRotation(Entity* entity, std::string nodeName);
void SendSetBuildModeConfirmed(LWOOBJID objectId, const SystemAddress& sysAddr, bool start, bool warnVisitors, bool modePaused, int32_t modeValue, LWOOBJID playerId, NiPoint3 startPos = NiPoint3::ZERO);
void SendSetBuildModeConfirmed(LWOOBJID objectId, const SystemAddress& sysAddr, bool start, bool warnVisitors, bool modePaused, int32_t modeValue, LWOOBJID playerId, NiPoint3 startPos = NiPoint3Constant::ZERO);
void SendGetModelsOnProperty(LWOOBJID objectId, std::map<LWOOBJID, LWOOBJID> models, const SystemAddress& sysAddr);

View File

@@ -16,13 +16,13 @@ public:
consumableItemID = LWOOBJID_EMPTY;
fCasterLatency = 0.0f;
iCastType = 0;
lastClickedPosit = NiPoint3::ZERO;
lastClickedPosit = NiPoint3Constant::ZERO;
optionalTargetID = LWOOBJID_EMPTY;
originatorRot = NiQuaternion::IDENTITY;
originatorRot = NiQuaternionConstant::IDENTITY;
uiSkillHandle = 0;
}
StartSkill(LWOOBJID _optionalOriginatorID, std::string _sBitStream, TSkillID _skillID, bool _bUsedMouse = false, LWOOBJID _consumableItemID = LWOOBJID_EMPTY, float _fCasterLatency = 0.0f, int32_t _iCastType = 0, NiPoint3 _lastClickedPosit = NiPoint3::ZERO, LWOOBJID _optionalTargetID = LWOOBJID_EMPTY, NiQuaternion _originatorRot = NiQuaternion::IDENTITY, uint32_t _uiSkillHandle = 0) {
StartSkill(LWOOBJID _optionalOriginatorID, std::string _sBitStream, TSkillID _skillID, bool _bUsedMouse = false, LWOOBJID _consumableItemID = LWOOBJID_EMPTY, float _fCasterLatency = 0.0f, int32_t _iCastType = 0, NiPoint3 _lastClickedPosit = NiPoint3Constant::ZERO, LWOOBJID _optionalTargetID = LWOOBJID_EMPTY, NiQuaternion _originatorRot = NiQuaternionConstant::IDENTITY, uint32_t _uiSkillHandle = 0) {
bUsedMouse = _bUsedMouse;
consumableItemID = _consumableItemID;
fCasterLatency = _fCasterLatency;
@@ -57,16 +57,16 @@ public:
stream->Write(iCastType != 0);
if (iCastType != 0) stream->Write(iCastType);
stream->Write(lastClickedPosit != NiPoint3::ZERO);
if (lastClickedPosit != NiPoint3::ZERO) stream->Write(lastClickedPosit);
stream->Write(lastClickedPosit != NiPoint3Constant::ZERO);
if (lastClickedPosit != NiPoint3Constant::ZERO) stream->Write(lastClickedPosit);
stream->Write(optionalOriginatorID);
stream->Write(optionalTargetID != LWOOBJID_EMPTY);
if (optionalTargetID != LWOOBJID_EMPTY) stream->Write(optionalTargetID);
stream->Write(originatorRot != NiQuaternion::IDENTITY);
if (originatorRot != NiQuaternion::IDENTITY) stream->Write(originatorRot);
stream->Write(originatorRot != NiQuaternionConstant::IDENTITY);
if (originatorRot != NiQuaternionConstant::IDENTITY) stream->Write(originatorRot);
uint32_t sBitStreamLength = sBitStream.length();
stream->Write(sBitStreamLength);