From 3d85f6639e9f93b4f2ea2bac4d45bfc1d6022742 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Mon, 4 Dec 2023 09:20:41 -0600 Subject: [PATCH] chore: rename VehiclePhysics to HavokVehiclePhysics (#1331) since that is it's true name and there's another VehiclePhysics component that is simply named that --- dCommon/dEnums/eReplicaComponentType.h | 4 +-- dGame/Entity.cpp | 26 +++++++++---------- dGame/dComponents/CMakeLists.txt | 2 +- dGame/dComponents/CharacterComponent.cpp | 2 +- ...t.cpp => HavokVehiclePhysicsComponent.cpp} | 22 ++++++++-------- ...onent.h => HavokVehiclePhysicsComponent.h} | 6 ++--- dGame/dComponents/InventoryComponent.cpp | 4 +-- dGame/dComponents/RacingControlComponent.cpp | 2 +- dGame/dGameMessages/GameMessages.cpp | 2 +- dGame/dUtilities/SlashCommandHandler.cpp | 8 +++--- dNet/ClientPackets.cpp | 24 ++++++++--------- 11 files changed, 51 insertions(+), 51 deletions(-) rename dGame/dComponents/{VehiclePhysicsComponent.cpp => HavokVehiclePhysicsComponent.cpp} (77%) rename dGame/dComponents/{VehiclePhysicsComponent.h => HavokVehiclePhysicsComponent.h} (94%) diff --git a/dCommon/dEnums/eReplicaComponentType.h b/dCommon/dEnums/eReplicaComponentType.h index a0be9dd4..ca60355f 100644 --- a/dCommon/dEnums/eReplicaComponentType.h +++ b/dCommon/dEnums/eReplicaComponentType.h @@ -34,7 +34,7 @@ enum class eReplicaComponentType : uint32_t { PLATFORM_BOUNDARY, MODULE, ARCADE, - VEHICLE_PHYSICS, // Havok demo based + HAVOK_VEHICLE_PHYSICS, MOVEMENT_AI, EXHIBIT, OVERHEAD_ICON, @@ -50,7 +50,7 @@ enum class eReplicaComponentType : uint32_t { PROPERTY_ENTRANCE, FX, PROPERTY_MANAGEMENT, - VEHICLE_PHYSICS_NEW, // internal physics based on havok + VEHICLE_PHYSICS, PHYSICS_SYSTEM, QUICK_BUILD, SWITCH, diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index 4d4f5c10..f62a0825 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -62,7 +62,7 @@ #include "ModelComponent.h" #include "ZCompression.h" #include "PetComponent.h" -#include "VehiclePhysicsComponent.h" +#include "HavokVehiclePhysicsComponent.h" #include "PossessableComponent.h" #include "PossessorComponent.h" #include "ModuleAssemblyComponent.h" @@ -299,10 +299,10 @@ void Entity::Initialize() { AddComponent()->SetPhysicsEffectActive(false); } - if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::VEHICLE_PHYSICS) > 0) { - auto* vehiclePhysicsComponent = AddComponent(); - vehiclePhysicsComponent->SetPosition(m_DefaultPosition); - vehiclePhysicsComponent->SetRotation(m_DefaultRotation); + if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::HAVOK_VEHICLE_PHYSICS) > 0) { + auto* havokVehiclePhysicsComponent = AddComponent(); + havokVehiclePhysicsComponent->SetPosition(m_DefaultPosition); + havokVehiclePhysicsComponent->SetRotation(m_DefaultRotation); } if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SOUND_TRIGGER, -1) != -1) { @@ -744,7 +744,7 @@ void Entity::Initialize() { !HasComponent(eReplicaComponentType::PHANTOM_PHYSICS) && !HasComponent(eReplicaComponentType::PROPERTY) && !HasComponent(eReplicaComponentType::RACING_CONTROL) && - !HasComponent(eReplicaComponentType::VEHICLE_PHYSICS) + !HasComponent(eReplicaComponentType::HAVOK_VEHICLE_PHYSICS) ) //if (HasComponent(eReplicaComponentType::BASE_COMBAT_AI)) { @@ -1023,9 +1023,9 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType rigidbodyPhantomPhysics->Serialize(outBitStream, bIsInitialUpdate); } - VehiclePhysicsComponent* vehiclePhysicsComponent; - if (TryGetComponent(eReplicaComponentType::VEHICLE_PHYSICS, vehiclePhysicsComponent)) { - vehiclePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate); + HavokVehiclePhysicsComponent* havokVehiclePhysicsComponent; + if (TryGetComponent(eReplicaComponentType::HAVOK_VEHICLE_PHYSICS, havokVehiclePhysicsComponent)) { + havokVehiclePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate); } PhantomPhysicsComponent* phantomPhysicsComponent; @@ -1846,7 +1846,7 @@ const NiPoint3& Entity::GetPosition() const { return simple->GetPosition(); } - auto* vehicel = GetComponent(); + auto* vehicel = GetComponent(); if (vehicel != nullptr) { return vehicel->GetPosition(); @@ -1874,7 +1874,7 @@ const NiQuaternion& Entity::GetRotation() const { return simple->GetRotation(); } - auto* vehicel = GetComponent(); + auto* vehicel = GetComponent(); if (vehicel != nullptr) { return vehicel->GetRotation(); @@ -1902,7 +1902,7 @@ void Entity::SetPosition(NiPoint3 position) { simple->SetPosition(position); } - auto* vehicel = GetComponent(); + auto* vehicel = GetComponent(); if (vehicel != nullptr) { vehicel->SetPosition(position); @@ -1930,7 +1930,7 @@ void Entity::SetRotation(NiQuaternion rotation) { simple->SetRotation(rotation); } - auto* vehicel = GetComponent(); + auto* vehicel = GetComponent(); if (vehicel != nullptr) { vehicel->SetRotation(rotation); diff --git a/dGame/dComponents/CMakeLists.txt b/dGame/dComponents/CMakeLists.txt index b1550f37..814a4fb9 100644 --- a/dGame/dComponents/CMakeLists.txt +++ b/dGame/dComponents/CMakeLists.txt @@ -43,7 +43,7 @@ set(DGAME_DCOMPONENTS_SOURCES "BaseCombatAIComponent.cpp" "SoundTriggerComponent.cpp" "SwitchComponent.cpp" "TriggerComponent.cpp" - "VehiclePhysicsComponent.cpp" + "HavokVehiclePhysicsComponent.cpp" "VendorComponent.cpp" "ZoneControlComponent.cpp" PARENT_SCOPE diff --git a/dGame/dComponents/CharacterComponent.cpp b/dGame/dComponents/CharacterComponent.cpp index d1b7ee21..1e441293 100644 --- a/dGame/dComponents/CharacterComponent.cpp +++ b/dGame/dComponents/CharacterComponent.cpp @@ -10,7 +10,7 @@ #include "InventoryComponent.h" #include "ControllablePhysicsComponent.h" #include "EntityManager.h" -#include "VehiclePhysicsComponent.h" +#include "HavokVehiclePhysicsComponent.h" #include "GameMessages.h" #include "Item.h" #include "Amf3.h" diff --git a/dGame/dComponents/VehiclePhysicsComponent.cpp b/dGame/dComponents/HavokVehiclePhysicsComponent.cpp similarity index 77% rename from dGame/dComponents/VehiclePhysicsComponent.cpp rename to dGame/dComponents/HavokVehiclePhysicsComponent.cpp index 0e93782d..62e49a56 100644 --- a/dGame/dComponents/VehiclePhysicsComponent.cpp +++ b/dGame/dComponents/HavokVehiclePhysicsComponent.cpp @@ -1,7 +1,7 @@ -#include "VehiclePhysicsComponent.h" +#include "HavokVehiclePhysicsComponent.h" #include "EntityManager.h" -VehiclePhysicsComponent::VehiclePhysicsComponent(Entity* parent) : PhysicsComponent(parent) { +HavokVehiclePhysicsComponent::HavokVehiclePhysicsComponent(Entity* parent) : PhysicsComponent(parent) { m_Velocity = NiPoint3::ZERO; m_AngularVelocity = NiPoint3::ZERO; m_IsOnGround = true; @@ -12,45 +12,45 @@ VehiclePhysicsComponent::VehiclePhysicsComponent(Entity* parent) : PhysicsCompon m_EndBehavior = GeneralUtils::GenerateRandomNumber(0, 7); } -void VehiclePhysicsComponent::SetVelocity(const NiPoint3& vel) { +void HavokVehiclePhysicsComponent::SetVelocity(const NiPoint3& vel) { if (vel == m_Velocity) return; m_DirtyPosition = true; m_Velocity = vel; } -void VehiclePhysicsComponent::SetAngularVelocity(const NiPoint3& vel) { +void HavokVehiclePhysicsComponent::SetAngularVelocity(const NiPoint3& vel) { if (vel == m_AngularVelocity) return; m_DirtyPosition = true; m_AngularVelocity = vel; } -void VehiclePhysicsComponent::SetIsOnGround(bool val) { +void HavokVehiclePhysicsComponent::SetIsOnGround(bool val) { if (val == m_IsOnGround) return; m_DirtyPosition = true; m_IsOnGround = val; } -void VehiclePhysicsComponent::SetIsOnRail(bool val) { +void HavokVehiclePhysicsComponent::SetIsOnRail(bool val) { if (val == m_IsOnRail) return; m_DirtyPosition = true; m_IsOnRail = val; } -void VehiclePhysicsComponent::SetRemoteInputInfo(const RemoteInputInfo& remoteInputInfo) { +void HavokVehiclePhysicsComponent::SetRemoteInputInfo(const RemoteInputInfo& remoteInputInfo) { if (m_RemoteInputInfo == remoteInputInfo) return; this->m_RemoteInputInfo = remoteInputInfo; m_DirtyRemoteInput = true; } -void VehiclePhysicsComponent::SetDirtyVelocity(bool val) { +void HavokVehiclePhysicsComponent::SetDirtyVelocity(bool val) { m_DirtyVelocity = val; } -void VehiclePhysicsComponent::SetDirtyAngularVelocity(bool val) { +void HavokVehiclePhysicsComponent::SetDirtyAngularVelocity(bool val) { m_DirtyAngularVelocity = val; } -void VehiclePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) { +void HavokVehiclePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) { outBitStream->Write(bIsInitialUpdate || m_DirtyPosition); if (bIsInitialUpdate || m_DirtyPosition) { @@ -111,7 +111,7 @@ void VehiclePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bI outBitStream->Write0(); } -void VehiclePhysicsComponent::Update(float deltaTime) { +void HavokVehiclePhysicsComponent::Update(float deltaTime) { if (m_SoftUpdate > 5) { Game::entityManager->SerializeEntity(m_Parent); m_SoftUpdate = 0; diff --git a/dGame/dComponents/VehiclePhysicsComponent.h b/dGame/dComponents/HavokVehiclePhysicsComponent.h similarity index 94% rename from dGame/dComponents/VehiclePhysicsComponent.h rename to dGame/dComponents/HavokVehiclePhysicsComponent.h index 94ba650a..2d04e0ac 100644 --- a/dGame/dComponents/VehiclePhysicsComponent.h +++ b/dGame/dComponents/HavokVehiclePhysicsComponent.h @@ -33,11 +33,11 @@ struct RemoteInputInfo { /** * Physics component for vehicles. */ -class VehiclePhysicsComponent : public PhysicsComponent { +class HavokVehiclePhysicsComponent : public PhysicsComponent { public: - inline static const eReplicaComponentType ComponentType = eReplicaComponentType::VEHICLE_PHYSICS; + inline static const eReplicaComponentType ComponentType = eReplicaComponentType::HAVOK_VEHICLE_PHYSICS; - VehiclePhysicsComponent(Entity* parentEntity); + HavokVehiclePhysicsComponent(Entity* parentEntity); void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override; diff --git a/dGame/dComponents/InventoryComponent.cpp b/dGame/dComponents/InventoryComponent.cpp index 4d737ab7..fc379398 100644 --- a/dGame/dComponents/InventoryComponent.cpp +++ b/dGame/dComponents/InventoryComponent.cpp @@ -19,7 +19,7 @@ #include "PossessorComponent.h" #include "PossessableComponent.h" #include "ModuleAssemblyComponent.h" -#include "VehiclePhysicsComponent.h" +#include "HavokVehiclePhysicsComponent.h" #include "CharacterComponent.h" #include "dZoneManager.h" #include "PropertyManagementComponent.h" @@ -981,7 +981,7 @@ void InventoryComponent::HandlePossession(Item* item) { auto* mount = Game::entityManager->CreateEntity(info, nullptr, m_Parent); // Check to see if the mount is a vehicle, if so, flip it - auto* vehicleComponent = mount->GetComponent(); + auto* vehicleComponent = mount->GetComponent(); if (vehicleComponent) characterComponent->SetIsRacing(true); // Setup the destroyable stats diff --git a/dGame/dComponents/RacingControlComponent.cpp b/dGame/dComponents/RacingControlComponent.cpp index a4737d9e..6c8df280 100644 --- a/dGame/dComponents/RacingControlComponent.cpp +++ b/dGame/dComponents/RacingControlComponent.cpp @@ -17,7 +17,7 @@ #include "PossessorComponent.h" #include "eRacingTaskParam.h" #include "Spawner.h" -#include "VehiclePhysicsComponent.h" +#include "HavokVehiclePhysicsComponent.h" #include "dServer.h" #include "dZoneManager.h" #include "dConfig.h" diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index fe2ad720..fd174a2b 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -71,7 +71,7 @@ #include "MovingPlatformComponent.h" #include "PetComponent.h" #include "ModuleAssemblyComponent.h" -#include "VehiclePhysicsComponent.h" +#include "HavokVehiclePhysicsComponent.h" #include "RenderComponent.h" #include "PossessableComponent.h" #include "PossessorComponent.h" diff --git a/dGame/dUtilities/SlashCommandHandler.cpp b/dGame/dUtilities/SlashCommandHandler.cpp index 13fc3ded..7c18e9a4 100644 --- a/dGame/dUtilities/SlashCommandHandler.cpp +++ b/dGame/dUtilities/SlashCommandHandler.cpp @@ -59,7 +59,7 @@ #include "dpShapeSphere.h" #include "PossessableComponent.h" #include "PossessorComponent.h" -#include "VehiclePhysicsComponent.h" +#include "HavokVehiclePhysicsComponent.h" #include "BuffComponent.h" #include "SkillComponent.h" #include "VanityUtilities.h" @@ -942,9 +942,9 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit auto* possassableEntity = Game::entityManager->GetEntity(possessorComponent->GetPossessable()); if (possassableEntity != nullptr) { - auto* vehiclePhysicsComponent = possassableEntity->GetComponent(); - if (vehiclePhysicsComponent) { - vehiclePhysicsComponent->SetPosition(pos); + auto* havokVehiclePhysicsComponent = possassableEntity->GetComponent(); + if (havokVehiclePhysicsComponent) { + havokVehiclePhysicsComponent->SetPosition(pos); Game::entityManager->SerializeEntity(possassableEntity); } else GameMessages::SendTeleport(possassableEntity->GetObjectID(), pos, NiQuaternion(), sysAddr); } diff --git a/dNet/ClientPackets.cpp b/dNet/ClientPackets.cpp index 18b2f3d1..cf405053 100644 --- a/dNet/ClientPackets.cpp +++ b/dNet/ClientPackets.cpp @@ -27,7 +27,7 @@ #include "Zone.h" #include "PossessorComponent.h" #include "PossessableComponent.h" -#include "VehiclePhysicsComponent.h" +#include "HavokVehiclePhysicsComponent.h" #include "dConfig.h" #include "CharacterComponent.h" #include "Database.h" @@ -187,17 +187,17 @@ void ClientPackets::HandleClientPositionUpdate(const SystemAddress& sysAddr, Pac if (possessableComponent->GetPossessionType() != ePossessionType::ATTACHED_VISIBLE) updateChar = false; } - auto* vehiclePhysicsComponent = possassableEntity->GetComponent(); - if (vehiclePhysicsComponent != nullptr) { - vehiclePhysicsComponent->SetPosition(position); - vehiclePhysicsComponent->SetRotation(rotation); - vehiclePhysicsComponent->SetIsOnGround(onGround); - vehiclePhysicsComponent->SetIsOnRail(onRail); - vehiclePhysicsComponent->SetVelocity(velocity); - vehiclePhysicsComponent->SetDirtyVelocity(velocityFlag); - vehiclePhysicsComponent->SetAngularVelocity(angVelocity); - vehiclePhysicsComponent->SetDirtyAngularVelocity(angVelocityFlag); - vehiclePhysicsComponent->SetRemoteInputInfo(remoteInput); + auto* havokVehiclePhysicsComponent = possassableEntity->GetComponent(); + if (havokVehiclePhysicsComponent != nullptr) { + havokVehiclePhysicsComponent->SetPosition(position); + havokVehiclePhysicsComponent->SetRotation(rotation); + havokVehiclePhysicsComponent->SetIsOnGround(onGround); + havokVehiclePhysicsComponent->SetIsOnRail(onRail); + havokVehiclePhysicsComponent->SetVelocity(velocity); + havokVehiclePhysicsComponent->SetDirtyVelocity(velocityFlag); + havokVehiclePhysicsComponent->SetAngularVelocity(angVelocity); + havokVehiclePhysicsComponent->SetDirtyAngularVelocity(angVelocityFlag); + havokVehiclePhysicsComponent->SetRemoteInputInfo(remoteInput); } else { // Need to get the mount's controllable physics auto* controllablePhysicsComponent = possassableEntity->GetComponent();