Fixes for the backupBackground method when X < 0

svn-id: r40590
This commit is contained in:
Paul Gilbert 2009-05-15 04:54:45 +00:00
parent bb45be960d
commit b7af9831da
2 changed files with 7 additions and 3 deletions

View File

@ -52,7 +52,11 @@ void backupBackground(backgroundIncrustStruct *pIncrust, int X, int Y, int width
pIncrust->ptr = (uint8*)malloc(width * height);
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
pIncrust->ptr[i * width + j] = pBackground[(i+Y) * 320 + j + X];
int xp = j + X;
int yp = i + Y;
pIncrust->ptr[i * width + j] = ((xp < 0) || (yp < 0) || (xp >= 320) || (yp >= 200)) ?
0 : pBackground[yp * 320 + xp];
}
}
}

View File

@ -35,8 +35,8 @@ struct backgroundIncrustStruct {
uint16 objectIdx;
int16 type;
uint16 overlayIdx;
uint16 X;
uint16 Y;
int16 X;
int16 Y;
uint16 field_E;
uint16 scale;
uint16 backgroundIdx;