mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-20 23:01:16 +00:00
Use union, unexpected 93 % on LEGO1
This commit is contained in:
parent
38e5b06808
commit
abf8fc5ef0
@ -365,12 +365,15 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
|
|||||||
short xmax = xofs + width - 1;
|
short xmax = xofs + width - 1;
|
||||||
|
|
||||||
// LINE: BETA10 0x1013e652
|
// LINE: BETA10 0x1013e652
|
||||||
BYTE* data = p_data;
|
union {
|
||||||
|
BYTE* byte;
|
||||||
|
WORD* word;
|
||||||
|
} data = { p_data };
|
||||||
|
|
||||||
// The first word in the data following the chunk header contains the number of lines in the chunk.
|
// The first word in the data following the chunk header contains the number of lines in the chunk.
|
||||||
// The line count does not include skipped lines.
|
// The line count does not include skipped lines.
|
||||||
short lines = *(short*) data;
|
short lines = *(short*) data.word++;
|
||||||
data += 2;
|
// data += 2;
|
||||||
|
|
||||||
// LINE: BETA10 0x1013e666
|
// LINE: BETA10 0x1013e666
|
||||||
short row = p_flcHeader->height - yofs - 1;
|
short row = p_flcHeader->height - yofs - 1;
|
||||||
@ -386,8 +389,8 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
|
|||||||
start_packet:
|
start_packet:
|
||||||
// LINE: LEGO1 0x100bdaef
|
// LINE: LEGO1 0x100bdaef
|
||||||
// LINE: BETA10 0x1013e692
|
// LINE: BETA10 0x1013e692
|
||||||
token = *(short*) data;
|
token = *(short*) data.word;
|
||||||
data += 2;
|
data.byte += 2;
|
||||||
// LINE: LEGO1 0x100bdafb
|
// LINE: LEGO1 0x100bdafb
|
||||||
if (token >= 0) {
|
if (token >= 0) {
|
||||||
goto column_loop;
|
goto column_loop;
|
||||||
@ -399,8 +402,8 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
|
|||||||
|
|
||||||
// LINE: LEGO1 0x100bdb0a
|
// LINE: LEGO1 0x100bdb0a
|
||||||
WritePixel(p_bitmapHeader, p_pixelData, xmax, row, token);
|
WritePixel(p_bitmapHeader, p_pixelData, xmax, row, token);
|
||||||
token = *(short*) data;
|
token = *(short*) data.word;
|
||||||
data += 2;
|
data.byte += 2;
|
||||||
|
|
||||||
// LINE: LEGO1 0x100bdb2f
|
// LINE: LEGO1 0x100bdb2f
|
||||||
// LINE: BETA10 0x1013e6ef
|
// LINE: BETA10 0x1013e6ef
|
||||||
@ -421,15 +424,15 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
|
|||||||
column_loop_inner:
|
column_loop_inner:
|
||||||
// LINE: LEGO1 0x100bdb50
|
// LINE: LEGO1 0x100bdb50
|
||||||
// LINE: BETA10 0x1013e726
|
// LINE: BETA10 0x1013e726
|
||||||
column += *data++;
|
column += *data.byte++;
|
||||||
// LINE: BETA10 0x1013e73a
|
// LINE: BETA10 0x1013e73a
|
||||||
short type = *(char*) data++;
|
short type = *(char*) data.byte++;
|
||||||
type += type;
|
type += type;
|
||||||
|
|
||||||
if (type >= 0) {
|
if (type >= 0) {
|
||||||
WritePixels(p_bitmapHeader, p_pixelData, column, row, (BYTE*) data, type);
|
WritePixels(p_bitmapHeader, p_pixelData, column, row, (BYTE*) data.byte, type);
|
||||||
column += type;
|
column += type;
|
||||||
data += type;
|
data.byte += type;
|
||||||
// LINE: BETA10 0x1013e797
|
// LINE: BETA10 0x1013e797
|
||||||
if (--token != 0) {
|
if (--token != 0) {
|
||||||
goto column_loop_inner;
|
goto column_loop_inner;
|
||||||
@ -442,8 +445,8 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
|
|||||||
}
|
}
|
||||||
|
|
||||||
type = -type;
|
type = -type;
|
||||||
WORD* p_pixel = (WORD*) data;
|
WORD* p_pixel = (WORD*) data.byte;
|
||||||
data += 2;
|
data.byte += 2;
|
||||||
WritePixelPairs(p_bitmapHeader, p_pixelData, column, row, *p_pixel, type >> 1);
|
WritePixelPairs(p_bitmapHeader, p_pixelData, column, row, *p_pixel, type >> 1);
|
||||||
column += type;
|
column += type;
|
||||||
// LINE: BETA10 0x1013e813
|
// LINE: BETA10 0x1013e813
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user