mirror of
https://github.com/isledecomp/isle.git
synced 2025-04-21 02:50:52 -04:00
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:
parent
795d6e144d
commit
c77b5869f5
7 changed files with 19 additions and 17 deletions
LEGO1
lego
legoomni
sources/anim
omni/src/video
tgl/d3drm
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1163,7 +1163,7 @@ undefined4 LegoAnim::GetActorUnknown0x04(LegoU32 p_index)
|
|||
return m_modelList[p_index].m_unk0x04;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100a0f60
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue