Get the game working on 64bit systems (#113)

* Use int instead of long

* Move static_asserts to the bottom

---------

Co-authored-by: Anonymous Maarten <anonymous.maarten@gmail.com>
This commit is contained in:
Anders Jenbo 2025-05-19 17:56:12 +02:00 committed by GitHub
parent fdde353b1f
commit 4e2df63d9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 155 additions and 140 deletions

View File

@ -154,7 +154,7 @@ double Lego3DView::Render(double p_und)
} }
// FUNCTION: LEGO1 0x100ab2b0 // FUNCTION: LEGO1 0x100ab2b0
ViewROI* Lego3DView::Pick(unsigned long x, unsigned long y) ViewROI* Lego3DView::Pick(unsigned int x, unsigned int y)
{ {
return m_pViewManager->Pick(GetView(), x, y); return m_pViewManager->Pick(GetView(), x, y);
} }

View File

@ -27,7 +27,7 @@ class Lego3DView : public LegoView1 {
double Render(double p_und); double Render(double p_und);
ViewROI* Pick(unsigned long x, unsigned long y); ViewROI* Pick(unsigned int x, unsigned int y);
ViewROI* GetPointOfView(); ViewROI* GetPointOfView();
ViewManager* GetViewManager(); ViewManager* GetViewManager();

View File

@ -204,9 +204,9 @@ double TglSurface::Render()
{ {
#if 0 #if 0
// FIXME: Tgl::Device::GetDrawnTriangleCount does not exist // FIXME: Tgl::Device::GetDrawnTriangleCount does not exist
unsigned long triangleCount = m_pDevice->GetDrawnTriangleCount(); unsigned int triangleCount = m_pDevice->GetDrawnTriangleCount();
#else #else
unsigned long triangleCount = 0; unsigned int triangleCount = 0;
#endif #endif
m_triangleRateMeter.IncreaseOperationCount(triangleCount - m_triangleCount - 1); m_triangleRateMeter.IncreaseOperationCount(triangleCount - m_triangleCount - 1);

View File

@ -51,14 +51,14 @@ class TglSurface {
Tgl::Group* GetScene() const { return m_pScene; } Tgl::Group* GetScene() const { return m_pScene; }
// FUNCTION: BETA10 0x1017cbc0 // FUNCTION: BETA10 0x1017cbc0
unsigned long GetWidth() const { return m_width; } unsigned int GetWidth() const { return m_width; }
// FUNCTION: BETA10 0x1017cbe0 // FUNCTION: BETA10 0x1017cbe0
unsigned long GetHeight() const { return m_height; } unsigned int GetHeight() const { return m_height; }
double GetRenderingRate() const { return m_renderingRateMeter.Frequency(); } double GetRenderingRate() const { return m_renderingRateMeter.Frequency(); }
double GetFrameRate() const { return m_frameRateMeter.Frequency(); } double GetFrameRate() const { return m_frameRateMeter.Frequency(); }
unsigned long GetFrameCount() const { return m_frameCount; } unsigned int GetFrameCount() const { return m_frameCount; }
#ifdef _DEBUG #ifdef _DEBUG
double GetTriangleRate() const { return m_triangleRateMeter.Frequency(); } double GetTriangleRate() const { return m_triangleRateMeter.Frequency(); }
#endif #endif
@ -73,8 +73,8 @@ class TglSurface {
Tgl::View* m_pView; // 0x10 Tgl::View* m_pView; // 0x10
Tgl::Group* m_pScene; // 0x14 Tgl::Group* m_pScene; // 0x14
unsigned long m_width; // 0x18 unsigned int m_width; // 0x18
unsigned long m_height; // 0x1c unsigned int m_height; // 0x1c
BOOL m_isInitialized; // 0x20 BOOL m_isInitialized; // 0x20
BOOL m_stopRendering; // 0x24 BOOL m_stopRendering; // 0x24
@ -82,10 +82,10 @@ class TglSurface {
// statistics // statistics
MxFrequencyMeter m_renderingRateMeter; // 0x28 MxFrequencyMeter m_renderingRateMeter; // 0x28
MxFrequencyMeter m_frameRateMeter; // 0x48 MxFrequencyMeter m_frameRateMeter; // 0x48
unsigned long m_frameCount; // 0x68 unsigned int m_frameCount; // 0x68
#ifdef _DEBUG #ifdef _DEBUG
MxFrequencyMeter m_triangleRateMeter; MxFrequencyMeter m_triangleRateMeter;
unsigned long m_triangleCount; unsigned int m_triangleCount;
#endif #endif
}; };

View File

@ -32,8 +32,8 @@ typedef char LegoS8;
typedef unsigned char LegoU8; typedef unsigned char LegoU8;
typedef short LegoS16; typedef short LegoS16;
typedef unsigned short LegoU16; typedef unsigned short LegoU16;
typedef long LegoS32; typedef int LegoS32;
typedef unsigned long LegoU32; typedef unsigned int LegoU32;
typedef float LegoFloat; typedef float LegoFloat;
typedef char LegoChar; typedef char LegoChar;
@ -41,4 +41,16 @@ typedef LegoU8 LegoBool;
typedef LegoS32 LegoTime; typedef LegoS32 LegoTime;
typedef LegoS32 LegoResult; typedef LegoS32 LegoResult;
static_assert(sizeof(LegoS8) == 1, "sizeof(LegoS8) == 1");
static_assert(sizeof(LegoU8) == 1, "sizeof(LegoU8) == 1");
static_assert(sizeof(LegoS16) == 2, "sizeof(LegoS16) == 2");
static_assert(sizeof(LegoU16) == 2, "sizeof(LegoU16) == 2");
static_assert(sizeof(LegoS32) == 4, "sizeof(LegoS32) == 4");
static_assert(sizeof(LegoU32) == 4, "sizeof(LegoU32) == 4");
static_assert(sizeof(LegoFloat) == 4, "sizeof(LegoFloat) == 4");
static_assert(sizeof(LegoChar) == 1, "sizeof(LegoChar) == 1");
static_assert(sizeof(LegoChar) == 1, "sizeof(LegoChar) == 1");
static_assert(sizeof(LegoTime) == 4, "sizeof(LegoTime) == 4");
static_assert(sizeof(LegoResult) == 4, "sizeof(LegoResult) == 4");
#endif // __LEGOTYPES_H #endif // __LEGOTYPES_H

View File

@ -111,14 +111,14 @@ class MxFrequencyMeter {
double Frequency() const; double Frequency() const;
void Reset(); void Reset();
unsigned long OperationCount() const; unsigned int OperationCount() const;
double ElapsedSeconds() const; double ElapsedSeconds() const;
void IncreaseOperationCount(unsigned long); void IncreaseOperationCount(unsigned int);
private: private:
unsigned long m_operationCount; // 0x00 unsigned int m_operationCount; // 0x00
MxStopWatch m_stopWatch; // 0x08 MxStopWatch m_stopWatch; // 0x08
}; };
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
@ -170,13 +170,13 @@ inline void MxFrequencyMeter::Reset()
m_operationCount = 0; m_operationCount = 0;
} }
inline unsigned long MxFrequencyMeter::OperationCount() const inline unsigned int MxFrequencyMeter::OperationCount() const
{ {
return m_operationCount; return m_operationCount;
} }
// FUNCTION: BETA10 0x1017df40 // FUNCTION: BETA10 0x1017df40
inline void MxFrequencyMeter::IncreaseOperationCount(unsigned long delta) inline void MxFrequencyMeter::IncreaseOperationCount(unsigned int delta)
{ {
m_operationCount += delta; m_operationCount += delta;
} }

View File

@ -13,7 +13,7 @@ class MxQuaternionTransformer {
MxQuaternionTransformer() : m_flags(0) {} MxQuaternionTransformer() : m_flags(0) {}
inline long NormalizeDirection(); inline int NormalizeDirection();
inline void SetStartEnd(Matrix4& p_m1, Matrix4& p_m2); inline void SetStartEnd(Matrix4& p_m1, Matrix4& p_m2);
inline void SetStart(Matrix4& p_m); inline void SetStart(Matrix4& p_m);
inline void SetEnd(Matrix4& p_m); inline void SetEnd(Matrix4& p_m);
@ -38,7 +38,7 @@ class MxQuaternionTransformer {
}; };
// FUNCTION: LEGO1 0x10004520 // FUNCTION: LEGO1 0x10004520
long MxQuaternionTransformer::NormalizeDirection() int MxQuaternionTransformer::NormalizeDirection()
{ {
if (!m_flags) { if (!m_flags) {
return -1; return -1;

View File

@ -1,34 +1,21 @@
#ifndef MXTYPES_H #ifndef MXTYPES_H
#define MXTYPES_H #define MXTYPES_H
#include <stdint.h>
typedef unsigned char MxU8; typedef unsigned char MxU8;
typedef signed char MxS8; typedef signed char MxS8;
typedef unsigned short MxU16; typedef unsigned short MxU16;
typedef signed short MxS16; typedef signed short MxS16;
typedef unsigned int MxU32; typedef unsigned int MxU32;
typedef signed int MxS32; typedef signed int MxS32;
#ifdef _MSC_VER typedef uint64_t MxU64;
typedef unsigned __int64 MxU64; typedef int64_t MxS64;
typedef signed __int64 MxS64;
#else
typedef unsigned long long int MxU64;
typedef signed long long int MxS64;
#endif
typedef float MxFloat; typedef float MxFloat;
typedef double MxDouble; typedef double MxDouble;
// On MSVC, a long is 32-bit, but on GCC/Clang, it's 64-bit. LEGO Island obviously
// assumes the former in all cases, which could become an issue in the future.
// The "longs" can't all be changed to "ints" (which are 32-bit on both) because
// this will break DLL export compatibility. Therefore, we define MxLong/MxULong,
// which is guaranteed to be 32-bit, and guaranteed to be a "long" on MSVC.
#if defined(_MSC_VER)
typedef long MxLong;
typedef unsigned long MxULong;
#else
typedef int MxLong; typedef int MxLong;
typedef unsigned int MxULong; typedef unsigned int MxULong;
#endif
typedef MxS32 MxTime; typedef MxS32 MxTime;
@ -43,6 +30,7 @@ typedef MxLong MxResult;
#endif #endif
typedef MxU8 MxBool; typedef MxU8 MxBool;
static_assert(sizeof(MxBool) == 1, "Incorrect size");
#ifndef TRUE #ifndef TRUE
#define TRUE 1 #define TRUE 1
@ -74,4 +62,19 @@ typedef union {
// BYTE all; // ? // BYTE all; // ?
} FlagBitfield; } FlagBitfield;
static_assert(sizeof(MxU8) == 1, "sizeof(MxU8) == 1");
static_assert(sizeof(MxS8) == 1, "sizeof(MxS8) == 1");
static_assert(sizeof(MxU16) == 2, "sizeof(MxU16) == 2");
static_assert(sizeof(MxS16) == 2, "sizeof(MxS16) == 2");
static_assert(sizeof(MxU32) == 4, "sizeof(MxU32) == 4");
static_assert(sizeof(MxS32) == 4, "sizeof(MxS32) == 4");
static_assert(sizeof(MxU64) == 8, "sizeof(MxU64) == 8");
static_assert(sizeof(MxS64) == 8, "sizeof(MxS64) == 8");
static_assert(sizeof(MxFloat) == 4, "sizeof(MxFloat) == 4");
static_assert(sizeof(MxDouble) == 8, "sizeof(MxDouble) == 8");
static_assert(sizeof(MxLong) == 4, "sizeof(MxLong) == 4");
static_assert(sizeof(MxULong) == 4, "sizeof(MxULong) == 4");
static_assert(sizeof(MxTime) == 4, "sizeof(MxTime) == 4");
static_assert(sizeof(MxResult) == 4, "sizeof(MxResult) == 4");
#endif // MXTYPES_H #endif // MXTYPES_H

View File

@ -17,13 +17,13 @@ void* DeviceImpl::ImplementationDataPtr()
} }
// FUNCTION: LEGO1 0x100a2c00 // FUNCTION: LEGO1 0x100a2c00
unsigned long DeviceImpl::GetWidth() unsigned int DeviceImpl::GetWidth()
{ {
return m_data->GetWidth(); return m_data->GetWidth();
} }
// FUNCTION: LEGO1 0x100a2c10 // FUNCTION: LEGO1 0x100a2c10
unsigned long DeviceImpl::GetHeight() unsigned int DeviceImpl::GetHeight()
{ {
return m_data->GetHeight(); return m_data->GetHeight();
} }
@ -51,7 +51,7 @@ Result DeviceImpl::SetShadingModel(ShadingModel model)
} }
// FUNCTION: LEGO1 0x100a2ca0 // FUNCTION: LEGO1 0x100a2ca0
Result DeviceImpl::SetShadeCount(unsigned long shadeCount) Result DeviceImpl::SetShadeCount(unsigned int shadeCount)
{ {
return ResultVal(m_data->SetShades(shadeCount)); return ResultVal(m_data->SetShades(shadeCount));
} }

