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:
ragnarok-clanker 2026-10-25 15:42:21 +00:00
commit e168b4e4a6
326 changed files with 9538 additions and 3481 deletions

View file

@ -1,29 +0,0 @@
#include "Contents/World/WorldEnvironment.h"
#include "Render/Renderer.h"
#include "Resource/World/WorldResource.h"
// OFFSET: 0x00AC94C0
// FUNCTION: fn_17684
void PublishWorldEnvironment(
const C3dWorldRes& resource, int* modeBounds, WorldSpatialTree*& serialized, WorldEnvironmentLighting& lighting, unsigned char& rendererFlag,
CRenderer& renderer
) {
serialized = resource.spatial;
modeBounds[0] = resource.bounds[2];
modeBounds[1] = resource.bounds[3];
modeBounds[2] = resource.bounds[0];
modeBounds[3] = resource.bounds[1];
lighting.direction[0] = resource.lightDirection[0];
lighting.direction[1] = resource.lightDirection[1];
lighting.direction[2] = resource.lightDirection[2];
lighting.diffuse[0] = resource.diffuse[0];
lighting.diffuse[1] = resource.diffuse[1];
lighting.diffuse[2] = resource.diffuse[2];
lighting.ambient[0] = resource.ambient[0];
lighting.ambient[1] = resource.ambient[1];
lighting.ambient[2] = resource.ambient[2];
rendererFlag = resource.flag;
renderer.SetLighting(lighting.direction, lighting.diffuse, lighting.ambient);
}

View file

