Propagate BG_COORD constants

This commit is contained in:
GriffinR 2021-11-03 23:02:06 -04:00
parent d6f873ba69
commit c291fa8e7f
49 changed files with 307 additions and 306 deletions

View File

@ -21,6 +21,7 @@ enum {
BG_TYPE_NONE = 0xFFFF
};
// Modes for ChangeBgX / ChangeBgY
enum {
BG_COORD_SET,
BG_COORD_ADD,

View File

@ -5281,10 +5281,10 @@ static void Task_ShowTourneyTree(u8 taskId)
gBattle_BG0_Y = 0;
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0;
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0xB00, 0);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0xB00, BG_COORD_SET);
gTasks[taskId].tState++;
break;
case 1:
@ -5597,8 +5597,8 @@ static void CB2_TourneyTree(void)
static void VblankCb_TourneyInfoCard(void)
{
ChangeBgX(3, 0x80, 1);
ChangeBgY(3, 0x80, 2);
ChangeBgX(3, 0x80, BG_COORD_ADD);
ChangeBgY(3, 0x80, BG_COORD_SUB);
SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X);
SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y);
SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X);
@ -5693,8 +5693,8 @@ static void VblankCb_TourneyTree(void)
SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y);
SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X);
SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
ChangeBgY(2, 0x80, 2);
ChangeBgY(3, 0x80, 1);
ChangeBgY(2, 0x80, BG_COORD_SUB);
ChangeBgY(3, 0x80, BG_COORD_ADD);
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();

View File

@ -1147,12 +1147,12 @@ static void CB2_InitSelectScreen(void)
sSelectMonPicBgTilesetBuffer = AllocZeroed(0x440);
sSelectMenuTilemapBuffer = Alloc(BG_SCREEN_SIZE);
sSelectMonPicBgTilemapBuffer = AllocZeroed(BG_SCREEN_SIZE);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
@ -3280,14 +3280,14 @@ static void CB2_InitSwapScreen(void)
sSwapMonPicBgTilesetBuffer = AllocZeroed(0x440);
sSwapMenuTilemapBuffer = Alloc(BG_SCREEN_SIZE);
sSwapMonPicBgTilemapBuffer = AllocZeroed(BG_SCREEN_SIZE);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
SetGpuReg(REG_OFFSET_BLDY, 0);
SetGpuReg(REG_OFFSET_MOSAIC, 0);
SetGpuReg(REG_OFFSET_WIN0H, 0);

View File

@ -425,14 +425,14 @@ static void ClearTasksAndGraphicalStructs(void)
static void ResetBgCoordinates(void)
{
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
}
static void SetDispcntReg(void)

View File

@ -378,9 +378,9 @@ static bool8 Circles_Init(struct Task *task)
LoadLogoGfx();
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgY(0, 0x500, 2);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgY(0, 0x500, BG_COORD_SUB);
task->tTimer = 0;
task->tState++;

View File

@ -1013,10 +1013,10 @@ static void DrawBlenderBg(void)
ShowBg(0);
ShowBg(1);
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
}
static void InitBerryBlenderWindows(void)

View File

@ -1202,12 +1202,12 @@ static s32 ShowGameDisplay(void)
SetBgTilemapBuffer(1, game->gfx.bgBuffers[0]);
SetBgTilemapBuffer(2, game->gfx.bgBuffers[2]);
SetBgTilemapBuffer(3, game->gfx.bgBuffers[3]);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
break;
@ -1249,8 +1249,8 @@ static s32 ShowGameDisplay(void)
CreateWirelessStatusIndicatorSprite(0, 0);
CreateGameSprites(game);
SetGpuReg(REG_OFFSET_BG1VOFS, -gSpriteCoordOffsetY);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
break;
case 9:
gPaletteFade.bufferTransferDisabled = FALSE;

View File

@ -290,10 +290,10 @@ static void BerryFix_GpuSet(void)
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sBerryFixBgTemplates, ARRAY_COUNT(sBerryFixBgTemplates));
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
InitWindows(sBerryFixWindowTemplates);
DeactivateAllTextPrinters();

View File

@ -267,8 +267,8 @@ static void InitContestPaintingWindow(void)
{
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
SetBgTilemapBuffer(1, AllocZeroed(BG_SCREEN_SIZE));
sWindowId = AddWindow(&sWindowTemplate);
DeactivateAllTextPrinters();

View File

@ -1352,14 +1352,14 @@ static void ResetGame(void)
}
break;
case 2:
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
sGame->state++;
break;
case 3:
@ -5172,14 +5172,14 @@ static void InitBgs(void)
SetGpuReg(REG_OFFSET_DISPCNT, 0);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
InitStandardTextBoxWindows();
InitTextBoxGfxAndPrinters();
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);

View File

