Working on state for location
This commit is contained in:
1 parent
e0968b5522
commit
b01e970554
13 files changed
+494
-101
No files matched your search
@@ -0,0 +1,52 @@
|
||||
#include "LocationState.h"
|
||||
|
||||
namespace ZL {
|
||||
|
||||
void LocationState::save(nlohmann::json& out) const
|
||||
{
|
||||
out["cameraAzimuth"] = cameraAzimuth;
|
||||
out["cameraInclination"] = cameraInclination;
|
||||
|
||||
out["activeNavigationIndex"] = activeNavigationIndex;
|
||||
|
||||
out["targetInteractiveObjectIndex"] = targetInteractiveObjectIndex;
|
||||
out["targetInteractNpcIndex"] = targetInteractNpcIndex;
|
||||
out["targetTeleportZoneIndex"] = targetTeleportZoneIndex;
|
||||
|
||||
out["isDarklands"] = isDarklands;
|
||||
out["isNight"] = isNight;
|
||||
out["isDawn"] = isDawn;
|
||||
|
||||
out["tutorialInteractiveObjectsLocked"] = tutorialInteractiveObjectsLocked;
|
||||
|
||||
nlohmann::json tzArr = nlohmann::json::array();
|
||||
for (bool v : triggerZonePlayerInside) tzArr.push_back(v);
|
||||
out["triggerZonePlayerInside"] = std::move(tzArr);
|
||||
}
|
||||
|
||||
void LocationState::load(const nlohmann::json& in)
|
||||
{
|
||||
cameraAzimuth = in.value("cameraAzimuth", cameraAzimuth);
|
||||
cameraInclination = in.value("cameraInclination", cameraInclination);
|
||||
|
||||
activeNavigationIndex = in.value("activeNavigationIndex", activeNavigationIndex);
|
||||
|
||||
targetInteractiveObjectIndex = in.value("targetInteractiveObjectIndex", -1);
|
||||
targetInteractNpcIndex = in.value("targetInteractNpcIndex", -1);
|
||||
targetTeleportZoneIndex = in.value("targetTeleportZoneIndex", -1);
|
||||
|
||||
isDarklands = in.value("isDarklands", false);
|
||||
isNight = in.value("isNight", false);
|
||||
isDawn = in.value("isDawn", false);
|
||||
|
||||
tutorialInteractiveObjectsLocked = in.value("tutorialInteractiveObjectsLocked", false);
|
||||
|
||||
triggerZonePlayerInside.clear();
|
||||
if (in.contains("triggerZonePlayerInside") && in["triggerZonePlayerInside"].is_array()) {
|
||||
for (const auto& v : in["triggerZonePlayerInside"]) {
|
||||
triggerZonePlayerInside.push_back(v.get<bool>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ZL
|
||||
Reference in new issue
Block a user