@ -1,9 +1,8 @@
#ifndef RAGNAROK_SOURCE_CONTENTS_WORLD_WORLDENVIRONMENT_H
#define RAGNAROK_SOURCE_CONTENTS_WORLD_WORLDENVIRONMENT_H
class C3dWorldRes;
struct WorldSpatialTree;
class CRenderer;
#include "Render/Renderer.h"
#include "Resource/World/WorldResource.h"
struct WorldEnvironmentLighting {
float direction[3];
@ -11,9 +10,29 @@ struct WorldEnvironmentLighting {
float ambient[3];
};
void PublishWorldEnvironment(
// INLINED
inline void PublishWorldEnvironment(
const C3dWorldRes& resource, int* modeBounds, WorldSpatialTree*& serialized, WorldEnvironmentLighting& lighting, unsigned char& rendererFlag,
CRenderer& renderer
);
) {
serialized = resource.spatial;
modeBounds[0] = resource.bounds[2];
modeBounds[1] = resource.bounds[3];
modeBounds[2] = resource.bounds[0];
modeBounds[3] = resource.bounds[1];
lighting.direction[0] = resource.lightDirection[0];
lighting.direction[1] = resource.lightDirection[1];
lighting.direction[2] = resource.lightDirection[2];
lighting.diffuse[0] = resource.diffuse[0];
lighting.diffuse[1] = resource.diffuse[1];
lighting.diffuse[2] = resource.diffuse[2];
lighting.ambient[0] = resource.ambient[0];
lighting.ambient[1] = resource.ambient[1];
lighting.ambient[2] = resource.ambient[2];
rendererFlag = resource.flag;
renderer.SetLighting(lighting.direction, lighting.diffuse, lighting.ambient);
}
#endif

View file

@ -1,55 +0,0 @@
#include "Client/Application/ErrorDialog.h"
#include "Contents/Ground/GroundGeometry.h"
#include "Contents/World/WorldGroundImport.h"
#include "Resource/World/GroundResource.h"
#include "Resource/ResourceMgr.h"
#include "Resource/World/TerrainResource.h"
#include "Resource/World/WorldResource.h"
#include "Utility/Math/ScalarConversion.h"
bool ImportWorldGround(
const C3dWorldRes& world, ResourceMgr& resources, TextureCache& textures, CRenderSystemBase* renderSystem, C3dAttr*& terrain, GroundGeometry*& ground,
int& nearbyRange, const float* lightDirection, const float* diffuse, const float* ambient
) {
if (world.terrainName.empty()) {
ShowErrorDialog(renderSystem, "attr ", 0);
return false;
}
terrain = static_cast<C3dAttr*>(resources.Load(world.terrainName.c_str()));
if (!terrain) {
ShowErrorDialog(renderSystem, "attr ", 0);
return false;
}
terrain->cellSize = 5;
nearbyRange *= terrain->cellSize;
if (world.groundName.empty()) {
ShowErrorDialog(renderSystem, "gnd ", 0);
return false;
}
auto* resource = static_cast<CGndRes*>(resources.Load(world.groundName.c_str()));
if (!resource) {
ShowErrorDialog(renderSystem, "ground", 0);
return false;
}
if (!resource->loaded) {
ShowErrorDialog(renderSystem, "", 0);
return false;
}
ground = new GroundGeometry;
ground->Build(*resource, textures, lightDirection, diffuse, ambient);
const int pitch = TruncateToInt(world.waveSpeed);
const int phase = TruncateToInt(world.wavePitch);
ground->water.Set(world.waterLevel, world.waterType, world.waterAnimation, pitch, phase, world.waveHeight);
ground->water.Import(*resource, textures);
resources.Remove(resource);
return true;
}

View file

@ -1,16 +1,60 @@
#ifndef RAGNAROK_SOURCE_CONTENTS_WORLD_WORLDGROUNDIMPORT_H
#define RAGNAROK_SOURCE_CONTENTS_WORLD_WORLDGROUNDIMPORT_H
class C3dWorldRes;
class C3dAttr;
class GroundGeometry;
class ResourceMgr;
class TextureCache;
class CRenderSystemBase;
#include "Client/Application/ErrorDialog.h"
#include "Contents/Ground/GroundGeometry.h"
#include "Resource/World/GroundResource.h"
#include "Resource/ResourceMgr.h"
#include "Resource/World/TerrainResource.h"
#include "Resource/World/WorldResource.h"
#include "Utility/Math/ScalarConversion.h"
bool ImportWorldGround(
// INLINED
inline bool ImportWorldGround(
const C3dWorldRes& world, ResourceMgr& resources, TextureCache& textures, CRenderSystemBase* renderSystem, C3dAttr*& terrain, GroundGeometry*& ground,
int& nearbyRange, const float* lightDirection, const float* diffuse, const float* ambient
);
) {
if (world.terrainName.empty()) {
ShowErrorDialog(renderSystem, "attr ", 0);
return false;
}
terrain = static_cast<C3dAttr*>(resources.Load(world.terrainName.c_str()));
if (!terrain) {
ShowErrorDialog(renderSystem, "attr ", 0);
return false;
}
terrain->cellSize = 5;
nearbyRange *= terrain->cellSize;
if (world.groundName.empty()) {
ShowErrorDialog(renderSystem, "gnd ", 0);
return false;
}
auto* resource = static_cast<CGndRes*>(resources.Load(world.groundName.c_str()));
if (!resource) {
ShowErrorDialog(renderSystem, "ground", 0);
return false;
}
if (!resource->loaded) {
ShowErrorDialog(renderSystem, "", 0);
return false;
}
ground = new GroundGeometry;
ground->Build(*resource, textures, lightDirection, diffuse, ambient);
const int pitch = TruncateToInt(world.waveSpeed);
const int phase = TruncateToInt(world.wavePitch);
ground->water.Set(world.waterLevel, world.waterType, world.waterAnimation, pitch, phase, world.waveHeight);
ground->water.Import(*resource, textures);
resources.Remove(resource);
return true;
}
#endif

View file

@ -1,7 +1,6 @@
#include "Contents/Models/ModelActor.h"
#include "Contents/Ground/TerrainHeight.h"
#include "Contents/World/WorldModelLoading.h"
#include "Contents/World/WorldModelPlacement.h"
#include "Contents/World/WorldSpatialInitialization.h"
#include "Resource/ResourceMgr.h"
#include "Resource/World/WorldResource.h"
@ -10,8 +9,10 @@
#include <atomic>
#include <cmath>
#include <cstdint>
#include <cstring>
namespace {
// INLINED
bool Before(const DeferredWorldModel& left, const DeferredWorldModel& right) {
if (left.distance < right.distance) {
return true;
@ -27,8 +28,43 @@ namespace {
return false;
}
// INLINED
C3dActor* CreatePlacedWorldModel(const WorldModelRecord& placement, C3dModelRes& resource, BinkMovies& movies, ModelLightingContext& lighting) {
resource.RegisterMovies(movies, placement.position);
if (!resource.FindNode(placement.node) && resource.nodes.empty()) {
return nullptr;
}
C3dActor* actor = nullptr;
if (resource.major == 1) {
actor = new C3dActorV1;
} else if (resource.major == 2) {
actor = new C3dActorV2;
}
actor->CopyVolumes(resource.volumes);
actor->SetSpeed(placement.animationSpeed);
actor->playback = placement.animation;
std::memcpy(actor->position, placement.position, sizeof(actor->position));
actor->dirty = 1;
std::memcpy(actor->rotation, placement.rotation, sizeof(actor->rotation));
actor->dirty = 1;
std::memcpy(actor->scale, placement.scale, sizeof(actor->scale));
actor->dirty = 1;
actor->commandMode = placement.flag;
actor->color = static_cast<std::uint32_t>(placement.index);
actor->Assign(resource);
actor->occlusionEnabled = 0;
actor->Prepare(lighting);
return actor;
}
}
// INLINED
void WorldModelLoading::Schedule(const WorldModelRecord& placement, const TerrainHeight& terrain, int column, int row, float* center) {
terrain.CellCenter(column, row, center[0], center[2]);
const float y = placement.position[1] - center[1];
@ -51,11 +87,13 @@ void WorldModelLoading::Schedule(const WorldModelRecord& placement, const Terrai
}
}
// FUNCTION: fn_17680
DWORD WINAPI WorldModelLoading::ThreadEntry(void* context) {
static_cast<WorldModelLoading*>(context)->Run();
return 0;
}
// INLINED
void WorldModelLoading::Start() {
this->thread = CreateThread(nullptr, 0, &WorldModelLoading::ThreadEntry, this, 0, nullptr);
@ -65,8 +103,7 @@ void WorldModelLoading::Start() {
}
}
// OFFSET: 0x00AC8BF0
// FUNCTION: fn_17680
// INLINED
void WorldModelLoading::Run() {
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
std::sort(this->deferred.begin(), this->deferred.end(), Before);

View file

@ -1,43 +0,0 @@
#include "Contents/Models/ModelActor.h"
#include "Contents/World/WorldModelPlacement.h"
#include "Resource/World/WorldResource.h"
#include <cstring>
// OFFSET: 0x00AC94C0
// FUNCTION: fn_17684
// OFFSET: 0x00AC8BF0
// FUNCTION: fn_17680
C3dActor* CreatePlacedWorldModel(const WorldModelRecord& placement, C3dModelRes& resource, BinkMovies& movies, ModelLightingContext& lighting) {
resource.RegisterMovies(movies, placement.position);
if (!resource.FindNode(placement.node) && resource.nodes.empty()) {
return nullptr;
}
C3dActor* actor = nullptr;
if (resource.major == 1) {
actor = new C3dActorV1;
} else if (resource.major == 2) {
actor = new C3dActorV2;
}
actor->CopyVolumes(resource.volumes);
actor->SetSpeed(placement.animationSpeed);
actor->playback = placement.animation;
std::memcpy(actor->position, placement.position, sizeof(actor->position));
actor->dirty = 1;
std::memcpy(actor->rotation, placement.rotation, sizeof(actor->rotation));
actor->dirty = 1;
std::memcpy(actor->scale, placement.scale, sizeof(actor->scale));
actor->dirty = 1;
actor->commandMode = placement.flag;
actor->color = static_cast<std::uint32_t>(placement.index);
actor->Assign(resource);
actor->occlusionEnabled = 0;
actor->Prepare(lighting);
return actor;
}

View file

@ -1,12 +0,0 @@
#ifndef RAGNAROK_SOURCE_CONTENTS_WORLD_WORLDMODELPLACEMENT_H
#define RAGNAROK_SOURCE_CONTENTS_WORLD_WORLDMODELPLACEMENT_H
class C3dActor;
class C3dModelRes;
class BinkMovies;
struct WorldModelRecord;
struct ModelLightingContext;
C3dActor* CreatePlacedWorldModel(const WorldModelRecord& placement, C3dModelRes& resource, BinkMovies& movies, ModelLightingContext& lighting);
#endif

View file

@ -7,10 +7,12 @@
#include <cmath>
namespace {
// INLINED
float Absolute(float value) {
return std::fabs(value);
}
// INLINED
void IncludeRectangle(const int* rectangle, int* output) {
if (output[0] > rectangle[0]) {
output[0] = rectangle[0];
@ -81,8 +83,7 @@ int ModelViewPlanes::ClassifyOriented(const OrientedBounds& bounds) const {
return clipped ? 2 : 1;
}
// OFFSET: 0x00ADC1E0
// FUNCTION: fn_17930
// INLINED
int ClassifyModelView(const OrientedBounds& bounds, const ModelViewPlanes& planes) {
bool clipped = false;
@ -111,6 +112,7 @@ int ClassifyModelView(const OrientedBounds& bounds, const ModelViewPlanes& plane
return clipped ? 2 : 1;
}
// INLINED
void DrawWorldModelLeaves(
std::list<WorldSpatialTree*>& clipped, std::list<WorldSpatialTree*>& inside, const ModelViewPlanes& planes, const float* matrix, unsigned frame, int updates,
GroundGeometry& ground, ModelRenderContext& models, GroundLightingContext& lighting, int* visibleRectangle

View file

@ -13,9 +13,7 @@ void WorldObjects::Remove(CRenderObject* object) {
}
}
// OFFSET: 0x00ACA320
// FUNCTION: fn_17691
// INLINED
void WorldObjects::Clear() {
auto entry = this->objects.begin();

View file

@ -8,8 +8,7 @@
#include "Utility/Math/ScalarConversion.h"
#include <cstring>
// OFFSET: 0x00CD5AD0
// FUNCTION: fn_21286
// INLINED
void MarkWorldOcclusionRay(const float* ray, float actorLimit, float groundLimit, WorldSpatialTree& root, GroundGeometry& ground, bool markGround) {
float actorRay[7];
std::memcpy(actorRay, ray, 6 * sizeof(float));
@ -41,6 +40,7 @@ void MarkWorldOcclusionRay(const float* ray, float actorLimit, float groundLimit
}
}
// FUNCTION: fn_21286
void MarkScreenWorldOcclusion(
const RenderProjection& projection, int screenX, int screenY, float rendererScale, const float* origin, const float* cameraMatrix, float playerHeight,
float cameraHeight, WorldSpatialTree& root, GroundGeometry& ground, bool markGround

View file

@ -46,6 +46,7 @@ void InitializeWorldSpatial(
}
}
// INLINED
void PublishWorldModels(WorldSpatialTree& root, C3dActor* const* models, int& published, int& pending) {
std::atomic_ref<int> count(pending);
const int ready = count.load(std::memory_order_acquire);

View file

@ -219,8 +219,8 @@ void WorldSpatialTree::RefreshBounds(int depth) {
}
// OFFSET: 0x00AC84F0
// FUNCTION: fn_17673
// OFFSET: 0x00AC86B0
// FUNCTION: fn_17673
// FUNCTION: fn_17676
void WorldSpatialTree::InsertModel(C3dActor& model, int depth) {
if (depth == 5) {

View file

@ -4,8 +4,7 @@
#include "Render/Projection/RenderProjection.h"
#include "Resource/World/TerrainResource.h"
// OFFSET: 0x00CD4060
// FUNCTION: fn_21274
// INLINED
bool PickTerrainRay(const float* ray, WorldSpatialTree& root, int& column, int& row) {
WorldRayQuery query;
query.Collect(ray, &root);

View file

@ -4,6 +4,7 @@
#include <bit>
namespace {
// INLINED
float Horizontal(float x, const float* row) {
return (x * row[0] + row[1] * 0.0f) + row[2];
}