mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-11-14 22:28:47 +00:00
Merge remote-tracking branch 'origin/main' into grim-lu
This commit is contained in:
@@ -3,6 +3,5 @@ set(DZONEMANAGER_SOURCES "dZoneManager.cpp"
|
||||
"Spawner.cpp"
|
||||
"Zone.cpp")
|
||||
|
||||
#add_library(dZoneManager STATIC ${DZONEMANAGER_SOURCES})
|
||||
|
||||
set(DZONEMANAGER_SOURCES ${DZONEMANAGER_SOURCES} PARENT_SCOPE)
|
||||
add_library(dZoneManager STATIC ${DZONEMANAGER_SOURCES})
|
||||
target_link_libraries(dZoneManager dPhysics)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
class Command;
|
||||
class Event;
|
||||
|
||||
@@ -179,8 +179,8 @@ void Level::ReadSceneObjectDataChunk(std::istream& file, Header& header) {
|
||||
//This is a little bit of a bodge, but because the alpha client (HF) doesn't store the
|
||||
//spawn position / rotation like the later versions do, we need to check the LOT for the spawn pos & set it.
|
||||
if (obj.lot == LOT_MARKER_PLAYER_START) {
|
||||
dZoneManager::Instance()->GetZone()->SetSpawnPos(obj.position);
|
||||
dZoneManager::Instance()->GetZone()->SetSpawnRot(obj.rotation);
|
||||
Game::zoneManager->GetZone()->SetSpawnPos(obj.position);
|
||||
Game::zoneManager->GetZone()->SetSpawnRot(obj.rotation);
|
||||
}
|
||||
|
||||
std::u16string ldfString = u"";
|
||||
@@ -297,7 +297,7 @@ void Level::ReadSceneObjectDataChunk(std::istream& file, Header& header) {
|
||||
}
|
||||
}
|
||||
Spawner* spawner = new Spawner(spawnInfo);
|
||||
dZoneManager::Instance()->AddSpawner(obj.id, spawner);
|
||||
Game::zoneManager->AddSpawner(obj.id, spawner);
|
||||
} else { //Regular object
|
||||
EntityInfo info;
|
||||
info.spawnerID = 0;
|
||||
@@ -328,11 +328,11 @@ void Level::ReadSceneObjectDataChunk(std::istream& file, Header& header) {
|
||||
if (!clientOnly) {
|
||||
|
||||
// We should never have more than 1 zone control object
|
||||
const auto zoneControlObject = dZoneManager::Instance()->GetZoneControlObject();
|
||||
const auto zoneControlObject = Game::zoneManager->GetZoneControlObject();
|
||||
if (zoneControlObject != nullptr && info.lot == zoneControlObject->GetLOT())
|
||||
goto deleteSettings;
|
||||
|
||||
EntityManager::Instance()->CreateEntity(info, nullptr);
|
||||
Game::entityManager->CreateEntity(info, nullptr);
|
||||
} else {
|
||||
deleteSettings:
|
||||
|
||||
|
||||
@@ -49,9 +49,9 @@ Spawner::Spawner(const SpawnerInfo info) {
|
||||
}
|
||||
|
||||
if (m_Info.spawnOnSmashGroupName != "") {
|
||||
std::vector<Entity*> spawnSmashEntities = EntityManager::Instance()->GetEntitiesInGroup(m_Info.spawnOnSmashGroupName);
|
||||
std::vector<Spawner*> spawnSmashSpawners = dZoneManager::Instance()->GetSpawnersInGroup(m_Info.spawnOnSmashGroupName);
|
||||
std::vector<Spawner*> spawnSmashSpawnersN = dZoneManager::Instance()->GetSpawnersByName(m_Info.spawnOnSmashGroupName);
|
||||
std::vector<Entity*> spawnSmashEntities = Game::entityManager->GetEntitiesInGroup(m_Info.spawnOnSmashGroupName);
|
||||
std::vector<Spawner*> spawnSmashSpawners = Game::zoneManager->GetSpawnersInGroup(m_Info.spawnOnSmashGroupName);
|
||||
std::vector<Spawner*> spawnSmashSpawnersN = Game::zoneManager->GetSpawnersByName(m_Info.spawnOnSmashGroupName);
|
||||
for (Entity* ssEntity : spawnSmashEntities) {
|
||||
m_SpawnSmashFoundGroup = true;
|
||||
ssEntity->AddDieCallback([=]() {
|
||||
@@ -198,11 +198,100 @@ Entity* Spawner::Spawn(std::vector<SpawnerNode*> freeNodes, const bool force) {
|
||||
}
|
||||
}
|
||||
|
||||
Entity* rezdE = EntityManager::Instance()->CreateEntity(m_EntityInfo, nullptr);
|
||||
bool usedSpawnPattern = false;
|
||||
|
||||
if (m_SpawnPattern != nullptr) {
|
||||
auto pattern = m_SpawnPattern->GetSpawnPatterns();
|
||||
|
||||
// Check the area rating
|
||||
// std::map<LOT, std::vector<std::pair<NiPoint3, float>>> m_Ratings
|
||||
for (const auto& lot : m_LotsToCheck)
|
||||
{
|
||||
const auto& it = m_Ratings.find(lot);
|
||||
|
||||
int32_t rating = 0;
|
||||
|
||||
if (it != m_Ratings.end()) {
|
||||
// Check if we are within 50units of a rating
|
||||
for (const auto& ratingIt : it->second)
|
||||
{
|
||||
if (NiPoint3::DistanceSquared(ratingIt.first, m_EntityInfo.pos) <= 100.0f * 100.0f)
|
||||
{
|
||||
rating = ratingIt.second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& it : pattern)
|
||||
{
|
||||
if (it.first > rating) continue;
|
||||
|
||||
// Random number between 0 and 1
|
||||
float random = GeneralUtils::GenerateRandomNumber<float>(0, 1);
|
||||
|
||||
const auto& change = it.second.first;
|
||||
|
||||
if (random >= change) continue;
|
||||
|
||||
usedSpawnPattern = true;
|
||||
|
||||
Entity* first = nullptr;
|
||||
|
||||
for (const auto& spawn : it.second.second)
|
||||
{
|
||||
float angle = GeneralUtils::GenerateRandomNumber<float>(0, 360) * M_PI / 180.0f;
|
||||
float radius = GeneralUtils::GenerateRandomNumber<float>(0, 6);
|
||||
|
||||
float x = radius * cos(angle);
|
||||
float z = radius * sin(angle);
|
||||
|
||||
auto copy = m_EntityInfo;
|
||||
copy.pos.x += x;
|
||||
copy.pos.z += z;
|
||||
copy.lot = spawn;
|
||||
|
||||
if (std::find(m_LotsToCheck.begin(), m_LotsToCheck.end(), spawn) == m_LotsToCheck.end()) {
|
||||
m_LotsToCheck.push_back(spawn);
|
||||
}
|
||||
|
||||
Entity* rezdE = EntityManager::Instance()->CreateEntity(copy, nullptr);
|
||||
|
||||
rezdE->GetGroups() = m_Info.groups;
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(rezdE);
|
||||
|
||||
m_Entities.insert({ rezdE->GetObjectID(), spawnNode });
|
||||
|
||||
spawnNode->entities.push_back(rezdE->GetObjectID());
|
||||
|
||||
for (const auto& cb : m_EntitySpawnedCallbacks) {
|
||||
cb(rezdE);
|
||||
}
|
||||
|
||||
if (first == nullptr) {
|
||||
first = rezdE;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
usedSpawnPattern = true;
|
||||
|
||||
if (m_Entities.size() == m_Info.amountMaintained) {
|
||||
m_NeedsUpdate = false;
|
||||
}
|
||||
|
||||
return first;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Entity* rezdE = Game::entityManager->CreateEntity(m_EntityInfo, nullptr);
|
||||
|
||||
rezdE->GetGroups() = m_Info.groups;
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(rezdE);
|
||||
Game::entityManager->ConstructEntity(rezdE);
|
||||
|
||||
m_Entities.insert({ rezdE->GetObjectID(), spawnNode });
|
||||
spawnNode->entities.push_back(rezdE->GetObjectID());
|
||||
@@ -239,7 +328,7 @@ void Spawner::Reset() {
|
||||
void Spawner::DestroyAllEntities(){
|
||||
for (auto* node : m_Info.nodes) {
|
||||
for (const auto& element : node->entities) {
|
||||
auto* entity = EntityManager::Instance()->GetEntity(element);
|
||||
auto* entity = Game::entityManager->GetEntity(element);
|
||||
if (entity == nullptr) continue;
|
||||
entity->Kill();
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "CDZoneTableTable.h"
|
||||
#include "Spawner.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "dpWorld.h"
|
||||
|
||||
#include "eTriggerCommandType.h"
|
||||
#include "eTriggerEventType.h"
|
||||
@@ -54,22 +55,22 @@ void Zone::LoadZoneIntoMemory() {
|
||||
|
||||
std::istream file(&buffer);
|
||||
if (file) {
|
||||
BinaryIO::BinaryRead(file, m_ZoneFileFormatVersion);
|
||||
BinaryIO::BinaryRead(file, m_FileFormatVersion);
|
||||
|
||||
uint32_t mapRevision = 0;
|
||||
if (m_ZoneFileFormatVersion >= Zone::ZoneFileFormatVersion::Alpha) BinaryIO::BinaryRead(file, mapRevision);
|
||||
if (m_FileFormatVersion >= Zone::FileFormatVersion::Alpha) BinaryIO::BinaryRead(file, mapRevision);
|
||||
|
||||
BinaryIO::BinaryRead(file, m_WorldID);
|
||||
if ((uint16_t)m_WorldID != m_ZoneID.GetMapID()) Game::logger->Log("Zone", "WorldID: %i doesn't match MapID %i! Is this intended?", m_WorldID, m_ZoneID.GetMapID());
|
||||
|
||||
AddRevision(LWOSCENEID_INVALID, mapRevision);
|
||||
|
||||
if (m_ZoneFileFormatVersion >= Zone::ZoneFileFormatVersion::Beta) {
|
||||
if (m_FileFormatVersion >= Zone::FileFormatVersion::Beta) {
|
||||
BinaryIO::BinaryRead(file, m_Spawnpoint);
|
||||
BinaryIO::BinaryRead(file, m_SpawnpointRotation);
|
||||
}
|
||||
|
||||
if (m_ZoneFileFormatVersion <= Zone::ZoneFileFormatVersion::LateAlpha) {
|
||||
if (m_FileFormatVersion <= Zone::FileFormatVersion::LateAlpha) {
|
||||
uint8_t sceneCount;
|
||||
BinaryIO::BinaryRead(file, sceneCount);
|
||||
m_SceneCount = sceneCount;
|
||||
@@ -93,14 +94,14 @@ void Zone::LoadZoneIntoMemory() {
|
||||
BinaryIO::BinaryRead(file, stringLength);
|
||||
m_ZoneDesc = BinaryIO::ReadString(file, stringLength);
|
||||
|
||||
if (m_ZoneFileFormatVersion >= Zone::ZoneFileFormatVersion::PreAlpha) {
|
||||
if (m_FileFormatVersion >= Zone::FileFormatVersion::PreAlpha) {
|
||||
BinaryIO::BinaryRead(file, m_NumberOfSceneTransitionsLoaded);
|
||||
for (uint32_t i = 0; i < m_NumberOfSceneTransitionsLoaded; ++i) {
|
||||
LoadSceneTransition(file);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_ZoneFileFormatVersion >= Zone::ZoneFileFormatVersion::EarlyAlpha) {
|
||||
if (m_FileFormatVersion >= Zone::FileFormatVersion::EarlyAlpha) {
|
||||
BinaryIO::BinaryRead(file, m_PathDataLength);
|
||||
BinaryIO::BinaryRead(file, m_PathChunkVersion); // always should be 1
|
||||
|
||||
@@ -149,7 +150,7 @@ void Zone::LoadZoneIntoMemory() {
|
||||
info.activeOnLoad = path.spawner.spawnerNetActive;
|
||||
info.isNetwork = true;
|
||||
Spawner* spawner = new Spawner(info);
|
||||
dZoneManager::Instance()->AddSpawner(info.spawnerID, spawner);
|
||||
Game::zoneManager->AddSpawner(info.spawnerID, spawner);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -244,16 +245,29 @@ void Zone::LoadScene(std::istream& file) {
|
||||
scene.triggers.insert({ trigger->id, trigger });
|
||||
}
|
||||
|
||||
BinaryIO::BinaryRead(file, scene.id);
|
||||
BinaryIO::BinaryRead(file, scene.sceneType);
|
||||
lwoSceneID.SetSceneID(scene.id);
|
||||
if (m_FileFormatVersion >= Zone::FileFormatVersion::LatePreAlpha || m_FileFormatVersion < Zone::FileFormatVersion::PrePreAlpha) {
|
||||
BinaryIO::BinaryRead(file, scene.id);
|
||||
lwoSceneID.SetSceneID(scene.id);
|
||||
}
|
||||
if (m_FileFormatVersion >= Zone::FileFormatVersion::LatePreAlpha) {
|
||||
BinaryIO::BinaryRead(file, scene.sceneType);
|
||||
lwoSceneID.SetLayerID(scene.sceneType);
|
||||
|
||||
uint8_t sceneNameLength;
|
||||
BinaryIO::BinaryRead(file, sceneNameLength);
|
||||
scene.name = BinaryIO::ReadString(file, sceneNameLength);
|
||||
file.ignore(3);
|
||||
uint8_t sceneNameLength;
|
||||
BinaryIO::BinaryRead(file, sceneNameLength);
|
||||
scene.name = BinaryIO::ReadString(file, sceneNameLength);
|
||||
}
|
||||
|
||||
lwoSceneID.SetLayerID(scene.sceneType);
|
||||
if (m_FileFormatVersion == Zone::FileFormatVersion::LatePreAlpha){
|
||||
BinaryIO::BinaryRead(file, scene.unknown1);
|
||||
BinaryIO::BinaryRead(file, scene.unknown2);
|
||||
}
|
||||
|
||||
if (m_FileFormatVersion >= Zone::FileFormatVersion::LatePreAlpha) {
|
||||
BinaryIO::BinaryRead(file, scene.color_r);
|
||||
BinaryIO::BinaryRead(file, scene.color_b);
|
||||
BinaryIO::BinaryRead(file, scene.color_g);
|
||||
}
|
||||
|
||||
m_Scenes.insert(std::make_pair(lwoSceneID, scene));
|
||||
m_NumberOfScenesLoaded++;
|
||||
@@ -345,15 +359,15 @@ const Path* Zone::GetPath(std::string name) const {
|
||||
|
||||
void Zone::LoadSceneTransition(std::istream& file) {
|
||||
SceneTransition sceneTrans;
|
||||
if (m_ZoneFileFormatVersion < Zone::ZoneFileFormatVersion::Auramar) {
|
||||
if (m_FileFormatVersion < Zone::FileFormatVersion::Auramar) {
|
||||
uint8_t length;
|
||||
BinaryIO::BinaryRead(file, length);
|
||||
sceneTrans.name = BinaryIO::ReadString(file, length);
|
||||
file.ignore(4);
|
||||
BinaryIO::BinaryRead(file, sceneTrans.width);
|
||||
}
|
||||
|
||||
//BR<42>THER MAY I HAVE SOME L<><4C>PS?
|
||||
uint8_t loops = (m_ZoneFileFormatVersion < Zone::ZoneFileFormatVersion::EarlyAlpha || m_ZoneFileFormatVersion >= Zone::ZoneFileFormatVersion::Launch) ? 2 : 5;
|
||||
uint8_t loops = (m_FileFormatVersion <= Zone::FileFormatVersion::LatePreAlpha || m_FileFormatVersion >= Zone::FileFormatVersion::Launch) ? 2 : 5;
|
||||
|
||||
for (uint8_t i = 0; i < loops; ++i) {
|
||||
sceneTrans.points.push_back(LoadSceneTransitionInfo(file));
|
||||
@@ -401,7 +415,7 @@ void Zone::LoadPath(std::istream& file) {
|
||||
} else if (path.pathType == PathType::Property) {
|
||||
BinaryIO::BinaryRead(file, path.property.pathType);
|
||||
BinaryIO::BinaryRead(file, path.property.price);
|
||||
BinaryIO::BinaryRead(file, path.property.rentalTimeUnit);
|
||||
BinaryIO::BinaryRead(file, path.property.rentalTime);
|
||||
BinaryIO::BinaryRead(file, path.property.associatedZone);
|
||||
|
||||
if (path.pathVersion >= 5) {
|
||||
@@ -426,14 +440,12 @@ void Zone::LoadPath(std::istream& file) {
|
||||
if (path.pathVersion >= 7) {
|
||||
BinaryIO::BinaryRead(file, path.property.cloneLimit);
|
||||
BinaryIO::BinaryRead(file, path.property.repMultiplier);
|
||||
BinaryIO::BinaryRead(file, path.property.rentalTimeUnit);
|
||||
BinaryIO::BinaryRead(file, path.property.rentalPeriod);
|
||||
}
|
||||
|
||||
if (path.pathVersion >= 8) {
|
||||
BinaryIO::BinaryRead(file, path.property.achievementRequired);
|
||||
BinaryIO::BinaryRead(file, path.property.playerZoneCoords.x);
|
||||
BinaryIO::BinaryRead(file, path.property.playerZoneCoords.y);
|
||||
BinaryIO::BinaryRead(file, path.property.playerZoneCoords.z);
|
||||
BinaryIO::BinaryRead(file, path.property.playerZoneCoords);
|
||||
BinaryIO::BinaryRead(file, path.property.maxBuildHeight);
|
||||
}
|
||||
} else if (path.pathType == PathType::Camera) {
|
||||
@@ -543,11 +555,15 @@ void Zone::LoadPath(std::istream& file) {
|
||||
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) {
|
||||
if (dpWorld::Instance().IsLoaded()) {
|
||||
// 2000 should be large enough for every world.
|
||||
waypoint.position.y = dpWorld::Instance().GetNavMesh()->GetHeightAtPoint(waypoint.position, 2000.0f);
|
||||
}
|
||||
}
|
||||
path.pathWaypoints.push_back(waypoint);
|
||||
}
|
||||
|
||||
|
||||
|
||||
m_Paths.push_back(path);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,11 @@ struct SceneRef {
|
||||
uint32_t id;
|
||||
uint32_t sceneType; //0 = general, 1 = audio?
|
||||
std::string name;
|
||||
NiPoint3 unknown1;
|
||||
float unknown2;
|
||||
uint8_t color_r;
|
||||
uint8_t color_g;
|
||||
uint8_t color_b;
|
||||
Level* level;
|
||||
std::map<uint32_t, LUTriggers::Trigger*> triggers;
|
||||
};
|
||||
@@ -30,6 +35,7 @@ struct SceneTransitionInfo {
|
||||
struct SceneTransition {
|
||||
std::string name;
|
||||
std::vector<SceneTransitionInfo> points;
|
||||
float width;
|
||||
};
|
||||
|
||||
struct MovingPlatformPathWaypoint {
|
||||
@@ -100,7 +106,7 @@ enum class PropertyType : int32_t {
|
||||
Headspace = 3
|
||||
};
|
||||
|
||||
enum class PropertyRentalTimeUnit : int32_t {
|
||||
enum class PropertyRentalPeriod : uint32_t {
|
||||
Forever = 0,
|
||||
Seconds = 1,
|
||||
Minutes = 2,
|
||||
@@ -111,7 +117,7 @@ enum class PropertyRentalTimeUnit : int32_t {
|
||||
Years = 7
|
||||
};
|
||||
|
||||
enum class PropertyAchievmentRequired : int32_t {
|
||||
enum class PropertyAchievmentRequired : uint32_t {
|
||||
None = 0,
|
||||
Builder = 1,
|
||||
Craftsman = 2,
|
||||
@@ -133,13 +139,14 @@ struct MovingPlatformPath {
|
||||
struct PropertyPath {
|
||||
PropertyPathType pathType;
|
||||
int32_t price;
|
||||
PropertyRentalTimeUnit rentalTimeUnit;
|
||||
uint32_t rentalTime;
|
||||
uint64_t associatedZone;
|
||||
std::string displayName;
|
||||
std::string displayDesc;
|
||||
PropertyType type;
|
||||
int32_t cloneLimit;
|
||||
uint32_t cloneLimit;
|
||||
float repMultiplier;
|
||||
PropertyRentalPeriod rentalPeriod;
|
||||
PropertyAchievmentRequired achievementRequired;
|
||||
NiPoint3 playerZoneCoords;
|
||||
float maxBuildHeight;
|
||||
@@ -176,15 +183,17 @@ struct Path {
|
||||
|
||||
class Zone {
|
||||
public:
|
||||
enum class ZoneFileFormatVersion : uint32_t { //Times are guessed.
|
||||
PreAlpha = 0x20,
|
||||
EarlyAlpha = 0x23,
|
||||
Alpha = 0x24,
|
||||
LateAlpha = 0x25,
|
||||
Beta = 0x26,
|
||||
Launch = 0x27,
|
||||
Auramar = 0x28,
|
||||
Latest = 0x29
|
||||
enum class FileFormatVersion : uint32_t { //Times are guessed.
|
||||
PrePreAlpha = 30,
|
||||
PreAlpha = 32,
|
||||
LatePreAlpha = 33,
|
||||
EarlyAlpha = 35,
|
||||
Alpha = 36,
|
||||
LateAlpha = 37,
|
||||
Beta = 38,
|
||||
Launch = 39,
|
||||
Auramar = 40,
|
||||
Latest = 41
|
||||
};
|
||||
|
||||
public:
|
||||
@@ -220,7 +229,7 @@ private:
|
||||
uint32_t m_NumberOfScenesLoaded;
|
||||
uint32_t m_NumberOfObjectsLoaded;
|
||||
uint32_t m_NumberOfSceneTransitionsLoaded;
|
||||
ZoneFileFormatVersion m_ZoneFileFormatVersion;
|
||||
FileFormatVersion m_FileFormatVersion;
|
||||
uint32_t m_CheckSum;
|
||||
uint32_t m_WorldID; //should be equal to the MapID
|
||||
NiPoint3 m_Spawnpoint;
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
|
||||
#include "../dWorldServer/ObjectIDManager.h"
|
||||
|
||||
dZoneManager* dZoneManager::m_Address = nullptr;
|
||||
|
||||
void dZoneManager::Initialize(const LWOZONEID& zoneID) {
|
||||
Game::logger->Log("dZoneManager", "Preparing zone: %i/%i/%i", zoneID.GetMapID(), zoneID.GetInstanceID(), zoneID.GetCloneID());
|
||||
|
||||
@@ -39,8 +37,8 @@ void dZoneManager::Initialize(const LWOZONEID& zoneID) {
|
||||
zoneControlTemplate = zone->zoneControlTemplate != -1 ? zone->zoneControlTemplate : 2365;
|
||||
const auto min = zone->ghostdistance_min != -1.0f ? zone->ghostdistance_min : 100;
|
||||
const auto max = zone->ghostdistance != -1.0f ? zone->ghostdistance : 100;
|
||||
EntityManager::Instance()->SetGhostDistanceMax(max + min);
|
||||
EntityManager::Instance()->SetGhostDistanceMin(max);
|
||||
Game::entityManager->SetGhostDistanceMax(max + min);
|
||||
Game::entityManager->SetGhostDistanceMin(max);
|
||||
m_PlayerLoseCoinsOnDeath = zone->PlayerLoseCoinsOnDeath;
|
||||
}
|
||||
}
|
||||
@@ -48,10 +46,15 @@ void dZoneManager::Initialize(const LWOZONEID& zoneID) {
|
||||
Game::logger->Log("dZoneManager", "Creating zone control object %i", zoneControlTemplate);
|
||||
|
||||
// Create ZoneControl object
|
||||
if (!Game::entityManager) {
|
||||
Game::logger->Log("dZoneManager", "ERROR: No entity manager loaded. Cannot proceed.");
|
||||
throw std::invalid_argument("No entity manager loaded. Cannot proceed.");
|
||||
}
|
||||
Game::entityManager->Initialize();
|
||||
EntityInfo info;
|
||||
info.lot = zoneControlTemplate;
|
||||
info.id = 70368744177662;
|
||||
Entity* zoneControl = EntityManager::Instance()->CreateEntity(info, nullptr, nullptr, true);
|
||||
Entity* zoneControl = Game::entityManager->CreateEntity(info, nullptr, nullptr, true);
|
||||
m_ZoneControlObject = zoneControl;
|
||||
|
||||
m_pZone->Initalize();
|
||||
@@ -148,9 +151,9 @@ LWOOBJID dZoneManager::MakeSpawner(SpawnerInfo info) {
|
||||
entityInfo.id = objectId;
|
||||
entityInfo.lot = 176;
|
||||
|
||||
auto* entity = EntityManager::Instance()->CreateEntity(entityInfo, nullptr, nullptr, false, objectId);
|
||||
auto* entity = Game::entityManager->CreateEntity(entityInfo, nullptr, nullptr, false, objectId);
|
||||
|
||||
EntityManager::Instance()->ConstructEntity(entity);
|
||||
Game::entityManager->ConstructEntity(entity);
|
||||
|
||||
AddSpawner(objectId, spawner);
|
||||
|
||||
@@ -175,7 +178,7 @@ void dZoneManager::RemoveSpawner(const LWOOBJID id) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* entity = EntityManager::Instance()->GetEntity(id);
|
||||
auto* entity = Game::entityManager->GetEntity(id);
|
||||
|
||||
if (entity != nullptr) {
|
||||
entity->Kill();
|
||||
@@ -274,7 +277,7 @@ void dZoneManager::LoadWorldConfig() {
|
||||
m_WorldConfig->characterMaxSlope = worldConfig.getFloatField("character_max_slope");
|
||||
m_WorldConfig->defaultRespawnTime = worldConfig.getFloatField("defaultrespawntime");
|
||||
m_WorldConfig->missionTooltipTimeout = worldConfig.getFloatField("mission_tooltip_timeout");
|
||||
m_WorldConfig->vendorBuyMultiplier = worldConfig.getFloatField("vendor_buy_multiplier");
|
||||
m_WorldConfig->vendorBuyMultiplier = worldConfig.getFloatField("vendor_buy_multiplier", 0.1);
|
||||
m_WorldConfig->petFollowRadius = worldConfig.getFloatField("pet_follow_radius");
|
||||
m_WorldConfig->characterEyeHeight = worldConfig.getFloatField("character_eye_height");
|
||||
m_WorldConfig->flightVerticalVelocity = worldConfig.getFloatField("flight_vertical_velocity");
|
||||
|
||||
@@ -25,14 +25,6 @@ private:
|
||||
void LoadWorldConfig();
|
||||
|
||||
public:
|
||||
static dZoneManager* Instance() {
|
||||
if (!m_Address) {
|
||||
m_Address = new dZoneManager();
|
||||
}
|
||||
|
||||
return m_Address;
|
||||
}
|
||||
|
||||
void Initialize(const LWOZONEID& zoneID);
|
||||
~dZoneManager();
|
||||
|
||||
@@ -64,7 +56,6 @@ private:
|
||||
*/
|
||||
uint32_t m_UniqueMissionIdStart = 0;
|
||||
|
||||
static dZoneManager* m_Address; //Singleton
|
||||
Zone* m_pZone = nullptr;
|
||||
LWOZONEID m_ZoneID;
|
||||
bool m_PlayerLoseCoinsOnDeath; //Do players drop coins in this zone when smashed
|
||||
|
||||
Reference in New Issue
Block a user