@ -3900,14 +3900,14 @@ static bool8 InitEasyChatScreenControl_(void)
static void InitEasyChatBgs(void)
{
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON);
}
@ -4550,7 +4550,7 @@ static void BufferLowerWindowFrame(int left, int top, int width, int height)
static void ResetLowerWindowScroll(void)
{
ChangeBgY(2, 0x800, 0);
ChangeBgY(2, 0x800, BG_COORD_SET);
sScreenControl->scrollOffset = 0;
}
@ -4572,7 +4572,7 @@ static void InitLowerWindowScroll(s16 scrollChange, u8 speed)
}
else
{
ChangeBgY(2, bgY, 0);
ChangeBgY(2, bgY, BG_COORD_SET);
}
}
@ -4587,7 +4587,7 @@ static bool8 UpdateLowerWindowScroll(void)
}
else
{
ChangeBgY(2, sScreenControl->scrollSpeed, 1);
ChangeBgY(2, sScreenControl->scrollSpeed, BG_COORD_ADD);
return TRUE;
}
}

View File

@ -495,10 +495,10 @@ static void CB2_EggHatch_0(void)
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sBgTemplates_EggHatch, ARRAY_COUNT(sBgTemplates_EggHatch));
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
SetBgAttribute(1, BG_ATTR_PRIORITY, 2);
SetBgTilemapBuffer(1, Alloc(0x1000));

View File

@ -561,14 +561,14 @@ static void ResetGpuRegsAndBgs(void)
SetGpuReg(REG_OFFSET_BG2CNT, 0);
SetGpuReg(REG_OFFSET_BG1CNT, 0);
SetGpuReg(REG_OFFSET_BG0CNT, 0);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);

View File

@ -1295,12 +1295,12 @@ static void InitHofBgs(void)
InitBgsFromTemplates(0, sHof_BgTemplates, ARRAY_COUNT(sHof_BgTemplates));
SetBgTilemapBuffer(1, sHofGfxPtr->tilemap1);
SetBgTilemapBuffer(3, sHofGfxPtr->tilemap2);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
}
static bool8 LoadHofBgs(void)

View File

@ -2039,7 +2039,7 @@ bool8 UseRegisteredKeyItemOnField(void)
if (InUnionRoom() == TRUE || InBattlePyramid() || InBattlePike() || InMultiPartnerRoom() == TRUE)
return FALSE;
HideMapNamePopUpWindow();
ChangeBgY_ScreenOff(0, 0, 0);
ChangeBgY_ScreenOff(0, 0, BG_COORD_SET);
if (gSaveBlock1Ptr->registeredItem != ITEM_NONE)
{
if (CheckBagHasItem(gSaveBlock1Ptr->registeredItem, 1) == TRUE)

View File

@ -583,10 +583,10 @@ static u32 InitMainMenu(bool8 returningFromOptionsMenu)
BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_WHITEALPHA); // fade to white
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sMainMenuBgTemplates, ARRAY_COUNT(sMainMenuBgTemplates));
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
InitWindows(sWindowTemplates_MainMenu);
DeactivateAllTextPrinters();
LoadMainMenuWindowFrameTiles(0, MAIN_MENU_BORDER_TILE);
@ -861,8 +861,8 @@ static void Task_DisplayMainMenu(u8 taskId)
gTasks[tScrollArrowTaskId].func = Task_ScrollIndicatorArrowPairOnMainMenu;
if (sCurrItemAndOptionMenuCheck == 4)
{
ChangeBgY(0, 0x2000, 1);
ChangeBgY(1, 0x2000, 1);
ChangeBgY(0, 0x2000, BG_COORD_ADD);
ChangeBgY(1, 0x2000, BG_COORD_ADD);
tIsScrolled = TRUE;
gTasks[tScrollArrowTaskId].tArrowTaskIsScrolled = TRUE;
}
@ -901,8 +901,8 @@ static bool8 HandleMainMenuInput(u8 taskId)
{
if (tMenuType == HAS_MYSTERY_EVENTS && tIsScrolled == TRUE && tCurrItem == 1)
{
ChangeBgY(0, 0x2000, 2);
ChangeBgY(1, 0x2000, 2);
ChangeBgY(0, 0x2000, BG_COORD_SUB);
ChangeBgY(1, 0x2000, BG_COORD_SUB);
gTasks[tScrollArrowTaskId].tArrowTaskIsScrolled = tIsScrolled = FALSE;
}
tCurrItem--;
@ -913,8 +913,8 @@ static bool8 HandleMainMenuInput(u8 taskId)
{
if (tMenuType == HAS_MYSTERY_EVENTS && tCurrItem == 3 && tIsScrolled == FALSE)
{
ChangeBgY(0, 0x2000, 1);
ChangeBgY(1, 0x2000, 1);
ChangeBgY(0, 0x2000, BG_COORD_ADD);
ChangeBgY(1, 0x2000, BG_COORD_ADD);
gTasks[tScrollArrowTaskId].tArrowTaskIsScrolled = tIsScrolled = TRUE;
}
tCurrItem++;
@ -1048,8 +1048,8 @@ static void Task_HandleMainMenuAPressed(u8 taskId)
}
break;
}
ChangeBgY(0, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
switch (action)
{
case ACTION_NEW_GAME:

View File

@ -1263,7 +1263,7 @@ static bool32 MatchCall_LoadGfx(u8 taskId)
FillWindowPixelBuffer(tWindowId, PIXEL_FILL(8));
LoadPalette(sMatchCallWindow_Pal, 0xE0, sizeof(sMatchCallWindow_Pal));
LoadPalette(sPokenavIcon_Pal, 0xF0, sizeof(sPokenavIcon_Pal));
ChangeBgY(0, -0x2000, 0);
ChangeBgY(0, -0x2000, BG_COORD_SET);
return TRUE;
}
@ -1297,9 +1297,9 @@ static bool32 MatchCall_ReadyIntro(u8 taskId)
static bool32 MatchCall_SlideWindowIn(u8 taskId)
{
if (ChangeBgY(0, 0x600, 1) >= 0)
if (ChangeBgY(0, 0x600, BG_COORD_ADD) >= 0)
{
ChangeBgY(0, 0, 0);
ChangeBgY(0, 0, BG_COORD_SET);
return TRUE;
}
@ -1340,7 +1340,7 @@ static bool32 MatchCall_PrintMessage(u8 taskId)
static bool32 MatchCall_SlideWindowOut(u8 taskId)
{
s16 *data = gTasks[taskId].data;
if (ChangeBgY(0, 0x600, 2) <= -0x2000)
if (ChangeBgY(0, 0x600, BG_COORD_SUB) <= -0x2000)
{
FillBgTilemapBufferRect_Palette0(0, 0, 0, 14, 30, 6);
DestroyTask(tIconTaskId);
@ -1357,7 +1357,7 @@ static bool32 MatchCall_EndCall(u8 taskId)
u8 playerObjectId;
if (!IsDma3ManagerBusyWithBgCopy() && !IsSEPlaying())
{
ChangeBgY(0, 0, 0);
ChangeBgY(0, 0, BG_COORD_SET);
if (!sMatchCallState.triggeredFromScript)
{
LoadMessageBoxAndBorderGfx();

View File

@ -153,8 +153,8 @@ void FreeAllOverworldWindowBuffers(void)
void InitTextBoxGfxAndPrinters(void)
{
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
DeactivateAllTextPrinters();
LoadMessageBoxAndBorderGfx();
}
@ -1922,14 +1922,14 @@ void AddValToTilemapBuffer(void *ptr, int delta, int width, int height, bool32 i
void ResetBgPositions(void)
{
ChangeBgX(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
}
void sub_8199DF0(u32 bg, u8 a1, int a2, int a3)

View File

@ -106,14 +106,14 @@ void ResetVramOamAndBgCntRegs(void)
void ResetAllBgsCoordinates(void)
{
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
}
void SetVBlankHBlankCallbacksToNull(void)

View File

@ -536,8 +536,8 @@ static void InitMirageTowerShake(u8 taskId)
case 1:
sMirageTowerGfxBuffer = (u8 *)AllocZeroed(MIRAGE_TOWER_GFX_LENGTH);
sMirageTowerTilemapBuffer = (u8 *)AllocZeroed(BG_SCREEN_SIZE);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
gTasks[taskId].tState++;
break;
case 2:

View File

@ -387,14 +387,14 @@ static bool32 HandleMysteryGiftOrEReaderSetup(s32 isEReader)
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sBGTemplates, ARRAY_COUNT(sBGTemplates));
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
SetBgTilemapBuffer(3, Alloc(BG_SCREEN_SIZE));
SetBgTilemapBuffer(2, Alloc(BG_SCREEN_SIZE));

View File

@ -678,10 +678,10 @@ s32 WonderNews_Enter(void)
case 1:
if (UpdatePaletteFade())
return 0;
ChangeBgY(0, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, DISPLAY_WIDTH));
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(26, 152));
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ);
@ -753,7 +753,7 @@ s32 WonderNews_Exit(bool32 useCancel)
case 1:
if (UpdatePaletteFade())
return 0;
ChangeBgY(2, 0, 0);
ChangeBgY(2, 0, BG_COORD_SET);
SetGpuReg(REG_OFFSET_WIN0H, 0);
SetGpuReg(REG_OFFSET_WIN0V, 0);
SetGpuReg(REG_OFFSET_WININ, 0);
@ -777,8 +777,8 @@ s32 WonderNews_Exit(bool32 useCancel)
RemoveWindow(sWonderNewsData->windowIds[NEWS_WIN_TITLE]);
break;
case 4:
ChangeBgY(2, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
if (sWonderNewsData->arrowTaskId != TASK_NONE)
{
RemoveScrollIndicatorArrowPair(sWonderNewsData->arrowTaskId);

View File

@ -516,14 +516,14 @@ static void NamingScreen_InitBGs(void)
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
InitStandardTextBoxWindows();
InitTextBoxGfxAndPrinters();

View File

@ -173,14 +173,14 @@ void CB2_InitOptionMenu(void)
SetGpuReg(REG_OFFSET_DISPCNT, 0);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sOptionMenuBgTemplates, ARRAY_COUNT(sOptionMenuBgTemplates));
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
InitWindows(sOptionMenuWinTemplates);
DeactivateAllTextPrinters();
SetGpuReg(REG_OFFSET_WIN0H, 0);

View File

@ -2101,14 +2101,14 @@ static void InitOverworldGraphicsRegisters(void)
ScheduleBgCopyTilemapToVram(1);
ScheduleBgCopyTilemapToVram(2);
ScheduleBgCopyTilemapToVram(3);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_WIN0_ON | DISPCNT_WIN1_ON
| DISPCNT_OBJ_1D_MAP | DISPCNT_HBLANK_INTERVAL);
ShowBg(0);

View File

@ -6056,7 +6056,7 @@ static void Task_InitMultiPartnerPartySlideIn(u8 taskId)
// The first slide step also sets the sprites offscreen
gTasks[taskId].tXPos = 256;
SlideMultiPartyMenuBoxSpritesOneStep(taskId);
ChangeBgX(2, 0x10000, 0);
ChangeBgX(2, 0x10000, BG_COORD_SET);
gTasks[taskId].func = Task_MultiPartnerPartySlideIn;
}
@ -6112,7 +6112,7 @@ static void SlideMultiPartyMenuBoxSpritesOneStep(u8 taskId)
MoveMultiPartyMenuBoxSprite(sPartyMenuBoxes[i].statusSpriteId, tXPos - 8);
}
}
ChangeBgX(2, 0x800, 1);
ChangeBgX(2, 0x800, BG_COORD_ADD);
}
#undef tXpos

