Fix struct type

This commit is contained in:
Christian Semmler 2024-02-29 11:55:21 -05:00
parent 4cd2944a2c
commit 8eb5039693
3 changed files with 12 additions and 14 deletions

View File

@ -27,9 +27,8 @@ typedef struct {
typedef struct : FLIC_CHUNK { typedef struct : FLIC_CHUNK {
WORD frames; /* Number of frames in first segment */ // 0x06 WORD frames; /* Number of frames in first segment */ // 0x06
// TODO: See signed issue in MxFlcPresenter::CreateBitmap() WORD width; /* FLIC width in pixels */ // 0x08
short width; /* FLIC width in pixels */ // 0x08 WORD height; /* FLIC height in pixels */ // 0x0a
short height; /* FLIC height in pixels */ // 0x0a
WORD depth; /* Bits per pixel (usually 8) */ // 0x0c WORD depth; /* Bits per pixel (usually 8) */ // 0x0c
WORD flags; /* Set to zero or to three */ // 0x0e WORD flags; /* Set to zero or to three */ // 0x0e
DWORD speed; /* Delay between frames */ // 0x10 DWORD speed; /* Delay between frames */ // 0x10
@ -37,7 +36,7 @@ typedef struct : FLIC_CHUNK {
#pragma pack(pop) #pragma pack(pop)
typedef struct : FLIC_CHUNK { typedef struct : FLIC_CHUNK {
short chunks; /* Number of subchunks */ // 0x06 WORD chunks; /* Number of subchunks */ // 0x06
WORD delay; /* Delay in milliseconds */ // 0x08 WORD delay; /* Delay in milliseconds */ // 0x08
WORD reserved; /* Always zero */ // 0x0a WORD reserved; /* Always zero */ // 0x0a
WORD width; /* Frame width override (if non-zero) */ // 0x0c WORD width; /* Frame width override (if non-zero) */ // 0x0c

View File

@ -170,7 +170,7 @@ short DecodeChunks(
{ {
*p_decodedColorMap = FALSE; *p_decodedColorMap = FALSE;
for (short subchunk = 0; subchunk < p_flcFrame->chunks; subchunk++) { for (short subchunk = 0; subchunk < (short) p_flcFrame->chunks; subchunk++) {
FLIC_CHUNK* chunk = (FLIC_CHUNK*) p_flcSubchunks; FLIC_CHUNK* chunk = (FLIC_CHUNK*) p_flcSubchunks;
p_flcSubchunks += chunk->size; p_flcSubchunks += chunk->size;
@ -260,7 +260,7 @@ void DecodeBrun(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_da
BYTE* data = p_data; BYTE* data = p_data;
short width = p_flcHeader->width; short width = p_flcHeader->width;
short height = p_flcHeader->height; short height = p_flcHeader->height;
BYTE* offset = ((p_bitmapHeader->biWidth + 3) & -4) * (p_flcHeader->height - 1) + p_pixelData; BYTE* offset = ((p_bitmapHeader->biWidth + 3) & -4) * (height - 1) + p_pixelData;
for (short line = height - 1; line >= 0; line--) { for (short line = height - 1; line >= 0; line--) {
data++; data++;
@ -292,7 +292,7 @@ void DecodeBrun(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_da
// FUNCTION: LEGO1 0x100bda10 // FUNCTION: LEGO1 0x100bda10
void DecodeLC(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_data, FLIC_HEADER* p_flcHeader) void DecodeLC(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_data, FLIC_HEADER* p_flcHeader)
{ {
short row = p_flcHeader->height - *((short*) p_data) - 1; short row = (short) p_flcHeader->height - *((short*) p_data) - 1;
BYTE* data = p_data + 4; BYTE* data = p_data + 4;
for (short lines = *((short*) (p_data + 2)) - 1; lines >= 0; lines--) { for (short lines = *((short*) (p_data + 2)) - 1; lines >= 0; lines--) {
@ -322,8 +322,8 @@ void DecodeLC(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_data
// FUNCTION: LEGO1 0x100bdac0 // FUNCTION: LEGO1 0x100bdac0
void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_data, FLIC_HEADER* p_flcHeader) void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_data, FLIC_HEADER* p_flcHeader)
{ {
short width = p_flcHeader->width - 1; short width = (short) p_flcHeader->width - 1;
short row = p_flcHeader->height - 1; short row = (short) p_flcHeader->height - 1;
short lines = *((short*) p_data); short lines = *((short*) p_data);
BYTE* data = p_data + 2; BYTE* data = p_data + 2;

View File

@ -40,8 +40,7 @@ void MxFlcPresenter::CreateBitmap()
} }
m_bitmap = new MxBitmap; m_bitmap = new MxBitmap;
// TODO: Unlikely that width/height are signed shorts m_bitmap->SetSize(m_flcHeader->width, m_flcHeader->height, NULL, FALSE);
m_bitmap->SetSize((MxU16) m_flcHeader->width, (MxU16) m_flcHeader->height, NULL, FALSE);
} }
// FUNCTION: LEGO1 0x100b3570 // FUNCTION: LEGO1 0x100b3570