mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-14 20:28:21 +00:00
this took 4 eons to get compiling again
Update Zone.cpp Update Zone.h Update Zone.h Update MovingPlatformComponent.cpp Update ProximityMonitorComponent.cpp quick cleanup Use correct logging
This commit is contained in:
parent
6863ee9d76
commit
772ac06e94
@ -19,7 +19,7 @@ INCLUDE_BACKTRACE=0
|
||||
COMPILE_BACKTRACE=0
|
||||
|
||||
# Set to the number of jobs (make -j equivalent) to compile the mariadbconn files with.
|
||||
MARIADB_CONNECTOR_COMPILE_JOBS=1
|
||||
MARIADB_CONNECTOR_COMPILE_JOBS=
|
||||
|
||||
# When set to 1 and uncommented, compiling and linking testing folders and libraries will be done.
|
||||
ENABLE_TESTING=1
|
||||
|
@ -2125,9 +2125,7 @@ void Entity::ProcessPositionUpdate(PositionUpdate& update) {
|
||||
possessedControllablePhysicsComponent->SetIsOnGround(update.onGround);
|
||||
possessedControllablePhysicsComponent->SetIsOnRail(update.onRail);
|
||||
possessedControllablePhysicsComponent->SetVelocity(update.velocity);
|
||||
possessedControllablePhysicsComponent->SetDirtyVelocity(update.velocity != NiPoint3Constant::ZERO);
|
||||
possessedControllablePhysicsComponent->SetAngularVelocity(update.angularVelocity);
|
||||
possessedControllablePhysicsComponent->SetDirtyAngularVelocity(update.angularVelocity != NiPoint3Constant::ZERO);
|
||||
}
|
||||
Game::entityManager->SerializeEntity(possassableEntity);
|
||||
}
|
||||
@ -2149,9 +2147,7 @@ void Entity::ProcessPositionUpdate(PositionUpdate& update) {
|
||||
controllablePhysicsComponent->SetIsOnGround(update.onGround);
|
||||
controllablePhysicsComponent->SetIsOnRail(update.onRail);
|
||||
controllablePhysicsComponent->SetVelocity(update.velocity);
|
||||
controllablePhysicsComponent->SetDirtyVelocity(update.velocity != NiPoint3Constant::ZERO);
|
||||
controllablePhysicsComponent->SetAngularVelocity(update.angularVelocity);
|
||||
controllablePhysicsComponent->SetDirtyAngularVelocity(update.angularVelocity != NiPoint3Constant::ZERO);
|
||||
|
||||
auto* ghostComponent = GetComponent<GhostComponent>();
|
||||
if (ghostComponent) ghostComponent->SetGhostReferencePoint(update.position);
|
||||
|
@ -22,7 +22,6 @@ ControllablePhysicsComponent::ControllablePhysicsComponent(Entity* entity) : Phy
|
||||
m_IsOnGround = true;
|
||||
m_IsOnRail = false;
|
||||
m_DirtyVelocity = true;
|
||||
m_DirtyAngularVelocity = true;
|
||||
m_dpEntity = nullptr;
|
||||
m_Static = false;
|
||||
m_SpeedMultiplier = 1;
|
||||
@ -68,7 +67,7 @@ ControllablePhysicsComponent::~ControllablePhysicsComponent() {
|
||||
}
|
||||
|
||||
void ControllablePhysicsComponent::Update(float deltaTime) {
|
||||
if (m_Velocity == NiPoint3::ZERO) return;
|
||||
if (m_Velocity == NiPoint3Constant::ZERO) return;
|
||||
SetPosition(m_Position + (m_Velocity * deltaTime));
|
||||
Game::entityManager->SerializeEntity(m_Parent);
|
||||
}
|
||||
@ -117,8 +116,8 @@ void ControllablePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bo
|
||||
if (!bIsInitialUpdate) m_DirtyBubble = false;
|
||||
}
|
||||
|
||||
bool isVelocityZero = m_Velocity != NiPoint3::ZERO;
|
||||
bool isAngularVelocityZero = m_AngularVelocity != NiPoint3::ZERO;
|
||||
bool isVelocityZero = m_Velocity != NiPoint3Constant::ZERO;
|
||||
bool isAngularVelocityZero = m_AngularVelocity != NiPoint3Constant::ZERO;
|
||||
bool shouldWriteFrameStats = m_DirtyPosition || bIsInitialUpdate || isVelocityZero || isAngularVelocityZero;
|
||||
outBitStream->Write(m_DirtyPosition || bIsInitialUpdate);
|
||||
if (m_DirtyPosition || bIsInitialUpdate) {
|
||||
|
@ -67,7 +67,7 @@ void HavokVehiclePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bo
|
||||
outBitStream->Write(m_IsOnGround);
|
||||
outBitStream->Write(m_IsOnRail);
|
||||
|
||||
bool isVelocityZero = m_Velocity == NiPoint3::ZERO;
|
||||
bool isVelocityZero = m_Velocity == NiPoint3Constant::ZERO;
|
||||
|
||||
outBitStream->Write(isVelocityZero);
|
||||
if (isVelocityZero) {
|
||||
@ -76,7 +76,7 @@ void HavokVehiclePhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bo
|
||||
outBitStream->Write(m_Velocity.z);
|
||||
}
|
||||
|
||||
bool isAngularVelocityZero = m_AngularVelocity == NiPoint3::ZERO;
|
||||
bool isAngularVelocityZero = m_AngularVelocity == NiPoint3Constant::ZERO;
|
||||
outBitStream->Write(isAngularVelocityZero);
|
||||
if (isAngularVelocityZero) {
|
||||
outBitStream->Write(m_AngularVelocity.x);
|
||||
|
@ -73,30 +73,30 @@ float MovementAIComponent::GetCurrentPathWaypointSpeed() const {
|
||||
|
||||
void MovementAIComponent::SetupPath(const std::string& pathname) {
|
||||
std::string path = pathname;
|
||||
if (path.empty()) path = m_Parent->GetVarAsString(u"attached_path");
|
||||
if (path.empty()) {
|
||||
Game::logger->Log("MovementAIComponent", "No path to load for %i:%llu", m_Parent->GetLOT(), m_Parent->GetObjectID());
|
||||
path = m_Parent->GetVarAsString(u"attached_path");
|
||||
if (path.empty()) {
|
||||
LOG("No path to load for %i:%llu", m_Parent->GetLOT(), m_Parent->GetObjectID());
|
||||
return;
|
||||
}
|
||||
}
|
||||
const Path* pathData = Game::zoneManager->GetZone()->GetPath(path);
|
||||
if (pathData) {
|
||||
Game::logger->Log("MovementAIComponent", "found path %i %s", m_Parent->GetLOT(), path.c_str());
|
||||
LOG("found path %i %s", m_Parent->GetLOT(), path.c_str());
|
||||
m_Path = pathData;
|
||||
if (!HasAttachedPathStart() && m_Parent->HasVar(u"attached_path_start")) m_StartingWaypointIndex = m_Parent->GetVar<uint32_t>(u"attached_path_start");
|
||||
if (m_Path && HasAttachedPathStart() && (m_StartingWaypointIndex < 0 || m_StartingWaypointIndex >= m_Path->pathWaypoints.size())) {
|
||||
Game::logger->Log(
|
||||
"MovementAIComponent",
|
||||
"WARNING: attached path start is out of bounds for %i:%llu, defaulting path start to 0",
|
||||
LOG("WARNING: attached path start is out of bounds for %i:%llu, defaulting path start to 0",
|
||||
m_Parent->GetLOT(), m_Parent->GetObjectID());
|
||||
m_StartingWaypointIndex = 0;
|
||||
}
|
||||
std::vector<NiPoint3> waypoints;
|
||||
for (auto& waypoint : m_Path->pathWaypoints) {
|
||||
for (const auto& waypoint : m_Path->pathWaypoints) {
|
||||
waypoints.push_back(waypoint.position);
|
||||
}
|
||||
SetPath(waypoints);
|
||||
} else {
|
||||
Game::logger->Log("MovementAIComponent", "No path found for %i:%llu", m_Parent->GetLOT(), m_Parent->GetObjectID());
|
||||
LOG("No path found for %i:%llu", m_Parent->GetLOT(), m_Parent->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ bool MovementAIComponent::Warp(const NiPoint3& point) {
|
||||
void MovementAIComponent::Pause() {
|
||||
if (AtFinalWaypoint() || IsPaused()) return;
|
||||
SetPosition(ApproximateLocation());
|
||||
SetVelocity(NiPoint3::ZERO);
|
||||
SetVelocity(NiPoint3Constant::ZERO);
|
||||
|
||||
// Clear this as we may be somewhere else when we resume movement.
|
||||
m_InterpolatedWaypoints.clear();
|
||||
@ -325,7 +325,7 @@ const NiPoint3& MovementAIComponent::GetCurrentPathWaypoint() const {
|
||||
return m_CurrentPath.at(m_CurrentPathWaypointIndex);
|
||||
}
|
||||
|
||||
void MovementAIComponent::SetPath(std::vector<NiPoint3> path, bool startInReverse) {
|
||||
void MovementAIComponent::SetPath(const std::vector<NiPoint3>& path, bool startInReverse) {
|
||||
if (path.empty()) return;
|
||||
m_CurrentPath = path;
|
||||
m_IsInReverse = startInReverse;
|
||||
@ -549,11 +549,11 @@ void MovementAIComponent::HandleWaypointArrived(uint32_t commandIndex) {
|
||||
GameMessages::SendPlayNDAudioEmitter(m_Parent, UNASSIGNED_SYSTEM_ADDRESS, data);
|
||||
break;
|
||||
case eWaypointCommandType::BOUNCE:
|
||||
Game::logger->LogDebug("MovementAIComponent", "Unable to process bounce waypoint command server side!");
|
||||
LOG("Unable to process bounce waypoint command server side!");
|
||||
break;
|
||||
case eWaypointCommandType::INVALID:
|
||||
default:
|
||||
Game::logger->LogDebug("MovementAIComponent", "Got invalid waypoint command %i", command);
|
||||
LOG("Got invalid waypoint command %i", command);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -583,20 +583,18 @@ void MovementAIComponent::HandleWaypointCommandCastSkill(const std::string& data
|
||||
if (data.empty()) return;
|
||||
auto* skillComponent = m_Parent->GetComponent<SkillComponent>();
|
||||
if (!skillComponent) {
|
||||
Game::logger->LogDebug("MovementAIComponent::HandleWaypointCommandCastSkill", "Skill component not found!");
|
||||
LOG("Skill component not found!");
|
||||
return;
|
||||
}
|
||||
uint32_t skillId = 0;
|
||||
if (!GeneralUtils::TryParse<uint32_t>(data, skillId)) return;
|
||||
if (skillId != 0) skillComponent->CastSkill(skillId);
|
||||
return;
|
||||
auto skillId = GeneralUtils::TryParse<uint32_t>(data);
|
||||
if (skillId && skillId != 0) skillComponent->CastSkill(skillId.value());
|
||||
}
|
||||
|
||||
void MovementAIComponent::HandleWaypointCommandEquipInventory(const std::string& data) {
|
||||
if (data.empty()) return;
|
||||
auto* inventoryComponent = m_Parent->GetComponent<InventoryComponent>();
|
||||
if (!inventoryComponent) {
|
||||
Game::logger->LogDebug("MovementAIComponent::HandleWaypointCommandEquipInventory", "Inventory component not found!");
|
||||
LOG("Inventory component not found!");
|
||||
return;
|
||||
}
|
||||
// the client says use slot 0 of items
|
||||
@ -611,7 +609,7 @@ void MovementAIComponent::HandleWaypointCommandUnequipInventory(const std::strin
|
||||
if (data.empty()) return;
|
||||
auto* inventoryComponent = m_Parent->GetComponent<InventoryComponent>();
|
||||
if (!inventoryComponent) {
|
||||
Game::logger->LogDebug("MovementAIComponent::HandleWaypointCommandEquipInventory", "Inventory component not found!");
|
||||
LOG("Inventory component not found!");
|
||||
return;
|
||||
}
|
||||
// the client says use slot 0 of items
|
||||
@ -623,35 +621,50 @@ void MovementAIComponent::HandleWaypointCommandUnequipInventory(const std::strin
|
||||
}
|
||||
|
||||
float MovementAIComponent::HandleWaypointCommandDelay(const std::string& data) {
|
||||
float delay = 0.0f;
|
||||
std::string delayString = data;
|
||||
if (!GeneralUtils::TryParse<float>(delayString, delay)) {
|
||||
Game::logger->LogDebug("MovementAIComponentAronwk", "Failed to parse delay %s", data.c_str());
|
||||
auto delay = GeneralUtils::TryParse<float>(data);
|
||||
if (!delay) {
|
||||
LOG("Failed to parse delay %s", data.c_str());
|
||||
}
|
||||
return delay;
|
||||
return delay.value_or(0.0f);
|
||||
}
|
||||
|
||||
void MovementAIComponent::HandleWaypointCommandTeleport(const std::string& data) {
|
||||
auto posString = GeneralUtils::SplitString(data, ',');
|
||||
if (posString.size() == 0) return;
|
||||
auto newPos = NiPoint3();
|
||||
if (posString.size() == 1 && !GeneralUtils::TryParse<float>(posString.at(0), newPos.x)) return;
|
||||
if (posString.size() == 2 && !GeneralUtils::TryParse<float>(posString.at(1), newPos.y)) return;
|
||||
if (posString.size() == 3 && !GeneralUtils::TryParse<float>(posString.at(2), newPos.z)) return;
|
||||
GameMessages::SendTeleport(m_Parent->GetObjectID(), newPos, NiQuaternion::IDENTITY, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
std::optional<float> intermediate;
|
||||
if (posString.size() >= 1) {
|
||||
intermediate = GeneralUtils::TryParse<float>(posString.at(0));
|
||||
if (!intermediate) return;
|
||||
|
||||
newPos.x = intermediate.value();
|
||||
if (posString.size() >= 2) {
|
||||
intermediate = GeneralUtils::TryParse<float>(posString.at(1));
|
||||
if (!intermediate) return;
|
||||
|
||||
newPos.y = intermediate.value();
|
||||
if (posString.size() >= 3) {
|
||||
intermediate = GeneralUtils::TryParse<float>(posString.at(2));
|
||||
if (!intermediate) return;
|
||||
|
||||
newPos.z = intermediate.value();
|
||||
}
|
||||
}
|
||||
}
|
||||
GameMessages::SendTeleport(m_Parent->GetObjectID(), newPos, NiQuaternionConstant::IDENTITY, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
}
|
||||
|
||||
void MovementAIComponent::HandleWaypointCommandPathSpeed(const std::string& data) {
|
||||
float speed = 0.0;
|
||||
if (!GeneralUtils::TryParse<float>(data, speed)) return;
|
||||
SetMaxSpeed(speed);
|
||||
auto speed = GeneralUtils::TryParse<float>(data);
|
||||
if (!speed) return;
|
||||
SetMaxSpeed(speed.value());
|
||||
}
|
||||
|
||||
void MovementAIComponent::HandleWaypointCommandRemoveNPC(const std::string& data) {
|
||||
if (data.empty()) return;
|
||||
auto* proximityMonitorComponent = m_Parent->GetComponent<ProximityMonitorComponent>();
|
||||
if (!proximityMonitorComponent) {
|
||||
Game::logger->LogDebug("MovementAIComponent::HandleWaypointCommandRemoveNPC", "Proximity monitor component not found!");
|
||||
LOG("Proximity monitor component not found!");
|
||||
return;
|
||||
}
|
||||
const auto foundObjs = proximityMonitorComponent->GetProximityObjects("KillOBJS");
|
||||
@ -660,11 +673,13 @@ void MovementAIComponent::HandleWaypointCommandRemoveNPC(const std::string& data
|
||||
if (!entity) return;
|
||||
auto* destroyableComponent = m_Parent->GetComponent<DestroyableComponent>();
|
||||
if (!destroyableComponent) {
|
||||
Game::logger->LogDebug("MovementAIComponent::HandleWaypointCommandRemoveNPC", "Destroyable component not found!");
|
||||
LOG("Destroyable component not found!");
|
||||
return;
|
||||
}
|
||||
uint32_t factionID = -1;
|
||||
if (!GeneralUtils::TryParse<uint32_t>(data, factionID)) return;
|
||||
int32_t factionID = -1;
|
||||
auto parsed = GeneralUtils::TryParse<uint32_t>(data);
|
||||
if (!parsed) return;
|
||||
factionID = parsed.value();
|
||||
if (destroyableComponent->BelongsToFaction(factionID)) m_Parent->Kill();
|
||||
}
|
||||
}
|
||||
@ -676,7 +691,9 @@ void MovementAIComponent::HandleWaypointCommandChangeWaypoint(const std::string&
|
||||
if (data.find(",") != std::string::npos) {
|
||||
auto datas = GeneralUtils::SplitString(data, ',');
|
||||
path_string = datas.at(0);
|
||||
if (!GeneralUtils::TryParse(datas.at(1), index)) return;
|
||||
auto parsed = GeneralUtils::TryParse<int32_t>(datas.at(1));
|
||||
if (!parsed) return;
|
||||
index = parsed.value();
|
||||
} else path_string = data;
|
||||
|
||||
if (path_string != "") {
|
||||
@ -687,7 +704,9 @@ void MovementAIComponent::HandleWaypointCommandChangeWaypoint(const std::string&
|
||||
|
||||
void MovementAIComponent::HandleWaypointCommandSpawnObject(const std::string& data) {
|
||||
LOT newObjectLOT = 0;
|
||||
if (!GeneralUtils::TryParse(data, newObjectLOT)) return;
|
||||
auto parsed = GeneralUtils::TryParse<LOT>(data);
|
||||
if (!parsed) return;
|
||||
newObjectLOT = parsed.value();
|
||||
EntityInfo info{};
|
||||
info.lot = newObjectLOT;
|
||||
info.pos = m_Parent->GetPosition();
|
||||
|
@ -224,7 +224,7 @@ public:
|
||||
* Sets a path to follow for the AI
|
||||
* @param path the path to follow
|
||||
*/
|
||||
void SetPath(std::vector<NiPoint3> path, bool startsInReverse = false);
|
||||
void SetPath(const std::vector<NiPoint3>& path, bool startsInReverse = false);
|
||||
|
||||
// Advance the path waypoint index and return if there is a next waypoint
|
||||
bool AdvancePathWaypointIndex();
|
||||
|
@ -162,7 +162,7 @@ void MovingPlatformComponent::StartPathing() {
|
||||
const auto& nextWaypoint = m_Path->pathWaypoints[subComponent->mNextWaypointIndex];
|
||||
|
||||
subComponent->mPosition = currentWaypoint.position;
|
||||
subComponent->mSpeed = currentWaypoint.speed;
|
||||
subComponent->mSpeed = currentWaypoint.movingPlatform.speed;
|
||||
subComponent->mWaitTime = currentWaypoint.movingPlatform.wait;
|
||||
|
||||
targetPosition = nextWaypoint.position;
|
||||
@ -213,7 +213,7 @@ void MovingPlatformComponent::ContinuePathing() {
|
||||
const auto& nextWaypoint = m_Path->pathWaypoints[subComponent->mNextWaypointIndex];
|
||||
|
||||
subComponent->mPosition = currentWaypoint.position;
|
||||
subComponent->mSpeed = currentWaypoint.speed;
|
||||
subComponent->mSpeed = currentWaypoint.movingPlatform.speed;
|
||||
subComponent->mWaitTime = currentWaypoint.movingPlatform.wait; // + 2;
|
||||
|
||||
pathSize = m_Path->pathWaypoints.size() - 1;
|
||||
|
@ -61,17 +61,17 @@ bool ProximityMonitorComponent::IsInProximity(const std::string& name, LWOOBJID
|
||||
}
|
||||
|
||||
void ProximityMonitorComponent::Update(float deltaTime) {
|
||||
for (const auto& [name, dpentity] : m_ProximitiesData) {
|
||||
if (!dpentity) continue;
|
||||
dpentity->SetPosition(m_Parent->GetPosition());
|
||||
for (const auto& prox : m_ProximitiesData) {
|
||||
if (!prox.second) continue;
|
||||
prox.second->SetPosition(m_Parent->GetPosition());
|
||||
//Process enter events
|
||||
for (auto* en : dpentity->GetNewObjects()) {
|
||||
m_Parent->OnCollisionProximity(en->GetObjectID(), name, "ENTER");
|
||||
for (auto* en : prox.second->GetNewObjects()) {
|
||||
m_Parent->OnCollisionProximity(en->GetObjectID(), prox.first, "ENTER");
|
||||
}
|
||||
|
||||
//Process exit events
|
||||
for (auto* en : dpentity->GetRemovedObjects()) {
|
||||
m_Parent->OnCollisionProximity(en->GetObjectID(), name, "LEAVE");
|
||||
for (auto* en : prox.second->GetRemovedObjects()) {
|
||||
m_Parent->OnCollisionProximity(en->GetObjectID(), prox.first, "LEAVE");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -227,9 +227,9 @@ void TriggerComponent::HandleSetPath(Entity* targetEntity, std::vector<std::stri
|
||||
if (!movementAIComponent) return;
|
||||
movementAIComponent->SetupPath(argArray.at(0));
|
||||
if (argArray.size() >= 2) {
|
||||
int32_t index = 0;
|
||||
if (!GeneralUtils::TryParse(argArray.at(1), index)) return;
|
||||
movementAIComponent->SetPathStartingWaypointIndex(index);
|
||||
auto index = GeneralUtils::TryParse<int32_t>(argArray.at(1));
|
||||
if (!index) return;
|
||||
movementAIComponent->SetPathStartingWaypointIndex(index.value());
|
||||
}
|
||||
if (argArray.size() >= 3 && argArray.at(2) == "1") movementAIComponent->ReversePath();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ set(DSCRIPTS_SOURCES_02_SERVER_MAP_AM
|
||||
"AmBlueX.cpp"
|
||||
"AmTeapotServer.cpp"
|
||||
"WanderingVendor.cpp"
|
||||
PARENT_SCOPE)
|
||||
)
|
||||
|
||||
add_library(dScriptsServerMapAM ${DSCRIPTS_SOURCES_02_SERVER_MAP_AM})
|
||||
target_include_directories(dScriptsServerMapAM PUBLIC ".")
|
||||
|
@ -18,7 +18,7 @@ void WanderingVendor::OnProximityUpdate(Entity* self, Entity* entering, std::str
|
||||
} else if (status == "LEAVE") {
|
||||
auto* proximityMonitorComponent = self->GetComponent<ProximityMonitorComponent>();
|
||||
if (!proximityMonitorComponent) {
|
||||
Game::logger->LogDebug("MovementAIComponent::HandleWaypointCommandRemoveNPC", "Proximity monitor component not found!");
|
||||
LOG("Proximity monitor component not found!");
|
||||
return;
|
||||
}
|
||||
const auto proxObjs = proximityMonitorComponent->GetProximityObjects("playermonitor");
|
||||
|
@ -22,6 +22,7 @@ add_library(dScriptsZone STATIC ${DSCRIPTS_SOURCES_ZONE})
|
||||
target_include_directories(dScriptsZone PUBLIC "."
|
||||
"AG"
|
||||
"LUPs"
|
||||
"LUPs/RobotCity_Intro"
|
||||
"PROPERTY"
|
||||
"PROPERTY/FV"
|
||||
"PROPERTY/GF"
|
||||
|
@ -420,7 +420,7 @@ void Zone::LoadPath(std::istream& file) {
|
||||
|
||||
if (path.pathType == PathType::MovingPlatform) {
|
||||
BinaryIO::BinaryRead(file, waypoint.movingPlatform.lockPlayer);
|
||||
BinaryIO::BinaryRead(file, waypoint.speed);
|
||||
BinaryIO::BinaryRead(file, waypoint.movingPlatform.speed);
|
||||
BinaryIO::BinaryRead(file, waypoint.movingPlatform.wait);
|
||||
if (path.pathVersion >= 13) {
|
||||
BinaryIO::ReadString<uint8_t>(file, waypoint.movingPlatform.departSound, BinaryIO::ReadType::WideString);
|
||||
@ -439,7 +439,7 @@ void Zone::LoadPath(std::istream& file) {
|
||||
BinaryIO::BinaryRead(file, waypoint.racing.planeHeight);
|
||||
BinaryIO::BinaryRead(file, waypoint.racing.shortestDistanceToEnd);
|
||||
} else if (path.pathType == PathType::Rail) {
|
||||
if (path.pathVersion > 16) BinaryIO::BinaryRead(file, waypoint.speed);
|
||||
if (path.pathVersion > 16) BinaryIO::BinaryRead(file, waypoint.rail.speed);
|
||||
}
|
||||
|
||||
// object LDF configs
|
||||
@ -460,7 +460,7 @@ void Zone::LoadPath(std::istream& file) {
|
||||
auto waypointCommand = WaypointCommandType::StringToWaypointCommandType(parameter);
|
||||
if (waypointCommand == eWaypointCommandType::DELAY) value.erase(std::remove_if(value.begin(), value.end(), ::isspace), value.end());
|
||||
if (waypointCommand != eWaypointCommandType::INVALID) waypoint.commands.push_back(WaypointCommand(waypointCommand, value));
|
||||
else Game::logger->Log("Zone", "Tried to load invalid waypoint command '%s'", parameter.c_str());
|
||||
else LOG("Tried to load invalid waypoint command '%s'", parameter.c_str());
|
||||
} else {
|
||||
ldfConfig = LDFBaseData::DataFromString(parameter + "=" + value);
|
||||
if (ldfConfig) waypoint.config.push_back(ldfConfig);
|
||||
|
@ -50,6 +50,7 @@ struct SceneTransition {
|
||||
|
||||
struct MovingPlatformPathWaypoint {
|
||||
uint8_t lockPlayer;
|
||||
float speed;
|
||||
float wait;
|
||||
std::string departSound;
|
||||
std::string arriveSound;
|
||||
@ -71,13 +72,17 @@ struct RacingPathWaypoint {
|
||||
float shortestDistanceToEnd;
|
||||
};
|
||||
|
||||
struct RailPathWaypoint {
|
||||
float speed;
|
||||
};
|
||||
|
||||
struct PathWaypoint {
|
||||
NiPoint3 position;
|
||||
NiQuaternion rotation; // not included in all, but it's more convenient here
|
||||
MovingPlatformPathWaypoint movingPlatform;
|
||||
CameraPathWaypoint camera;
|
||||
RacingPathWaypoint racing;
|
||||
float speed = 1.0f;
|
||||
RailPathWaypoint rail;
|
||||
std::vector<LDFBaseData*> config;
|
||||
std::vector<WaypointCommand> commands;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user