View File

@ -38,8 +38,8 @@ void LoadPokedexAreaMapGfx(const struct PokedexAreaMapTemplate *template)
AddValToTilemapBuffer(tilemap, template->offset, 64, 64, TRUE); // template->offset is always 0, so this does nothing.
}
ChangeBgX(template->bg, 0, 0);
ChangeBgY(template->bg, 0, 0);
ChangeBgX(template->bg, 0, BG_COORD_SET);
ChangeBgY(template->bg, 0, BG_COORD_SET);
SetBgAttribute(template->bg, BG_ATTR_PALETTEMODE, 1);
CpuCopy32(sPokedexAreaMap_Pal, &gPlttBufferUnfaded[0x70], 0x60);
*sPokedexAreaMapBgNum = template->bg;
@ -65,5 +65,5 @@ void FreePokedexAreaMapBgNum(void)
void PokedexAreaMapChangeBgY(u32 a0)
{
ChangeBgY(*sPokedexAreaMapBgNum, a0 * 0x100, 0);
ChangeBgY(*sPokedexAreaMapBgNum, a0 * 0x100, BG_COORD_SET);
}

View File

@ -319,7 +319,7 @@ static bool8 DrawAreaGlow(void)
}
return TRUE;
case 4:
ChangeBgY(2, -0x800, 0);
ChangeBgY(2, -0x800, BG_COORD_SET);
break;
default:
return FALSE;

View File

@ -443,7 +443,7 @@ static void ShiftWaveformOver(u8 windowId, s16 offset, bool8 rsVertical)
if (!rsVertical)
{
u8 bg = GetWindowAttribute(windowId, WINDOW_BG);
ChangeBgX(bg, offset << 8, 0);
ChangeBgX(bg, offset << 8, BG_COORD_SET);
}
}

View File

