diff --git a/dCommon/dEnums/eWaypointCommandType.h b/dCommon/dEnums/eWaypointCommandType.h new file mode 100644 index 00000000..9cb3cf00 --- /dev/null +++ b/dCommon/dEnums/eWaypointCommandType.h @@ -0,0 +1,61 @@ +#ifndef __EWAYPOINTCOMMANDTYPES__H__ +#define __EWAYPOINTCOMMANDTYPES__H__ + +#include + +enum class eWaypointCommandType : uint32_t { + INVALID, + BOUNCE, + STOP, + GROUP_EMOTE, + SET_VARIABLE, + CAST_SKILL, + EQUIP_INVENTORY, + UNEQUIP_INVENTORY, + DELAY, + EMOTE, + TELEPORT, + PATH_SPEED, + REMOVE_NPC, + CHANGE_WAYPOINT, + DELETE_SELF, + KILL_SELF, + REMOVE_SELF, + SPAWN_OBJECT, + PLAY_SOUND, +}; + + + +class WaypointCommandType { +public: + static eWaypointCommandType StringToWaypointCommandType(std::string commandString) { + const std::map WaypointCommandTypeMap = { + {"bounce", eWaypointCommandType::BOUNCE}, + {"stop", eWaypointCommandType::STOP}, + {"groupemote", eWaypointCommandType::GROUP_EMOTE}, + {"setvar", eWaypointCommandType::SET_VARIABLE}, + {"castskill", eWaypointCommandType::CAST_SKILL}, + {"eqInvent", eWaypointCommandType::EQUIP_INVENTORY}, + {"unInvent", eWaypointCommandType::UNEQUIP_INVENTORY}, + {"delay", eWaypointCommandType::DELAY}, + {"femote", eWaypointCommandType::EMOTE}, + {"emote", eWaypointCommandType::EMOTE}, + {"teleport", eWaypointCommandType::TELEPORT}, + {"pathspeed", eWaypointCommandType::PATH_SPEED}, + {"removeNPC", eWaypointCommandType::REMOVE_NPC}, + {"changeWP", eWaypointCommandType::CHANGE_WAYPOINT}, + {"DeleteSelf", eWaypointCommandType::DELETE_SELF}, + {"killself", eWaypointCommandType::KILL_SELF}, + {"removeself", eWaypointCommandType::REMOVE_SELF}, + {"spawnOBJ", eWaypointCommandType::SPAWN_OBJECT}, + {"playSound", eWaypointCommandType::PLAY_SOUND}, + }; + + auto intermed = WaypointCommandTypeMap.find(commandString); + return (intermed != WaypointCommandTypeMap.end()) ? intermed->second : eWaypointCommandType::INVALID; + }; +}; + + +#endif //!__EWAYPOINTCOMMANDTYPES__H__ diff --git a/dGame/dComponents/MovementAIComponentAronwk.cpp b/dGame/dComponents/MovementAIComponentAronwk.cpp index d6f87d8d..cbe007f8 100644 --- a/dGame/dComponents/MovementAIComponentAronwk.cpp +++ b/dGame/dComponents/MovementAIComponentAronwk.cpp @@ -1,7 +1,50 @@ #ifndef MOVEMENTAICOMPONENT_H #include "MovementAIComponent.h" #endif +#include "eWaypointCommandType.h" void MovementAIComponent::HandleWaypointArrived() { - + if (m_Path->pathWaypoints[m_CurrentPathWaypointIndex].commands.empty()) return; + for(auto [command, data] : m_Path->pathWaypoints[m_CurrentPathWaypointIndex].commands){ + switch(command){ + case eWaypointCommandType::BOUNCE: + break; + case eWaypointCommandType::STOP: + break; + case eWaypointCommandType::GROUP_EMOTE: + break; + case eWaypointCommandType::SET_VARIABLE: + break; + case eWaypointCommandType::CAST_SKILL: + break; + case eWaypointCommandType::EQUIP_INVENTORY: + break; + case eWaypointCommandType::UNEQUIP_INVENTORY: + break; + case eWaypointCommandType::DELAY: + break; + case eWaypointCommandType::EMOTE: + break; + case eWaypointCommandType::TELEPORT: + break; + case eWaypointCommandType::PATH_SPEED: + break; + case eWaypointCommandType::REMOVE_NPC: + break; + case eWaypointCommandType::CHANGE_WAYPOINT: + break; + case eWaypointCommandType::DELETE_SELF: + break; + case eWaypointCommandType::KILL_SELF: + break; + case eWaypointCommandType::REMOVE_SELF: + break; + case eWaypointCommandType::SPAWN_OBJECT: + break; + case eWaypointCommandType::PLAY_SOUND: + break; + case eWaypointCommandType::INVALID: + Game::logger->LogDebug("MovementAIComponentAronwk", "Got invalid waypoint command %i", command); + } + } } diff --git a/dZoneManager/Zone.cpp b/dZoneManager/Zone.cpp index 2d68b31e..c5c3983d 100644 --- a/dZoneManager/Zone.cpp +++ b/dZoneManager/Zone.cpp @@ -17,6 +17,7 @@ #include "eTriggerCommandType.h" #include "eTriggerEventType.h" +#include "eWaypointCommandType.h" Zone::Zone(const LWOMAPID& mapID, const LWOINSTANCEID& instanceID, const LWOCLONEID& cloneID) : m_ZoneID(mapID, instanceID, cloneID) { @@ -537,16 +538,16 @@ void Zone::LoadPath(std::istream& file) { LDFBaseData* ldfConfig = nullptr; if (path.pathType == PathType::Movement || path.pathType == PathType::Rail) { - ldfConfig = LDFBaseData::DataFromString(parameter + "=0:" + value); + waypoint.commands.push_back(WaypointCommand(WaypointCommandType::StringToWaypointCommandType(parameter), value)); } else { ldfConfig = LDFBaseData::DataFromString(parameter + "=" + value); + if (ldfConfig) waypoint.config.push_back(ldfConfig); } - 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, + // the waypoint is located near 0 height, if (path.pathType == PathType::Movement) { if (dpWorld::Instance().IsLoaded()) { // 2000 should be large enough for every world. diff --git a/dZoneManager/Zone.h b/dZoneManager/Zone.h index b3e72036..fea2b1db 100644 --- a/dZoneManager/Zone.h +++ b/dZoneManager/Zone.h @@ -13,6 +13,16 @@ namespace LUTriggers { class Level; +enum class eWaypointCommandType : uint32_t; +struct WaypointCommand { + eWaypointCommandType command; + std::string data; + WaypointCommand(eWaypointCommandType command, std::string data){ + this->command = command; + this->data = data; + } +}; + struct SceneRef { std::string filename; uint32_t id; @@ -69,6 +79,7 @@ struct PathWaypoint { RacingPathWaypoint racing; RailPathWaypoint rail; std::vector config; + std::vector commands; }; enum class PathType : uint32_t {