mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Fix BgAttributes
This commit is contained in:
parent
2dd706ca54
commit
7f6f6c33ab
20
include/bg.h
20
include/bg.h
@ -13,14 +13,16 @@ struct BGCntrlBitfield // for the I/O registers
|
||||
|
||||
enum
|
||||
{
|
||||
BG_CTRL_ATTR_VISIBLE = 1,
|
||||
BG_CTRL_ATTR_CHARBASEINDEX = 2,
|
||||
BG_CTRL_ATTR_MAPBASEINDEX = 3,
|
||||
BG_CTRL_ATTR_SCREENSIZE = 4,
|
||||
BG_CTRL_ATTR_PALETTEMODE = 5,
|
||||
BG_CTRL_ATTR_PRIORITY = 6,
|
||||
BG_CTRL_ATTR_MOSAIC = 7,
|
||||
BG_CTRL_ATTR_WRAPAROUND = 8,
|
||||
BG_ATTR_CHARBASEINDEX = 1,
|
||||
BG_ATTR_MAPBASEINDEX,
|
||||
BG_ATTR_SCREENSIZE,
|
||||
BG_ATTR_PALETTEMODE,
|
||||
BG_ATTR_MOSAIC,
|
||||
BG_ATTR_WRAPAROUND,
|
||||
BG_ATTR_PRIORITY,
|
||||
BG_ATTR_METRIC,
|
||||
BG_ATTR_TYPE,
|
||||
BG_ATTR_BASETILE,
|
||||
};
|
||||
|
||||
struct BgTemplate
|
||||
@ -38,8 +40,6 @@ void ResetBgs(void);
|
||||
u8 GetBgMode(void);
|
||||
void ResetBgControlStructs(void);
|
||||
void Unused_ResetBgControlStruct(u8 bg);
|
||||
void SetBgControlAttributes(u8 bg, u8 charBaseIndex, u8 mapBaseIndex, u8 screenSize, u8 paletteMode, u8 priority, u8 mosaic, u8 wraparound);
|
||||
u16 GetBgControlAttribute(u8 bg, u8 attributeId);
|
||||
u8 LoadBgVram(u8 bg, const void *src, u16 size, u16 destOffset, u8 mode);
|
||||
void SetTextModeAndHideBgs(void);
|
||||
bool8 IsInvalidBg(u8 bg);
|
||||
|
@ -1092,7 +1092,7 @@ void DrawBattleEntryBackground(void)
|
||||
LZDecompressVram(gUnknown_08D778F0, (void*)(VRAM + 0x4000));
|
||||
LZDecompressVram(gUnknown_08D77B0C, (void*)(VRAM + 0x10000));
|
||||
LoadCompressedPalette(gUnknown_08D77AE4, 0x60, 0x20);
|
||||
SetBgAttribute(1, BG_CTRL_ATTR_MAPBASEINDEX, 1);
|
||||
SetBgAttribute(1, BG_ATTR_SCREENSIZE, 1);
|
||||
SetGpuReg(REG_OFFSET_BG1CNT, 0x5C04);
|
||||
CopyToBgTilemapBuffer(1, gUnknown_08D779D8, 0, 0);
|
||||
CopyToBgTilemapBuffer(2, gUnknown_08D779D8, 0, 0);
|
||||
@ -1113,8 +1113,8 @@ void DrawBattleEntryBackground(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
SetBgAttribute(1, BG_CTRL_ATTR_VISIBLE, 2);
|
||||
SetBgAttribute(2, BG_CTRL_ATTR_VISIBLE, 2);
|
||||
SetBgAttribute(1, BG_ATTR_CHARBASEINDEX, 2);
|
||||
SetBgAttribute(2, BG_ATTR_CHARBASEINDEX, 2);
|
||||
CopyToBgTilemapBuffer(1, gUnknown_08D857A8, 0, 0);
|
||||
CopyToBgTilemapBuffer(2, gUnknown_08D85A1C, 0, 0);
|
||||
CopyBgTilemapBufferToVram(1);
|
||||
|
@ -221,8 +221,8 @@ static void BattleIntroSlide1(u8 taskId)
|
||||
gScanlineEffect.state = 3;
|
||||
gTasks[taskId].data[0]++;
|
||||
CpuFill32(0, (void *)BG_SCREEN_ADDR(28), BG_SCREEN_SIZE);
|
||||
SetBgAttribute(1, BG_CTRL_ATTR_VISIBLE, 0);
|
||||
SetBgAttribute(2, BG_CTRL_ATTR_VISIBLE, 0);
|
||||
SetBgAttribute(1, BG_ATTR_CHARBASEINDEX, 0);
|
||||
SetBgAttribute(2, BG_ATTR_CHARBASEINDEX, 0);
|
||||
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_16COLOR | BGCNT_SCREENBASE(28) | BGCNT_TXT256x512);
|
||||
SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_16COLOR | BGCNT_SCREENBASE(30) | BGCNT_TXT512x256);
|
||||
}
|
||||
@ -330,8 +330,8 @@ static void BattleIntroSlide2(u8 taskId)
|
||||
gScanlineEffect.state = 3;
|
||||
gTasks[taskId].data[0]++;
|
||||
CpuFill32(0, (void *)BG_SCREEN_ADDR(28), BG_SCREEN_SIZE);
|
||||
SetBgAttribute(1, BG_CTRL_ATTR_VISIBLE, 0);
|
||||
SetBgAttribute(2, BG_CTRL_ATTR_VISIBLE, 0);
|
||||
SetBgAttribute(1, BG_ATTR_CHARBASEINDEX, 0);
|
||||
SetBgAttribute(2, BG_ATTR_CHARBASEINDEX, 0);
|
||||
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_16COLOR | BGCNT_SCREENBASE(28) | BGCNT_TXT256x512);
|
||||
SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_16COLOR | BGCNT_SCREENBASE(30) | BGCNT_TXT512x256);
|
||||
}
|
||||
@ -418,8 +418,8 @@ static void BattleIntroSlide3(u8 taskId)
|
||||
gScanlineEffect.state = 3;
|
||||
gTasks[taskId].data[0]++;
|
||||
CpuFill32(0, (void *)BG_SCREEN_ADDR(28), BG_SCREEN_SIZE);
|
||||
SetBgAttribute(1, BG_CTRL_ATTR_VISIBLE, 0);
|
||||
SetBgAttribute(2, BG_CTRL_ATTR_VISIBLE, 0);
|
||||
SetBgAttribute(1, BG_ATTR_CHARBASEINDEX, 0);
|
||||
SetBgAttribute(2, BG_ATTR_CHARBASEINDEX, 0);
|
||||
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_16COLOR | BGCNT_SCREENBASE(28) | BGCNT_TXT256x512);
|
||||
SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_16COLOR | BGCNT_SCREENBASE(30) | BGCNT_TXT512x256);
|
||||
}
|
||||
@ -499,8 +499,8 @@ static void BattleIntroSlideLink(u8 taskId)
|
||||
{
|
||||
gScanlineEffect.state = 3;
|
||||
gTasks[taskId].data[0]++;
|
||||
SetBgAttribute(1, BG_CTRL_ATTR_VISIBLE, 0);
|
||||
SetBgAttribute(2, BG_CTRL_ATTR_VISIBLE, 0);
|
||||
SetBgAttribute(1, BG_ATTR_CHARBASEINDEX, 0);
|
||||
SetBgAttribute(2, BG_ATTR_CHARBASEINDEX, 0);
|
||||
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_16COLOR | BGCNT_SCREENBASE(28) | BGCNT_TXT256x512);
|
||||
SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_16COLOR | BGCNT_SCREENBASE(30) | BGCNT_TXT512x256);
|
||||
}
|
||||
@ -567,8 +567,8 @@ static void BattleIntroSlidePartner(u8 taskId)
|
||||
{
|
||||
CpuFill32(0, (void *)BG_SCREEN_ADDR(28), BG_SCREEN_SIZE * 4);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, GetGpuReg(REG_OFFSET_DISPCNT) & ~DISPCNT_WIN1_ON);
|
||||
SetBgAttribute(1, BG_CTRL_ATTR_VISIBLE, 0);
|
||||
SetBgAttribute(2, BG_CTRL_ATTR_VISIBLE, 0);
|
||||
SetBgAttribute(1, BG_ATTR_CHARBASEINDEX, 0);
|
||||
SetBgAttribute(2, BG_ATTR_CHARBASEINDEX, 0);
|
||||
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_16COLOR | BGCNT_SCREENBASE(28) | BGCNT_TXT256x512);
|
||||
SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_16COLOR | BGCNT_SCREENBASE(30) | BGCNT_TXT512x256);
|
||||
gScanlineEffect.state = 3;
|
||||
|
@ -6237,7 +6237,7 @@ static void atk6C_drawlvlupbox(void)
|
||||
{
|
||||
case 1:
|
||||
gBattle_BG2_Y = 0x60;
|
||||
SetBgAttribute(2, BG_CTRL_ATTR_MOSAIC, 0);
|
||||
SetBgAttribute(2, BG_ATTR_PRIORITY, 0);
|
||||
ShowBg(2);
|
||||
sub_804F17C();
|
||||
gBattleScripting.atk6C_state = 2;
|
||||
@ -6249,8 +6249,8 @@ static void atk6C_drawlvlupbox(void)
|
||||
case 3:
|
||||
gBattle_BG1_X = 0;
|
||||
gBattle_BG1_Y = 0x100;
|
||||
SetBgAttribute(0, BG_CTRL_ATTR_MOSAIC, 1);
|
||||
SetBgAttribute(1, BG_CTRL_ATTR_MOSAIC, 0);
|
||||
SetBgAttribute(0, BG_ATTR_PRIORITY, 1);
|
||||
SetBgAttribute(1, BG_ATTR_PRIORITY, 0);
|
||||
ShowBg(0);
|
||||
ShowBg(1);
|
||||
HandleBattleWindow(0x12, 7, 0x1D, 0x13, WINDOW_x80);
|
||||
@ -6296,7 +6296,7 @@ static void atk6C_drawlvlupbox(void)
|
||||
ClearWindowTilemap(13);
|
||||
CopyWindowToVram(13, 1);
|
||||
|
||||
SetBgAttribute(2, BG_CTRL_ATTR_MOSAIC, 2);
|
||||
SetBgAttribute(2, BG_ATTR_PRIORITY, 2);
|
||||
ShowBg(2);
|
||||
|
||||
gBattleScripting.atk6C_state = 10;
|
||||
@ -6305,8 +6305,8 @@ static void atk6C_drawlvlupbox(void)
|
||||
case 10:
|
||||
if (!IsDma3ManagerBusyWithBgCopy())
|
||||
{
|
||||
SetBgAttribute(0, BG_CTRL_ATTR_MOSAIC, 0);
|
||||
SetBgAttribute(1, BG_CTRL_ATTR_MOSAIC, 1);
|
||||
SetBgAttribute(0, BG_ATTR_PRIORITY, 0);
|
||||
SetBgAttribute(1, BG_ATTR_PRIORITY, 1);
|
||||
ShowBg(0);
|
||||
ShowBg(1);
|
||||
gBattlescriptCurrInstr++;
|
||||
|
136
src/bg.c
136
src/bg.c
@ -77,15 +77,27 @@ void ResetBgControlStructs(void)
|
||||
|
||||
void Unused_ResetBgControlStruct(u8 bg)
|
||||
{
|
||||
if (IsInvalidBg(bg) == FALSE)
|
||||
if (!IsInvalidBg(bg))
|
||||
{
|
||||
sGpuBgConfigs.configs[bg] = sZeroedBgControlStruct;
|
||||
}
|
||||
}
|
||||
|
||||
void SetBgControlAttributes(u8 bg, u8 charBaseIndex, u8 mapBaseIndex, u8 screenSize, u8 paletteMode, u8 priority, u8 mosaic, u8 wraparound)
|
||||
enum
|
||||
{
|
||||
if (IsInvalidBg(bg) == FALSE)
|
||||
BG_CTRL_ATTR_VISIBLE = 1,
|
||||
BG_CTRL_ATTR_CHARBASEINDEX = 2,
|
||||
BG_CTRL_ATTR_MAPBASEINDEX = 3,
|
||||
BG_CTRL_ATTR_SCREENSIZE = 4,
|
||||
BG_CTRL_ATTR_PALETTEMODE = 5,
|
||||
BG_CTRL_ATTR_PRIORITY = 6,
|
||||
BG_CTRL_ATTR_MOSAIC = 7,
|
||||
BG_CTRL_ATTR_WRAPAROUND = 8,
|
||||
};
|
||||
|
||||
static void SetBgControlAttributes(u8 bg, u8 charBaseIndex, u8 mapBaseIndex, u8 screenSize, u8 paletteMode, u8 priority, u8 mosaic, u8 wraparound)
|
||||
{
|
||||
if (!IsInvalidBg(bg))
|
||||
{
|
||||
if (charBaseIndex != 0xFF)
|
||||
{
|
||||
@ -129,9 +141,9 @@ void SetBgControlAttributes(u8 bg, u8 charBaseIndex, u8 mapBaseIndex, u8 screenS
|
||||
}
|
||||
}
|
||||
|
||||
u16 GetBgControlAttribute(u8 bg, u8 attributeId)
|
||||
static u16 GetBgControlAttribute(u8 bg, u8 attributeId)
|
||||
{
|
||||
if (IsInvalidBg(bg) == FALSE && sGpuBgConfigs.configs[bg].visible != FALSE)
|
||||
if (!IsInvalidBg(bg) && sGpuBgConfigs.configs[bg].visible)
|
||||
{
|
||||
switch (attributeId)
|
||||
{
|
||||
@ -162,7 +174,7 @@ u8 LoadBgVram(u8 bg, const void *src, u16 size, u16 destOffset, u8 mode)
|
||||
u16 offset;
|
||||
s8 cursor;
|
||||
|
||||
if (IsInvalidBg(bg) == FALSE && sGpuBgConfigs.configs[bg].visible != FALSE)
|
||||
if (!IsInvalidBg(bg) && sGpuBgConfigs.configs[bg].visible)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
@ -198,7 +210,7 @@ end:
|
||||
static void ShowBgInternal(u8 bg)
|
||||
{
|
||||
u16 value;
|
||||
if (IsInvalidBg(bg) == FALSE && sGpuBgConfigs.configs[bg].visible != FALSE)
|
||||
if (!IsInvalidBg(bg) && sGpuBgConfigs.configs[bg].visible)
|
||||
{
|
||||
value = sGpuBgConfigs.configs[bg].priority |
|
||||
(sGpuBgConfigs.configs[bg].charBaseIndex << 2) |
|
||||
@ -217,7 +229,7 @@ static void ShowBgInternal(u8 bg)
|
||||
|
||||
static void HideBgInternal(u8 bg)
|
||||
{
|
||||
if (IsInvalidBg(bg) == FALSE)
|
||||
if (!IsInvalidBg(bg))
|
||||
{
|
||||
sGpuBgConfigs.bgVisibilityAndMode &= ~(1 << (bg + 8));
|
||||
sGpuBgConfigs.bgVisibilityAndMode &= DISPCNT_ALL_BG_AND_MODE_BITS;
|
||||
@ -226,12 +238,12 @@ static void HideBgInternal(u8 bg)
|
||||
|
||||
static void SyncBgVisibilityAndMode(void)
|
||||
{
|
||||
SetGpuReg(0, (GetGpuReg(0) & ~DISPCNT_ALL_BG_AND_MODE_BITS) | sGpuBgConfigs.bgVisibilityAndMode);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, (GetGpuReg(REG_OFFSET_DISPCNT) & ~DISPCNT_ALL_BG_AND_MODE_BITS) | sGpuBgConfigs.bgVisibilityAndMode);
|
||||
}
|
||||
|
||||
void SetTextModeAndHideBgs(void)
|
||||
{
|
||||
SetGpuReg(0, GetGpuReg(0) & ~DISPCNT_ALL_BG_AND_MODE_BITS);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, GetGpuReg(REG_OFFSET_DISPCNT) & ~DISPCNT_ALL_BG_AND_MODE_BITS);
|
||||
}
|
||||
|
||||
static void SetBgAffineInternal(u8 bg, u32 srcCenterX, u32 srcCenterY, s16 dispCenterX, s16 dispCenterY, s16 scaleX, s16 scaleY, u16 rotationAngle)
|
||||
@ -312,7 +324,8 @@ void InitBgsFromTemplates(u8 bgMode, const struct BgTemplate *templates, u8 numT
|
||||
for (i = 0; i < numTemplates; i++)
|
||||
{
|
||||
bg = templates[i].bg;
|
||||
if (bg < 4) {
|
||||
if (bg < 4)
|
||||
{
|
||||
SetBgControlAttributes(bg,
|
||||
templates[i].charBaseIndex,
|
||||
templates[i].mapBaseIndex,
|
||||
@ -396,9 +409,7 @@ u16 LoadBgTiles(u8 bg, const void* src, u16 size, u16 destOffset)
|
||||
|
||||
u16 LoadBgTilemap(u8 bg, const void *src, u16 size, u16 destOffset)
|
||||
{
|
||||
u8 cursor;
|
||||
|
||||
cursor = LoadBgVram(bg, src, size, destOffset * 2, DISPCNT_MODE_2);
|
||||
u8 cursor = LoadBgVram(bg, src, size, destOffset * 2, DISPCNT_MODE_2);
|
||||
|
||||
if (cursor == 0xFF)
|
||||
{
|
||||
@ -412,12 +423,11 @@ u16 LoadBgTilemap(u8 bg, const void *src, u16 size, u16 destOffset)
|
||||
|
||||
u16 Unused_LoadBgPalette(u8 bg, const void *src, u16 size, u16 destOffset)
|
||||
{
|
||||
u16 paletteOffset;
|
||||
s8 cursor;
|
||||
|
||||
if (IsInvalidBg32(bg) == FALSE)
|
||||
if (!IsInvalidBg32(bg))
|
||||
{
|
||||
paletteOffset = (sGpuBgConfigs2[bg].basePalette * 0x20) + (destOffset * 2);
|
||||
u16 paletteOffset = (sGpuBgConfigs2[bg].basePalette * 0x20) + (destOffset * 2);
|
||||
cursor = RequestDma3Copy(src, (void*)(paletteOffset + BG_PLTT), size, 0);
|
||||
|
||||
if (cursor == -1)
|
||||
@ -437,20 +447,16 @@ u16 Unused_LoadBgPalette(u8 bg, const void *src, u16 size, u16 destOffset)
|
||||
|
||||
bool8 IsDma3ManagerBusyWithBgCopy(void)
|
||||
{
|
||||
u8 mod;
|
||||
u8 div;
|
||||
s8 reqSpace;
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 0x80; i++)
|
||||
{
|
||||
div = i / 0x20;
|
||||
mod = i % 0x20;
|
||||
u8 div = i / 0x20;
|
||||
u8 mod = i % 0x20;
|
||||
|
||||
if ((sDmaBusyBitfield[div] & (1 << mod)) != FALSE)
|
||||
if ((sDmaBusyBitfield[div] & (1 << mod)))
|
||||
{
|
||||
reqSpace = CheckForSpaceForDma3Request(i);
|
||||
s8 reqSpace = CheckForSpaceForDma3Request(i);
|
||||
if (reqSpace == -1)
|
||||
{
|
||||
return TRUE;
|
||||
@ -479,25 +485,25 @@ void SetBgAttribute(u8 bg, u8 attributeId, u8 value)
|
||||
{
|
||||
switch (attributeId)
|
||||
{
|
||||
case 1:
|
||||
case BG_ATTR_CHARBASEINDEX:
|
||||
SetBgControlAttributes(bg, value, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case 2:
|
||||
case BG_ATTR_MAPBASEINDEX:
|
||||
SetBgControlAttributes(bg, 0xFF, value, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case 3:
|
||||
case BG_ATTR_SCREENSIZE:
|
||||
SetBgControlAttributes(bg, 0xFF, 0xFF, value, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case 4:
|
||||
case BG_ATTR_PALETTEMODE:
|
||||
SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, value, 0xFF, 0xFF, 0xFF);
|
||||
break;
|
||||
case 7:
|
||||
case BG_ATTR_PRIORITY:
|
||||
SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, 0xFF, value, 0xFF, 0xFF);
|
||||
break;
|
||||
case 5:
|
||||
case BG_ATTR_MOSAIC:
|
||||
SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, value, 0xFF);
|
||||
break;
|
||||
case 6:
|
||||
case BG_ATTR_WRAPAROUND:
|
||||
SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, value);
|
||||
break;
|
||||
}
|
||||
@ -507,21 +513,21 @@ u16 GetBgAttribute(u8 bg, u8 attributeId)
|
||||
{
|
||||
switch (attributeId)
|
||||
{
|
||||
case 1:
|
||||
case BG_ATTR_CHARBASEINDEX:
|
||||
return GetBgControlAttribute(bg, BG_CTRL_ATTR_CHARBASEINDEX);
|
||||
case 2:
|
||||
case BG_ATTR_MAPBASEINDEX:
|
||||
return GetBgControlAttribute(bg, BG_CTRL_ATTR_MAPBASEINDEX);
|
||||
case 3:
|
||||
case BG_ATTR_SCREENSIZE:
|
||||
return GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE);
|
||||
case 4:
|
||||
case BG_ATTR_PALETTEMODE:
|
||||
return GetBgControlAttribute(bg, BG_CTRL_ATTR_PALETTEMODE);
|
||||
case 7:
|
||||
case BG_ATTR_PRIORITY:
|
||||
return GetBgControlAttribute(bg, BG_CTRL_ATTR_PRIORITY);
|
||||
case 5:
|
||||
case BG_ATTR_MOSAIC:
|
||||
return GetBgControlAttribute(bg, BG_CTRL_ATTR_MOSAIC);
|
||||
case 6:
|
||||
case BG_ATTR_WRAPAROUND:
|
||||
return GetBgControlAttribute(bg, BG_CTRL_ATTR_WRAPAROUND);
|
||||
case 8:
|
||||
case BG_ATTR_METRIC:
|
||||
switch (GetBgType(bg))
|
||||
{
|
||||
case 0:
|
||||
@ -531,9 +537,9 @@ u16 GetBgAttribute(u8 bg, u8 attributeId)
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
case 9:
|
||||
case BG_ATTR_TYPE:
|
||||
return GetBgType(bg);
|
||||
case 10:
|
||||
case BG_ATTR_BASETILE:
|
||||
return sGpuBgConfigs2[bg].baseTile;
|
||||
default:
|
||||
return -1;
|
||||
@ -546,7 +552,7 @@ s32 ChangeBgX(u8 bg, s32 value, u8 op)
|
||||
u16 temp1;
|
||||
u16 temp2;
|
||||
|
||||
if (IsInvalidBg32(bg) != FALSE || GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0)
|
||||
if (IsInvalidBg32(bg) || !GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@ -612,9 +618,9 @@ s32 ChangeBgX(u8 bg, s32 value, u8 op)
|
||||
|
||||
s32 GetBgX(u8 bg)
|
||||
{
|
||||
if (IsInvalidBg32(bg) != FALSE)
|
||||
if (IsInvalidBg32(bg))
|
||||
return -1;
|
||||
else if (GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0)
|
||||
else if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
return -1;
|
||||
else
|
||||
return sGpuBgConfigs2[bg].bg_x;
|
||||
@ -626,7 +632,7 @@ s32 ChangeBgY(u8 bg, s32 value, u8 op)
|
||||
u16 temp1;
|
||||
u16 temp2;
|
||||
|
||||
if (IsInvalidBg32(bg) != FALSE || GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0)
|
||||
if (IsInvalidBg32(bg) || !GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@ -696,7 +702,7 @@ s32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op)
|
||||
u16 temp1;
|
||||
u16 temp2;
|
||||
|
||||
if (IsInvalidBg32(bg) != FALSE || GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0)
|
||||
if (IsInvalidBg32(bg) || !GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@ -763,9 +769,9 @@ s32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op)
|
||||
|
||||
s32 GetBgY(u8 bg)
|
||||
{
|
||||
if (IsInvalidBg32(bg) != FALSE)
|
||||
if (IsInvalidBg32(bg))
|
||||
return -1;
|
||||
else if (GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0)
|
||||
else if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
return -1;
|
||||
else
|
||||
return sGpuBgConfigs2[bg].bg_y;
|
||||
@ -849,7 +855,7 @@ u8 Unused_AdjustBgMosaic(u8 a1, u8 a2)
|
||||
|
||||
void SetBgTilemapBuffer(u8 bg, void *tilemap)
|
||||
{
|
||||
if (IsInvalidBg32(bg) == FALSE && GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) != 0x0)
|
||||
if (!IsInvalidBg32(bg) && GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
{
|
||||
sGpuBgConfigs2[bg].tilemap = tilemap;
|
||||
}
|
||||
@ -857,7 +863,7 @@ void SetBgTilemapBuffer(u8 bg, void *tilemap)
|
||||
|
||||
void UnsetBgTilemapBuffer(u8 bg)
|
||||
{
|
||||
if (IsInvalidBg32(bg) == FALSE && GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) != 0x0)
|
||||
if (!IsInvalidBg32(bg) && GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
{
|
||||
sGpuBgConfigs2[bg].tilemap = NULL;
|
||||
}
|
||||
@ -865,9 +871,9 @@ void UnsetBgTilemapBuffer(u8 bg)
|
||||
|
||||
void* GetBgTilemapBuffer(u8 bg)
|
||||
{
|
||||
if (IsInvalidBg32(bg) != FALSE)
|
||||
if (IsInvalidBg32(bg))
|
||||
return NULL;
|
||||
else if (GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0)
|
||||
else if (!GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE))
|
||||
return NULL;
|
||||
else
|
||||
return sGpuBgConfigs2[bg].tilemap;
|
||||
@ -875,7 +881,7 @@ void* GetBgTilemapBuffer(u8 bg)
|
||||
|
||||
void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset)
|
||||
{
|
||||
if (IsInvalidBg32(bg) == FALSE && IsTileMapOutsideWram(bg) == FALSE)
|
||||
if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg))
|
||||
{
|
||||
if (mode != 0)
|
||||
CpuCopy16(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)), mode);
|
||||
@ -888,7 +894,7 @@ void CopyBgTilemapBufferToVram(u8 bg)
|
||||
{
|
||||
u16 sizeToLoad;
|
||||
|
||||
if (IsInvalidBg32(bg) == FALSE && IsTileMapOutsideWram(bg) == FALSE)
|
||||
if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg))
|
||||
{
|
||||
switch (GetBgType(bg))
|
||||
{
|
||||
@ -908,12 +914,12 @@ void CopyBgTilemapBufferToVram(u8 bg)
|
||||
|
||||
void CopyToBgTilemapBufferRect(u8 bg, const void* src, u8 destX, u8 destY, u8 width, u8 height)
|
||||
{
|
||||
const void* srcCopy;
|
||||
const void *srcCopy;
|
||||
u16 destX16;
|
||||
u16 destY16;
|
||||
u16 mode;
|
||||
|
||||
if (IsInvalidBg32(bg) == FALSE && IsTileMapOutsideWram(bg) == FALSE)
|
||||
if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg))
|
||||
{
|
||||
switch (GetBgType(bg))
|
||||
{
|
||||
@ -997,7 +1003,7 @@ void FillBgTilemapBufferRect_Palette0(u8 bg, u16 tileNum, u8 x, u8 y, u8 width,
|
||||
u16 y16;
|
||||
u16 mode;
|
||||
|
||||
if (IsInvalidBg32(bg) == FALSE && IsTileMapOutsideWram(bg) == FALSE)
|
||||
if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg))
|
||||
{
|
||||
switch (GetBgType(bg))
|
||||
{
|
||||
@ -1071,12 +1077,12 @@ void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 widt
|
||||
|
||||
u16 GetBgMetricTextMode(u8 bg, u8 whichMetric)
|
||||
{
|
||||
u8 attribute = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE);
|
||||
u8 screenSize = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE);
|
||||
|
||||
switch (whichMetric)
|
||||
{
|
||||
case 0:
|
||||
switch (attribute)
|
||||
switch (screenSize)
|
||||
{
|
||||
case 0:
|
||||
return 1;
|
||||
@ -1088,7 +1094,7 @@ u16 GetBgMetricTextMode(u8 bg, u8 whichMetric)
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
switch (attribute)
|
||||
switch (screenSize)
|
||||
{
|
||||
case 0:
|
||||
return 1;
|
||||
@ -1101,7 +1107,7 @@ u16 GetBgMetricTextMode(u8 bg, u8 whichMetric)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch (attribute)
|
||||
switch (screenSize)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
@ -1117,12 +1123,12 @@ u16 GetBgMetricTextMode(u8 bg, u8 whichMetric)
|
||||
|
||||
u32 GetBgMetricAffineMode(u8 bg, u8 whichMetric)
|
||||
{
|
||||
u8 attribute = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE);
|
||||
u8 screenSize = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE);
|
||||
|
||||
switch (whichMetric)
|
||||
{
|
||||
case 0:
|
||||
switch (attribute)
|
||||
switch (screenSize)
|
||||
{
|
||||
case 0:
|
||||
return 0x1;
|
||||
@ -1136,7 +1142,7 @@ u32 GetBgMetricAffineMode(u8 bg, u8 whichMetric)
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
return 0x10 << attribute;
|
||||
return 0x10 << screenSize;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ void sub_80D779C(void)
|
||||
|
||||
ResetBgsAndClearDma3BusyFlags(0);
|
||||
InitBgsFromTemplates(0, gUnknown_08587F34, ARRAY_COUNT(gUnknown_08587F34));
|
||||
SetBgAttribute(3, BG_CTRL_ATTR_PRIORITY, 1);
|
||||
SetBgAttribute(3, BG_ATTR_WRAPAROUND, 1);
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
SetBgTilemapBuffer(i, gContestResources->field_24[i]);
|
||||
|
@ -502,7 +502,7 @@ static void CB2_EggHatch_0(void)
|
||||
ChangeBgX(0, 0, 0);
|
||||
ChangeBgY(0, 0, 0);
|
||||
|
||||
SetBgAttribute(1, BG_CTRL_ATTR_MOSAIC, 2);
|
||||
SetBgAttribute(1, BG_ATTR_PRIORITY, 2);
|
||||
SetBgTilemapBuffer(1, Alloc(0x1000));
|
||||
SetBgTilemapBuffer(0, Alloc(0x2000));
|
||||
|
||||
|
@ -1483,8 +1483,8 @@ static void InitMovingBackgroundTask(bool8 isLink)
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, 0x808);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG2_ON | DISPCNT_BG1_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP);
|
||||
|
||||
SetBgAttribute(innerBgId, BG_CTRL_ATTR_MOSAIC, 2);
|
||||
SetBgAttribute(outerBgId, BG_CTRL_ATTR_MOSAIC, 2);
|
||||
SetBgAttribute(innerBgId, BG_ATTR_PRIORITY, 2);
|
||||
SetBgAttribute(outerBgId, BG_ATTR_PRIORITY, 2);
|
||||
|
||||
ShowBg(1);
|
||||
ShowBg(2);
|
||||
@ -1529,8 +1529,8 @@ static void sub_8140174(void)
|
||||
gBattle_BG1_X = 0;
|
||||
gBattle_BG1_Y = 0;
|
||||
gBattle_BG2_X = 0;
|
||||
SetBgAttribute(1, BG_CTRL_ATTR_MOSAIC, sub_80391E0(1, 5));
|
||||
SetBgAttribute(2, BG_CTRL_ATTR_MOSAIC, sub_80391E0(2, 5));
|
||||
SetBgAttribute(1, BG_ATTR_PRIORITY, sub_80391E0(1, 5));
|
||||
SetBgAttribute(2, BG_ATTR_PRIORITY, sub_80391E0(2, 5));
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG3_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP);
|
||||
Free(sEvoMovingBgPtr);
|
||||
}
|
||||
|
@ -1934,8 +1934,8 @@ void sub_8199D98(void)
|
||||
|
||||
void sub_8199DF0(u32 bg, u8 a1, int a2, int a3)
|
||||
{
|
||||
int temp = (!GetBgAttribute(bg, 4)) ? 0x20 : 0x40;
|
||||
void *addr = (void *)((GetBgAttribute(bg, 1) * 0x4000) + (GetBgAttribute(bg, 10) + a2) * temp);
|
||||
int temp = (!GetBgAttribute(bg, BG_ATTR_PALETTEMODE)) ? 0x20 : 0x40;
|
||||
void *addr = (void *)((GetBgAttribute(bg, BG_ATTR_CHARBASEINDEX) * 0x4000) + (GetBgAttribute(bg, BG_ATTR_BASETILE) + a2) * temp);
|
||||
RequestDma3Fill(a1 << 24 | a1 << 16 | a1 << 8 | a1, addr + VRAM, a3 * temp, 1);
|
||||
}
|
||||
|
||||
|
@ -509,7 +509,7 @@ static void InitMirageTowerShake(u8 taskId)
|
||||
{
|
||||
case 0:
|
||||
FreeAllWindowBuffers();
|
||||
SetBgAttribute(0, BG_CTRL_ATTR_MOSAIC, 2);
|
||||
SetBgAttribute(0, BG_ATTR_PRIORITY, 2);
|
||||
gTasks[taskId].data[0]++;
|
||||
break;
|
||||
case 1:
|
||||
@ -624,7 +624,7 @@ static void DoMirageTowerDisintegration(u8 taskId)
|
||||
case 6:
|
||||
SetGpuRegBits(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2));
|
||||
SetGpuRegBits(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0));
|
||||
SetBgAttribute(0, BG_CTRL_ATTR_MOSAIC, 0);
|
||||
SetBgAttribute(0, BG_ATTR_PRIORITY, 0);
|
||||
sub_81971D0();
|
||||
break;
|
||||
case 7:
|
||||
|
@ -1448,9 +1448,9 @@ u8 GetCurrentMapBattleScene(void)
|
||||
static void overworld_bg_setup(void)
|
||||
{
|
||||
InitBgsFromTemplates(0, gUnknown_08339DAC, ARRAY_COUNT(gUnknown_08339DAC));
|
||||
SetBgAttribute(1, BG_CTRL_ATTR_PALETTEMODE, 1);
|
||||
SetBgAttribute(2, BG_CTRL_ATTR_PALETTEMODE, 1);
|
||||
SetBgAttribute(3, BG_CTRL_ATTR_PALETTEMODE, 1);
|
||||
SetBgAttribute(1, BG_ATTR_MOSAIC, 1);
|
||||
SetBgAttribute(2, BG_ATTR_MOSAIC, 1);
|
||||
SetBgAttribute(3, BG_ATTR_MOSAIC, 1);
|
||||
gBGTilemapBuffers2 = AllocZeroed(0x800);
|
||||
gBGTilemapBuffers1 = AllocZeroed(0x800);
|
||||
gBGTilemapBuffers3 = AllocZeroed(0x800);
|
||||
|
@ -533,7 +533,7 @@ static void Task_PokedexAreaScreen_0(u8 taskId)
|
||||
HideBg(0);
|
||||
break;
|
||||
case 1:
|
||||
SetBgAttribute(3, BG_CTRL_ATTR_VISIBLE, 3);
|
||||
SetBgAttribute(3, BG_ATTR_CHARBASEINDEX, 3);
|
||||
sub_81C4D70(&sUnknown_085B4018);
|
||||
StringFill(sPokedexAreaScreen->charBuffer, CHAR_SPACE, 16);
|
||||
break;
|
||||
@ -628,8 +628,8 @@ static void Task_PokedexAreaScreen_1(u8 taskId)
|
||||
|
||||
static void sub_813D6B4(void)
|
||||
{
|
||||
SetBgAttribute(3, BG_CTRL_ATTR_VISIBLE, 0);
|
||||
SetBgAttribute(3, BG_CTRL_ATTR_SCREENSIZE, 0);
|
||||
SetBgAttribute(3, BG_ATTR_CHARBASEINDEX, 0);
|
||||
SetBgAttribute(3, BG_ATTR_PALETTEMODE, 0);
|
||||
}
|
||||
|
||||
static void CreateAreaMarkerSprites(void)
|
||||
|
@ -8826,7 +8826,7 @@ static bool8 sub_80D024C(void)
|
||||
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20);
|
||||
FillWindowPixelBuffer8Bit(sPSSData->field_2200, 0);
|
||||
sub_80D07B0(sMoveMonsPtr->fromRow, sMoveMonsPtr->fromColumn);
|
||||
SetBgAttribute(0, 4, 1);
|
||||
SetBgAttribute(0, BG_ATTR_PALETTEMODE, 1);
|
||||
PutWindowTilemap(sPSSData->field_2200);
|
||||
CopyWindowToVram8Bit(sPSSData->field_2200, 3);
|
||||
BlendPalettes(0x3F00, 8, RGB_WHITE);
|
||||
@ -9246,7 +9246,7 @@ static void sub_80D0B5C(void)
|
||||
{
|
||||
ChangeBgX(0, 0, 0);
|
||||
ChangeBgY(0, 0, 0);
|
||||
SetBgAttribute(0, 4, 0);
|
||||
SetBgAttribute(0, BG_ATTR_PALETTEMODE, 0);
|
||||
ClearGpuRegBits(REG_OFFSET_BG0CNT, BGCNT_256COLOR);
|
||||
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32);
|
||||
CopyBgTilemapBufferToVram(0);
|
||||
@ -9865,7 +9865,7 @@ static bool8 sub_80D184C(void)
|
||||
var = 0x15 - sPSSData->field_2236;
|
||||
for (i = 0; i < var; i++)
|
||||
{
|
||||
WriteSequenceToBgTilemapBuffer(0, GetBgAttribute(0, 10) + 0x14 + sPSSData->field_2236 + i, i, 13, 1, 7, 15, 21);
|
||||
WriteSequenceToBgTilemapBuffer(0, GetBgAttribute(0, BG_ATTR_BASETILE) + 0x14 + sPSSData->field_2236 + i, i, 13, 1, 7, 15, 21);
|
||||
}
|
||||
|
||||
sub_80D19B4(var);
|
||||
@ -9886,7 +9886,7 @@ static bool8 sub_80D18E4(void)
|
||||
var = 0x15 - sPSSData->field_2236;
|
||||
for (i = 0; i < var; i++)
|
||||
{
|
||||
WriteSequenceToBgTilemapBuffer(0, GetBgAttribute(0, 10) + 0x14 + sPSSData->field_2236 + i, i, 13, 1, 7, 15, 21);
|
||||
WriteSequenceToBgTilemapBuffer(0, GetBgAttribute(0, BG_ATTR_BASETILE) + 0x14 + sPSSData->field_2236 + i, i, 13, 1, 7, 15, 21);
|
||||
}
|
||||
|
||||
if (var >= 0)
|
||||
@ -10423,7 +10423,7 @@ static const sUnkVars[][4] =
|
||||
|
||||
static void sub_80D2644(u8 id, u8 bg, const void *arg2, u16 arg3, u16 arg4)
|
||||
{
|
||||
u16 attribute1, attribute2;
|
||||
u16 bgScreenSize, bgType;
|
||||
|
||||
if (id >= gUnknown_02039D88)
|
||||
return;
|
||||
@ -10434,11 +10434,11 @@ static void sub_80D2644(u8 id, u8 bg, const void *arg2, u16 arg3, u16 arg4)
|
||||
gUnknown_02039D84[id].field_24 = arg3;
|
||||
gUnknown_02039D84[id].field_26 = arg4;
|
||||
|
||||
attribute1 = GetBgAttribute(bg, 3);
|
||||
attribute2 = GetBgAttribute(bg, 9);
|
||||
gUnknown_02039D84[id].field_20 = sUnkVars[attribute2][attribute1].a;
|
||||
gUnknown_02039D84[id].field_22 = sUnkVars[attribute2][attribute1].b;
|
||||
if (attribute2 != 0)
|
||||
bgScreenSize = GetBgAttribute(bg, BG_ATTR_SCREENSIZE);
|
||||
bgType = GetBgAttribute(bg, BG_ATTR_TYPE);
|
||||
gUnknown_02039D84[id].field_20 = sUnkVars[bgType][bgScreenSize].a;
|
||||
gUnknown_02039D84[id].field_22 = sUnkVars[bgType][bgScreenSize].b;
|
||||
if (bgType != 0)
|
||||
gUnknown_02039D84[id].field_2A = 1;
|
||||
else
|
||||
gUnknown_02039D84[id].field_2A = 2;
|
||||
|
@ -1688,15 +1688,15 @@ static void sub_81C0B8C(u8 taskId)
|
||||
if (pssData->unk40C9 == 0)
|
||||
{
|
||||
data[1] = 1;
|
||||
SetBgAttribute(1, 7, 1);
|
||||
SetBgAttribute(2, 7, 2);
|
||||
SetBgAttribute(1, BG_ATTR_PRIORITY, 1);
|
||||
SetBgAttribute(2, BG_ATTR_PRIORITY, 2);
|
||||
schedule_bg_copy_tilemap_to_vram(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
data[1] = 2;
|
||||
SetBgAttribute(2, 7, 1);
|
||||
SetBgAttribute(1, 7, 2);
|
||||
SetBgAttribute(2, BG_ATTR_PRIORITY, 1);
|
||||
SetBgAttribute(1, BG_ATTR_PRIORITY, 2);
|
||||
schedule_bg_copy_tilemap_to_vram(2);
|
||||
}
|
||||
ChangeBgX(data[1], 0, 0);
|
||||
@ -1745,14 +1745,14 @@ static void sub_81C0D44(u8 taskId)
|
||||
s16 *data = gTasks[taskId].data;
|
||||
if (pssData->unk40C9 == 0)
|
||||
{
|
||||
SetBgAttribute(1, 7, 1);
|
||||
SetBgAttribute(2, 7, 2);
|
||||
SetBgAttribute(1, BG_ATTR_PRIORITY, 1);
|
||||
SetBgAttribute(2, BG_ATTR_PRIORITY, 2);
|
||||
schedule_bg_copy_tilemap_to_vram(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetBgAttribute(2, 7, 1);
|
||||
SetBgAttribute(1, 7, 2);
|
||||
SetBgAttribute(2, BG_ATTR_PRIORITY, 1);
|
||||
SetBgAttribute(1, BG_ATTR_PRIORITY, 2);
|
||||
schedule_bg_copy_tilemap_to_vram(1);
|
||||
}
|
||||
if (pssData->currPageIndex > 1)
|
||||
|
@ -493,11 +493,11 @@ bool8 sub_8122DB0(void)
|
||||
gRegionMap->blinkPlayerIcon = FALSE;
|
||||
if (gRegionMap->bgManaged)
|
||||
{
|
||||
SetBgAttribute(gRegionMap->bgNum, BG_CTRL_ATTR_MAPBASEINDEX, 2);
|
||||
SetBgAttribute(gRegionMap->bgNum, BG_CTRL_ATTR_VISIBLE, gRegionMap->charBaseIdx);
|
||||
SetBgAttribute(gRegionMap->bgNum, BG_CTRL_ATTR_CHARBASEINDEX, gRegionMap->mapBaseIdx);
|
||||
SetBgAttribute(gRegionMap->bgNum, BG_CTRL_ATTR_PRIORITY, 1);
|
||||
SetBgAttribute(gRegionMap->bgNum, BG_CTRL_ATTR_SCREENSIZE, 1);
|
||||
SetBgAttribute(gRegionMap->bgNum, BG_ATTR_SCREENSIZE, 2);
|
||||
SetBgAttribute(gRegionMap->bgNum, BG_ATTR_CHARBASEINDEX, gRegionMap->charBaseIdx);
|
||||
SetBgAttribute(gRegionMap->bgNum, BG_ATTR_MAPBASEINDEX, gRegionMap->mapBaseIdx);
|
||||
SetBgAttribute(gRegionMap->bgNum, BG_ATTR_WRAPAROUND, 1);
|
||||
SetBgAttribute(gRegionMap->bgNum, BG_ATTR_PALETTEMODE, 1);
|
||||
}
|
||||
gRegionMap->initStep++;
|
||||
return FALSE;
|
||||
|
@ -50,8 +50,8 @@ static void CB2_ReshowBattleScreenAfterMenu(void)
|
||||
case 0:
|
||||
ScanlineEffect_Clear();
|
||||
BattleInitBgsAndWindows();
|
||||
SetBgAttribute(1, BG_CTRL_ATTR_VISIBLE, 0);
|
||||
SetBgAttribute(2, BG_CTRL_ATTR_VISIBLE, 0);
|
||||
SetBgAttribute(1, BG_ATTR_CHARBASEINDEX, 0);
|
||||
SetBgAttribute(2, BG_ATTR_CHARBASEINDEX, 0);
|
||||
ShowBg(0);
|
||||
ShowBg(1);
|
||||
ShowBg(2);
|
||||
|
@ -22,21 +22,21 @@ void sub_81C4D70(const struct UnkStruct_1C4D70 *template)
|
||||
|
||||
if (unk == 0)
|
||||
{
|
||||
SetBgAttribute(template->bg, BG_CTRL_ATTR_WRAPAROUND, 0);
|
||||
SetBgAttribute(template->bg, BG_ATTR_METRIC, 0);
|
||||
decompress_and_copy_tile_data_to_vram(template->bg, gUnknown_0861D1A0, 0, template->unk2, unk);
|
||||
sub_8199D3C(decompress_and_copy_tile_data_to_vram(template->bg, gUnknown_0861DEF4, 0, 0, 1), template->unk2, 32, 32, unk);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetBgAttribute(template->bg, BG_CTRL_ATTR_WRAPAROUND, 2);
|
||||
SetBgAttribute(template->bg, 9, 1);
|
||||
SetBgAttribute(template->bg, BG_ATTR_METRIC, 2);
|
||||
SetBgAttribute(template->bg, BG_ATTR_TYPE, 1);
|
||||
decompress_and_copy_tile_data_to_vram(template->bg, gUnknown_0861E208, 0, template->unk2, 0);
|
||||
sub_8199D3C(decompress_and_copy_tile_data_to_vram(template->bg, gUnknown_0861EF64, 0, 0, 1), template->unk2, 64, 64, 1);
|
||||
}
|
||||
|
||||
ChangeBgX(template->bg, 0, 0);
|
||||
ChangeBgY(template->bg, 0, 0);
|
||||
SetBgAttribute(template->bg, BG_CTRL_ATTR_SCREENSIZE, 1);
|
||||
SetBgAttribute(template->bg, BG_ATTR_PALETTEMODE, 1);
|
||||
CpuCopy32(gUnknown_0861D140, &gPlttBufferUnfaded[0x70], 0x60);
|
||||
*gUnknown_0203CF28 = template->bg;
|
||||
}
|
||||
|
12
src/window.c
12
src/window.c
@ -63,7 +63,7 @@ bool16 InitWindows(const struct WindowTemplate *templates)
|
||||
|
||||
if (gUnknown_03002F70[bgLayer] == NULL)
|
||||
{
|
||||
attrib = GetBgAttribute(bgLayer, 0x8);
|
||||
attrib = GetBgAttribute(bgLayer, BG_ATTR_METRIC);
|
||||
|
||||
if (attrib != 0xFFFF)
|
||||
{
|
||||
@ -141,7 +141,7 @@ u16 AddWindow(const struct WindowTemplate *template)
|
||||
|
||||
if (gUnknown_03002F70[bgLayer] == NULL)
|
||||
{
|
||||
attrib = GetBgAttribute(bgLayer, 0x8);
|
||||
attrib = GetBgAttribute(bgLayer, BG_ATTR_METRIC);
|
||||
|
||||
if (attrib != 0xFFFF)
|
||||
{
|
||||
@ -328,7 +328,7 @@ void PutWindowTilemap(u8 windowId)
|
||||
|
||||
WriteSequenceToBgTilemapBuffer(
|
||||
windowLocal.window.bg,
|
||||
GetBgAttribute(windowLocal.window.bg, 0xA) + windowLocal.window.baseBlock,
|
||||
GetBgAttribute(windowLocal.window.bg, BG_ATTR_BASETILE) + windowLocal.window.baseBlock,
|
||||
windowLocal.window.tilemapLeft,
|
||||
windowLocal.window.tilemapTop,
|
||||
windowLocal.window.width,
|
||||
@ -340,7 +340,7 @@ void PutWindowTilemap(u8 windowId)
|
||||
void PutWindowRectTilemapOverridePalette(u8 windowId, u8 x, u8 y, u8 width, u8 height, u8 palette)
|
||||
{
|
||||
struct Window windowLocal = gWindows[windowId];
|
||||
u16 currentRow = windowLocal.window.baseBlock + (y * windowLocal.window.width) + x + GetBgAttribute(windowLocal.window.bg, 0xA);
|
||||
u16 currentRow = windowLocal.window.baseBlock + (y * windowLocal.window.width) + x + GetBgAttribute(windowLocal.window.bg, BG_ATTR_BASETILE);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < height; ++i)
|
||||
@ -376,7 +376,7 @@ void ClearWindowTilemap(u8 windowId)
|
||||
void PutWindowRectTilemap(u8 windowId, u8 x, u8 y, u8 width, u8 height)
|
||||
{
|
||||
struct Window windowLocal = gWindows[windowId];
|
||||
u16 currentRow = windowLocal.window.baseBlock + (y * windowLocal.window.width) + x + GetBgAttribute(windowLocal.window.bg, 0xA);
|
||||
u16 currentRow = windowLocal.window.baseBlock + (y * windowLocal.window.width) + x + GetBgAttribute(windowLocal.window.bg, BG_ATTR_BASETILE);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < height; ++i)
|
||||
@ -617,7 +617,7 @@ u16 AddWindow8Bit(const struct WindowTemplate *template)
|
||||
bgLayer = template->bg;
|
||||
if (gUnknown_03002F70[bgLayer] == 0)
|
||||
{
|
||||
u16 attribute = GetBgAttribute(bgLayer, 8);
|
||||
u16 attribute = GetBgAttribute(bgLayer, BG_ATTR_METRIC);
|
||||
if (attribute != 0xFFFF)
|
||||
{
|
||||
s32 i;
|
||||
|
Loading…
Reference in New Issue
Block a user