@ -3732,7 +3732,7 @@ static void SetMonSpriteY(u32 id, s16 y)
static void UpdateVineSwing(int vineState)
{
UpdateVineAnim(sPokemonJumpGfx, vineState);
ChangeBgY(BG_VENUSAUR, (sVenusaurStates[vineState] * 5) << 13, 0);
ChangeBgY(BG_VENUSAUR, (sVenusaurStates[vineState] * 5) << 13, BG_COORD_SET);
}
static int DoSameJumpTimeBonus(u8 flags)
@ -3896,8 +3896,8 @@ static void DrawPlayerNameWindows(void)
static void ShowBonus(u8 bonusId)
{
sPokemonJumpGfx->bonusTimer = 0;
ChangeBgX(BG_BONUSES, (bonusId / 2) * 256 * 256, 0);
ChangeBgY(BG_BONUSES, (((bonusId % 2) * 256) - 40) * 256, 0);
ChangeBgX(BG_BONUSES, (bonusId / 2) * 256 * 256, BG_COORD_SET);
ChangeBgY(BG_BONUSES, (((bonusId % 2) * 256) - 40) * 256, BG_COORD_SET);
ShowBg(BG_BONUSES);
CreateTask(Task_UpdateBonus, 4);
}
@ -3910,7 +3910,7 @@ static bool32 UpdateBonus(void)
}
else
{
ChangeBgY(BG_BONUSES, 128, 1);
ChangeBgY(BG_BONUSES, 128, BG_COORD_ADD);
if (++sPokemonJumpGfx->bonusTimer >= 32)
HideBg(BG_BONUSES);
return TRUE;

View File

@ -3827,8 +3827,8 @@ static void SetScrollingBackground(void)
static void ScrollBackground(void)
{
ChangeBgX(3, 128, 1);
ChangeBgY(3, 128, 2);
ChangeBgX(3, 128, BG_COORD_ADD);
ChangeBgY(3, 128, BG_COORD_SUB);
}
static void LoadPokeStorageMenuGfx(void)
@ -8184,8 +8184,8 @@ static bool8 MultiMove_Start(void)
GetCursorBoxColumnAndRow(&sMultiMove->fromColumn, &sMultiMove->fromRow);
sMultiMove->toColumn = sMultiMove->fromColumn;
sMultiMove->toRow = sMultiMove->fromRow;
ChangeBgX(0, -1024, 0);
ChangeBgY(0, -1024, 0);
ChangeBgX(0, -1024, BG_COORD_SET);
ChangeBgY(0, -1024, BG_COORD_SET);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20);
FillWindowPixelBuffer8Bit(sStorage->multiMoveWindowId, PIXEL_FILL(0));
MultiMove_SetIconToBg(sMultiMove->fromColumn, sMultiMove->fromRow);
@ -8499,8 +8499,8 @@ static u8 MultiMove_UpdateMove(void)
{
if (sMultiMove->bgMoveSteps != 0)
{
ChangeBgX(0, sMultiMove->bgX, 1);
ChangeBgY(0, sMultiMove->bgY, 1);
ChangeBgX(0, sMultiMove->bgX, BG_COORD_ADD);
ChangeBgY(0, sMultiMove->bgY, BG_COORD_ADD);
sMultiMove->bgMoveSteps--;
}
@ -8605,8 +8605,8 @@ static void MultiMove_SetPlacedMonData(void)
static void MultiMove_ResetBg(void)
{
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
SetBgAttribute(0, BG_ATTR_PALETTEMODE, 0);
ClearGpuRegBits(REG_OFFSET_BG0CNT, BGCNT_256COLOR);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32);

View File

@ -1462,7 +1462,7 @@ static void SetDefaultTilemaps(void)
TilemapFiveMovesDisplay(sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, FALSE);
SetBgTilemapBuffer(1, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0]);
SetBgTilemapBuffer(2, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0]);
ChangeBgX(2, 0x10000, 1);
ChangeBgX(2, 0x10000, BG_COORD_ADD);
ClearWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_SPECIES);
ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS);
}
@ -1778,12 +1778,12 @@ static void PssScrollRight(u8 taskId) // Scroll right
SetBgAttribute(1, BG_ATTR_PRIORITY, 2);
ScheduleBgCopyTilemapToVram(2);
}
ChangeBgX(data[1], 0, 0);
ChangeBgX(data[1], 0, BG_COORD_SET);
SetBgTilemapBuffer(data[1], sMonSummaryScreen->bgTilemapBuffers[sMonSummaryScreen->currPageIndex][0]);
ShowBg(1);
ShowBg(2);
}
ChangeBgX(data[1], 0x2000, 1);
ChangeBgX(data[1], 0x2000, BG_COORD_ADD);
data[0] += 32;
if (data[0] > 0xFF)
gTasks[taskId].func = PssScrollRightEnd;
@ -1811,9 +1811,9 @@ static void PssScrollLeft(u8 taskId) // Scroll left
data[1] = 2;
else
data[1] = 1;
ChangeBgX(data[1], 0x10000, 0);
ChangeBgX(data[1], 0x10000, BG_COORD_SET);
}
ChangeBgX(data[1], 0x2000, 2);
ChangeBgX(data[1], 0x2000, BG_COORD_SUB);
data[0] += 32;
if (data[0] > 0xFF)
gTasks[taskId].func = PssScrollLeftEnd;
@ -1837,7 +1837,7 @@ static void PssScrollLeftEnd(u8 taskId) // display left
if (sMonSummaryScreen->currPageIndex > 1)
{
SetBgTilemapBuffer(data[1], sMonSummaryScreen->bgTilemapBuffers[sMonSummaryScreen->currPageIndex - 1][0]);
ChangeBgX(data[1], 0x10000, 0);
ChangeBgX(data[1], 0x10000, BG_COORD_SET);
}
ShowBg(1);
ShowBg(2);
@ -2681,9 +2681,9 @@ static void DrawContestMoveHearts(u16 move)
static void LimitEggSummaryPageDisplay(void) // If the pokemon is an egg, limit the number of pages displayed to 1
{
if (sMonSummaryScreen->summary.isEgg)
ChangeBgX(3, 0x10000, 0);
ChangeBgX(3, 0x10000, BG_COORD_SET);
else
ChangeBgX(3, 0, 0);
ChangeBgX(3, 0, BG_COORD_SET);
}
static void ResetWindows(void)

View File

@ -199,12 +199,12 @@ u32 LoopedTask_OpenPartyConditionGraph(s32 state)
return LT_INC_AND_PAUSE;
case 1:
InitBgTemplates(sPartyConditionBgTemplates, ARRAY_COUNT(sPartyConditionBgTemplates));
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG3_ON);
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG2 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG3);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(11, 4));

