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
|
|
@ -2,7 +2,10 @@
|
|||
#include "Resource/Bitmap/BitmapResource.h"
|
||||
#include "Resource/ResourceByteReader.h"
|
||||
#include "Resource/World/WorldResource.h"
|
||||
#include "Utility/Math/AffineMatrix.h"
|
||||
|
||||
#include <array>
|
||||
#include <bit>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
|
|
@ -34,13 +37,13 @@ namespace {
|
|||
}
|
||||
|
||||
// OFFSET: 0x00763060
|
||||
// FUNCTION: fn_08076
|
||||
C3dWorldRes::C3dWorldRes(WorldResourceContext& context) : spatial(nullptr), lightDirection{}, diffuse{}, ambient{}, flag(0), m_context(&context) {
|
||||
}
|
||||
|
||||
// OFFSET: 0x00763550
|
||||
// FUNCTION: fn_08077
|
||||
// OFFSET: 0x00762FE0
|
||||
// FUNCTION: fn_08074
|
||||
// FUNCTION: fn_08077
|
||||
C3dWorldRes::~C3dWorldRes() = default;
|
||||
|
||||
// OFFSET: 0x00761940
|
||||
|
|
@ -73,6 +76,177 @@ void C3dWorldRes::Unload() {
|
|||
this->sounds.clear();
|
||||
}
|
||||
|
||||
// INLINED
|
||||
inline void C3dWorldRes::ReadEnvironment(ResourceByteReader& input, unsigned version) {
|
||||
if (version < 0x206u) {
|
||||
if (version >= 0x103u) {
|
||||
input.Read(&this->waterLevel, sizeof(this->waterLevel));
|
||||
}
|
||||
|
||||
if (version >= 0x108u) {
|
||||
input.Read(&this->waterType, sizeof(this->waterType));
|
||||
input.Read(&this->waveHeight, sizeof(this->waveHeight));
|
||||
input.Read(&this->waveSpeed, sizeof(this->waveSpeed));
|
||||
input.Read(&this->wavePitch, sizeof(this->wavePitch));
|
||||
} else {
|
||||
this->waterType = 0;
|
||||
this->waveHeight = 1.0f;
|
||||
this->waveSpeed = 2.0f;
|
||||
this->wavePitch = 50.0f;
|
||||
}
|
||||
|
||||
if (version >= 0x109u) {
|
||||
input.Read(&this->waterAnimation, sizeof(this->waterAnimation));
|
||||
} else {
|
||||
this->waterAnimation = 3;
|
||||
}
|
||||
}
|
||||
|
||||
if (version >= 0x105u) {
|
||||
input.Read(&this->longitude, sizeof(this->longitude));
|
||||
input.Read(&this->latitude, sizeof(this->latitude));
|
||||
input.Read(this->diffuse, sizeof(this->diffuse));
|
||||
input.Read(this->ambient, sizeof(this->ambient));
|
||||
} else {
|
||||
this->latitude = 45;
|
||||
this->longitude = 45;
|
||||
|
||||
for (float& value : this->diffuse) {
|
||||
value = 1.0f;
|
||||
}
|
||||
|
||||
for (float& value : this->ambient) {
|
||||
value = 0.3f;
|
||||
}
|
||||
}
|
||||
|
||||
constexpr float pi = 3.141592f;
|
||||
AffineMatrix matrix;
|
||||
matrix.SetXRotation((static_cast<float>(this->latitude) / 180.0f) * pi);
|
||||
matrix.RotateY((static_cast<float>(this->longitude) / 180.0f) * pi);
|
||||
|
||||
for (unsigned component = 0; component < 3; ++component) {
|
||||
this->lightDirection[component] =
|
||||
((matrix.values[component] * 0.0f + matrix.values[component + 3]) + matrix.values[component + 6] * 0.0f) + matrix.values[component + 9];
|
||||
}
|
||||
|
||||
if (version >= 0x107u) {
|
||||
unsigned unused;
|
||||
input.Read(&unused, sizeof(unused));
|
||||
}
|
||||
|
||||
if (version >= 0x106u) {
|
||||
for (int& bound : this->bounds) {
|
||||
input.Read(&bound, sizeof(bound));
|
||||
}
|
||||
} else {
|
||||
this->bounds[0] = -500;
|
||||
this->bounds[1] = 500;
|
||||
this->bounds[2] = -500;
|
||||
this->bounds[3] = 500;
|
||||
}
|
||||
}
|
||||
|
||||
// INLINED
|
||||
inline void C3dWorldRes::ReadObjects(ResourceByteReader& input, unsigned version, unsigned build, char* lastName) {
|
||||
int count;
|
||||
input.Read(&count, sizeof(count));
|
||||
|
||||
for (int index = 0; index < count; ++index) {
|
||||
int type;
|
||||
input.Read(&type, sizeof(type));
|
||||
|
||||
switch (type) {
|
||||
case 1: {
|
||||
int animation = 0;
|
||||
int unknown = 0;
|
||||
int modelIndex = -1;
|
||||
float speed = 1.0f;
|
||||
unsigned char flag = 0;
|
||||
|
||||
if (version >= 0x103u) {
|
||||
input.Read(lastName, 40);
|
||||
input.Read(&animation, sizeof(animation));
|
||||
input.Read(&speed, sizeof(speed));
|
||||
input.Read(&unknown, sizeof(unknown));
|
||||
|
||||
if (version >= 0x206u && build >= 186) {
|
||||
input.Read(&flag, 1);
|
||||
}
|
||||
|
||||
if (version >= 0x207u) {
|
||||
input.Read(&modelIndex, sizeof(modelIndex));
|
||||
}
|
||||
|
||||
if (speed > 100.0f || !(0.0f < speed)) {
|
||||
speed = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
std::array<unsigned char, 196> wire;
|
||||
std::memset(wire.data() + 160, 0, 36);
|
||||
input.Read(wire.data(), static_cast<unsigned>(wire.size()));
|
||||
auto* record = new WorldModelRecord;
|
||||
std::strcpy(record->name, lastName);
|
||||
std::strcpy(record->model, reinterpret_cast<const char*>(wire.data()));
|
||||
std::strcpy(record->node, reinterpret_cast<const char*>(wire.data() + 80));
|
||||
std::memcpy(record->position, wire.data() + 160, 12);
|
||||
std::memcpy(record->rotation, wire.data() + 172, 12);
|
||||
std::memcpy(record->scale, wire.data() + 184, 12);
|
||||
record->animationSpeed = speed;
|
||||
record->animation = animation;
|
||||
record->unknown_00F0 = unknown;
|
||||
record->flag = flag != 0;
|
||||
record->index = modelIndex;
|
||||
this->models.push_back(record);
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: {
|
||||
unsigned char light[108];
|
||||
std::memset(light + 72, 0, 12);
|
||||
input.Read(light, sizeof(light));
|
||||
break;
|
||||
}
|
||||
|
||||
case 3: {
|
||||
auto* record = new WorldSoundRecord;
|
||||
std::memset(record->position, 0, sizeof(record->position));
|
||||
|
||||
if (version < 0x200u) {
|
||||
unsigned char wire[188];
|
||||
std::memset(wire + 160, 0, 12);
|
||||
input.Read(wire, sizeof(wire));
|
||||
std::strncpy(record->name, reinterpret_cast<const char*>(wire), 79);
|
||||
std::strncpy(record->file, reinterpret_cast<const char*>(wire + 80), 79);
|
||||
std::memcpy(record->position, wire + 160, 12);
|
||||
std::memcpy(&record->volume, wire + 172, 4);
|
||||
std::memcpy(&record->width, wire + 176, 4);
|
||||
std::memcpy(&record->height, wire + 180, 4);
|
||||
std::memcpy(&record->range, wire + 184, 4);
|
||||
record->cycle = 4.0f;
|
||||
} else {
|
||||
input.Read(record, sizeof(*record));
|
||||
}
|
||||
|
||||
this->sounds.push_back(record);
|
||||
break;
|
||||
}
|
||||
|
||||
case 4: {
|
||||
auto* record = new WorldEffectRecord;
|
||||
std::memset(record->position, 0, sizeof(record->position));
|
||||
input.Read(record, sizeof(*record));
|
||||
this->effects.push_back(record);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x00761CC0
|
||||
// FUNCTION: fn_08073
|
||||
bool C3dWorldRes::Load(const char* name) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue