diff --git a/LEGO1/lego/legoomni/include/legotextureinfo.h b/LEGO1/lego/legoomni/include/legotextureinfo.h index e7cd894b9d..c070bfecb7 100644 --- a/LEGO1/lego/legoomni/include/legotextureinfo.h +++ b/LEGO1/lego/legoomni/include/legotextureinfo.h @@ -19,7 +19,7 @@ class LegoTextureInfo { 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 diff --git a/LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp b/LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp index c66dd26952..bc31bb2ccd 100644 --- a/LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp +++ b/LEGO1/lego/legoomni/src/common/legobackgroundcolor.cpp @@ -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; diff --git a/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp b/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp index ea00ad5f14..51678ed814 100644 --- a/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp +++ b/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp @@ -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); diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 48d021b03d..e1a61a38d8 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -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); diff --git a/LEGO1/lego/sources/anim/legoanim.cpp b/LEGO1/lego/sources/anim/legoanim.cpp index 930e40a485..39b8921bd3 100644 --- a/LEGO1/lego/sources/anim/legoanim.cpp +++ b/LEGO1/lego/sources/anim/legoanim.cpp @@ -1163,7 +1163,7 @@ undefined4 LegoAnim::GetActorUnknown0x04(LegoU32 p_index) return m_modelList[p_index].m_unk0x04; } - return NULL; + return 0; } // FUNCTION: LEGO1 0x100a0f60 diff --git a/LEGO1/omni/src/video/mxdisplaysurface.cpp b/LEGO1/omni/src/video/mxdisplaysurface.cpp index d08322ce70..685c59be92 100644 --- a/LEGO1/omni/src/video/mxdisplaysurface.cpp +++ b/LEGO1/omni/src/video/mxdisplaysurface.cpp @@ -13,6 +13,8 @@ DECOMP_SIZE_ASSERT(MxDisplaySurface, 0xac); +#define RGB555_CREATE(R, G, B) (((R) << 10) | (G) << 5 | (B) << 0) + // GLOBAL: LEGO1 0x1010215c MxU32 g_unk0x1010215c = 0; @@ -976,8 +978,8 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::VTable0x44( if (p_transparent) { for (MxS32 y = 0; y < heightAbs; y++) { for (MxS32 x = 0; x < widthNormal; x++) { - if (*bitmapSrcPtr == NULL) { - *surfaceData = 31775; + if (*bitmapSrcPtr == 0) { + *surfaceData = RGB555_CREATE(0x1f, 0, 0x1f); } else { *surfaceData = m_16bitPal[*bitmapSrcPtr]; @@ -992,7 +994,7 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::VTable0x44( } DDCOLORKEY key; - key.dwColorSpaceLowValue = key.dwColorSpaceHighValue = 31775; + key.dwColorSpaceLowValue = key.dwColorSpaceHighValue = RGB555_CREATE(0x1f, 0, 0x1f); surface->SetColorKey(DDCKEY_SRCBLT, &key); } else { @@ -1098,7 +1100,7 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::CreateCursorSurface() for (MxS32 y = 0; y < 16; y++) { if ((y > 10 || x) && (x > 10 || y) && x + y != 10) { if (x + y > 10) { - *surface2 = 31775; + *surface2 = RGB555_CREATE(0x1f, 0, 0x1f); } else { *surface2 = -1; @@ -1114,8 +1116,8 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::CreateCursorSurface() newSurface->Unlock(ddsd.lpSurface); DDCOLORKEY colorkey; - colorkey.dwColorSpaceHighValue = 31775; - colorkey.dwColorSpaceLowValue = 31775; + colorkey.dwColorSpaceHighValue = RGB555_CREATE(0x1f, 0, 0x1f); + colorkey.dwColorSpaceLowValue = RGB555_CREATE(0x1f, 0, 0x1f); newSurface->SetColorKey(DDCKEY_SRCBLT, &colorkey); return newSurface; diff --git a/LEGO1/tgl/d3drm/texture.cpp b/LEGO1/tgl/d3drm/texture.cpp index 79452ba6b0..ea8ef1b0ec 100644 --- a/LEGO1/tgl/d3drm/texture.cpp +++ b/LEGO1/tgl/d3drm/texture.cpp @@ -81,7 +81,7 @@ TglD3DRMIMAGE::TglD3DRMIMAGE( void TglD3DRMIMAGE::Destroy() { if (m_texelsAllocatedByClient == 0) { - delete m_image.buffer1; + delete[] ((char*) m_image.buffer1); } delete m_image.palette; } @@ -111,7 +111,7 @@ Result TglD3DRMIMAGE::CreateBuffer(int width, int height, int depth, void* pBuff m_image.bytes_per_line = width; if (!m_texelsAllocatedByClient) { - delete[] m_image.buffer1; + delete[] ((char*) m_image.buffer1); m_image.buffer1 = NULL; }