View File

@ -448,8 +448,8 @@ static u32 LoopedTask_OpenConditionSearchResults(s32 state)
case 4:
if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE;
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ShowBg(1);
ShowBg(2);
HideBg(3);

View File

@ -421,9 +421,9 @@ static u32 LoopedTask_SlideMenuHeaderUp(s32 a0)
case 0:
return LT_INC_AND_PAUSE;
case 2:
if (ChangeBgY(0, 384, 1) >= 0x2000u)
if (ChangeBgY(0, 384, BG_COORD_ADD) >= 0x2000u)
{
ChangeBgY(0, 0x2000, 0);
ChangeBgY(0, 0x2000, BG_COORD_SET);
return LT_FINISH;
}
@ -433,9 +433,9 @@ static u32 LoopedTask_SlideMenuHeaderUp(s32 a0)
static u32 LoopedTask_SlideMenuHeaderDown(s32 a0)
{
if (ChangeBgY(0, 384, 2) <= 0)
if (ChangeBgY(0, 384, BG_COORD_SUB) <= 0)
{
ChangeBgY(0, 0, 0);
ChangeBgY(0, 0, BG_COORD_SET);
return LT_FINISH;
}
return LT_PAUSE;

View File

@ -322,8 +322,8 @@ static u32 LoopedTask_OpenMatchCall(s32 taskState)
{
case 0:
InitBgTemplates(sMatchCallBgTemplates, ARRAY_COUNT(sMatchCallBgTemplates));
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
DecompressAndCopyTileDataToVram(2, sMatchCallUI_Gfx, 0, 0, 0);
SetBgTilemapBuffer(2, state->unk1024);
CopyToBgTilemapBuffer(2, sMatchCallUI_Tilemap, 0, 0);
@ -367,8 +367,8 @@ static u32 LoopedTask_OpenMatchCall(s32 taskState)
PrintMatchCallLocation(state, 0);
return LT_INC_AND_PAUSE;
case 6:
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ShowBg(2);
ShowBg(3);
ShowBg(1);

View File

@ -174,9 +174,9 @@ void sub_81C82E4(struct PokenavSub17 *matchCall)
sub_8199DF0(matchCall->list.listWindow.bg, PIXEL_FILL(4), matchCall->list.listWindow.unk6 + 1, 1);
SetBgTilemapBuffer(matchCall->list.listWindow.bg, matchCall->tilemapBuffer);
FillBgTilemapBufferRect_Palette0(matchCall->list.listWindow.bg, tileNum, 0, 0, 32, 32);
ChangeBgY(matchCall->list.listWindow.bg, 0, 0);
ChangeBgX(matchCall->list.listWindow.bg, 0, 0);
ChangeBgY(matchCall->list.listWindow.bg, matchCall->list.listWindow.unk3 << 11, 2);
ChangeBgY(matchCall->list.listWindow.bg, 0, BG_COORD_SET);
ChangeBgX(matchCall->list.listWindow.bg, 0, BG_COORD_SET);
ChangeBgY(matchCall->list.listWindow.bg, matchCall->list.listWindow.unk3 << 11, BG_COORD_SUB);
CopyBgTilemapBufferToVram(matchCall->list.listWindow.bg);
}
@ -296,9 +296,9 @@ void sub_81C8568(s32 a0, struct PokenavSub17Substruct *list)
list->unk20 = GetBgY(list->listWindow.bg);
list->unk24 = list->unk20 + (a0 << 12);
if (a0 > 0)
list->unk30 = 1;
list->unk30 = BG_COORD_ADD;
else
list->unk30 = 2;
list->unk30 = BG_COORD_SUB;
list->unk2C = a0;
list->loopedTaskId = CreateLoopedTask(LoopedTask_sub_81C85A0, 6);
}
@ -320,12 +320,12 @@ u32 LoopedTask_sub_81C85A0(s32 state)
flag = FALSE;
y = GetBgY(subPtr->listWindow.bg);
v1 = ChangeBgY(subPtr->listWindow.bg, 0x1000, subPtr->unk30);
if (subPtr->unk30 == 2)
if (subPtr->unk30 == BG_COORD_SUB)
{
if ((y > subPtr->unk24 || y <= subPtr->unk20) && v1 <= subPtr->unk24)
flag = TRUE;
}
else
else // BG_COORD_ADD
{
if ((y < subPtr->unk24 || y >= subPtr->unk20) && v1 >= subPtr->unk24)
flag = TRUE;
@ -334,7 +334,7 @@ u32 LoopedTask_sub_81C85A0(s32 state)
if (flag)
{
subPtr->listWindow.unkA = (subPtr->listWindow.unkA + subPtr->unk2C) & 0xF;
ChangeBgY(subPtr->listWindow.bg, subPtr->unk24, 0);
ChangeBgY(subPtr->listWindow.bg, subPtr->unk24, BG_COORD_SET);
return LT_FINISH;
}
return LT_PAUSE;

View File

@ -415,12 +415,12 @@ static u32 LoopedTask_OpenMenu(s32 state)
CopyToBgTilemapBuffer(1, gPokenavMessageBox_Tilemap, 0, 0);
CopyBgTilemapBufferToVram(1);
CopyPaletteIntoBufferUnfaded(gPokenavMessageBox_Pal, 0x10, 0x20);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
return LT_INC_AND_PAUSE;
case 1:
if (FreeTempTileDataBuffersIfPossible())
@ -1168,7 +1168,7 @@ static void DestroyMovingDotsBgTask(void)
static void Task_MoveBgDots(u8 taskId)
{
ChangeBgX(3, 0x80, 1);
ChangeBgX(3, 0x80, BG_COORD_ADD);
}
static void CreateBgDotPurplePalTask(void)

View File

@ -515,11 +515,11 @@ static void LoadPokenavRegionMapGfx(struct Pokenav5Struct_2 *state)
CopyPaletteIntoBufferUnfaded(sMapSecInfoWindow_Pal, 0x10, 0x20);
CopyPaletteIntoBufferUnfaded(gRegionMapCityZoomTiles_Pal, 0x30, 0x20);
if (!IsRegionMapZoomed())
ChangeBgY(1, -0x6000, 0);
ChangeBgY(1, -0x6000, BG_COORD_SET);
else
ChangeBgY(1, 0, 0);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(1, 0, 0);
ChangeBgX(1, 0, BG_COORD_SET);
}
static bool32 TryFreeTempTileDataBuffers(void)
@ -587,9 +587,9 @@ static void Task_ChangeBgYForZoom(u8 taskId)
{
if (gTasks[taskId].tZoomIn)
{
if (ChangeBgY(1, 0x480, 1) >= 0)
if (ChangeBgY(1, 0x480, BG_COORD_ADD) >= 0)
{
ChangeBgY(1, 0, 0);
ChangeBgY(1, 0, BG_COORD_SET);
DestroyTask(taskId);
}
@ -597,9 +597,9 @@ static void Task_ChangeBgYForZoom(u8 taskId)
}
else
{
if (ChangeBgY(1, 0x480, 2) <= -0x6000)
if (ChangeBgY(1, 0x480, BG_COORD_SUB) <= -0x6000)
{
ChangeBgY(1, -0x6000, 0);
ChangeBgY(1, -0x6000, BG_COORD_SET);
DestroyTask(taskId);
}

View File

@ -439,8 +439,8 @@ static u32 LoopedTask_OpenRibbonsMonList(s32 state)
return LT_PAUSE;
if (!UpdateMonListBgs())
return LT_PAUSE;
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ShowBg(1);
return LT_INC_AND_PAUSE;
case 2:

View File

@ -631,10 +631,10 @@ static u32 LoopedTask_OpenRibbonsSummaryMenu(s32 state)
if (!IsDma3ManagerBusyWithBgCopy())
{
CreateBigRibbonSprite(structPtr);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ShowBg(1);
ShowBg(2);
HideBg(3);

View File

@ -1757,8 +1757,8 @@ static void DuoFight_LightningLong(void)
static void DuoFight_AnimateRain(void)
{
ChangeBgX(2, 0x400, 1);
ChangeBgY(2, 0x800, 2);
ChangeBgX(2, 0x400, BG_COORD_ADD);
ChangeBgY(2, 0x800, BG_COORD_SUB);
}
// Only used by the full version, which pans up at the end (so scene objects move down)
@ -1772,7 +1772,7 @@ static void DuoFight_PanOffScene(u8 taskId)
bgY = GetBgY(1);
if (GetBgY(1) == 0 || bgY > 0x8000)
ChangeBgY(1, 0x400, 2);
ChangeBgY(1, 0x400, BG_COORD_SUB);
if (tTimer != 16)
{
@ -1795,7 +1795,7 @@ static void Task_DuoFightEnd(u8 taskId)
if (!gPaletteFade.active)
{
DestroyTask(tHelperTaskId);
ChangeBgY(1, 0, 0);
ChangeBgY(1, 0, BG_COORD_SET);
SetVBlankCallback(NULL);
ScanlineEffect_Stop();
ResetSpriteData();
@ -2579,8 +2579,8 @@ static void Task_RayCharges_ShakeRayquaza(u8 taskId)
s16 *data = gTasks[taskId].data;
if ((tTimer & 3) == 0)
{
ChangeBgX(1, (Random() % 8 - 4) << 8, 0);
ChangeBgY(1, (Random() % 8 - 4) << 8, 0);
ChangeBgX(1, (Random() % 8 - 4) << 8, BG_COORD_SET);
ChangeBgY(1, (Random() % 8 - 4) << 8, BG_COORD_SET);
}
tTimer++;
@ -2592,16 +2592,16 @@ static void Task_RayCharges_FlyOffscreen(u8 taskId)
s16 *data = gTasks[taskId].data;
if (tState == 0)
{
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
tState++;
tOffset = 10;
tShakeDir = -1;
}
else if (tState == 1)
{
ChangeBgX(1, tOffset << 8, 2);
ChangeBgY(1, tOffset << 8, 1);
ChangeBgX(1, tOffset << 8, BG_COORD_SUB);
ChangeBgY(1, tOffset << 8, BG_COORD_ADD);
tOffset += tShakeDir;
if (tOffset == -10)
tShakeDir *= -1;
@ -2616,12 +2616,12 @@ static void Task_RayCharges_FlyOffscreen(u8 taskId)
static void RayCharges_AnimateBg(void)
{
// Update yellow orbs
ChangeBgX(2, 0x400, 2);
ChangeBgY(2, 0x400, 1);
ChangeBgX(2, 0x400, BG_COORD_SUB);
ChangeBgY(2, 0x400, BG_COORD_ADD);
// Update blue streaks
ChangeBgX(0, 0x800, 2);
ChangeBgY(0, 0x800, 1);
ChangeBgX(0, 0x800, BG_COORD_SUB);
ChangeBgY(0, 0x800, BG_COORD_ADD);
}
static void Task_RayChargesEnd(u8 taskId)

View File

@ -389,14 +389,14 @@ void CB2_ChooseStarter(void)
SetGpuReg(REG_OFFSET_BG1CNT, 0);
SetGpuReg(REG_OFFSET_BG0CNT, 0);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
DmaFill16(3, 0, VRAM, VRAM_SIZE);
DmaFill32(3, 0, OAM, OAM_SIZE);

View File

@ -2907,8 +2907,8 @@ static void InitTradeBgInternal(void)
SetGpuReg(REG_OFFSET_DISPCNT, 0);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sTradeSequenceBgTemplates, ARRAY_COUNT(sTradeSequenceBgTemplates));
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
SetBgTilemapBuffer(0, Alloc(BG_SCREEN_SIZE));
SetBgTilemapBuffer(1, Alloc(BG_SCREEN_SIZE));
SetBgTilemapBuffer(3, Alloc(BG_SCREEN_SIZE));

View File

@ -884,14 +884,14 @@ static void InitBgsAndWindows(void)
{
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sTrainerCardBgTemplates, ARRAY_COUNT(sTrainerCardBgTemplates));
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
InitWindows(sTrainerCardWindowTemplates);
DeactivateAllTextPrinters();
LoadMessageBoxAndBorderGfx();

View File

@ -2803,7 +2803,7 @@ static void AddStdMessageWindow(int msgId, u16 bg0vofs)
str = sDisplayStdMessages[msgId].text;
}
ChangeBgY(0, bg0vofs * 256, 0);
ChangeBgY(0, bg0vofs * 256, BG_COORD_SET);
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
PutWindowTilemap(windowId);
if (sDisplayStdMessages[msgId].boxType == 1)
@ -2846,7 +2846,7 @@ static void HideStdMessageWindow(void)
ClearWindowTilemap(sDisplay->messageWindowId);
}
ChangeBgY(0, 0, 0);
ChangeBgY(0, 0, BG_COORD_SET);
}
static void DestroyStdMessageWindow(void)
@ -3011,14 +3011,14 @@ static void PrintChatMessage(u16 row, u8 *str, u8 colorIdx)
static void ResetGpuBgState(void)
{
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
ShowBg(0);
ShowBg(1);
ShowBg(2);

View File

@ -1316,14 +1316,14 @@ static bool8 LoadUsePokeblockMenuGfx(void)
switch (sMenu->info.helperState)
{
case 0:
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 136 << 6, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 136 << 6, BG_COORD_SET);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON | DISPCNT_WIN1_ON);
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG2 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG1);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(11, 4));

