summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDiegoisawesome <diego@domoreaweso.me>2017-09-06 23:53:13 -0500
committerDiegoisawesome <diego@domoreaweso.me>2017-09-06 23:53:13 -0500
commita2d37efb6792025d8f3753bff782774ba57d10b9 (patch)
tree5d732d866576ccf343d9c9591f0e94c860825eab /src
parent3f61c01afa39b5902a94ceaecb62360ba88bae87 (diff)
Almost perfect now but r8 and r12 are flipped
Diffstat (limited to 'src')
-rw-r--r--src/bg.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/bg.c b/src/bg.c
index 902579b57..eec73390e 100644
--- a/src/bg.c
+++ b/src/bg.c
@@ -1551,27 +1551,36 @@ void CopyToBgTilemapBufferRect(u8 bg, void* src, u8 destX, u8 destY, u8 width, u
s16 finalX;
s16 finalY;
u16 test;
+ u8 destXCopy;
+ u8 destYCopy;
+ void* srcBackup;
if (IsInvalidBgDuplicate(bg) == FALSE && IsTileMapOutsideWram(bg) == FALSE)
{
switch (GetBgType(bg))
{
case 0:
- for (finalY = destY + height; destY < finalY; destY++)
+ srcBackup = src;
+ destYCopy = destY;
+ for (finalY = destYCopy + height; destYCopy < finalY; destYCopy++)
{
- for (finalX = destX + width; destX < finalX; destX++)
+ destXCopy = destX;
+ for (finalX = destXCopy + width; destXCopy < finalX; destXCopy++)
{
- ((u16*)gUnknown_030008F8[bg].tilemap)[((destY * 0x20) + destX)] = *((u16*)src)++;
+ ((u16*)gUnknown_030008F8[bg].tilemap)[((destYCopy * 0x20) + destXCopy)] = *((u16*)srcBackup)++;
}
}
break;
case 1:
+ srcBackup = src;
test = GetBgMetricAffineMode(bg, 0x1);
- for (finalY = destY + height; destY < finalY; destY++)
+ destYCopy = destY;
+ for (finalY = destYCopy + height; destYCopy < finalY; destYCopy++)
{
- for (finalX = destX + width; destX < finalX; destX++)
+ destXCopy = destX;
+ for (finalX = destXCopy + width; destXCopy < finalX; destXCopy++)
{
- ((u8*)gUnknown_030008F8[bg].tilemap)[((destY * test) + destX)] = *((u8*)src)++;
+ ((u8*)gUnknown_030008F8[bg].tilemap)[((destYCopy * test) + destXCopy)] = *((u8*)srcBackup)++;
}
}
break;