Fix warnings triggered by isle-portable (#1304)

* Replace computed constant with more readable computed constants

* LegoAnim::GetActorUnknown0x04 returns a number, not a pointer

* Add macro for creating RGB555 colors

* Texture pixel data is passed through as const data

* Compare palette index against 0 instead of NULL pointer

* warning: deleting 'void*' is undefined [-Wdelete-incomplete] warning

Some DirectX sdk's declars D3DRMIMAGE::buffer1 and D3DRMIMAGE::buffer2
as a void pointer.

* Don't use floats

* Fix wrong op

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Anonymous Maarten
2024-12-29 22:45:00 +01:00
committed by GitHub
parent 795d6e144d
commit c77b5869f5
7 changed files with 19 additions and 17 deletions

View File

@@ -19,7 +19,7 @@ public:
static BOOL SetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo* p_textureInfo);
static BOOL GetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo*& p_textureInfo);
LegoResult FUN_10066010(LegoU8* p_bits);
LegoResult FUN_10066010(const LegoU8* p_bits);
// private:
char* m_name; // 0x00

View File

@@ -121,9 +121,9 @@ void LegoBackgroundColor::SetLightColor(float p_r, float p_g, float p_b)
{
if (!VideoManager()->GetVideoParam().Flags().GetF2bit0()) {
// TODO: Computed constants based on what?
p_r *= 4.3478260869565215;
p_g *= 1.5873015873015872;
p_b *= 1.1764705882352942;
p_r *= 1. / 0.23;
p_g *= 1. / 0.63;
p_b *= 1. / 0.85;
if (p_r > 1.0) {
p_r = 1.0;

View File

@@ -71,7 +71,7 @@ LegoTextureInfo* LegoTextureInfo::Create(const char* p_name, LegoTexture* p_text
desc.ddpfPixelFormat.dwRGBBitCount = 8;
MxS32 i;
LegoU8* bits;
const LegoU8* bits;
MxU8* surface;
if (pDirectDraw->CreateSurface(&desc, &textureInfo->m_surface, NULL) != DD_OK) {
@@ -186,7 +186,7 @@ BOOL LegoTextureInfo::GetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo*& p_text
}
// FUNCTION: LEGO1 0x10066010
LegoResult LegoTextureInfo::FUN_10066010(LegoU8* p_bits)
LegoResult LegoTextureInfo::FUN_10066010(const LegoU8* p_bits)
{
if (m_surface != NULL && m_texture != NULL) {
DDSURFACEDESC desc;
@@ -195,7 +195,7 @@ LegoResult LegoTextureInfo::FUN_10066010(LegoU8* p_bits)
if (m_surface->Lock(NULL, &desc, 0, NULL) == DD_OK) {
MxU8* surface = (MxU8*) desc.lpSurface;
LegoU8* bits = p_bits;
const LegoU8* bits = p_bits;
if (desc.dwWidth == desc.lPitch) {
memcpy(desc.lpSurface, p_bits, desc.dwWidth * desc.dwHeight);

View File

@@ -709,7 +709,7 @@ void WriteDefaultTexture(LegoFile* p_file, const char* p_name)
}
else {
MxU8* surface = (MxU8*) desc.lpSurface;
LegoU8* bits = image->GetBits();
const LegoU8* bits = image->GetBits();
for (MxS32 i = 0; i < desc.dwHeight; i++) {
memcpy(surface, bits, desc.dwWidth);