mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 19:03:43 +00:00
- The client puts a shape in its sorted, blended pass only when its NiMaterialProperty alpha is under 0.99999 (ShaderCommon::GetAlphaFlags 0x0109f5a0; the NiAlphaProperty blend flag isn't read); at 1.0 it's drawn solid with blending off. Transparent (and transparent glitter) shapes now get a material with alpha 0.9999, as the S01_Alpha shapes of the game's own brick models (res/BrickModels/ndmade) do; opaque shapes keep 1.0. Models with a transparent brick change; the others are byte for byte the same. - dUgcServer's files move into Bricks/, Model/, Render/, Formats/ and Processing/ (the CMakeLists says what each holds); includes are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
2.2 KiB
C++
60 lines
2.2 KiB
C++
#include "UgcCdClient.h"
|
|
|
|
#include <optional>
|
|
|
|
#include "CDClientDatabase.h"
|
|
#include "UgcModular.h"
|
|
|
|
namespace {
|
|
constexpr int32_t MODULE_COMPONENT = 28;
|
|
constexpr int32_t RENDER_COMPONENT = 2;
|
|
}
|
|
|
|
namespace UgcCdClient {
|
|
bool GatherModular(const std::string& modules, UgcJobs::ModularInput& input, std::string& error) {
|
|
const auto lots = UgcModular::ParseModuleLots(modules);
|
|
if (lots.empty()) {
|
|
error = "no modules in \"" + modules + "\"";
|
|
return false;
|
|
}
|
|
std::optional<int32_t> buildType;
|
|
for (const auto lot : lots) {
|
|
auto moduleQuery = CDClientDatabase::CreatePreppedStmt(
|
|
"SELECT m.partCode, m.buildType, m.xml FROM ComponentsRegistry cr JOIN ModuleComponent m ON m.id = cr.component_id "
|
|
"WHERE cr.id = ? AND cr.component_type = ? LIMIT 1;");
|
|
moduleQuery.bind(1, static_cast<int>(lot));
|
|
moduleQuery.bind(2, MODULE_COMPONENT);
|
|
auto moduleRow = moduleQuery.execQuery();
|
|
if (moduleRow.eof()) {
|
|
error = "LOT " + std::to_string(lot) + " is not a module";
|
|
return false;
|
|
}
|
|
UgcJobs::ModuleInput module;
|
|
module.lot = lot;
|
|
module.partCode = static_cast<uint32_t>(moduleRow.getIntField("partCode", 0));
|
|
module.moduleXml = moduleRow.getStringField("xml", "");
|
|
if (!buildType) buildType = moduleRow.getIntField("buildType", 0);
|
|
input.buildType = *buildType;
|
|
|
|
auto renderQuery = CDClientDatabase::CreatePreppedStmt(
|
|
"SELECT rc.render_asset FROM ComponentsRegistry cr JOIN RenderComponent rc ON rc.id = cr.component_id "
|
|
"WHERE cr.id = ? AND cr.component_type = ? LIMIT 1;");
|
|
renderQuery.bind(1, static_cast<int>(lot));
|
|
renderQuery.bind(2, RENDER_COMPONENT);
|
|
auto renderRow = renderQuery.execQuery();
|
|
if (!renderRow.eof()) module.renderAsset = renderRow.getStringField("render_asset", "");
|
|
input.modules.push_back(std::move(module));
|
|
}
|
|
|
|
auto buildQuery = CDClientDatabase::CreatePreppedStmt("SELECT xml FROM ModularBuildComponent WHERE buildType = ? ORDER BY id LIMIT 1;");
|
|
buildQuery.bind(1, *buildType);
|
|
auto buildRow = buildQuery.execQuery();
|
|
if (buildRow.eof()) {
|
|
error = "no ModularBuildComponent for build type " + std::to_string(*buildType);
|
|
return false;
|
|
}
|
|
input.buildXml = buildRow.getStringField("xml", "");
|
|
return true;
|
|
}
|
|
}
|