Return paramter naming convention to what Tgl used

This commit is contained in:
Mark Langen 2023-11-30 01:06:39 -08:00
parent 87a20e1557
commit c2bb95b210
11 changed files with 348 additions and 348 deletions

View File

@ -21,10 +21,10 @@ void* CameraImpl::ImplementationDataPtr()
}
// OFFSET: LEGO1 0x100a3700
Result CameraImpl::SetTransformation(const FloatMatrix4& p_matrix)
Result CameraImpl::SetTransformation(const FloatMatrix4& matrix)
{
D3DRMMATRIX4D helper;
D3DRMMATRIX4D* pTransformation = Translate(p_matrix, helper);
D3DRMMATRIX4D* pTransformation = Translate(matrix, helper);
D3DVECTOR position;
Result result;

View File

@ -38,24 +38,24 @@ Result DeviceImpl::SetColorModel(ColorModel)
}
// OFFSET: LEGO1 0x100a2c30
Result DeviceImpl::SetShadingModel(ShadingModel p_model)
Result DeviceImpl::SetShadingModel(ShadingModel model)
{
// Doesn't match well even though we know this is exactly
// the original code thanks to the jump table.
D3DRMRENDERQUALITY renderQuality = Translate(p_model);
D3DRMRENDERQUALITY renderQuality = Translate(model);
return ResultVal(m_data->SetQuality(renderQuality));
}
// OFFSET: LEGO1 0x100a2ca0
Result DeviceImpl::SetShadeCount(unsigned long p_shadeCount)
Result DeviceImpl::SetShadeCount(unsigned long shadeCount)
{
return ResultVal(m_data->SetShades(p_shadeCount));
return ResultVal(m_data->SetShades(shadeCount));
}
// OFFSET: LEGO1 0x100a2cc0
Result DeviceImpl::SetDither(int p_dither)
Result DeviceImpl::SetDither(int dither)
{
return ResultVal(m_data->SetDither(p_dither));
return ResultVal(m_data->SetDither(dither));
}
// Probably wrong, not sure what's going on in this method.

View File

