mirror of https://github.com/pret/pokeemerald.git
Fix incorrect arguments on CopyRectToBgTilemapBufferRect
This commit is contained in:
parent
07bf225f94
commit
901cd476b6
18
gflib/bg.c
18
gflib/bg.c
|
@ -950,7 +950,7 @@ void CopyToBgTilemapBufferRect_ChangePalette(u8 bg, const void *src, u8 destX, u
|
|||
CopyRectToBgTilemapBufferRect(bg, src, 0, 0, rectWidth, rectHeight, destX, destY, rectWidth, rectHeight, palette, 0, 0);
|
||||
}
|
||||
|
||||
void CopyRectToBgTilemapBufferRect(u8 bg, const void *src, u8 srcX, u8 srcY, u8 srcWidth, u8 unused, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, s16 palette1, s16 tileOffset)
|
||||
void CopyRectToBgTilemapBufferRect(u8 bg, const void *src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, s16 tileOffset, s16 palette2)
|
||||
{
|
||||
u16 screenWidth, screenHeight, screenSize;
|
||||
u16 var;
|
||||
|
@ -966,28 +966,28 @@ void CopyRectToBgTilemapBufferRect(u8 bg, const void *src, u8 srcX, u8 srcY, u8
|
|||
{
|
||||
case BG_TYPE_NORMAL:
|
||||
srcPtr = src + ((srcY * srcWidth) + srcX) * 2;
|
||||
for (i = destX; i < (destX + rectWidth); i++)
|
||||
for (i = destY; i < (destY + rectHeight); i++)
|
||||
{
|
||||
for (j = srcHeight; j < (srcHeight + destY); j++)
|
||||
for (j = destX; j < (destX + rectWidth); j++)
|
||||
{
|
||||
u16 index = GetTileMapIndexFromCoords(j, i, screenSize, screenWidth, screenHeight);
|
||||
CopyTileMapEntry(srcPtr, sGpuBgConfigs2[bg].tilemap + (index * 2), rectHeight, palette1, tileOffset);
|
||||
CopyTileMapEntry(srcPtr, sGpuBgConfigs2[bg].tilemap + (index * 2), palette1, tileOffset, palette2);
|
||||
srcPtr += 2;
|
||||
}
|
||||
srcPtr += (srcWidth - destY) * 2;
|
||||
srcPtr += (srcWidth - rectWidth) * 2;
|
||||
}
|
||||
break;
|
||||
case BG_TYPE_AFFINE:
|
||||
srcPtr = src + ((srcY * srcWidth) + srcX);
|
||||
var = GetBgMetricAffineMode(bg, 0x1);
|
||||
for (i = destX; i < (destX + rectWidth); i++)
|
||||
for (i = destY; i < (destY + rectHeight); i++)
|
||||
{
|
||||
for (j = srcHeight; j < (srcHeight + destY); j++)
|
||||
for (j = destX; j < (destX + rectWidth); j++)
|
||||
{
|
||||
*(u8*)(sGpuBgConfigs2[bg].tilemap + ((var * i) + j)) = *(u8*)(srcPtr) + palette1;
|
||||
*(u8*)(sGpuBgConfigs2[bg].tilemap + ((var * i) + j)) = *(u8*)(srcPtr) + tileOffset;
|
||||
srcPtr++;
|
||||
}
|
||||
srcPtr += (srcWidth - destY);
|
||||
srcPtr += (srcWidth - rectWidth);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset);
|
|||
void CopyBgTilemapBufferToVram(u8 bg);
|
||||
void CopyToBgTilemapBufferRect(u8 bg, const void* src, u8 destX, u8 destY, u8 width, u8 height);
|
||||
void CopyToBgTilemapBufferRect_ChangePalette(u8 bg, const void *src, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette);
|
||||
void CopyRectToBgTilemapBufferRect(u8 bg, const void *src, u8 srcX, u8 srcY, u8 srcWidth, u8 unused, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, s16 palette1, s16 tileOffset);
|
||||
void CopyRectToBgTilemapBufferRect(u8 bg, const void *src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, s16 tileOffset, s16 palette2);
|
||||
void FillBgTilemapBufferRect_Palette0(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height);
|
||||
void FillBgTilemapBufferRect(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height, u8 palette);
|
||||
void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 width, u8 height, u8 paletteSlot, s16 tileNumDelta);
|
||||
|
|
|
@ -2792,7 +2792,7 @@ static void SwitchSelectedMons(u8 taskId)
|
|||
// returns FALSE if the slot has slid fully offscreen / back onscreen
|
||||
static bool8 TryMovePartySlot(s16 x, s16 width, u8 *leftMove, u8 *newX, u8 *newWidth)
|
||||
{
|
||||
if ((x + width) < 0)
|
||||
if (x + width < 0)
|
||||
return FALSE;
|
||||
if (x > 31)
|
||||
return FALSE;
|
||||
|
@ -2807,7 +2807,7 @@ static bool8 TryMovePartySlot(s16 x, s16 width, u8 *leftMove, u8 *newX, u8 *newW
|
|||
{
|
||||
*leftMove = 0;
|
||||
*newX = x;
|
||||
if ((x + width) > 31)
|
||||
if (x + width > 31)
|
||||
*newWidth = 32 - x;
|
||||
else
|
||||
*newWidth = width;
|
||||
|
@ -2818,14 +2818,13 @@ static bool8 TryMovePartySlot(s16 x, s16 width, u8 *leftMove, u8 *newX, u8 *newW
|
|||
|
||||
static void MoveAndBufferPartySlot(const void *rectSrc, s16 x, s16 y, s16 width, s16 height, s16 dir)
|
||||
{
|
||||
// The use of the dimension parameters here is a mess
|
||||
u8 leftMove, newX, newWidth; // leftMove is used as a srcX, newX is used as both x and srcHeight, newWidth is used as both width and destY
|
||||
u8 srcX, newX, newWidth;
|
||||
|
||||
if (TryMovePartySlot(x, width, &leftMove, &newX, &newWidth))
|
||||
if (TryMovePartySlot(x, width, &srcX, &newX, &newWidth))
|
||||
{
|
||||
FillBgTilemapBufferRect_Palette0(0, 0, newX, y, newWidth, height);
|
||||
if (TryMovePartySlot(x + dir, width, &leftMove, &newX, &newWidth))
|
||||
CopyRectToBgTilemapBufferRect(0, rectSrc, leftMove, 0, width, height, newX, y, newWidth, height, 17, 0, 0);
|
||||
if (TryMovePartySlot(x + dir, width, &srcX, &newX, &newWidth))
|
||||
CopyRectToBgTilemapBufferRect(0, rectSrc, srcX, 0, width, height, newX, y, newWidth, height, 17, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5437,16 +5437,16 @@ static bool32 WaitForWallpaperGfxLoad(void)
|
|||
|
||||
static void DrawWallpaper(const void *tilemap, s8 direction, u8 offset)
|
||||
{
|
||||
s16 var = offset * 256;
|
||||
s16 var2 = (offset * 2) + 3;
|
||||
s16 tileOffset = offset * 256;
|
||||
s16 paletteNum = (offset * 2) + 3;
|
||||
s16 x = ((sStorage->bg2_X / 8 + 10) + (direction * 24)) & 0x3F;
|
||||
|
||||
CopyRectToBgTilemapBufferRect(2, tilemap, 0, 0, 0x14, 0x12, x, 2, 0x14, 0x12, 0x11, var, var2);
|
||||
CopyRectToBgTilemapBufferRect(2, tilemap, 0, 0, 20, 18, x, 2, 20, 18, 17, tileOffset, paletteNum);
|
||||
|
||||
if (direction == 0)
|
||||
return;
|
||||
if (direction > 0)
|
||||
x += 0x14;
|
||||
x += 20;
|
||||
else
|
||||
x -= 4;
|
||||
|
||||
|
|
Loading…
Reference in New Issue