feat: add further MovementAI skeleton (#1499)

* add movement ai skeleton

Zone loading code is tested to load and read the correct values using logs.  other ldf data is unaffected as I walked around crux and dragons/apes can still spawn and be killed.

* format
This commit is contained in:
David Markowitz
2024-03-08 17:29:01 -08:00
committed by GitHub
parent 3a6313a3ba
commit 4bc4624bc9
5 changed files with 271 additions and 129 deletions

View File

@@ -17,6 +17,7 @@
#include "eTriggerCommandType.h"
#include "eTriggerEventType.h"
#include "eWaypointCommandType.h"
#include "dNavMesh.h"
Zone::Zone(const LWOMAPID& mapID, const LWOINSTANCEID& instanceID, const LWOCLONEID& cloneID) :
@@ -452,15 +453,23 @@ void Zone::LoadPath(std::istream& file) {
std::string value;
BinaryIO::ReadString<uint8_t>(file, value, BinaryIO::ReadType::WideString);
LDFBaseData* ldfConfig = nullptr;
if (path.pathType == PathType::Movement || path.pathType == PathType::Rail) {
ldfConfig = LDFBaseData::DataFromString(parameter + "=0:" + value);
// cause NetDevil puts spaces in things that don't need spaces
parameter.erase(std::remove_if(parameter.begin(), parameter.end(), ::isspace), parameter.end());
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) {
auto& command = waypoint.commands.emplace_back();
command.command = waypointCommand;
command.data = value;
} else LOG("Tried to load invalid waypoint command '%s'", parameter.c_str());
} else {
ldfConfig = LDFBaseData::DataFromString(parameter + "=" + value);
waypoint.config.emplace_back(LDFBaseData::DataFromString(parameter + "=" + value));
}
if (ldfConfig) waypoint.config.push_back(ldfConfig);
}
}
// We verify the waypoint heights against the navmesh because in many movement paths,
// the waypoint is located near 0 height,
if (path.pathType == PathType::Movement) {

View File

@@ -13,6 +13,14 @@ namespace LUTriggers {
class Level;
enum class eWaypointCommandType : uint32_t;
struct WaypointCommand {
eWaypointCommandType command;
std::string data;
};
struct SceneRef {
std::string filename;
uint32_t id;
@@ -69,6 +77,7 @@ struct PathWaypoint {
RacingPathWaypoint racing;
float speed;
std::vector<LDFBaseData*> config;
std::vector<WaypointCommand> commands;
};
enum class PathType : uint32_t {