Merge pull request #1497 from GriffinRichards/doc-hasmargin

Label swap line margin flag
This commit is contained in:
GriffinR 2021-08-21 12:06:30 -04:00 committed by GitHub
commit 63e6b914e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 9 deletions

View File

@ -7,7 +7,7 @@
#define MENU_L_PRESSED 1
#define MENU_R_PRESSED 2
// Exported type declarations
#define SWAP_LINE_HAS_MARGIN (1 << 7)
struct YesNoFuncTable
{
@ -15,9 +15,6 @@ struct YesNoFuncTable
TaskFunc noFunc;
};
// Exported RAM declarations
// Exported ROM declarations
void ResetVramOamAndBgCntRegs(void);
void ResetAllBgsCoordinates(void);
void SetVBlankHBlankCallbacksToNull(void);

View File

@ -1608,5 +1608,5 @@ static void SetSwapLineInvisibility(bool8 invisible)
static void UpdateSwapLinePos(u8 y)
{
UpdateSwapLineSpritesPos(&gPyramidBagMenu->spriteIds[PBAG_SPRITE_SWAP_LINE_START], NUM_SWAP_LINE_SPRITES | 0x80, 120, (y + 1) * 16);
UpdateSwapLineSpritesPos(&gPyramidBagMenu->spriteIds[PBAG_SPRITE_SWAP_LINE_START], NUM_SWAP_LINE_SPRITES | SWAP_LINE_HAS_MARGIN, 120, (y + 1) * 16);
}

View File

@ -559,7 +559,7 @@ void SetItemMenuSwapLineInvisibility(bool8 invisible)
void UpdateItemMenuSwapLinePos(u8 y)
{
UpdateSwapLineSpritesPos(&gBagMenu->spriteIds[ITEMMENUSPRITE_SWAP_LINE], ITEMMENU_SWAP_LINE_LENGTH | 0x80, 120, (y + 1) * 16);
UpdateSwapLineSpritesPos(&gBagMenu->spriteIds[ITEMMENUSPRITE_SWAP_LINE], ITEMMENU_SWAP_LINE_LENGTH | SWAP_LINE_HAS_MARGIN, 120, (y + 1) * 16);
}
static void sub_80D5018(void *mem0, void *mem1)

View File

@ -440,12 +440,16 @@ void SetSwapLineSpritesInvisibility(u8 *spriteIds, u8 count, bool8 invisible)
void UpdateSwapLineSpritesPos(u8 *spriteIds, u8 count, s16 x, u16 y)
{
u8 i;
bool8 unknownBit = count & 0x80;
count &= ~(0x80);
bool8 hasMargin = count & SWAP_LINE_HAS_MARGIN;
count &= ~SWAP_LINE_HAS_MARGIN;
for (i = 0; i < count; i++)
{
if (i == count - 1 && unknownBit)
// If the list menu has a right margin, the swap line
// shouldn't extend all the way to the edge of the screen.
// If this is the last sprite in the line, move it a bit
// to the left to keep it out of the margin.
if (i == count - 1 && hasMargin)
gSprites[spriteIds[i]].x2 = x - 8;
else
gSprites[spriteIds[i]].x2 = x;