Restore translation-unit ownership and publish verified source corrections
Owner-authorized source migration: 31 helper-only translation units were merged into their callers or existing inline headers; both build manifests updated. Includes the preserved source payload, Lua configuration matching wowdecomp, and exact malloca expansion without diagnostic pragmas. 449 native units compiled locally and 449 staged units compiled by the pinned server toolchain. No previously byte-matched function regressed. Compiler mapping diagnostics remain recorded as needs_cleanup, not accepted or peer-confirmed. Existing independent review records are preserved. README.md is intentionally unchanged.
This commit is contained in:
parent
3c939f1cdd
commit
e168b4e4a6
326 changed files with 9538 additions and 3481 deletions
|
|
@ -5,17 +5,17 @@
|
|||
#include "Resource/Models/ModelResource.h"
|
||||
#include "Resource/ResourceByteReader.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
// OFFSET: 0x00755630
|
||||
// FUNCTION: fn_07985
|
||||
// OFFSET: 0x00750B10
|
||||
// FUNCTION: fn_07950
|
||||
// FUNCTION: fn_07985
|
||||
ModelNode::ModelNode(TextureCache& textures) : model(nullptr), parent(nullptr), alpha(255), m_textures(textures) {
|
||||
}
|
||||
|
||||
// OFFSET: 0x007570F0
|
||||
// FUNCTION: fn_08002
|
||||
// FUNCTION: fn_07996
|
||||
ModelNode::~ModelNode() {
|
||||
for (CTexture* texture : this->textures) {
|
||||
if (texture) {
|
||||
|
|
@ -31,16 +31,15 @@ C3dModelRes::C3dModelRes(ModelResourceContext& context) : major(0), shade(0), al
|
|||
}
|
||||
|
||||
// OFFSET: 0x00757090
|
||||
// FUNCTION: fn_08000
|
||||
// FUNCTION: fn_07995
|
||||
C3dModelRes::~C3dModelRes() = default;
|
||||
|
||||
// OFFSET: 0x00750A70
|
||||
// FUNCTION: fn_07949
|
||||
// FUNCTION: fn_07983
|
||||
C3dModelResV1::C3dModelResV1(ModelResourceContext& context) : C3dModelRes(context), animationLength(0) {
|
||||
}
|
||||
|
||||
// OFFSET: 0x00751E70
|
||||
// FUNCTION: fn_07952
|
||||
// INLINED
|
||||
C3dModelResV1::~C3dModelResV1() = default;
|
||||
|
||||
// OFFSET: 0x00750A70
|
||||
|
|
@ -80,6 +79,102 @@ void C3dModelRes::Unload() {
|
|||
this->movieNames.clear();
|
||||
}
|
||||
|
||||
// INLINED
|
||||
inline void C3dModelResV1::ReadNode(ResourceByteReader& input, unsigned minor, const std::vector<std::string>& textureNames) {
|
||||
auto node = std::make_unique<ModelNode>(this->m_context->textures);
|
||||
node->model = this;
|
||||
node->alpha = this->alpha;
|
||||
char field[40]{};
|
||||
input.Read(field, sizeof(field));
|
||||
node->name = field;
|
||||
input.Read(field, sizeof(field));
|
||||
node->parentName = field;
|
||||
int textureCount = 0;
|
||||
input.Read(&textureCount, 4);
|
||||
|
||||
for (int index = 0; index < textureCount; ++index) {
|
||||
int textureIndex = 0;
|
||||
input.Read(&textureIndex, 4);
|
||||
CTexture* texture = this->m_context->textures.Load(textureNames[textureIndex].c_str(), 0, false, true, false);
|
||||
node->textures.push_back(texture);
|
||||
|
||||
if (texture) {
|
||||
texture->Retain();
|
||||
}
|
||||
}
|
||||
|
||||
float matrix[12];
|
||||
input.Read(matrix, sizeof(matrix));
|
||||
input.Read(node->position, sizeof(node->position));
|
||||
input.Read(&node->angle, 4);
|
||||
input.Read(node->axis, sizeof(node->axis));
|
||||
input.Read(node->scale, sizeof(node->scale));
|
||||
node->mesh = std::make_unique<ModelMesh>();
|
||||
ModelMesh& mesh = *node->mesh;
|
||||
int vertexCount = 0;
|
||||
input.Read(&vertexCount, 4);
|
||||
mesh.vertices.resize(static_cast<unsigned>(vertexCount));
|
||||
input.Read(mesh.vertices.data(), static_cast<unsigned>(vertexCount) * 12u);
|
||||
|
||||
for (auto& vertex : mesh.vertices) {
|
||||
const float y = ((vertex[0] * matrix[1] + vertex[1] * matrix[4]) + matrix[7] * vertex[2]) + matrix[10];
|
||||
const float z = ((vertex[0] * matrix[2] + vertex[1] * matrix[5]) + matrix[8] * vertex[2]) + matrix[11];
|
||||
vertex[0] = ((vertex[0] * matrix[0] + vertex[1] * matrix[3]) + vertex[2] * matrix[6]) + matrix[9];
|
||||
vertex[1] = y;
|
||||
vertex[2] = z;
|
||||
}
|
||||
|
||||
int textureVertexCount = 0;
|
||||
input.Read(&textureVertexCount, 4);
|
||||
mesh.textureVertices.resize(static_cast<unsigned>(textureVertexCount));
|
||||
|
||||
if (minor == 1) {
|
||||
float uv[2];
|
||||
|
||||
for (auto& vertex : mesh.textureVertices) {
|
||||
input.Read(uv, sizeof(uv));
|
||||
vertex = {0xFFFFFFFFu, uv[0], uv[1]};
|
||||
}
|
||||
} else {
|
||||
input.Read(mesh.textureVertices.data(), static_cast<unsigned>(textureVertexCount) * 12u);
|
||||
}
|
||||
|
||||
std::uint32_t faceCount = 0;
|
||||
input.Read(&faceCount, 4);
|
||||
mesh.faces.resize(faceCount);
|
||||
unsigned char record[24];
|
||||
|
||||
for (ModelFace& face : mesh.faces) {
|
||||
input.Read(record, minor == 1 ? 20 : 24);
|
||||
std::memcpy(face.vertices, record, sizeof(face.vertices));
|
||||
std::memcpy(face.textureVertices, record + 6, sizeof(face.textureVertices));
|
||||
std::memcpy(&face.texture, record + 12, sizeof(face.texture));
|
||||
std::memcpy(&face.twoSided, record + 16, sizeof(face.twoSided));
|
||||
std::uint32_t group = 0;
|
||||
|
||||
if (minor != 1) {
|
||||
std::memcpy(&group, record + 20, sizeof(group));
|
||||
}
|
||||
|
||||
face.smoothing.push_back(group);
|
||||
}
|
||||
|
||||
// INLINED
|
||||
std::sort(mesh.faces.begin(), mesh.faces.end(), [](const ModelFace& a, const ModelFace& b) { return a.texture < b.texture; });
|
||||
mesh.CalculateNormals();
|
||||
int rotationCount;
|
||||
input.Read(&rotationCount, 4);
|
||||
|
||||
for (int index = 0; index < rotationCount; ++index) {
|
||||
ModelRotationKey key;
|
||||
input.Read(&key, sizeof(key));
|
||||
node->rotationKeys.push_back(key);
|
||||
}
|
||||
|
||||
this->meshes[node->name] = node->mesh.get();
|
||||
this->nodes.push_back(node.release());
|
||||
}
|
||||
|
||||
// OFFSET: 0x00750B10
|
||||
// FUNCTION: fn_07950
|
||||
bool C3dModelResV1::Load(const char* name) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue