mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-06-28 15:50:02 +00:00
revert all changes related to normalization of bbb positions
This commit is contained in:
parent
1f580491c7
commit
2184a7fdfb
@ -69,6 +69,8 @@ Lxfml::Result Lxfml::NormalizePosition(const std::string_view data) {
|
|||||||
|
|
||||||
// Clamp the Y to the lowest point on the model
|
// Clamp the Y to the lowest point on the model
|
||||||
newRootPos.y = lowest.y;
|
newRootPos.y = lowest.y;
|
||||||
|
// newRootPos = newRootPos - NiPoint3{-0.4f, 0, 0.4};
|
||||||
|
const auto posToReturn = newRootPos;
|
||||||
|
|
||||||
// Adjust all positions to account for the new origin
|
// Adjust all positions to account for the new origin
|
||||||
for (auto& transformation : transformations | std::views::values) {
|
for (auto& transformation : transformations | std::views::values) {
|
||||||
@ -112,6 +114,6 @@ Lxfml::Result Lxfml::NormalizePosition(const std::string_view data) {
|
|||||||
doc.Print(&printer);
|
doc.Print(&printer);
|
||||||
|
|
||||||
toReturn.lxfml = printer.CStr();
|
toReturn.lxfml = printer.CStr();
|
||||||
toReturn.center = newRootPos;
|
toReturn.center = posToReturn;
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
// this file should not be touched
|
// this file should not be touched
|
||||||
|
|
||||||
Lxfml::Result Lxfml::NormalizePositionOnlyFirstPart(const std::string_view data) {
|
Lxfml::Result Lxfml::NormalizePositionOnlyFirstPart(const std::string_view data) {
|
||||||
|
// this is bugged
|
||||||
|
return;
|
||||||
Result toReturn;
|
Result toReturn;
|
||||||
tinyxml2::XMLDocument doc;
|
tinyxml2::XMLDocument doc;
|
||||||
const auto err = doc.Parse(data.data());
|
const auto err = doc.Parse(data.data());
|
||||||
@ -117,6 +119,9 @@ Lxfml::Result Lxfml::NormalizePositionOnlyFirstPart(const std::string_view data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Lxfml::Result Lxfml::NormalizePositionAfterFirstPart(const std::string_view data, const NiPoint3& position) {
|
Lxfml::Result Lxfml::NormalizePositionAfterFirstPart(const std::string_view data, const NiPoint3& position) {
|
||||||
|
// this is bugged
|
||||||
|
return;
|
||||||
|
|
||||||
Result toReturn;
|
Result toReturn;
|
||||||
tinyxml2::XMLDocument doc;
|
tinyxml2::XMLDocument doc;
|
||||||
const auto err = doc.Parse(data.data());
|
const auto err = doc.Parse(data.data());
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include "Sd0.h"
|
#include "Sd0.h"
|
||||||
|
|
||||||
void ModelNormalizeMigration::Run() {
|
void ModelNormalizeMigration::Run() {
|
||||||
|
// Take this out when model position normalization works (never)
|
||||||
|
return;
|
||||||
const auto oldCommit = Database::Get()->GetAutoCommit();
|
const auto oldCommit = Database::Get()->GetAutoCommit();
|
||||||
Database::Get()->SetAutoCommit(false);
|
Database::Get()->SetAutoCommit(false);
|
||||||
for (auto& [lxfmlData, id, modelID] : Database::Get()->GetAllUgcModels()) {
|
for (auto& [lxfmlData, id, modelID] : Database::Get()->GetAllUgcModels()) {
|
||||||
@ -30,6 +32,8 @@ void ModelNormalizeMigration::Run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ModelNormalizeMigration::RunAfterFirstPart() {
|
void ModelNormalizeMigration::RunAfterFirstPart() {
|
||||||
|
// Take this out when model position normalization works (never)
|
||||||
|
return;
|
||||||
const auto oldCommit = Database::Get()->GetAutoCommit();
|
const auto oldCommit = Database::Get()->GetAutoCommit();
|
||||||
Database::Get()->SetAutoCommit(false);
|
Database::Get()->SetAutoCommit(false);
|
||||||
for (auto& [lxfmlData, id, modelID] : Database::Get()->GetAllUgcModels()) {
|
for (auto& [lxfmlData, id, modelID] : Database::Get()->GetAllUgcModels()) {
|
||||||
|
@ -2611,10 +2611,15 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream& inStream, Entity* ent
|
|||||||
|
|
||||||
// Uncompress the data and normalize the position
|
// Uncompress the data and normalize the position
|
||||||
const auto asStr = sd0.GetAsStringUncompressed();
|
const auto asStr = sd0.GetAsStringUncompressed();
|
||||||
const auto [newLxfml, newCenter] = Lxfml::NormalizePosition(asStr);
|
|
||||||
|
// This logic doesnt work
|
||||||
|
/*
|
||||||
|
// const auto [newLxfml, newCenter] = Lxfml::NormalizePosition(asStr);
|
||||||
|
|
||||||
// Recompress the data and save to the database
|
// Recompress the data and save to the database
|
||||||
sd0.FromData(reinterpret_cast<const uint8_t*>(newLxfml.data()), newLxfml.size());
|
// sd0.FromData(reinterpret_cast<const uint8_t*>(newLxfml.data()), newLxfml.size());
|
||||||
|
*/
|
||||||
|
|
||||||
auto sd0AsStream = sd0.GetAsStream();
|
auto sd0AsStream = sd0.GetAsStream();
|
||||||
Database::Get()->InsertNewUgcModel(sd0AsStream, blueprintIDSmall, entity->GetCharacter()->GetParentUser()->GetAccountID(), entity->GetCharacter()->GetID());
|
Database::Get()->InsertNewUgcModel(sd0AsStream, blueprintIDSmall, entity->GetCharacter()->GetParentUser()->GetAccountID(), entity->GetCharacter()->GetID());
|
||||||
|
|
||||||
@ -2622,8 +2627,8 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream& inStream, Entity* ent
|
|||||||
IPropertyContents::Model model;
|
IPropertyContents::Model model;
|
||||||
model.id = newIDL;
|
model.id = newIDL;
|
||||||
model.ugcId = blueprintIDSmall;
|
model.ugcId = blueprintIDSmall;
|
||||||
model.position = newCenter;
|
model.position = NiPoint3Constant::ZERO;
|
||||||
model.rotation = NiQuaternion(0.0f, 0.0f, 0.0f, 0.0f);
|
model.rotation = NiQuaternionConstant::IDENTITY;
|
||||||
model.lot = 14;
|
model.lot = 14;
|
||||||
Database::Get()->InsertNewPropertyModel(propertyId, model, "Objects_14_name");
|
Database::Get()->InsertNewPropertyModel(propertyId, model, "Objects_14_name");
|
||||||
|
|
||||||
@ -2668,8 +2673,8 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream& inStream, Entity* ent
|
|||||||
|
|
||||||
EntityInfo info;
|
EntityInfo info;
|
||||||
info.lot = 14;
|
info.lot = 14;
|
||||||
info.pos = newCenter;
|
info.pos = NiPoint3Constant::ZERO;
|
||||||
info.rot = {};
|
info.rot = NiQuaternionConstant::IDENTITY;
|
||||||
info.spawner = nullptr;
|
info.spawner = nullptr;
|
||||||
info.spawnerID = entity->GetObjectID();
|
info.spawnerID = entity->GetObjectID();
|
||||||
info.spawnerNodeID = 0;
|
info.spawnerNodeID = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user