mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-28 18:51:16 +00:00
Match ClampLine
This commit is contained in:
parent
7bc8d1e910
commit
4cd2944a2c
@ -78,26 +78,36 @@ void WritePixels(
|
|||||||
// FUNCTION: LEGO1 0x100bd600
|
// FUNCTION: LEGO1 0x100bd600
|
||||||
int ClampLine(LPBITMAPINFOHEADER p_bitmapHeader, short& p_column, short& p_row, short& p_count)
|
int ClampLine(LPBITMAPINFOHEADER p_bitmapHeader, short& p_column, short& p_row, short& p_count)
|
||||||
{
|
{
|
||||||
short lp_count;
|
short column = p_column;
|
||||||
short end = p_column + p_count;
|
short row = p_row;
|
||||||
|
short count = p_count;
|
||||||
|
short end = column + count;
|
||||||
|
int result;
|
||||||
|
|
||||||
if (p_row >= 0 && p_row < p_bitmapHeader->biHeight && end >= 0 && p_column < p_bitmapHeader->biWidth) {
|
if (row < 0 || p_bitmapHeader->biHeight <= row || end < 0 || p_bitmapHeader->biWidth <= column) {
|
||||||
if (p_column < 0) {
|
result = 0;
|
||||||
lp_count = end;
|
}
|
||||||
|
else {
|
||||||
|
if (column < 0) {
|
||||||
|
count += column;
|
||||||
p_count = end;
|
p_count = end;
|
||||||
p_column = 0;
|
p_column = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end > p_bitmapHeader->biWidth) {
|
if (p_bitmapHeader->biWidth < end) {
|
||||||
lp_count -= end;
|
count -= end - p_bitmapHeader->biWidth;
|
||||||
lp_count += p_bitmapHeader->biWidth;
|
p_count = count;
|
||||||
p_count = lp_count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return lp_count >= 0;
|
if (count < 0) {
|
||||||
|
result = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100bd680
|
// FUNCTION: LEGO1 0x100bd680
|
||||||
@ -319,9 +329,11 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
|
|||||||
|
|
||||||
while (--lines > 0) {
|
while (--lines > 0) {
|
||||||
short token;
|
short token;
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
token = *((short*) data);
|
token = *((short*) data);
|
||||||
data += 2;
|
data += 2;
|
||||||
|
|
||||||
if (token < 0) {
|
if (token < 0) {
|
||||||
if (token & 0x4000) {
|
if (token & 0x4000) {
|
||||||
row += token;
|
row += token;
|
||||||
@ -346,6 +358,7 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
short column = 0;
|
short column = 0;
|
||||||
do {
|
do {
|
||||||
column += *(data++);
|
column += *(data++);
|
||||||
@ -365,6 +378,7 @@ void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_dat
|
|||||||
column += type;
|
column += type;
|
||||||
}
|
}
|
||||||
} while (--token);
|
} while (--token);
|
||||||
|
|
||||||
row--;
|
row--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user