View File

@ -64,10 +64,10 @@ class RendererImpl : public Renderer {
View* CreateView( View* CreateView(
const Device*, const Device*,
const Camera*, const Camera*,
unsigned long x, unsigned int x,
unsigned long y, unsigned int y,
unsigned long width, unsigned int width,
unsigned long height unsigned int height
) override; ) override;
Camera* CreateCamera() override; Camera* CreateCamera() override;
Light* CreateLight(LightType, float r, float g, float b) override; Light* CreateLight(LightType, float r, float g, float b) override;
@ -86,10 +86,10 @@ class RendererImpl : public Renderer {
) override; ) override;
Texture* CreateTexture() override; Texture* CreateTexture() override;
Result SetTextureDefaultShadeCount(unsigned long) override; Result SetTextureDefaultShadeCount(unsigned int) override;
// vtable+0x30 // vtable+0x30
Result SetTextureDefaultColorCount(unsigned long) override; Result SetTextureDefaultColorCount(unsigned int) override;
HRESULT CreateTextureFromSurface(LPDIRECTDRAWSURFACE pSurface, LPDIRECT3DRMTEXTURE2* pTexture2) HRESULT CreateTextureFromSurface(LPDIRECTDRAWSURFACE pSurface, LPDIRECT3DRMTEXTURE2* pTexture2)
{ {
@ -110,10 +110,10 @@ class RendererImpl : public Renderer {
inline Result CreateView( inline Result CreateView(
const DeviceImpl& rDevice, const DeviceImpl& rDevice,
const CameraImpl& rCamera, const CameraImpl& rCamera,
unsigned long x, unsigned int x,
unsigned long y, unsigned int y,
unsigned long width, unsigned int width,
unsigned long height, unsigned int height,
ViewImpl& rView ViewImpl& rView
); );
inline Result CreateMeshBuilder(MeshBuilderImpl& rMesh); inline Result CreateMeshBuilder(MeshBuilderImpl& rMesh);
@ -170,13 +170,13 @@ class DeviceImpl : public Device {
void* ImplementationDataPtr() override; void* ImplementationDataPtr() override;
// vtable+0x08 // vtable+0x08
unsigned long GetWidth() override; unsigned int GetWidth() override;
unsigned long GetHeight() override; unsigned int GetHeight() override;
// vtable+0x10 // vtable+0x10
Result SetColorModel(ColorModel) override; Result SetColorModel(ColorModel) override;
Result SetShadingModel(ShadingModel) override; Result SetShadingModel(ShadingModel) override;
Result SetShadeCount(unsigned long) override; Result SetShadeCount(unsigned int) override;
Result SetDither(int) override; Result SetDither(int) override;
// vtable+0x20 // vtable+0x20
@ -243,14 +243,14 @@ class ViewImpl : public View {
Result GetBackgroundColor(float* r, float* g, float* b) override; Result GetBackgroundColor(float* r, float* g, float* b) override;
Result Clear() override; Result Clear() override;
Result Render(const Group*) override; Result Render(const Group*) override;
Result ForceUpdate(unsigned long x, unsigned long y, unsigned long width, unsigned long height) override; Result ForceUpdate(unsigned int x, unsigned int y, unsigned int width, unsigned int height) override;
// vtable+0x30 // vtable+0x30
Result TransformWorldToScreen(const float world[3], float screen[4]) override; Result TransformWorldToScreen(const float world[3], float screen[4]) override;
Result TransformScreenToWorld(const float screen[4], float world[3]) override; Result TransformScreenToWorld(const float screen[4], float world[3]) override;
Result Pick( Result Pick(
unsigned long x, unsigned int x,
unsigned long y, unsigned int y,
const Group** ppGroupsToPickFrom, const Group** ppGroupsToPickFrom,
int groupsToPickFromCount, int groupsToPickFromCount,
const Group**& rppPickedGroups, const Group**& rppPickedGroups,
@ -274,8 +274,8 @@ class ViewImpl : public View {
Result SetCamera(const CameraImpl& rCamera); Result SetCamera(const CameraImpl& rCamera);
Result Render(const GroupImpl& rScene); Result Render(const GroupImpl& rScene);
Result Pick( Result Pick(
unsigned long x, unsigned int x,
unsigned long y, unsigned int y,
const GroupImpl** ppGroupsToPickFrom, const GroupImpl** ppGroupsToPickFrom,
int groupsToPickFromCount, int groupsToPickFromCount,
const Group**& rppPickedGroups, const Group**& rppPickedGroups,
@ -533,13 +533,13 @@ class MeshBuilderImpl : public MeshBuilder {
// vtable+0x08 // vtable+0x08
Mesh* CreateMesh( Mesh* CreateMesh(
unsigned long faceCount, unsigned int faceCount,
unsigned long vertexCount, unsigned int vertexCount,
float (*pPositions)[3], float (*pPositions)[3],
float (*pNormals)[3], float (*pNormals)[3],
float (*pTextureCoordinates)[2], float (*pTextureCoordinates)[2],
unsigned long (*pFaceIndices)[3], unsigned int (*pFaceIndices)[3],
unsigned long (*pTextureIndices)[3], unsigned int (*pTextureIndices)[3],
ShadingModel shadingModel ShadingModel shadingModel
) override; ) override;
Result GetBoundingBox(float min[3], float max[3]) const override; Result GetBoundingBox(float min[3], float max[3]) const override;
@ -562,13 +562,13 @@ class MeshBuilderImpl : public MeshBuilder {
private: private:
inline Result CreateMeshImpl( inline Result CreateMeshImpl(
MeshImpl* pMeshImpl, MeshImpl* pMeshImpl,
unsigned long faceCount, unsigned int faceCount,
unsigned long vertexCount, unsigned int vertexCount,
float (*pPositions)[3], float (*pPositions)[3],
float (*pNormals)[3], float (*pNormals)[3],
float (*pTextureCoordinates)[2], float (*pTextureCoordinates)[2],
unsigned long (*pFaceIndices)[3], unsigned int (*pFaceIndices)[3],
unsigned long (*pTextureIndices)[3], unsigned int (*pTextureIndices)[3],
ShadingModel shadingModel ShadingModel shadingModel
); );

View File

@ -16,13 +16,13 @@ void* MeshBuilderImpl::ImplementationDataPtr()
// FUNCTION: LEGO1 0x100a3840 // FUNCTION: LEGO1 0x100a3840
Mesh* MeshBuilderImpl::CreateMesh( Mesh* MeshBuilderImpl::CreateMesh(
unsigned long faceCount, unsigned int faceCount,
unsigned long vertexCount, unsigned int vertexCount,
float (*pPositions)[3], float (*pPositions)[3],
float (*pNormals)[3], float (*pNormals)[3],
float (*pTextureCoordinates)[2], float (*pTextureCoordinates)[2],
unsigned long (*pFaceIndices)[3], unsigned int (*pFaceIndices)[3],
unsigned long (*pTextureIndices)[3], unsigned int (*pTextureIndices)[3],
ShadingModel shadingModel ShadingModel shadingModel
) )
{ {
@ -57,18 +57,18 @@ inline Result MeshSetTextureMappingMode(MeshImpl::MeshData* pMesh, TextureMappin
inline Result CreateMesh( inline Result CreateMesh(
IDirect3DRMMesh* pD3DRM, IDirect3DRMMesh* pD3DRM,
unsigned long faceCount, unsigned int faceCount,
unsigned long vertexCount, unsigned int vertexCount,
float (*pPositions)[3], float (*pPositions)[3],
float (*pNormals)[3], float (*pNormals)[3],
float (*pTextureCoordinates)[2], float (*pTextureCoordinates)[2],
unsigned long (*pFaceIndices)[3], unsigned int (*pFaceIndices)[3],
unsigned long (*pTextureIndices)[3], unsigned int (*pTextureIndices)[3],
ShadingModel shadingModel, ShadingModel shadingModel,
MeshImpl::MeshDataType& rpMesh MeshImpl::MeshDataType& rpMesh
) )
{ {
unsigned long* faceIndices = (unsigned long*) pFaceIndices; unsigned int* faceIndices = (unsigned int*) pFaceIndices;
D3DRMGROUPINDEX groupIndex = 0; D3DRMGROUPINDEX groupIndex = 0;
int count = faceCount * 3; int count = faceCount * 3;
int index = 0; int index = 0;
@ -83,7 +83,7 @@ inline Result CreateMesh(
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
if ((*((unsigned short*) &faceIndices[i] + 1) >> 0x0f) & 0x01) { if ((*((unsigned short*) &faceIndices[i] + 1) >> 0x0f) & 0x01) {
unsigned long j = *(unsigned short*) &faceIndices[i]; unsigned int j = *(unsigned short*) &faceIndices[i];
vertices[index].position.x = pPositions[j][0]; vertices[index].position.x = pPositions[j][0];
vertices[index].position.y = pPositions[j][1]; vertices[index].position.y = pPositions[j][1];
vertices[index].position.z = pPositions[j][2]; vertices[index].position.z = pPositions[j][2];
@ -93,7 +93,7 @@ inline Result CreateMesh(
vertices[index].normal.z = pNormals[j][2]; vertices[index].normal.z = pNormals[j][2];
if (pTextureIndices != NULL && pTextureCoordinates != NULL) { if (pTextureIndices != NULL && pTextureCoordinates != NULL) {
j = ((unsigned long*) pTextureIndices)[i]; j = ((unsigned int*) pTextureIndices)[i];
vertices[index].tu = pTextureCoordinates[j][0]; vertices[index].tu = pTextureCoordinates[j][0];
vertices[index].tv = pTextureCoordinates[j][1]; vertices[index].tv = pTextureCoordinates[j][1];
} }
@ -137,13 +137,13 @@ inline Result CreateMesh(
inline Result MeshBuilderImpl::CreateMeshImpl( inline Result MeshBuilderImpl::CreateMeshImpl(
MeshImpl* pMeshImpl, MeshImpl* pMeshImpl,
unsigned long faceCount, unsigned int faceCount,
unsigned long vertexCount, unsigned int vertexCount,
float (*pPositions)[3], float (*pPositions)[3],
float (*pNormals)[3], float (*pNormals)[3],
float (*pTextureCoordinates)[2], float (*pTextureCoordinates)[2],
unsigned long (*pFaceIndices)[3], unsigned int (*pFaceIndices)[3],
unsigned long (*pTextureIndices)[3], unsigned int (*pTextureIndices)[3],
ShadingModel shadingModel ShadingModel shadingModel
) )
{ {

View File

@ -130,10 +130,10 @@ inline Result RendererCreateView(
IDirect3DRM2* pRenderer, IDirect3DRM2* pRenderer,
const IDirect3DRMDevice2* pDevice, const IDirect3DRMDevice2* pDevice,
const IDirect3DRMFrame2* pCamera, const IDirect3DRMFrame2* pCamera,
unsigned long x, unsigned int x,
unsigned long y, unsigned int y,
unsigned long width, unsigned int width,
unsigned long height, unsigned int height,
IDirect3DRMViewport*& rpView IDirect3DRMViewport*& rpView
) )
{ {
@ -162,10 +162,10 @@ inline Result RendererCreateView(
inline Result RendererImpl::CreateView( inline Result RendererImpl::CreateView(
const DeviceImpl& rDevice, const DeviceImpl& rDevice,
const CameraImpl& rCamera, const CameraImpl& rCamera,
unsigned long x, unsigned int x,
unsigned long y, unsigned int y,
unsigned long width, unsigned int width,
unsigned long height, unsigned int height,
ViewImpl& rView ViewImpl& rView
) )
{ {
@ -191,10 +191,10 @@ inline Result RendererImpl::CreateView(
View* RendererImpl::CreateView( View* RendererImpl::CreateView(
const Device* pDevice, const Device* pDevice,
const Camera* pCamera, const Camera* pCamera,
unsigned long x, unsigned int x,
unsigned long y, unsigned int y,
unsigned long width, unsigned int width,
unsigned long height unsigned int height
) )
{ {
assert(m_data); assert(m_data);
@ -512,13 +512,13 @@ Texture* RendererImpl::CreateTexture()
} }
// FUNCTION: LEGO1 0x100a2270 // FUNCTION: LEGO1 0x100a2270
Result RendererImpl::SetTextureDefaultShadeCount(unsigned long shadeCount) Result RendererImpl::SetTextureDefaultShadeCount(unsigned int shadeCount)
{ {
return ResultVal(m_data->SetDefaultTextureShades(shadeCount)); return ResultVal(m_data->SetDefaultTextureShades(shadeCount));
} }
// FUNCTION: LEGO1 0x100a2290 // FUNCTION: LEGO1 0x100a2290
Result RendererImpl::SetTextureDefaultColorCount(unsigned long colorCount) Result RendererImpl::SetTextureDefaultColorCount(unsigned int colorCount)
{ {
return ResultVal(m_data->SetDefaultTextureColors(colorCount)); return ResultVal(m_data->SetDefaultTextureColors(colorCount));
} }

View File

@ -475,10 +475,10 @@ Result ViewImpl::Render(const Group* pGroup)
// FUNCTION: BETA10 0x1016edd0 // FUNCTION: BETA10 0x1016edd0
inline Result ViewForceUpdate( inline Result ViewForceUpdate(
IDirect3DRMViewport* pViewport, IDirect3DRMViewport* pViewport,
unsigned long x, unsigned int x,
unsigned long y, unsigned int y,
unsigned long width, unsigned int width,
unsigned long height unsigned int height
) )
{ {
return ResultVal(pViewport->ForceUpdate(x, y, x + width - 1, y + height - 1)); return ResultVal(pViewport->ForceUpdate(x, y, x + width - 1, y + height - 1));
@ -486,7 +486,7 @@ inline Result ViewForceUpdate(
// FUNCTION: LEGO1 0x100a3080 // FUNCTION: LEGO1 0x100a3080
// FUNCTION: BETA10 0x1016ed60 // FUNCTION: BETA10 0x1016ed60
Result ViewImpl::ForceUpdate(unsigned long x, unsigned long y, unsigned long width, unsigned long height) Result ViewImpl::ForceUpdate(unsigned int x, unsigned int y, unsigned int width, unsigned int height)
{ {
assert(m_data); assert(m_data);
@ -495,8 +495,8 @@ Result ViewImpl::ForceUpdate(unsigned long x, unsigned long y, unsigned long wid
// FUNCTION: BETA10 0x101710f0 // FUNCTION: BETA10 0x101710f0
inline Result ViewImpl::Pick( inline Result ViewImpl::Pick(
unsigned long x, unsigned int x,
unsigned long y, unsigned int y,
const GroupImpl** ppGroupsToPickFrom, const GroupImpl** ppGroupsToPickFrom,
int groupsToPickFromCount, int groupsToPickFromCount,
const Group**& rppPickedGroups, const Group**& rppPickedGroups,
@ -519,8 +519,8 @@ inline Result ViewImpl::Pick(
// FUNCTION: LEGO1 0x100a30c0 // FUNCTION: LEGO1 0x100a30c0
// FUNCTION: BETA10 0x1016ee10 // FUNCTION: BETA10 0x1016ee10
Result ViewImpl::Pick( Result ViewImpl::Pick(
unsigned long x, unsigned int x,
unsigned long y, unsigned int y,
const Group** ppGroupsToPickFrom, const Group** ppGroupsToPickFrom,
int groupsToPickFromCount, int groupsToPickFromCount,
const Group**& rppPickedGroups, const Group**& rppPickedGroups,

View File

@ -140,10 +140,10 @@ class Renderer : public Object {
virtual View* CreateView( virtual View* CreateView(
const Device*, const Device*,
const Camera*, const Camera*,
unsigned long x, unsigned int x,
unsigned long y, unsigned int y,
unsigned long width, unsigned int width,
unsigned long height unsigned int height
) = 0; ) = 0;
virtual Camera* CreateCamera() = 0; virtual Camera* CreateCamera() = 0;
virtual Light* CreateLight(LightType, float r, float g, float b) = 0; virtual Light* CreateLight(LightType, float r, float g, float b) = 0;
@ -161,10 +161,10 @@ class Renderer : public Object {
const PaletteEntry* pEntries const PaletteEntry* pEntries
) = 0; ) = 0;
virtual Texture* CreateTexture() = 0; virtual Texture* CreateTexture() = 0;
virtual Result SetTextureDefaultShadeCount(unsigned long) = 0; virtual Result SetTextureDefaultShadeCount(unsigned int) = 0;
// vtable+0x30 // vtable+0x30
virtual Result SetTextureDefaultColorCount(unsigned long) = 0; virtual Result SetTextureDefaultColorCount(unsigned int) = 0;
// SYNTHETIC: BETA10 0x10169ae0 // SYNTHETIC: BETA10 0x10169ae0
// Tgl::Renderer::Renderer // Tgl::Renderer::Renderer
@ -185,13 +185,13 @@ Renderer* CreateRenderer();
class Device : public Object { class Device : public Object {
public: public:
// vtable+0x08 // vtable+0x08
virtual unsigned long GetWidth() = 0; virtual unsigned int GetWidth() = 0;
virtual unsigned long GetHeight() = 0; virtual unsigned int GetHeight() = 0;
// vtable+0x10 // vtable+0x10
virtual Result SetColorModel(ColorModel) = 0; virtual Result SetColorModel(ColorModel) = 0;
virtual Result SetShadingModel(ShadingModel) = 0; virtual Result SetShadingModel(ShadingModel) = 0;
virtual Result SetShadeCount(unsigned long) = 0; virtual Result SetShadeCount(unsigned int) = 0;
virtual Result SetDither(int) = 0; virtual Result SetDither(int) = 0;
// vtable+0x20 // vtable+0x20
@ -228,7 +228,7 @@ class View : public Object {
virtual Result GetBackgroundColor(float* r, float* g, float* b) = 0; virtual Result GetBackgroundColor(float* r, float* g, float* b) = 0;
virtual Result Clear() = 0; virtual Result Clear() = 0;
virtual Result Render(const Group*) = 0; virtual Result Render(const Group*) = 0;
virtual Result ForceUpdate(unsigned long x, unsigned long y, unsigned long width, unsigned long height) = 0; virtual Result ForceUpdate(unsigned int x, unsigned int y, unsigned int width, unsigned int height) = 0;
// vtable+0x30 // vtable+0x30
virtual Result TransformWorldToScreen(const float world[3], float screen[4]) = 0; virtual Result TransformWorldToScreen(const float world[3], float screen[4]) = 0;
@ -257,8 +257,8 @@ class View : public Object {
// output parameter // output parameter
// size of rppPickedGroups // size of rppPickedGroups
virtual Result Pick( virtual Result Pick(
unsigned long x, unsigned int x,
unsigned long y, unsigned int y,
const Group** ppGroupsToPickFrom, const Group** ppGroupsToPickFrom,
int groupsToPickFromCount, int groupsToPickFromCount,
const Group**& rppPickedGroups, const Group**& rppPickedGroups,
@ -382,13 +382,13 @@ class Group : public Object {
class MeshBuilder : public Object { class MeshBuilder : public Object {
public: public:
virtual Mesh* CreateMesh( virtual Mesh* CreateMesh(
unsigned long faceCount, unsigned int faceCount,
unsigned long vertexCount, unsigned int vertexCount,
float (*pPositions)[3], float (*pPositions)[3],
float (*pNormals)[3], float (*pNormals)[3],
float (*pTextureCoordinates)[2], float (*pTextureCoordinates)[2],
unsigned long (*pFaceIndices)[3], unsigned int (*pFaceIndices)[3],
unsigned long (*pTextureIndices)[3], unsigned int (*pTextureIndices)[3],
ShadingModel shadingModel ShadingModel shadingModel
) = 0; ) = 0;
virtual Result GetBoundingBox(float min[3], float max[3]) const = 0; virtual Result GetBoundingBox(float min[3], float max[3]) const = 0;

View File

@ -486,7 +486,7 @@ float ViewManager::ProjectedSize(const BoundingSphere& p_bounding_sphere)
} }
// FUNCTION: LEGO1 0x100a6e00 // FUNCTION: LEGO1 0x100a6e00
ViewROI* ViewManager::Pick(Tgl::View* p_view, unsigned long x, unsigned long y) ViewROI* ViewManager::Pick(Tgl::View* p_view, unsigned int x, unsigned int y)
{ {
LPDIRECT3DRMPICKEDARRAY picked = NULL; LPDIRECT3DRMPICKEDARRAY picked = NULL;
ViewROI* result = NULL; ViewROI* result = NULL;

View File

@ -33,7 +33,7 @@ class ViewManager {
void RemoveROIDetailFromScene(ViewROI* p_roi); void RemoveROIDetailFromScene(ViewROI* p_roi);
void SetPOVSource(const OrientableROI* point_of_view); void SetPOVSource(const OrientableROI* point_of_view);
float ProjectedSize(const BoundingSphere& p_bounding_sphere); float ProjectedSize(const BoundingSphere& p_bounding_sphere);
ViewROI* Pick(Tgl::View* p_view, unsigned long x, unsigned long y); ViewROI* Pick(Tgl::View* p_view, unsigned int x, unsigned int y);
void SetResolution(int width, int height); void SetResolution(int width, int height);
void SetFrustrum(float fov, float front, float back); void SetFrustrum(float fov, float front, float back);
inline void ManageVisibilityAndDetailRecursively(ViewROI* p_roi, int p_und); inline void ManageVisibilityAndDetailRecursively(ViewROI* p_roi, int p_und);

View File

@ -66,7 +66,7 @@ typedef DWORD* LPDWORD;
typedef int BOOL, WINBOOL, INT; typedef int BOOL, WINBOOL, INT;
typedef unsigned int UINT; typedef unsigned int UINT;
typedef unsigned short WORD; typedef unsigned short WORD;
typedef long* LPLONG; typedef int* LPLONG;
typedef void* LPVOID; typedef void* LPVOID;
typedef char* LPSTR; typedef char* LPSTR;
typedef const char* LPCSTR; typedef const char* LPCSTR;
@ -75,7 +75,7 @@ typedef HANDLE HICON, HFONT;
typedef struct HINSTANCE__* HINSTANCE; typedef struct HINSTANCE__* HINSTANCE;
typedef SDL_Window *HMENU, *HWND; typedef SDL_Window *HMENU, *HWND;
typedef HANDLE HMODULE, HDC, HPALETTE, HFILE, HCURSOR; typedef HANDLE HMODULE, HDC, HPALETTE, HFILE, HCURSOR;
typedef LONG LSTATUS, HKEY, REGSAM; typedef int LSTATUS, HKEY, REGSAM;
// --- Structs --- // --- Structs ---
struct tagPOINT { struct tagPOINT {
@ -218,14 +218,14 @@ inline HFONT CreateFont(
int, int,
int, int,
int, int,
unsigned long, unsigned int,
unsigned long, unsigned int,
unsigned long, unsigned int,
unsigned long, unsigned int,
unsigned long, unsigned int,
unsigned long, unsigned int,
unsigned long, unsigned int,
unsigned long, unsigned int,
LPCSTR LPCSTR
) )
{ {

View File

@ -13,7 +13,7 @@
// --- Typedefs --- // --- Typedefs ---
typedef float D3DVAL; typedef float D3DVAL;
typedef void* LPD3DRM_APPDATA; typedef void* LPD3DRM_APPDATA;
typedef unsigned long D3DRMGROUPINDEX; typedef unsigned int D3DRMGROUPINDEX;
typedef DWORD D3DCOLOR, *LPD3DCOLOR; typedef DWORD D3DCOLOR, *LPD3DCOLOR;
typedef float D3DVALUE, *LPD3DVALUE; typedef float D3DVALUE, *LPD3DVALUE;
@ -306,11 +306,11 @@ struct IDirect3DRMWinDevice : virtual public IDirect3DRMObject {
}; };
struct IDirect3DRMDevice : virtual public IDirect3DRMObject { struct IDirect3DRMDevice : virtual public IDirect3DRMObject {
virtual unsigned long GetWidth() = 0; virtual unsigned int GetWidth() = 0;
virtual unsigned long GetHeight() = 0; virtual unsigned int GetHeight() = 0;
virtual HRESULT SetBufferCount(int count) = 0; virtual HRESULT SetBufferCount(int count) = 0;
virtual HRESULT GetBufferCount() = 0; virtual HRESULT GetBufferCount() = 0;
virtual HRESULT SetShades(unsigned long shadeCount) = 0; virtual HRESULT SetShades(unsigned int shadeCount) = 0;
virtual HRESULT GetShades() = 0; virtual HRESULT GetShades() = 0;
virtual HRESULT SetQuality(D3DRMRENDERQUALITY quality) = 0; virtual HRESULT SetQuality(D3DRMRENDERQUALITY quality) = 0;
virtual D3DRMRENDERQUALITY GetQuality() = 0; virtual D3DRMRENDERQUALITY GetQuality() = 0;

View File

@ -279,11 +279,11 @@ struct Direct3DRMDevice2Impl : public Direct3DRMObjectBase<IDirect3DRMDevice2> {
*ppObject = static_cast<void*>(new Direct3DRMDevice2Impl); *ppObject = static_cast<void*>(new Direct3DRMDevice2Impl);
return DD_OK; return DD_OK;
} }
unsigned long GetWidth() override { return 640; } unsigned int GetWidth() override { return 640; }
unsigned long GetHeight() override { return 480; } unsigned int GetHeight() override { return 480; }
HRESULT SetBufferCount(int count) override { return DD_OK; } HRESULT SetBufferCount(int count) override { return DD_OK; }
HRESULT GetBufferCount() override { return DD_OK; } HRESULT GetBufferCount() override { return DD_OK; }
HRESULT SetShades(unsigned long shadeCount) override { return DD_OK; } HRESULT SetShades(unsigned int shadeCount) override { return DD_OK; }
HRESULT GetShades() override { return DD_OK; } HRESULT GetShades() override { return DD_OK; }
HRESULT SetQuality(D3DRMRENDERQUALITY quality) override { return DD_OK; } HRESULT SetQuality(D3DRMRENDERQUALITY quality) override { return DD_OK; }
D3DRMRENDERQUALITY GetQuality() override { return D3DRMRENDERQUALITY::GOURAUD; } D3DRMRENDERQUALITY GetQuality() override { return D3DRMRENDERQUALITY::GOURAUD; }