View File

@ -628,14 +628,14 @@ static void LoadWallClockGraphics(void)
SetGpuReg(REG_OFFSET_BG2CNT, 0);
SetGpuReg(REG_OFFSET_BG1CNT, 0);
SetGpuReg(REG_OFFSET_BG0CNT, 0);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
ChangeBgY(2, 0, BG_COORD_SET);
ChangeBgX(3, 0, BG_COORD_SET);
ChangeBgY(3, 0, BG_COORD_SET);
DmaFillLarge16(3, 0, (void *)VRAM, VRAM_SIZE, 0x1000);
DmaClear32(3, (void *)OAM, OAM_SIZE);
DmaClear16(3, (void *)PLTT, PLTT_SIZE);

View File

@ -189,10 +189,10 @@ static void CB2_InitWirelessCommunicationScreen(void)
sStatusScreen->taskId = CreateTask(Task_WirelessCommunicationScreen, 0);
sStatusScreen->rfuTaskId = CreateTask_ListenToWireless();
sStatusScreen->prevGroupCounts[GROUPTYPE_TOTAL] = 1;
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(0, 0, BG_COORD_SET);
ChangeBgY(0, 0, BG_COORD_SET);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
LoadPalette(sBgTiles_Pal, 0x00, 0x20);
Menu_LoadStdPalAt(0xF0);
DynamicPlaceholderTextUtil_Reset();