@ -18,43 +18,43 @@ void* GroupImpl::ImplementationDataPtr()
}
// OFFSET: LEGO1 0x100a31e0
Result GroupImpl::SetTransformation(const FloatMatrix4& p_matrix)
Result GroupImpl::SetTransformation(const FloatMatrix4& matrix)
{
D3DRMMATRIX4D helper;
D3DRMMATRIX4D* matrix = Translate(p_matrix, helper);
return ResultVal(m_data->AddTransform(D3DRMCOMBINE_REPLACE, *matrix));
D3DRMMATRIX4D* d3dMatrix = Translate(matrix, helper);
return ResultVal(m_data->AddTransform(D3DRMCOMBINE_REPLACE, *d3dMatrix));
}
// OFFSET: LEGO1 0x100a3240
Result GroupImpl::SetColor(float p_r, float p_g, float p_b, float p_a)
Result GroupImpl::SetColor(float r, float g, float b, float a)
{
// The first instruction makes no sense here:
// cmp dword ptr [esp + 0x10], 0
// This compares a, which we know is a float because it immediately
// gets passed into D3DRMCreateColorRGBA, but does the comparison
// as though it's an int??
if (*reinterpret_cast<int*>(&p_a) > 0) {
D3DCOLOR color = D3DRMCreateColorRGBA(p_r, p_g, p_b, p_a);
if (*reinterpret_cast<int*>(&a) > 0) {
D3DCOLOR color = D3DRMCreateColorRGBA(r, g, b, a);
return ResultVal(m_data->SetColor(color));
}
else {
return ResultVal(m_data->SetColorRGB(p_r, p_a, p_b));
return ResultVal(m_data->SetColorRGB(r, a, b));
}
}
// OFFSET: LEGO1 0x100a32b0
Result GroupImpl::SetTexture(const Texture* p_texture)
Result GroupImpl::SetTexture(const Texture* pTexture)
{
IDirect3DRMTexture* texture = p_texture ? static_cast<const TextureImpl*>(p_texture)->ImplementationData() : NULL;
return ResultVal(m_data->SetTexture(texture));
IDirect3DRMTexture* pD3DTexture = pTexture ? static_cast<const TextureImpl*>(pTexture)->ImplementationData() : NULL;
return ResultVal(m_data->SetTexture(pD3DTexture));
}
// OFFSET: LEGO1 0x100a32e0
Result GroupImpl::GetTexture(Texture*& p_texture)
Result GroupImpl::GetTexture(Texture*& pTexture)
{
IDirect3DRMTexture* texture;
IDirect3DRMTexture* pD3DTexture;
TextureImpl* holder = new TextureImpl();
Result result = ResultVal(m_data->GetTexture(&texture));
Result result = ResultVal(m_data->GetTexture(&pD3DTexture));
if (result) {
// Seems to actually call the first virtual method of holder here
// but that doesn't make any sense since it passes three arguments
@ -63,57 +63,57 @@ Result GroupImpl::GetTexture(Texture*& p_texture)
// This line makes the start of the function match and is what I
// would expect to see there but it clearly isn't what's actually
// there.
holder->SetImplementation(texture);
holder->SetImplementation(pD3DTexture);
}
p_texture = holder;
pTexture = holder;
return Success;
}
// OFFSET: LEGO1 0x100a33c0
Result GroupImpl::SetMaterialMode(MaterialMode p_mode)
Result GroupImpl::SetMaterialMode(MaterialMode mode)
{
D3DRMMATERIALMODE mode;
switch (p_mode)
D3DRMMATERIALMODE d3dMode;
switch (mode)
{
case FromParent:
mode = D3DRMMATERIAL_FROMPARENT;
d3dMode = D3DRMMATERIAL_FROMPARENT;
break;
case FromFrame:
mode = D3DRMMATERIAL_FROMFRAME;
d3dMode = D3DRMMATERIAL_FROMFRAME;
break;
case FromMesh:
mode = D3DRMMATERIAL_FROMMESH;
d3dMode = D3DRMMATERIAL_FROMMESH;
break;
}
return ResultVal(m_data->SetMaterialMode(mode));
return ResultVal(m_data->SetMaterialMode(d3dMode));
}
// OFFSET: LEGO1 0x100a3410
Result GroupImpl::Add(const Mesh* p_mesh)
Result GroupImpl::Add(const Mesh* pMesh)
{
const MeshImpl* mesh = static_cast<const MeshImpl*>(p_mesh);
return ResultVal(m_data->AddVisual(mesh->ImplementationData()->groupMesh));
const MeshImpl* pMeshImpl = static_cast<const MeshImpl*>(pMesh);
return ResultVal(m_data->AddVisual(pMeshImpl->ImplementationData()->groupMesh));
}
// OFFSET: LEGO1 0x100a3430
Result GroupImpl::Add(const Group* p_group)
Result GroupImpl::Add(const Group* pGroup)
{
const GroupImpl* group = static_cast<const GroupImpl*>(p_group);
return ResultVal(m_data->AddVisual(group->m_data));
const GroupImpl* pGroupImpl = static_cast<const GroupImpl*>(pGroup);
return ResultVal(m_data->AddVisual(pGroupImpl->m_data));
}
// OFFSET: LEGO1 0x100a3450
Result GroupImpl::Remove(const Group* p_group)
Result GroupImpl::Remove(const Group* pGroup)
{
const GroupImpl* group = static_cast<const GroupImpl*>(p_group);
return ResultVal(m_data->DeleteVisual(group->m_data));
const GroupImpl* pGroupImpl = static_cast<const GroupImpl*>(pGroup);
return ResultVal(m_data->DeleteVisual(pGroupImpl->m_data));
}
// OFFSET: LEGO1 0x100a3480
Result GroupImpl::Remove(const Mesh* p_mesh)
Result GroupImpl::Remove(const Mesh* pMesh)
{
const MeshImpl* mesh = static_cast<const MeshImpl*>(p_mesh);
return ResultVal(m_data->DeleteVisual(mesh->ImplementationData()->groupMesh));
const MeshImpl* pMeshImpl = static_cast<const MeshImpl*>(pMesh);
return ResultVal(m_data->DeleteVisual(pMeshImpl->ImplementationData()->groupMesh));
}
// OFFSET: LEGO1 0x100a34b0 STUB

View File

@ -19,9 +19,9 @@ namespace TglImpl
using namespace Tgl;
// Utility function used by implementations
inline Result ResultVal(HRESULT p_result)
inline Result ResultVal(HRESULT result)
{
return SUCCEEDED(p_result) ? Success : Error;
return SUCCEEDED(result) ? Success : Error;
}
// Forward declare implementations
@ -51,26 +51,26 @@ class RendererImpl : public Renderer {
virtual View* CreateView(
const Device*,
const Camera*,
unsigned long p_x,
unsigned long p_y,
unsigned long p_width,
unsigned long p_height
unsigned long x,
unsigned long y,
unsigned long width,
unsigned long height
);
virtual Camera* CreateCamera();
virtual Light* CreateLight(LightType, float p_r, float p_g, float p_b);
virtual Group* CreateGroup(const Group* p_parent);
virtual Light* CreateLight(LightType, float r, float g, float b);
virtual Group* CreateGroup(const Group* pParent);
// vtable+0x20
virtual Unk* CreateUnk();
virtual Texture* CreateTexture();
virtual Texture* CreateTexture(
int p_width,
int p_height,
int p_bitsPerTexel,
const void* p_pTexels,
int p_pTexelsArePersistent,
int p_paletteEntryCount,
const PaletteEntry* p_pEntries
int width,
int height,
int bitsPerTexel,
const void* pTexels,
int pTexelsArePersistent,
int paletteEntryCount,
const PaletteEntry* pEntries
);
virtual Result SetTextureDefaultShadeCount(unsigned long);
@ -131,11 +131,11 @@ class ViewImpl : public View {
// vtable+0x10
virtual Result SetCamera(const Camera*);
virtual Result SetProjection(ProjectionType);
virtual Result SetFrustrum(float p_frontClippingDistance, float p_backClippingDistance, float p_degrees);
virtual Result SetBackgroundColor(float p_r, float p_g, float p_b);
virtual Result SetFrustrum(float frontClippingDistance, float backClippingDistance, float degrees);
virtual Result SetBackgroundColor(float r, float g, float b);
// vtable+0x20
virtual Result GetBackgroundColor(float* p_r, float* p_g, float* p_b);
virtual Result GetBackgroundColor(float* r, float* g, float* b);
virtual Result Clear();
virtual Result Render(const Light*);
virtual Result ForceUpdate(unsigned long x, unsigned long y, unsigned long width, unsigned long height);
@ -144,12 +144,12 @@ class ViewImpl : public View {
virtual Result TransformWorldToScreen(const float world[3], float screen[4]);
virtual Result TransformScreenToWorld(const float screen[4], float world[3]);
virtual Result Pick(
unsigned long p_x,
unsigned long p_y,
const Group** p_ppGroupsToPickFrom,
int p_groupsToPickFromCount,
const Group**& p_rppPickedGroups,
int& p_rPickedGroupCount
unsigned long x,
unsigned long y,
const Group** ppGroupsToPickFrom,
int groupsToPickFromCount,
const Group**& rppPickedGroups,
int& rPickedGroupCount
);
inline IDirect3DRMViewport* ImplementationData() const { return m_data; }
@ -191,7 +191,7 @@ class LightImpl : public Light {
// vtable+0x08
virtual Result SetTransformation(const FloatMatrix4&);
virtual Result SetColor(float p_r, float p_g, float p_b);
virtual Result SetColor(float r, float g, float b);
inline IDirect3DRMFrame* ImplementationData() const { return m_data; }
@ -210,7 +210,7 @@ class MeshImpl : public Mesh {
virtual void* ImplementationDataPtr();
// vtable+0x08
virtual Result SetColor(float p_r, float p_g, float p_b, float p_a);
virtual Result SetColor(float r, float g, float b, float a);
virtual Result SetTexture(const Texture*);
// vtable+0x10
@ -245,7 +245,7 @@ class GroupImpl : public Group {
// vtable+0x08
virtual Result SetTransformation(const FloatMatrix4&);
virtual Result SetColor(float p_r, float p_g, float p_b, float p_a);
virtual Result SetColor(float r, float g, float b, float a);
// vtable+0x10
virtual Result SetTexture(const Texture*);
@ -278,15 +278,15 @@ class UnkImpl : public Unk {
// vtable+0x08
virtual Result SetMeshData(
unsigned long p_faceCount,
unsigned long p_vertexCount,
const float (*p_positions)[3],
const float (*p_normals)[3],
const float (*p_textureCoordinates)[2],
unsigned long p_vertexPerFaceCount,
unsigned long* p_faceData
unsigned long faceCount,
unsigned long vertexCount,
const float (*pPositions)[3],
const float (*pNormals)[3],
const float (*pTextureCoordinates)[2],
unsigned long vertexPerFaceCount,
unsigned long* pFaceData
);
virtual Result GetBoundingBox(float p_min[3], float p_max[3]);
virtual Result GetBoundingBox(float min[3], float max[3]);
// vtable+0x10
virtual Unk* Clone();
@ -303,20 +303,20 @@ class UnkImpl : public Unk {
class TglD3DRMIMAGE {
public:
TglD3DRMIMAGE(
int p_width,
int p_height,
int p_depth,
void* p_buffer,
int p_useBuffer,
int p_paletteSize,
PaletteEntry* p_palette
int width,
int height,
int depth,
void* pBuffer,
int useBuffer,
int paletteSize,
PaletteEntry* pEntries
);
~TglD3DRMIMAGE() { Destroy(); }
Result CreateBuffer(int p_width, int p_height, int p_depth, void* p_buffer, int p_useBuffer);
Result CreateBuffer(int width, int height, int depth, void* pBuffer, int useBuffer);
void Destroy();
void FillRowsOfTexture(int p_y, int p_height, char* p_content);
Result InitializePalette(int p_paletteSize, PaletteEntry* p_palette);
void FillRowsOfTexture(int y, int height, char* content);
Result InitializePalette(int paletteSize, PaletteEntry* pEntries);
D3DRMIMAGE m_image;
int m_texelsAllocatedByClient;
@ -331,38 +331,38 @@ class TextureImpl : public Texture {
virtual void* ImplementationDataPtr();
// vtable+0x08
virtual Result SetTexels(int p_width, int p_height, int p_bitsPerTexel, void* p_texels);
virtual void FillRowsOfTexture(int p_y, int p_height, void* p_buffer);
virtual Result SetTexels(int width, int height, int bitsPerTexel, void* pTexels);
virtual void FillRowsOfTexture(int y, int height, void* pBuffer);
// vtable+0x10
virtual Result Changed(int p_texelsChanged, int p_paletteChanged);
virtual Result Changed(int texelsChanged, int paletteChanged);
virtual Result GetBufferAndPalette(
int* p_width,
int* p_height,
int* p_depth,
void** p_buffer,
int* p_paletteSize,
PaletteEntry** p_palette
int* pWidth,
int* pHeight,
int* pDepth,
void** ppBuffer,
int* ppPaletteSize,
PaletteEntry** ppPalette
);
virtual Result SetPalette(int p_entryCount, PaletteEntry* p_entries);
virtual Result SetPalette(int entryCount, PaletteEntry* entries);
inline IDirect3DRMTexture* ImplementationData() const { return m_data; }
inline void SetImplementation(IDirect3DRMTexture* data) { m_data = data; }
inline void SetImplementation(IDirect3DRMTexture* pData) { m_data = pData; }
friend class RendererImpl;
static Result SetImage(IDirect3DRMTexture* p_self, TglD3DRMIMAGE* p_image);
static Result SetImage(IDirect3DRMTexture* pSelf, TglD3DRMIMAGE* pImage);
private:
IDirect3DRMTexture* m_data;
};
// Translation helpers
inline D3DRMRENDERQUALITY Translate(ShadingModel p_tglShadingModel)
inline D3DRMRENDERQUALITY Translate(ShadingModel tglShadingModel)
{
D3DRMRENDERQUALITY renderQuality;
switch (p_tglShadingModel) {
switch (tglShadingModel) {
case Wireframe:
renderQuality = D3DRMRENDER_WIREFRAME;
break;
@ -386,10 +386,10 @@ inline D3DRMRENDERQUALITY Translate(ShadingModel p_tglShadingModel)
return renderQuality;
}
inline D3DRMPROJECTIONTYPE Translate(ProjectionType p_tglProjectionType)
inline D3DRMPROJECTIONTYPE Translate(ProjectionType tglProjectionType)
{
D3DRMPROJECTIONTYPE projectionType;
switch (p_tglProjectionType) {
switch (tglProjectionType) {
case Perspective:
projectionType = D3DRMPROJECT_PERSPECTIVE;
break;

View File

@ -21,19 +21,19 @@ void* LightImpl::ImplementationDataPtr()
}
// OFFSET: LEGO1 0x100a3780
Result LightImpl::SetTransformation(const FloatMatrix4& p_matrix)
Result LightImpl::SetTransformation(const FloatMatrix4& matrix)
{
D3DRMMATRIX4D helper;
D3DRMMATRIX4D* matrix = Translate(p_matrix, helper);
return ResultVal(m_data->AddTransform(D3DRMCOMBINE_REPLACE, *matrix));
D3DRMMATRIX4D* d3dMatrix = Translate(matrix, helper);
return ResultVal(m_data->AddTransform(D3DRMCOMBINE_REPLACE, *d3dMatrix));
}
// OFFSET: LEGO1 0x100a37e0
Result LightImpl::SetColor(float p_r, float p_g, float p_b)
Result LightImpl::SetColor(float r, float g, float b)
{
IDirect3DRMLightArray* lightArray;
IDirect3DRMLight* light;
m_data->GetLights(&lightArray);
lightArray->GetElement(0, &light);
return ResultVal(light->SetColorRGB(p_r, p_g, p_b));
return ResultVal(light->SetColorRGB(r, g, b));
}

View File

@ -23,33 +23,33 @@ void* MeshImpl::ImplementationDataPtr()
}
// OFFSET: LEGO1 0x100a3ee0
Result MeshImpl::SetColor(float p_r, float p_g, float p_b, float p_a)
Result MeshImpl::SetColor(float r, float g, float b, float a)
{
// The first instruction makes no sense here:
// cmp dword ptr [esp + 0x10], 0
// This compares a, which we know is a float because it immediately
// gets passed into D3DRMCreateColorRGBA, but does the comparison
// as though it's an int??
if (*reinterpret_cast<int*>(&p_a) > 0) {
D3DCOLOR color = D3DRMCreateColorRGBA(p_r, p_g, p_b, p_a);
if (*reinterpret_cast<int*>(&a) > 0) {
D3DCOLOR color = D3DRMCreateColorRGBA(r, g, b, a);
return ResultVal(m_data->groupMesh->SetGroupColor(m_data->groupIndex, color));
}
else {
return ResultVal(m_data->groupMesh->SetGroupColorRGB(m_data->groupIndex, p_r, p_g, p_b));
return ResultVal(m_data->groupMesh->SetGroupColorRGB(m_data->groupIndex, r, g, b));
}
}
// OFFSET: LEGO1 0x100a3f50
Result MeshImpl::SetTexture(const Texture* p_texture)
Result MeshImpl::SetTexture(const Texture* pTexture)
{
IDirect3DRMTexture* texture = p_texture ? static_cast<const TextureImpl*>(p_texture)->ImplementationData() : NULL;
IDirect3DRMTexture* texture = pTexture ? static_cast<const TextureImpl*>(pTexture)->ImplementationData() : NULL;
return ResultVal(m_data->groupMesh->SetGroupTexture(m_data->groupIndex, texture));
}
// OFFSET: LEGO1 0x100a3f80
Result MeshImpl::SetTextureMappingMode(ProjectionType p_projType)
Result MeshImpl::SetTextureMappingMode(ProjectionType projType)
{
if (p_projType == Perspective) {
if (projType == Perspective) {
return ResultVal(m_data->groupMesh->SetGroupMapping(m_data->groupIndex, D3DRMMAP_PERSPCORRECT));
}
else {
@ -58,10 +58,10 @@ Result MeshImpl::SetTextureMappingMode(ProjectionType p_projType)
}
// OFFSET: LEGO1 0x100a3fc0
Result MeshImpl::SetShadingModel(ShadingModel p_model)
Result MeshImpl::SetShadingModel(ShadingModel model)
{
D3DRMRENDERQUALITY mode;
switch (p_model) {
switch (model) {
case Wireframe:
mode = D3DRMRENDER_WIREFRAME;
break;
@ -82,7 +82,7 @@ Result MeshImpl::SetShadingModel(ShadingModel p_model)
}
// OFFSET: LEGO1 0x100a4030
Mesh* MeshImpl::DeepClone(Unk* p_mesh)
Mesh* MeshImpl::DeepClone(Unk* pUnk)
{
// Create group
MeshImpl* newMesh = new MeshImpl();
@ -105,7 +105,7 @@ Mesh* MeshImpl::DeepClone(Unk* p_mesh)
D3DCOLOR color = m_data->groupMesh->GetGroupColor(m_data->groupIndex);
// Push information to new group
UnkImpl* target = static_cast<UnkImpl*>(p_mesh);
UnkImpl* target = static_cast<UnkImpl*>(pUnk);
D3DRMGROUPINDEX index;
target->ImplementationData()->AddGroup(vcount, fcount, vperface, faceBuffer, &index);
newMesh->m_data->groupIndex = index;
@ -127,14 +127,14 @@ Mesh* MeshImpl::DeepClone(Unk* p_mesh)
}
// OFFSET: LEGO1 0x100a4240
Mesh* MeshImpl::ShallowClone(Unk* p_mesh)
Mesh* MeshImpl::ShallowClone(Unk* pUnk)
{
MeshImpl* newGroup = new MeshImpl();
MeshData* newData = new MeshData();
newGroup->m_data = newData;
if (newData) {
newData->groupIndex = m_data->groupIndex;
newData->groupMesh = static_cast<UnkImpl*>(p_mesh)->ImplementationData();
newData->groupMesh = static_cast<UnkImpl*>(pUnk)->ImplementationData();
}
else {
delete newGroup;
@ -144,7 +144,7 @@ Mesh* MeshImpl::ShallowClone(Unk* p_mesh)
}
// OFFSET: LEGO1 0x100a4330
Result MeshImpl::GetTexture(Texture*& p_texture)
Result MeshImpl::GetTexture(Texture*& rpTexture)
{
IDirect3DRMTexture* texture;
TextureImpl* holder = new TextureImpl();
@ -159,6 +159,6 @@ Result MeshImpl::GetTexture(Texture*& p_texture)
// there.
holder->SetImplementation(texture);
}
p_texture = holder;
rpTexture = holder;
return Success;
}

View File

@ -42,10 +42,10 @@ void RendererImpl::Destroy()
}
// OFFSET: LEGO1 0x100a1894
Device* RendererImpl::CreateDevice(const DeviceDirect3DCreateData& p_data)
Device* RendererImpl::CreateDevice(const DeviceDirect3DCreateData& data)
{
DeviceImpl* device = new DeviceImpl();
HRESULT result = m_data->CreateDeviceFromD3D(p_data.m_pDirect3D, p_data.m_pDirect3DDevice, &device->m_data);
HRESULT result = m_data->CreateDeviceFromD3D(data.m_pDirect3D, data.m_pDirect3DDevice, &device->m_data);
if (!SUCCEEDED(result)) {
delete device;
device = NULL;
@ -57,16 +57,16 @@ Device* RendererImpl::CreateDevice(const DeviceDirect3DCreateData& p_data)
static int gSetBufferCount = 1;
// OFFSET: LEGO1 0x100a1900
Device* RendererImpl::CreateDevice(const DeviceDirectDrawCreateData& p_data)
Device* RendererImpl::CreateDevice(const DeviceDirectDrawCreateData& data)
{
DeviceImpl* device = new DeviceImpl();
HRESULT result = m_data->CreateDeviceFromSurface(
const_cast<LPGUID>(p_data.m_driverGUID),
p_data.m_pDirectDraw,
p_data.m_pBackBuffer,
const_cast<LPGUID>(data.m_driverGUID),
data.m_pDirectDraw,
data.m_pBackBuffer,
&device->m_data
);
if (SUCCEEDED(result) && p_data.m_pBackBuffer && gSetBufferCount) {
if (SUCCEEDED(result) && data.m_pBackBuffer && gSetBufferCount) {
device->m_data->SetBufferCount(2);
}
if (!SUCCEEDED(result)) {
@ -77,22 +77,22 @@ Device* RendererImpl::CreateDevice(const DeviceDirectDrawCreateData& p_data)
}
inline Result RendererCreateView(
IDirect3DRM* p_renderer,
IDirect3DRMDevice* p_device,
IDirect3DRMFrame* p_camera,
IDirect3DRMViewport*& p_view,
unsigned long p_x,
unsigned long p_y,
unsigned long p_width,
unsigned long p_height
IDirect3DRM* pRenderer,
IDirect3DRMDevice* pDevice,
IDirect3DRMFrame* pCamera,
IDirect3DRMViewport*& rpView,
unsigned long x,
unsigned long y,
unsigned long width,
unsigned long height
)
{
Result result = ResultVal(p_renderer->CreateViewport(p_device, p_camera, p_x, p_y, p_width, p_height, &p_view));
Result result = ResultVal(pRenderer->CreateViewport(pDevice, pCamera, x, y, width, height, &rpView));
if (Succeeded(result)) {
result = ViewImpl::ViewportCreateAppData(p_renderer, p_view, p_camera);
result = ViewImpl::ViewportCreateAppData(pRenderer, rpView, pCamera);
if (!Succeeded(result)) {
p_view->Release();
p_view = NULL;
rpView->Release();
rpView = NULL;
}
}
return result;
@ -100,24 +100,24 @@ inline Result RendererCreateView(
// OFFSET: LEGO1 0x100a1a00
View* RendererImpl::CreateView(
const Device* p_device,
const Camera* p_camera,
unsigned long p_x,
unsigned long p_y,
unsigned long p_width,
unsigned long p_height
const Device* pDevice,
const Camera* pCamera,
unsigned long x,
unsigned long y,
unsigned long width,
unsigned long height
)
{
ViewImpl* view = new ViewImpl();
Result result = RendererCreateView(
m_data,
static_cast<const DeviceImpl*>(p_device)->m_data,
static_cast<const CameraImpl*>(p_camera)->m_data,
static_cast<const DeviceImpl*>(pDevice)->m_data,
static_cast<const CameraImpl*>(pCamera)->m_data,
view->m_data,
p_x,
p_y,
p_width,
p_height
x,
y,
width,
height
);
if (!result) {
delete view;
@ -126,25 +126,25 @@ View* RendererImpl::CreateView(
return view;
}
inline Result RendererCreateGroup(IDirect3DRM* p_renderer, IDirect3DRMFrame* p_parent, IDirect3DRMFrame*& p_group)
inline Result RendererCreateGroup(IDirect3DRM* pRenderer, IDirect3DRMFrame* pParent, IDirect3DRMFrame*& rpGroup)
{
Result result = ResultVal(p_renderer->CreateFrame(NULL, &p_group));
if (Succeeded(result) && p_parent) {
result = ResultVal(p_parent->AddVisual(p_group));
Result result = ResultVal(pRenderer->CreateFrame(NULL, &rpGroup));
if (Succeeded(result) && pParent) {
result = ResultVal(pParent->AddVisual(rpGroup));
if (!Succeeded(result)) {
p_group->Release();
p_group = NULL;
rpGroup->Release();
rpGroup = NULL;
}
}
return result;
}
// OFFSET: LEGO1 0x100a1b20
Group* RendererImpl::CreateGroup(const Group* p_parent)
Group* RendererImpl::CreateGroup(const Group* pParent)
{
GroupImpl* group = new GroupImpl();
Result result =
RendererCreateGroup(m_data, p_parent ? static_cast<const GroupImpl*>(p_parent)->m_data : NULL, group->m_data);
RendererCreateGroup(m_data, pParent ? static_cast<const GroupImpl*>(pParent)->m_data : NULL, group->m_data);
if (!result) {
delete group;
group = NULL;
@ -164,11 +164,11 @@ Camera* RendererImpl::CreateCamera()
}
// OFFSET: LEGO1 0x100a1cf0
Light* RendererImpl::CreateLight(LightType p_type, float p_r, float p_g, float p_b)
Light* RendererImpl::CreateLight(LightType type, float r, float g, float b)
{
LightImpl* newLight = new LightImpl();
D3DRMLIGHTTYPE translatedType;
switch (p_type) {
switch (type) {
case Ambient:
translatedType = D3DRMLIGHT_AMBIENT;
break;
@ -192,7 +192,7 @@ Light* RendererImpl::CreateLight(LightType p_type, float p_r, float p_g, float p
Result result = ResultVal(m_data->CreateFrame(NULL, &frame));
if (Succeeded(result)) {
LPDIRECT3DRMLIGHT d3dLight;
result = ResultVal(m_data->CreateLightRGB(translatedType, p_r, p_g, p_b, &d3dLight));
result = ResultVal(m_data->CreateLightRGB(translatedType, r, g, b, &d3dLight));
if (!Succeeded(result)) {
frame->Release();
}
@ -233,27 +233,27 @@ Unk* RendererImpl::CreateUnk()
}
inline Result RendererCreateTexture(
IDirect3DRM* p_renderer,
IDirect3DRMTexture*& p_texture,
int p_width,
int p_height,
int p_bytesPerPixel,
void* p_buffer,
int p_useBuffer,
int p_paletteSize,
PaletteEntry* p_palette
IDirect3DRM* renderer,
IDirect3DRMTexture*& texture,
int width,
int height,
int bytesPerPixel,
void* pBuffer,
int useBuffer,
int paletteSize,
PaletteEntry* pEntries
)
{
TglD3DRMIMAGE* image;
Result result;
image = new TglD3DRMIMAGE(p_width, p_height, p_bytesPerPixel, p_buffer, p_useBuffer, p_paletteSize, p_palette);
result = ResultVal(p_renderer->CreateTexture(&image->m_image, &p_texture));
image = new TglD3DRMIMAGE(width, height, bytesPerPixel, pBuffer, useBuffer, paletteSize, pEntries);
result = ResultVal(renderer->CreateTexture(&image->m_image, &texture));
if (Succeeded(result)) {
result = TextureImpl::SetImage(p_texture, image);
result = TextureImpl::SetImage(texture, image);
if (!Succeeded(result)) {
p_texture->Release();
p_texture = NULL;
texture->Release();
texture = NULL;
delete image;
}
}
@ -265,26 +265,26 @@ inline Result RendererCreateTexture(
// OFFSET: LEGO1 0x100a1f50
Texture* RendererImpl::CreateTexture(
int p_width,
int p_height,
int p_bitsPerTexel,
const void* p_pTexels,
int p_texelsArePersistent,
int p_paletteEntryCount,
const PaletteEntry* p_pEntries
int width,
int height,
int bitsPerTexel,
const void* pTexels,
int texelsArePersistent,
int paletteEntryCount,
const PaletteEntry* pEntries
)
{
TextureImpl* texture = new TextureImpl();
if (!Succeeded(RendererCreateTexture(
m_data,
texture->m_data,
p_width,
p_height,
p_bitsPerTexel,
const_cast<void*>(p_pTexels),
p_texelsArePersistent,
p_paletteEntryCount,
const_cast<PaletteEntry*>(p_pEntries)
width,
height,
bitsPerTexel,
const_cast<void*>(pTexels),
texelsArePersistent,
paletteEntryCount,
const_cast<PaletteEntry*>(pEntries)
))) {
delete texture;
texture = NULL;
@ -305,15 +305,15 @@ Texture* RendererImpl::CreateTexture()
// OFFSET: LEGO1 0x100a2270
Result RendererImpl::SetTextureDefaultShadeCount(unsigned long p_shadeCount)
Result RendererImpl::SetTextureDefaultShadeCount(unsigned long shadeCount)
{
return ResultVal(m_data->SetDefaultTextureShades(p_shadeCount));
return ResultVal(m_data->SetDefaultTextureShades(shadeCount));
}
// OFFSET: LEGO1 0x100a2290
Result RendererImpl::SetTextureDefaultColorCount(unsigned long p_colorCount)
Result RendererImpl::SetTextureDefaultColorCount(unsigned long colorCount)
{
return ResultVal(m_data->SetDefaultTextureColors(p_colorCount));
return ResultVal(m_data->SetDefaultTextureColors(colorCount));
}
// OFFSET: LEGO1 0x100a22b0

View File

@ -4,31 +4,31 @@ using namespace TglImpl;
DECOMP_SIZE_ASSERT(TglD3DRMIMAGE, 0x40);
inline TglD3DRMIMAGE* TextureGetImage(IDirect3DRMTexture* p_texture)
inline TglD3DRMIMAGE* TextureGetImage(IDirect3DRMTexture* pTexture)
{
return reinterpret_cast<TglD3DRMIMAGE*>(p_texture->GetAppData());
return reinterpret_cast<TglD3DRMIMAGE*>(pTexture->GetAppData());
}
// Forward declare to satisfy order check
void TextureDestroyCallback(IDirect3DRMObject* pObject, void* pArg);
// OFFSET: LEGO1 0x100a12a0
Result TextureImpl::SetImage(IDirect3DRMTexture* p_self, TglD3DRMIMAGE* p_image)
Result TextureImpl::SetImage(IDirect3DRMTexture* pSelf, TglD3DRMIMAGE* pImage)
{
unsigned long appData;
Result result;
appData = reinterpret_cast<unsigned long>(p_image);
appData = reinterpret_cast<unsigned long>(pImage);
// This is here because in the original code they asserted
// on the return value being NULL.
TextureGetImage(p_self);
TextureGetImage(pSelf);
result = ResultVal(p_self->SetAppData(appData));
if (Succeeded(result) && p_image) {
result = ResultVal(p_self->AddDestroyCallback(TextureDestroyCallback, NULL));
result = ResultVal(pSelf->SetAppData(appData));
if (Succeeded(result) && pImage) {
result = ResultVal(pSelf->AddDestroyCallback(TextureDestroyCallback, NULL));
if (!Succeeded(result)) {
p_self->SetAppData(0);
pSelf->SetAppData(0);
}
}
return result;
@ -44,13 +44,13 @@ void TextureDestroyCallback(IDirect3DRMObject* pObject, void* pArg)
// OFFSET: LEGO1 0x100a1330
TglD3DRMIMAGE::TglD3DRMIMAGE(
int p_width,
int p_height,
int p_depth,
void* p_buffer,
int p_useBuffer,
int p_paletteSize,
PaletteEntry* p_palette
int width,
int height,
int depth,
void* pBuffer,
int useBuffer,
int paletteSize,
PaletteEntry* pEntries
)
{
m_image.aspectx = 1;
@ -69,11 +69,11 @@ TglD3DRMIMAGE::TglD3DRMIMAGE(
m_image.palette_size = 0;
m_image.palette = NULL;
m_texelsAllocatedByClient = 0;
if (p_buffer != NULL) {
CreateBuffer(p_width, p_height, p_depth, p_buffer, p_useBuffer);
if (pBuffer != NULL) {
CreateBuffer(width, height, depth, pBuffer, useBuffer);
}
if (p_palette != NULL) {
InitializePalette(p_paletteSize, p_palette);
if (pEntries != NULL) {
InitializePalette(paletteSize, pEntries);
}
}
@ -87,39 +87,39 @@ void TglD3DRMIMAGE::Destroy()
}
// OFFSET: LEGO1 0x100a13e0 STUB
Result TglD3DRMIMAGE::CreateBuffer(int p_width, int p_height, int p_depth, void* p_buffer, int p_useBuffer)
Result TglD3DRMIMAGE::CreateBuffer(int width, int height, int depth, void* pBuffer, int useBuffer)
{
return Error;
}
// OFFSET: LEGO1 0x100a1510
void TglD3DRMIMAGE::FillRowsOfTexture(int p_y, int p_height, char* p_content)
void TglD3DRMIMAGE::FillRowsOfTexture(int y, int height, char* pContent)
{
// The purpose is clearly this but I can't get the assembly to line up.
memcpy((char*) m_image.buffer1 + (p_y * m_image.bytes_per_line), p_content, p_height * m_image.bytes_per_line);
memcpy((char*) m_image.buffer1 + (y * m_image.bytes_per_line), pContent, height * m_image.bytes_per_line);
}
// OFFSET: LEGO1 0x100a1550
Result TglD3DRMIMAGE::InitializePalette(int p_paletteSize, PaletteEntry* p_palette)
Result TglD3DRMIMAGE::InitializePalette(int paletteSize, PaletteEntry* pEntries)
{
// This function is a 100% match if the PaletteEntry class is copied
// into into the TglD3DRMIMAGE class instead of being a global struct.
if (m_image.palette_size != p_paletteSize) {
if (m_image.palette_size != paletteSize) {
if (m_image.palette != NULL) {
free(m_image.palette);
m_image.palette = NULL;
m_image.palette_size = 0;
}
if (p_paletteSize > 0) {
m_image.palette = (D3DRMPALETTEENTRY*) malloc(4 * p_paletteSize);
m_image.palette_size = p_paletteSize;
if (paletteSize > 0) {
m_image.palette = (D3DRMPALETTEENTRY*) malloc(4 * paletteSize);
m_image.palette_size = paletteSize;
}
}
if (p_paletteSize > 0) {
for (int i = 0; i < p_paletteSize; i++) {
m_image.palette[i].red = p_palette[i].m_red;
m_image.palette[i].green = p_palette[i].m_green;
m_image.palette[i].blue = p_palette[i].m_blue;
if (paletteSize > 0) {
for (int i = 0; i < paletteSize; i++) {
m_image.palette[i].red = pEntries[i].m_red;
m_image.palette[i].green = pEntries[i].m_green;
m_image.palette[i].blue = pEntries[i].m_blue;
m_image.palette[i].flags = D3DRMPALETTE_READONLY;
}
}
@ -136,10 +136,10 @@ TextureImpl::~TextureImpl()
}
// OFFSET: LEGO1 0x100a3c10
Result TextureImpl::SetTexels(int p_width, int p_height, int p_bitsPerTexel, void* p_texels)
Result TextureImpl::SetTexels(int width, int height, int bitsPerTexel, void* pTexels)
{
TglD3DRMIMAGE* image = TextureGetImage(m_data);
Result result = image->CreateBuffer(p_width, p_height, p_bitsPerTexel, p_texels, TRUE);
Result result = image->CreateBuffer(width, height, bitsPerTexel, pTexels, TRUE);
if (Succeeded(result)) {
result = ResultVal(m_data->Changed(TRUE, FALSE));
}
@ -147,50 +147,50 @@ Result TextureImpl::SetTexels(int p_width, int p_height, int p_bitsPerTexel, voi
}
// OFFSET: LEGO1 0x100a3c60
void TextureImpl::FillRowsOfTexture(int p_y, int p_height, void* p_buffer)
void TextureImpl::FillRowsOfTexture(int y, int height, void* pBuffer)
{
TglD3DRMIMAGE* image = TextureGetImage(m_data);
image->FillRowsOfTexture(p_y, p_height, (char*) p_buffer);
image->FillRowsOfTexture(y, height, (char*) pBuffer);
}
// OFFSET: LEGO1 0x100a3c90
Result TextureImpl::Changed(int p_texelsChanged, int p_paletteChanged)
Result TextureImpl::Changed(int texelsChanged, int paletteChanged)
{
return ResultVal(m_data->Changed(p_texelsChanged, p_paletteChanged));
return ResultVal(m_data->Changed(texelsChanged, paletteChanged));
}
// OFFSET: LEGO1 0x100a3d00
Result TextureImpl::GetBufferAndPalette(
int* p_width,
int* p_height,
int* p_depth,
void** p_buffer,
int* p_paletteSize,
PaletteEntry** p_palette
int* width,
int* height,
int* depth,
void** pBuffer,
int* paletteSize,
PaletteEntry** pEntries
)
{
// Something really doesn't match here, not sure what's up.
TglD3DRMIMAGE* image = TextureGetImage(m_data);
*p_width = image->m_image.width;
*p_height = image->m_image.height;
*p_depth = image->m_image.depth;
*p_buffer = image->m_image.buffer1;
*p_paletteSize = image->m_image.palette_size;
*width = image->m_image.width;
*height = image->m_image.height;
*depth = image->m_image.depth;
*pBuffer = image->m_image.buffer1;
*paletteSize = image->m_image.palette_size;
for (int i = 0; i < image->m_image.palette_size; i++) {
p_palette[i]->m_red = image->m_image.palette[i].red;
p_palette[i]->m_green = image->m_image.palette[i].green;
p_palette[i]->m_blue = image->m_image.palette[i].blue;
pEntries[i]->m_red = image->m_image.palette[i].red;
pEntries[i]->m_green = image->m_image.palette[i].green;
pEntries[i]->m_blue = image->m_image.palette[i].blue;
}
return Success;
}
// OFFSET: LEGO1 0x100a3d40
Result TextureImpl::SetPalette(int p_entryCount, PaletteEntry* p_entries)
Result TextureImpl::SetPalette(int entryCount, PaletteEntry* pEntries)
{
// Not 100% confident this is supposed to directly be forwarding arguments,
// but it probably is given FillRowsOfTexture matches doing that.
TglD3DRMIMAGE* image = TextureGetImage(m_data);
image->InitializePalette(p_entryCount, p_entries);
image->InitializePalette(entryCount, pEntries);
m_data->Changed(FALSE, TRUE);
return Success;
}

View File

@ -22,30 +22,30 @@ void* UnkImpl::ImplementationDataPtr()
// OFFSET: LEGO1 0x100a3840 STUB
Result UnkImpl::SetMeshData(
unsigned long p_faceCount,
unsigned long p_vertexCount,
const float (*p_positions)[3],
const float (*p_normals)[3],
const float (*p_textureCoordinates)[2],
unsigned long p_vertexPerFaceCount,
unsigned long* p_faceData
unsigned long faceCount,
unsigned long vertexCount,
const float (*pPositions)[3],
const float (*pNormals)[3],
const float (*pTextureCoordinates)[2],
unsigned long vertexPerFaceCount,
unsigned long* pFaceData
)
{
return Error;
}
// OFFSET: LEGO1 0x100a3ae0
Result UnkImpl::GetBoundingBox(float p_min[3], float p_max[3])
Result UnkImpl::GetBoundingBox(float min[3], float max[3])
{
D3DRMBOX box;
Result result = ResultVal(m_data->GetBox(&box));
if (result == Success) {
p_min[0] = box.min.x;
p_min[1] = box.min.y;
p_min[2] = box.min.z;
p_max[0] = box.max.x;
p_max[1] = box.max.y;
p_max[2] = box.max.z;
min[0] = box.min.x;
min[1] = box.min.y;
min[2] = box.min.z;
max[0] = box.max.x;
max[1] = box.max.y;
max[2] = box.max.z;
}
return result;
}

View File

@ -3,7 +3,7 @@
using namespace TglImpl;
struct ViewportAppData {
ViewportAppData(IDirect3DRM* p_renderer);
ViewportAppData(IDirect3DRM* pRenderer);
~ViewportAppData();
IDirect3DRMFrame* m_pLightFrame;
@ -17,9 +17,9 @@ struct ViewportAppData {
DECOMP_SIZE_ASSERT(ViewportAppData, 0x18);
// OFFSET: LEGO1 0x100a10b0
ViewportAppData::ViewportAppData(IDirect3DRM* p_renderer)
ViewportAppData::ViewportAppData(IDirect3DRM* pRenderer)
{
p_renderer->CreateFrame(NULL, &m_pLightFrame);
pRenderer->CreateFrame(NULL, &m_pLightFrame);
m_pCamera = NULL;
m_pLastRenderedFrame = NULL;
m_backgroundColorRed = 0.0f;
@ -43,20 +43,20 @@ ViewportAppData::~ViewportAppData()
}
// Forward declare to satisfy order check
void ViewportDestroyCallback(IDirect3DRMObject* p_object, void* p_arg);
void ViewportDestroyCallback(IDirect3DRMObject* pObject, void* pArg);
// OFFSET: LEGO1 0x100a1160
Result ViewImpl::ViewportCreateAppData(IDirect3DRM* p_device, IDirect3DRMViewport* p_view, IDirect3DRMFrame* p_camera)
Result ViewImpl::ViewportCreateAppData(IDirect3DRM* pDevice, IDirect3DRMViewport* pView, IDirect3DRMFrame* pCamera)
{
ViewportAppData* data = new ViewportAppData(p_device);
data->m_pCamera = p_camera;
Result result = ResultVal(p_view->SetAppData(reinterpret_cast<unsigned long>(data)));
ViewportAppData* data = new ViewportAppData(pDevice);
data->m_pCamera = pCamera;
Result result = ResultVal(pView->SetAppData(reinterpret_cast<unsigned long>(data)));
if (Succeeded(result)) {
result = ResultVal(p_view->AddDestroyCallback(ViewportDestroyCallback, data));
result = ResultVal(pView->AddDestroyCallback(ViewportDestroyCallback, data));
}
if (!Succeeded(result)) {
delete data;
p_view->SetAppData(0);
pView->SetAppData(0);
}
return result;
}
@ -81,9 +81,9 @@ inline Result ViewRestoreFrameAfterRender(
}
// OFFSET: LEGO1 0x100a1240
void ViewportDestroyCallback(IDirect3DRMObject* p_object, void* p_arg)
void ViewportDestroyCallback(IDirect3DRMObject* pObject, void* pArg)
{
ViewportAppData* pViewportAppData = reinterpret_cast<ViewportAppData*>(p_arg);
ViewportAppData* pViewportAppData = reinterpret_cast<ViewportAppData*>(pArg);
ViewRestoreFrameAfterRender(
pViewportAppData->m_pLastRenderedFrame,
@ -96,7 +96,7 @@ void ViewportDestroyCallback(IDirect3DRMObject* p_object, void* p_arg)
// OFFSET: LEGO1 0x100a1290
Result ViewportPickImpl(
IDirect3DRMViewport* p_viewport,
IDirect3DRMViewport* pViewport,
int x,
int y,
const Group** ppGroupsToPickFrom,
@ -109,14 +109,14 @@ Result ViewportPickImpl(
return Error;
}
inline ViewportAppData* ViewportGetData(IDirect3DRMViewport* p_viewport)
inline ViewportAppData* ViewportGetData(IDirect3DRMViewport* pViewport)
{
return reinterpret_cast<ViewportAppData*>(p_viewport->GetAppData());
return reinterpret_cast<ViewportAppData*>(pViewport->GetAppData());
}
inline IDirect3DRMFrame* ViewportGetLightFrame(IDirect3DRMViewport* p_viewport)
inline IDirect3DRMFrame* ViewportGetLightFrame(IDirect3DRMViewport* pViewport)
{
return ViewportGetData(p_viewport)->m_pLightFrame;
return ViewportGetData(pViewport)->m_pLightFrame;
}
// Inlined only
@ -135,25 +135,25 @@ void* ViewImpl::ImplementationDataPtr()
}
// OFFSET: LEGO1 0x100a2d90
Result ViewImpl::Add(const Light* p_light)
Result ViewImpl::Add(const Light* pLight)
{
const LightImpl* light = static_cast<const LightImpl*>(p_light);
const LightImpl* light = static_cast<const LightImpl*>(pLight);
IDirect3DRMFrame* frame = light->ImplementationData();
return ResultVal(ViewportGetLightFrame(m_data)->AddChild(frame));
}
// OFFSET: LEGO1 0x100a2dc0
Result ViewImpl::Remove(const Light* p_light)
Result ViewImpl::Remove(const Light* pLight)
{
const LightImpl* light = static_cast<const LightImpl*>(p_light);
const LightImpl* light = static_cast<const LightImpl*>(pLight);
IDirect3DRMFrame* frame = light->ImplementationData();
return ResultVal(ViewportGetLightFrame(m_data)->DeleteChild(frame));
}
// OFFSET: LEGO1 0x100a2df0
Result ViewImpl::SetCamera(const Camera* p_camera)
Result ViewImpl::SetCamera(const Camera* pCamera)
{
const CameraImpl* camera = static_cast<const CameraImpl*>(p_camera);
const CameraImpl* camera = static_cast<const CameraImpl*>(pCamera);
IDirect3DRMFrame* frame = camera->ImplementationData();
ViewportAppData* pViewportAppData;
@ -172,19 +172,19 @@ Result ViewImpl::SetCamera(const Camera* p_camera)
}
// OFFSET: LEGO1 0x100a2e70
Result ViewImpl::SetProjection(ProjectionType p_type)
Result ViewImpl::SetProjection(ProjectionType type)
{
return ResultVal(m_data->SetProjection(Translate(p_type)));
return ResultVal(m_data->SetProjection(Translate(type)));
}
// OFFSET: LEGO1 0x100a2eb0
Result ViewImpl::SetFrustrum(float p_frontClippingDistance, float p_backClippingDistance, float p_degrees)
Result ViewImpl::SetFrustrum(float frontClippingDistance, float backClippingDistance, float degrees)
{
float field = p_frontClippingDistance * tan(DegreesToRadians(p_degrees / 2));
float field = frontClippingDistance * tan(DegreesToRadians(degrees / 2));
Result result;
result = ResultVal(m_data->SetFront(p_frontClippingDistance));
result = ResultVal(m_data->SetFront(frontClippingDistance));
if (Succeeded(result)) {
result = ResultVal(m_data->SetBack(p_backClippingDistance));
result = ResultVal(m_data->SetBack(backClippingDistance));
}
if (Succeeded(result)) {
result = ResultVal(m_data->SetField(field));
@ -194,28 +194,28 @@ Result ViewImpl::SetFrustrum(float p_frontClippingDistance, float p_backClipping
}
// OFFSET: LEGO1 0x100a2f30
Result ViewImpl::SetBackgroundColor(float p_r, float p_g, float p_b)
Result ViewImpl::SetBackgroundColor(float r, float g, float b)
{
Result ret = Success;
// Note, this method in the shipped game is very diverged from
// the Tgl leak code.
ViewportAppData* data = ViewportGetData(m_data);
data->m_backgroundColorRed = p_r;
data->m_backgroundColorGreen = p_g;
data->m_backgroundColorBlue = p_b;
data->m_backgroundColorRed = r;
data->m_backgroundColorGreen = g;
data->m_backgroundColorBlue = b;
if (data->m_pLastRenderedFrame) {
ret = ResultVal(data->m_pLastRenderedFrame->SetSceneBackgroundRGB(p_r, p_g, p_b));
ret = ResultVal(data->m_pLastRenderedFrame->SetSceneBackgroundRGB(r, g, b));
}
return ret;
}
// OFFSET: LEGO1 0x100a2f80
Result ViewImpl::GetBackgroundColor(float* p_r, float* p_g, float* p_b)
Result ViewImpl::GetBackgroundColor(float* r, float* g, float* b)
{
ViewportAppData* data = ViewportGetData(m_data);
*p_r = data->m_backgroundColorRed;
*p_g = data->m_backgroundColorGreen;
*p_b = data->m_backgroundColorBlue;
*r = data->m_backgroundColorRed;
*g = data->m_backgroundColorGreen;
*b = data->m_backgroundColorBlue;
return Success;
}
@ -254,11 +254,11 @@ inline Result ViewPrepareFrameForRender(
}
// OFFSET: LEGO1 0x100a2fd0
Result ViewImpl::Render(const Light* p_camera)
Result ViewImpl::Render(const Light* pCamera)
{
ViewportAppData* appdata = ViewportGetData(m_data);
IDirect3DRMFrame* light = static_cast<const LightImpl*>(p_camera)->ImplementationData();
IDirect3DRMFrame* light = static_cast<const LightImpl*>(pCamera)->ImplementationData();
IDirect3DRMFrame* lastRendered = appdata->m_pLastRenderedFrame;
if (light != lastRendered) {
@ -332,23 +332,23 @@ Result ViewImpl::TransformWorldToScreen(const float world[3], float screen[4])
}
// OFFSET: LEGO1 0x100a3160
Result ViewImpl::TransformScreenToWorld(const float p_screen[4], float p_world[3])
Result ViewImpl::TransformScreenToWorld(const float screen[4], float world[3])
{
// 100% match minus instruction reordering.
D3DVECTOR d3dRMWorld;
D3DRMVECTOR4D d3dScreen;
d3dScreen.x = p_screen[0];
d3dScreen.y = p_screen[1];
d3dScreen.z = p_screen[2];
d3dScreen.w = p_screen[3];
d3dScreen.x = screen[0];
d3dScreen.y = screen[1];
d3dScreen.z = screen[2];
d3dScreen.w = screen[3];
Result result;
result = ResultVal(m_data->InverseTransform(&d3dRMWorld, &d3dScreen));
if (Succeeded(result)) {
p_world[0] = d3dRMWorld.x;
p_world[1] = d3dRMWorld.y;
p_world[2] = d3dRMWorld.z;
world[0] = d3dRMWorld.x;
world[1] = d3dRMWorld.y;
world[2] = d3dRMWorld.z;
}
return result;

View File

@ -123,20 +123,20 @@ class Renderer : public Object {
unsigned long height
) = 0;
virtual Camera* CreateCamera() = 0;
virtual Light* CreateLight(LightType, float p_r, float p_g, float p_b) = 0;
virtual Group* CreateGroup(const Group* p_parent = 0) = 0;
virtual Light* CreateLight(LightType, float r, float g, float b) = 0;
virtual Group* CreateGroup(const Group* pParent = 0) = 0;
// vtable+0x20
virtual Unk* CreateUnk() = 0;
virtual Texture* CreateTexture() = 0;
virtual Texture* CreateTexture(
int p_width,
int p_height,
int p_bitsPerTexel,
const void* p_pTexels,
int p_pTexelsArePersistent,
int p_paletteEntryCount,
const PaletteEntry* p_pEntries
int width,
int height,
int bitsPerTexel,
const void* pTexels,
int pTexelsArePersistent,
int paletteEntryCount,
const PaletteEntry* pEntries
) = 0;
virtual Result SetTextureDefaultShadeCount(unsigned long) = 0;
@ -174,11 +174,11 @@ class View : public Object {
// vtable+0x10
virtual Result SetCamera(const Camera*) = 0;
virtual Result SetProjection(ProjectionType) = 0;
virtual Result SetFrustrum(float p_frontClippingDistance, float p_backClippingDistance, float p_degrees) = 0;
virtual Result SetBackgroundColor(float p_r, float p_g, float p_b) = 0;
virtual Result SetFrustrum(float frontClippingDistance, float backClippingDistance, float degrees) = 0;
virtual Result SetBackgroundColor(float r, float g, float b) = 0;
// vtable+0x20
virtual Result GetBackgroundColor(float* p_r, float* p_g, float* p_b) = 0;
virtual Result GetBackgroundColor(float* r, float* g, float* b) = 0;
virtual Result Clear() = 0;
virtual Result Render(const Light*) = 0;
virtual Result ForceUpdate(unsigned long x, unsigned long y, unsigned long width, unsigned long height) = 0;
@ -229,13 +229,13 @@ class Camera : public Object {
class Light : public Object {
public:
virtual Result SetTransformation(const FloatMatrix4&) = 0;
virtual Result SetColor(float p_r, float p_g, float p_b) = 0;
virtual Result SetColor(float r, float g, float b) = 0;
};
// VTABLE 0x100dbbb0
class Mesh : public Object {
public:
virtual Result SetColor(float p_r, float p_g, float p_b, float p_a) = 0;
virtual Result SetColor(float r, float g, float b, float a) = 0;
virtual Result SetTexture(const Texture*) = 0;
virtual Result GetTexture(Texture*&) = 0;
@ -253,7 +253,7 @@ class Mesh : public Object {
class Group : public Object {
public:
virtual Result SetTransformation(const FloatMatrix4&) = 0;
virtual Result SetColor(float p_r, float p_g, float p_b, float p_a) = 0;
virtual Result SetColor(float r, float g, float b, float a) = 0;
virtual Result SetTexture(const Texture*) = 0;
virtual Result GetTexture(Texture*&) = 0;
virtual Result SetMaterialMode(MaterialMode) = 0;
@ -275,15 +275,15 @@ class Group : public Object {
class Unk : public Object {
public:
virtual Result SetMeshData(
unsigned long p_faceCount,
unsigned long p_vertexCount,
const float (*p_positions)[3],
const float (*p_normals)[3],
const float (*p_textureCoordinates)[2],
unsigned long p_vertexPerFaceCount,
unsigned long* p_faceData
unsigned long faceCount,
unsigned long vertexCount,
const float (*pPositions)[3],
const float (*pNormals)[3],
const float (*pTextureCoordinates)[2],
unsigned long vertexPerFaceCount,
unsigned long* pFaceData
) = 0;
virtual Result GetBoundingBox(float p_min[3], float p_max[3]) = 0;
virtual Result GetBoundingBox(float min[3], float max[3]) = 0;
virtual Unk* Clone() = 0;
};
@ -291,20 +291,20 @@ class Unk : public Object {
class Texture : public Object {
public:
// vtable+0x08
virtual Result SetTexels(int p_width, int p_height, int p_bitsPerTexel, void* p_texels) = 0;
virtual void FillRowsOfTexture(int p_y, int p_height, void* p_buffer) = 0;
virtual Result SetTexels(int width, int height, int bitsPerTexel, void* pTexels) = 0;
virtual void FillRowsOfTexture(int y, int height, void* pBuffer) = 0;
// vtable+0x10
virtual Result Changed(int p_texelsChanged, int p_paletteChanged) = 0;
virtual Result Changed(int texelsChanged, int paletteChanged) = 0;
virtual Result GetBufferAndPalette(
int* p_width,
int* p_height,
int* p_depth,
void** p_buffer,
int* p_paletteSize,
PaletteEntry** p_palette
int* pWidth,
int* pHeight,
int* pDepth,
void** ppBuffer,
int* pPaletteSize,
PaletteEntry** ppPalette
) = 0;
virtual Result SetPalette(int p_entryCount, PaletteEntry* p_entries) = 0;
virtual Result SetPalette(int entryCount, PaletteEntry* pEntries) = 0;
};
} // namespace Tgl