Merge remote-tracking branch 'pret/master' into RHH/pr/pretmerge_20221007

# Conflicts:
#	include/constants/items.h
#	src/battle_interface.c
This commit is contained in:
Eduardo Quezada 2022-10-07 14:52:32 -03:00
commit 68b474c0f0
35 changed files with 491 additions and 278 deletions

View File

@ -931,6 +931,10 @@
#define ITEMS_COUNT 758
#define ITEM_FIELD_ARROW ITEMS_COUNT
// A special item id associated with "Cancel"/"Exit" etc. in a list of items or decorations
// Its icon is defined at ITEMS_COUNT as the "return to field" arrow
#define ITEM_LIST_END 0xFFFF
// Range of berries given out by various NPCS
#define FIRST_BERRY_MASTER_BERRY ITEM_POMEG_BERRY
#define LAST_BERRY_MASTER_BERRY ITEM_NOMEL_BERRY

View File

@ -67,6 +67,9 @@
#define DISPLAY_WIDTH 240
#define DISPLAY_HEIGHT 160
#define DISPLAY_TILE_WIDTH (DISPLAY_WIDTH / 8)
#define DISPLAY_TILE_HEIGHT (DISPLAY_HEIGHT / 8)
#define TILE_SIZE_4BPP 32
#define TILE_SIZE_8BPP 64

View File

@ -70,7 +70,6 @@ u8 ItemId_GetHoldEffect(u16 itemId);
u8 ItemId_GetHoldEffectParam(u16 itemId);
const u8 *ItemId_GetDescription(u16 itemId);
u8 ItemId_GetImportance(u16 itemId);
u8 ItemId_GetRegistrability(u16 itemId);
u8 ItemId_GetPocket(u16 itemId);
u8 ItemId_GetType(u16 itemId);
ItemUseFunc ItemId_GetFieldFunc(u16 itemId);

View File

@ -3,47 +3,6 @@
extern EWRAM_DATA struct ItemSlot gMartPurchaseHistory[3];
enum
{
MART_TYPE_NORMAL, // normal mart
MART_TYPE_DECOR,
MART_TYPE_DECOR2,
};
// shop view window NPC info enum
enum
{
OBJ_EVENT_ID,
X_COORD,
Y_COORD,
ANIM_NUM,
LAYER_TYPE
};
struct MartInfo
{
/*0x0*/ void (*callback)(void);
/*0x4*/ const struct MenuAction *menuActions;
/*0x8*/ const u16 *itemList;
/*0xC*/ u16 itemCount;
/*0xE*/ u8 windowId;
/*0xF*/ u8 martType;
};
struct ShopData
{
/*0x0000*/ u16 tilemapBuffers[4][0x400];
/*0x2000*/ u32 totalCost;
/*0x2004*/ u16 itemsShowed;
/*0x2006*/ u16 selectedRow;
/*0x2008*/ u16 scrollOffset;
/*0x200A*/ u8 maxQuantity;
/*0x200B*/ u8 scrollIndicatorsTaskId;
/*0x200C*/ u8 iconSlot;
/*0x200D*/ u8 itemSpriteIds[2];
/*0x2010*/ s16 viewportObjects[OBJECT_EVENTS_COUNT][5];
};
void CreatePokemartMenu(const u16 *);
void CreateDecorationShop1Menu(const u16 *);
void CreateDecorationShop2Menu(const u16 *);

View File

@ -325,10 +325,13 @@ static const struct SpriteTemplate sHealthbarSpriteTemplates[MAX_BATTLERS_COUNT]
}
};
/* v-- Origin
[0 + ][1 ] 64x8
*/
static const struct Subsprite sHealthBar_Subsprites_Player[] =
{
{
.x = DISPLAY_WIDTH,
.x = -16,
.y = 0,
.shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
@ -345,10 +348,14 @@ static const struct Subsprite sHealthBar_Subsprites_Player[] =
}
};
/* v-- Origin
[] [0 + ][1 ] 8x8 + 64x8
2^ ^--- Note 8px space
*/
static const struct Subsprite sHealthBar_Subsprites_Opponent[] =
{
{
.x = DISPLAY_WIDTH,
.x = -16,
.y = 0,
.shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
@ -364,7 +371,7 @@ static const struct Subsprite sHealthBar_Subsprites_Opponent[] =
.priority = 1
},
{
.x = DISPLAY_WIDTH - 16,
.x = -32,
.y = 0,
.shape = SPRITE_SHAPE(8x8),
.size = SPRITE_SIZE(8x8),
@ -378,11 +385,13 @@ static const struct SubspriteTable sHealthBar_SubspriteTables[] =
[B_SIDE_PLAYER] = {ARRAY_COUNT(sHealthBar_Subsprites_Player), sHealthBar_Subsprites_Player},
[B_SIDE_OPPONENT] = {ARRAY_COUNT(sHealthBar_Subsprites_Opponent), sHealthBar_Subsprites_Opponent}
};
/* v-- Origin
[0 ][1 ][2 ][3 ] 128x8
*/
static const struct Subsprite sStatusSummaryBar_Subsprites_Enter[] =
{
{
.x = 32 * 5,
.x = 32 * -3,
.y = 0,
.shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
@ -390,7 +399,7 @@ static const struct Subsprite sStatusSummaryBar_Subsprites_Enter[] =
.priority = 1
},
{
.x = 32 * 6,
.x = 32 * -2,
.y = 0,
.shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
@ -398,7 +407,7 @@ static const struct Subsprite sStatusSummaryBar_Subsprites_Enter[] =
.priority = 1
},
{
.x = 32 * 7,
.x = 32 * -1,
.y = 0,
.shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
@ -415,10 +424,14 @@ static const struct Subsprite sStatusSummaryBar_Subsprites_Enter[] =
}
};
/* v-- Origin
[0 ][1 ][2 ][3 ][4 ][5 ] 192x8
^-- uses same tiles --^
*/
static const struct Subsprite sStatusSummaryBar_Subsprites_Exit[] =
{
{
.x = 32 * 5,
.x = 32 * -3,
.y = 0,
.shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
@ -426,7 +439,7 @@ static const struct Subsprite sStatusSummaryBar_Subsprites_Exit[] =
.priority = 1
},
{
.x = 32 * 6,
.x = 32 * -2,
.y = 0,
.shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
@ -434,7 +447,7 @@ static const struct Subsprite sStatusSummaryBar_Subsprites_Exit[] =
.priority = 1
},
{
.x = 32 * 7,
.x = 32 * -1,
.y = 0,
.shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),

View File

@ -645,7 +645,7 @@ static void BagCursorMoved(s32 itemIndex, bool8 onInit, struct ListMenu *list)
if (itemIndex != LIST_CANCEL)
ShowItemIcon(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode][itemIndex], gPyramidBagMenu->isAltIcon);
else
ShowItemIcon(0xFFFF, gPyramidBagMenu->isAltIcon); // Show exit arrow if on Cancel
ShowItemIcon(ITEM_LIST_END, gPyramidBagMenu->isAltIcon); // Show exit arrow if on Cancel
gPyramidBagMenu->isAltIcon ^= 1;
PrintItemDescription(itemIndex);
}

View File

@ -1008,7 +1008,7 @@ static bool8 LoadBerryBlenderGfx(void)
static void DrawBlenderBg(void)
{
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(0);
ShowBg(0);
ShowBg(1);
@ -1029,7 +1029,7 @@ static void InitBerryBlenderWindows(void)
for (i = 0; i < 5; i++)
FillWindowPixelBuffer(i, PIXEL_FILL(0));
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
Menu_LoadStdPalAt(0xE0);
}
}

View File

@ -525,6 +525,9 @@ static const struct SpriteTemplate sSpriteTemplates_NextTurn[CONTESTANT_COUNT] =
}
};
/* v-- Origin
[0 +][1 ] 64x8
*/
static const struct Subsprite sSubsprites_NextTurn[] =
{
{

View File

@ -1150,24 +1150,24 @@ static void TryCreateWirelessSprites(void)
static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
{
u16 windowId;
int origWidth;
int tileWidth;
int strWidth;
u8 *spriteTilePtrs[4];
u8 *dst;
struct WindowTemplate windowTemplate;
memset(&windowTemplate, 0, sizeof(windowTemplate));
windowTemplate.width = 30;
windowTemplate.width = DISPLAY_TILE_WIDTH;
windowTemplate.height = 2;
windowId = AddWindow(&windowTemplate);
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
origWidth = GetStringWidth(FONT_NORMAL, text, 0);
strWidth = (origWidth + 9) / 8;
if (strWidth > 30)
strWidth = 30;
strWidth = GetStringWidth(FONT_NORMAL, text, 0);
tileWidth = (strWidth + 9) / 8;
if (tileWidth > DISPLAY_TILE_WIDTH)
tileWidth = DISPLAY_TILE_WIDTH;
AddTextPrinterParameterized3(windowId, FONT_NORMAL, (strWidth * 8 - origWidth) / 2, 1, sContestLinkTextColors, TEXT_SKIP_DRAW, text);
AddTextPrinterParameterized3(windowId, FONT_NORMAL, (tileWidth * 8 - strWidth) / 2, 1, sContestLinkTextColors, TEXT_SKIP_DRAW, text);
{
s32 i;
struct Sprite *sprite;
@ -1190,7 +1190,7 @@ static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
CpuCopy32(src + 128, dst + 0x200, 0x20);
CpuCopy32(src + 64, dst + 0x300, 0x20);
for (i = 0; i < strWidth; i++)
for (i = 0; i < tileWidth; i++)
{
dst = &spriteTilePtrs[(i + 1) / 8][((i + 1) % 8) * 32];
CpuCopy32(src + 192, dst, 0x20);
@ -1208,7 +1208,7 @@ static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
}
RemoveWindow(windowId);
return (DISPLAY_WIDTH - (strWidth + 2) * 8) / 2;
return (DISPLAY_WIDTH - (tileWidth + 2) * 8) / 2;
}
static void CreateResultsTextWindowSprites(void)

View File

@ -184,7 +184,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 9,
.width = 30,
.width = DISPLAY_TILE_WIDTH,
.height = 12,
.paletteNum = 8,
.baseBlock = 1

View File

@ -10,7 +10,7 @@ static const u16 sFrontierExchangeCorner_Decor1[] =
DECOR_CYNDAQUIL_DOLL,
DECOR_CHIKORITA_DOLL,
DECOR_TOTODILE_DOLL,
0xFFFF
ITEM_LIST_END
};
static const u16 sFrontierExchangeCorner_Decor2[] =
@ -20,7 +20,7 @@ static const u16 sFrontierExchangeCorner_Decor2[] =
DECOR_VENUSAUR_DOLL,
DECOR_CHARIZARD_DOLL,
DECOR_BLASTOISE_DOLL,
0xFFFF
ITEM_LIST_END
};
static const u16 sFrontierExchangeCorner_Vitamins[] =
@ -31,7 +31,7 @@ static const u16 sFrontierExchangeCorner_Vitamins[] =
ITEM_ZINC,
ITEM_CARBOS,
ITEM_HP_UP,
0xFFFF
ITEM_LIST_END
};
static const u16 sFrontierExchangeCorner_HoldItems[] =
@ -45,7 +45,7 @@ static const u16 sFrontierExchangeCorner_HoldItems[] =
ITEM_KINGS_ROCK,
ITEM_FOCUS_BAND,
ITEM_SCOPE_LENS,
0xFFFF
ITEM_LIST_END
};
static const u8 *const sFrontierExchangeCorner_Decor1Descriptions[] =

View File

@ -1,4 +1,4 @@
const u32 *const gItemIconTable[][2] =
const u32 *const gItemIconTable[ITEMS_COUNT + 1][2] =
{
[ITEM_NONE] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark},
// Poké Balls
@ -804,5 +804,5 @@ const u32 *const gItemIconTable[][2] =
[ITEM_RUBY] = {gItemIcon_Gem, gItemIconPalette_Ruby},
[ITEM_SAPPHIRE] = {gItemIcon_Gem, gItemIconPalette_Sapphire},
// Return to field arrow
[ITEM_FIELD_ARROW] = {gItemIcon_ReturnToFieldArrow, gItemIconPalette_ReturnToFieldArrow},
[ITEMS_COUNT] = {gItemIcon_ReturnToFieldArrow, gItemIconPalette_ReturnToFieldArrow},
};

View File

@ -4675,7 +4675,7 @@ static void ShowNames(void)
ClearWindowTilemap(sGfx->windowIds[i]);
RemoveWindow(sGfx->windowIds[i]);
}
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(BG_INTERFACE);
sGfx->finished = TRUE;
}
@ -4859,7 +4859,7 @@ static void ShowResults(void)
sGfx->state++;
}
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 5, 30, 15);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 5, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT - 5);
RemoveWindow(sGfx->windowIds[1]);
sGfx->windowIds[1] = AddWindow(&sWindowTemplate_Prize);
ClearWindowTilemap(sGfx->windowIds[1]);
@ -4917,7 +4917,7 @@ static void ShowResults(void)
ClearWindowTilemap(sGfx->windowIds[1]);
RemoveWindow(sGfx->windowIds[0]);
RemoveWindow(sGfx->windowIds[1]);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(BG_INTERFACE);
sGfx->finished = TRUE;
break;
@ -5012,7 +5012,7 @@ static void Msg_WantToPlayAgain(void)
ClearWindowTilemap(sGfx->windowIds[WIN_YES_NO]);
RemoveWindow(sGfx->windowIds[WIN_PLAY_AGAIN]);
RemoveWindow(sGfx->windowIds[WIN_YES_NO]);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(BG_INTERFACE);
sGfx->finished = TRUE;
break;
@ -5044,7 +5044,7 @@ static void Msg_SavingDontTurnOff(void)
sGfx->state++;
break;
default:
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(BG_INTERFACE);
sGfx->finished = TRUE;
break;
@ -5083,7 +5083,7 @@ static void EraseMessage(void)
{
ClearWindowTilemap(sGfx->windowIds[0]);
RemoveWindow(sGfx->windowIds[0]);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(BG_INTERFACE);
sGfx->finished = TRUE;
}
@ -5121,7 +5121,7 @@ static void Msg_SomeoneDroppedOut(void)
sGfx->playAgainState = PLAY_AGAIN_DROPPED;
ClearWindowTilemap(sGfx->windowIds[0]);
RemoveWindow(sGfx->windowIds[0]);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(BG_INTERFACE);
sGfx->finished = TRUE;
break;

View File

@ -405,6 +405,11 @@ static const struct SpriteFrameImage sPicTable_HofMonitorSmall[] =
{.data = sHofMonitorSmall_Gfx, .size = 0x200} // the macro breaks down here
};
/*
[0_][] <-1 24x16
[2 ][] <-3
^-- Origin
*/
static const struct Subsprite sSubsprites_PokecenterMonitor[] =
{
{
@ -443,6 +448,11 @@ static const struct Subsprite sSubsprites_PokecenterMonitor[] =
static const struct SubspriteTable sSubspriteTable_PokecenterMonitor = subsprite_table(sSubsprites_PokecenterMonitor);
/*
[0_____][1_____] 24x16
[2 ][3 ]
^-- Origin
*/
static const struct Subsprite sSubsprites_HofMonitorBig[] =
{
{

View File

@ -1136,7 +1136,7 @@ static void Task_OrbEffect(u8 taskId)
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(12, 7));
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR);
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ);
SetBgTilemapPalette(0, 0, 0, 0x1E, 0x14, 0xF);
SetBgTilemapPalette(0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 0xF);
ScheduleBgCopyTilemapToVram(0);
SetOrbFlashScanlineEffectWindowBoundaries(&gScanlineEffectRegBuffers[0][0], tCenterX, tCenterY, 1);
CpuFastSet(&gScanlineEffectRegBuffers[0], &gScanlineEffectRegBuffers[1], 480);

View File

@ -2925,7 +2925,7 @@ static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection)
{
case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1:
AddTextPrinterParameterized2(0, FONT_NORMAL, sFrontierExchangeCorner_Decor1Descriptions[selection], 0, NULL, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY);
if (sFrontierExchangeCorner_Decor1[selection] == 0xFFFF)
if (sFrontierExchangeCorner_Decor1[selection] == ITEM_LIST_END)
{
ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Decor1[selection]);
}
@ -2938,7 +2938,7 @@ static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection)
break;
case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2:
AddTextPrinterParameterized2(0, FONT_NORMAL, sFrontierExchangeCorner_Decor2Descriptions[selection], 0, NULL, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY);
if (sFrontierExchangeCorner_Decor2[selection] == 0xFFFF)
if (sFrontierExchangeCorner_Decor2[selection] == ITEM_LIST_END)
{
ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Decor2[selection]);
}

View File

@ -760,9 +760,9 @@ static bool32 InitFrontierPass(void)
case 7:
if (FreeTempTileDataBuffersIfPossible())
return FALSE;
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);
@ -1396,9 +1396,9 @@ static bool32 InitFrontierMap(void)
SetBgTilemapBuffer(0, sMapData->tilemapBuff0);
SetBgTilemapBuffer(1, sMapData->tilemapBuff1);
SetBgTilemapBuffer(2, sMapData->tilemapBuff2);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);

View File

@ -3322,24 +3322,29 @@ static u8 CreateGameFreakLogoSprites(s16 x, s16 y, s16 unused)
#undef sLetterX
#undef COLOR_CHANGES
#define sScale data[1]
#define sRot data[2]
#define sPos data[3]
#define sTimer data[7]
static void SpriteCB_FlygonSilhouette(struct Sprite *sprite)
{
sprite->data[7]++;
sprite->sTimer++;
if (sprite->sState != 0)
{
s16 sin1;
s16 sin2;
s16 sin;
s16 cos;
s16 a, b, c, d;
sin1 = gSineTable[(u8)sprite->data[2]];
sin2 = gSineTable[(u8)(sprite->data[2] + 64)];
d = Q_8_8_TO_INT(sin2 * sprite->data[1]);
c = Q_8_8_TO_INT(-sin1 * sprite->data[1]);
b = Q_8_8_TO_INT(sin1 * sprite->data[1]);
a = Q_8_8_TO_INT(sin2 * sprite->data[1]);
// Determines rotation of the sprite
sin = gSineTable[(u8)sprite->sRot];
cos = gSineTable[(u8)(sprite->sRot + 64)];
// Converts rotation and scale into the OAM matrix
d = Q_8_8_TO_INT( cos * sprite->sScale);
c = Q_8_8_TO_INT(-sin * sprite->sScale);
b = Q_8_8_TO_INT( sin * sprite->sScale);
a = Q_8_8_TO_INT( cos * sprite->sScale);
SetOamMatrix(1, a, b, c, d);
}
@ -3353,36 +3358,41 @@ static void SpriteCB_FlygonSilhouette(struct Sprite *sprite)
CalcCenterToCornerVec(sprite, SPRITE_SHAPE(64x32), SPRITE_SIZE(64x32), ST_OAM_AFFINE_DOUBLE);
sprite->invisible = FALSE;
sprite->sState = 1;
sprite->data[1] = 0x80;
sprite->data[2] = 0;
sprite->data[3] = 0;
sprite->sScale = 128;
sprite->sRot = 0;
sprite->sPos = 0;
break;
case 1:
sprite->x2 = -Sin((u8)sprite->data[3], 140);
sprite->y2 = -Sin((u8)sprite->data[3], 120);
sprite->data[1] += 7;
sprite->data[3] += 3;
sprite->x2 = -Sin((u8)sprite->sPos, 140);
sprite->y2 = -Sin((u8)sprite->sPos, 120);
sprite->sScale += 7;
sprite->sPos += 3;
if (sprite->x + sprite->x2 <= -16)
{
sprite->oam.priority = 3;
sprite->sState++;
sprite->x = 20;
sprite->y = 40;
sprite->data[1] = 0x200;
sprite->data[2] = 0;
sprite->data[3] = 0x10;
sprite->sScale = 512;
sprite->sRot = 0;
sprite->sPos = 16;
}
break;
case 2:
sprite->x2 = Sin((u8)sprite->data[3], 34);
sprite->y2 = -Cos((u8)sprite->data[3], 60);
sprite->data[1] += 2;
if (sprite->data[7] % 5 == 0)
sprite->data[3]++;
sprite->x2 = Sin((u8)sprite->sPos, 34);
sprite->y2 = -Cos((u8)sprite->sPos, 60);
sprite->sScale += 2;
if (sprite->sTimer % 5 == 0)
sprite->sPos++;
break;
}
}
#undef sScale
#undef sRot
#undef sPos
#undef sTimer
static void SpriteCB_RayquazaOrb(struct Sprite *sprite)
{
u16 foo;

View File

@ -880,6 +880,7 @@ const u8 *ItemId_GetName(u16 itemId)
return gItems[SanitizeItemId(itemId)].name;
}
// Unused
u16 ItemId_GetId(u16 itemId)
{
return gItems[SanitizeItemId(itemId)].itemId;
@ -910,7 +911,7 @@ u8 ItemId_GetImportance(u16 itemId)
return gItems[SanitizeItemId(itemId)].importance;
}
// unused
// Unused
u8 ItemId_GetRegistrability(u16 itemId)
{
return gItems[SanitizeItemId(itemId)].registrability;

View File

@ -159,8 +159,8 @@ u8 AddCustomItemIconSprite(const struct SpriteTemplate *customSpriteTemplate, u1
const void *GetItemIconPicOrPalette(u16 itemId, u8 which)
{
if (itemId == 0xFFFF)
itemId = ITEM_FIELD_ARROW;
if (itemId == ITEM_LIST_END)
itemId = ITEMS_COUNT; // Use last icon, the "return to field" arrow
else if (itemId >= ITEMS_COUNT)
itemId = 0;

View File

@ -937,7 +937,7 @@ static void BagMenu_MoveCursorCallback(s32 itemIndex, bool8 onInit, struct ListM
if (itemIndex != LIST_CANCEL)
AddBagItemIconSprite(BagGetItemIdByPocketPosition(gBagPosition.pocket + 1, itemIndex), gBagMenu->itemIconSlot);
else
AddBagItemIconSprite(-1, gBagMenu->itemIconSlot);
AddBagItemIconSprite(ITEM_LIST_END, gBagMenu->itemIconSlot);
gBagMenu->itemIconSlot ^= 1;
if (!gBagMenu->inhibitItemDescriptionPrint)
PrintItemDescription(itemIndex);

View File

@ -198,7 +198,7 @@ static const struct WindowTemplate sLinkErrorWindowTemplates[] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 0,
.width = 30,
.width = DISPLAY_TILE_WIDTH,
.height = 5,
.paletteNum = 15,
.baseBlock = 0x002
@ -206,7 +206,7 @@ static const struct WindowTemplate sLinkErrorWindowTemplates[] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 6,
.width = 30,
.width = DISPLAY_TILE_WIDTH,
.height = 7,
.paletteNum = 15,
.baseBlock = 0x098
@ -214,7 +214,7 @@ static const struct WindowTemplate sLinkErrorWindowTemplates[] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 13,
.width = 30,
.width = DISPLAY_TILE_WIDTH,
.height = 7,
.paletteNum = 15,
.baseBlock = 0x16A

View File

@ -556,8 +556,8 @@ static bool8 MailReadBuildGraphics(void)
}
break;
case 10:
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 1, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(2, 1, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyToBgTilemapBuffer(1, sMailGraphics[sMailRead->mailType].tileMap, 0, 0);
break;
case 11:

View File

@ -1121,7 +1121,7 @@ static void Task_DisplayMainMenuInvalidActionError(u8 taskId)
switch (gTasks[taskId].tCurrItem)
{
case 0:
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
switch (gTasks[taskId].tMenuType)
{
case 0:

View File

@ -90,7 +90,7 @@ void CB2_InitMysteryEventMenu(void)
for (i = 0; i < 2; i++)
FillWindowPixelBuffer(i, PIXEL_FILL(0));
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
LoadUserWindowBorderGfx(0, 1u, 0xD0u);
Menu_LoadStdPalAt(0xE0);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON);

View File

@ -102,7 +102,7 @@ static const struct WindowTemplate sMainWindows[] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 0,
.width = 30,
.width = DISPLAY_TILE_WIDTH,
.height = 2,
.paletteNum = 12,
.baseBlock = 0x0013
@ -118,7 +118,7 @@ static const struct WindowTemplate sMainWindows[] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 15,
.width = 30,
.width = DISPLAY_TILE_WIDTH,
.height = 5,
.paletteNum = 13,
.baseBlock = 0x004f
@ -640,8 +640,8 @@ static u32 MysteryGift_HandleThreeOptionMenu(u8 *unused0, u16 * unused1, u8 whic
width++;
windowTemplate.width = width;
if (width < 30)
windowTemplate.tilemapLeft = (30 - width) / 2;
if (width < DISPLAY_TILE_WIDTH)
windowTemplate.tilemapLeft = (DISPLAY_TILE_WIDTH - width) / 2;
else
windowTemplate.tilemapLeft = 0;

View File

@ -226,9 +226,9 @@ s32 WonderCard_Enter(void)
return 0;
break;
case 2:
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);
@ -244,7 +244,7 @@ s32 WonderCard_Enter(void)
gPaletteFade.bufferTransferDisabled = TRUE;
LoadPalette(sWonderCardData->gfx->pal, 0x10, 0x20);
LZ77UnCompWram(sWonderCardData->gfx->map, sWonderCardData->bgTilemapBuffer);
CopyRectToBgTilemapBufferRect(2, sWonderCardData->bgTilemapBuffer, 0, 0, 30, 20, 0, 0, 30, 20, 1, 0x008, 0);
CopyRectToBgTilemapBufferRect(2, sWonderCardData->bgTilemapBuffer, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 1, 0x008, 0);
CopyBgTilemapBufferToVram(2);
break;
case 4:
@ -291,9 +291,9 @@ s32 WonderCard_Exit(bool32 useCancel)
return 0;
break;
case 2:
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);
@ -595,7 +595,7 @@ static const struct WindowTemplate sNews_WindowTemplates[] = {
.tilemapLeft = 1,
.tilemapTop = 3,
.width = 28,
.height = 20,
.height = DISPLAY_TILE_HEIGHT,
.paletteNum = 2,
.baseBlock = 0x07C
}
@ -688,10 +688,10 @@ s32 WonderNews_Enter(void)
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON);
break;
case 2:
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(3, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(3, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);
@ -707,8 +707,8 @@ s32 WonderNews_Enter(void)
gPaletteFade.bufferTransferDisabled = TRUE;
LoadPalette(sWonderNewsData->gfx->pal, 0x10, 0x20);
LZ77UnCompWram(sWonderNewsData->gfx->map, sWonderNewsData->bgTilemapBuffer);
CopyRectToBgTilemapBufferRect(1, sWonderNewsData->bgTilemapBuffer, 0, 0, 30, 3, 0, 0, 30, 3, 1, 8, 0);
CopyRectToBgTilemapBufferRect(3, sWonderNewsData->bgTilemapBuffer, 0, 3, 30, 23, 0, 3, 30, 23, 1, 8, 0);
CopyRectToBgTilemapBufferRect(1, sWonderNewsData->bgTilemapBuffer, 0, 0, DISPLAY_TILE_WIDTH, 3, 0, 0, DISPLAY_TILE_WIDTH, 3, 1, 8, 0);
CopyRectToBgTilemapBufferRect(3, sWonderNewsData->bgTilemapBuffer, 0, 3, DISPLAY_TILE_WIDTH, 3 + DISPLAY_TILE_HEIGHT, 0, 3, DISPLAY_TILE_WIDTH, 3 + DISPLAY_TILE_HEIGHT, 1, 8, 0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(3);
break;
@ -760,10 +760,10 @@ s32 WonderNews_Exit(bool32 useCancel)
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON);
break;
case 2:
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 24);
FillBgTilemapBufferRect_Palette0(3, 0x000, 0, 0, 30, 24);
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT + 4);
FillBgTilemapBufferRect_Palette0(3, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT + 4);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);

View File

@ -267,7 +267,7 @@ static const struct WindowTemplate sWindowTemplates[WIN_COUNT + 1] =
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 0,
.width = 30,
.width = DISPLAY_TILE_WIDTH,
.height = 2,
.paletteNum = 11,
.baseBlock = 0x074
@ -2179,6 +2179,12 @@ static const struct OamData sOam_32x16 =
.paletteNum = 0,
};
/*
[0_____][] <-1 40x32
[2_____][] <-3
[4___+_][] <-5/Origin
[6 ][] <-7
*/
static const struct Subsprite sSubsprites_PageSwapFrame[] =
{
{
@ -2247,6 +2253,10 @@ static const struct Subsprite sSubsprites_PageSwapFrame[] =
}
};
/*
[0_][] <-1 24x8
^-- Origin
*/
static const struct Subsprite sSubsprites_PageSwapText[] =
{
{
@ -2267,6 +2277,11 @@ static const struct Subsprite sSubsprites_PageSwapText[] =
}
};
/*
[0_____][] <-1 40x24
[2_____][] <-3
[4___+_][] <-5/Origin
*/
static const struct Subsprite sSubsprites_Button[] =
{
{
@ -2319,6 +2334,11 @@ static const struct Subsprite sSubsprites_Button[] =
}
};
/*
[0_] 16x24
[1+] <--Origin
[2_]
*/
static const struct Subsprite sSubsprites_PCIcon[] =
{
{

View File

@ -2857,7 +2857,7 @@ static bool8 TryMovePartySlot(s16 x, s16 width, u8 *leftMove, u8 *newX, u8 *newW
{
if (x + width < 0)
return FALSE;
if (x > 31)
if (x >= 32)
return FALSE;
if (x < 0)
@ -2870,7 +2870,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 >= 32)
*newWidth = 32 - x;
else
*newWidth = width;

View File

@ -1015,7 +1015,7 @@ static void ItemStorage_MoveCursor(s32 id, bool8 onInit, struct ListMenu *list)
if (id != LIST_CANCEL)
ItemStorage_DrawItemIcon(gSaveBlock1Ptr->pcItems[id].itemId);
else
ItemStorage_DrawItemIcon(MSG_GO_BACK_TO_PREV);
ItemStorage_DrawItemIcon(ITEM_LIST_END);
ItemStorage_PrintDescription(id);
}
}

View File

@ -42,10 +42,72 @@
#define TAG_SCROLL_ARROW 2100
#define TAG_ITEM_ICON_BASE 2110
#define MAX_ITEMS_SHOWN 8
enum {
WIN_BUY_SELL_QUIT,
WIN_BUY_QUIT,
};
enum {
WIN_MONEY,
WIN_ITEM_LIST,
WIN_ITEM_DESCRIPTION,
WIN_QUANTITY_IN_BAG,
WIN_QUANTITY_PRICE,
WIN_MESSAGE,
};
enum {
COLORID_NORMAL, // Item descriptions, quantity in bag, and quantity/price
COLORID_ITEM_LIST, // The text in the item list, and the cursor normally
COLORID_GRAY_CURSOR, // When the cursor has selected an item to purchase
};
enum {
MART_TYPE_NORMAL,
MART_TYPE_DECOR,
MART_TYPE_DECOR2,
};
// shop view window NPC info enum
enum
{
OBJ_EVENT_ID,
X_COORD,
Y_COORD,
ANIM_NUM,
LAYER_TYPE
};
struct MartInfo
{
void (*callback)(void);
const struct MenuAction *menuActions;
const u16 *itemList;
u16 itemCount;
u8 windowId;
u8 martType;
};
struct ShopData
{
u16 tilemapBuffers[4][0x400];
u32 totalCost;
u16 itemsShowed;
u16 selectedRow;
u16 scrollOffset;
u8 maxQuantity;
u8 scrollIndicatorsTaskId;
u8 iconSlot;
u8 itemSpriteIds[2];
s16 viewportObjects[OBJECT_EVENTS_COUNT][5];
};
static EWRAM_DATA struct MartInfo sMartInfo = {0};
static EWRAM_DATA struct ShopData *sShopData = NULL;
static EWRAM_DATA struct ListMenuItem *sListMenuItems = NULL;
static EWRAM_DATA u8 (*sItemNames)[16] = {0};
static EWRAM_DATA u8 (*sItemNames)[ITEM_NAME_LENGTH + 2] = {0};
static EWRAM_DATA u8 sPurchaseHistoryId = 0;
EWRAM_DATA struct ItemSlot gMartPurchaseHistory[SMARTSHOPPER_NUM_ITEMS] = {0};
@ -114,7 +176,7 @@ static const struct MenuAction sShopMenuActions_BuyQuit[] =
static const struct WindowTemplate sShopMenuWindowTemplates[] =
{
{
[WIN_BUY_SELL_QUIT] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 1,
@ -123,7 +185,8 @@ static const struct WindowTemplate sShopMenuWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x0008,
},
{
// Separate shop menu window for decorations, which can't be sold
[WIN_BUY_QUIT] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 1,
@ -141,7 +204,7 @@ static const struct ListMenuTemplate sShopBuyMenuListTemplate =
.itemPrintFunc = BuyMenuPrintPriceInList,
.totalItems = 0,
.maxShowed = 0,
.windowId = 1,
.windowId = WIN_ITEM_LIST,
.header_X = 0,
.item_X = 8,
.cursor_X = 0,
@ -198,7 +261,7 @@ static const struct BgTemplate sShopBuyMenuBgTemplates[] =
static const struct WindowTemplate sShopBuyMenuWindowTemplates[] =
{
{
[WIN_MONEY] = {
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 1,
@ -207,7 +270,7 @@ static const struct WindowTemplate sShopBuyMenuWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x001E,
},
{
[WIN_ITEM_LIST] = {
.bg = 0,
.tilemapLeft = 14,
.tilemapTop = 2,
@ -216,7 +279,7 @@ static const struct WindowTemplate sShopBuyMenuWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x0032,
},
{
[WIN_ITEM_DESCRIPTION] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 13,
@ -225,7 +288,7 @@ static const struct WindowTemplate sShopBuyMenuWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x0122,
},
{
[WIN_QUANTITY_IN_BAG] = {
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 11,
@ -234,7 +297,7 @@ static const struct WindowTemplate sShopBuyMenuWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x0176,
},
{
[WIN_QUANTITY_PRICE] = {
.bg = 0,
.tilemapLeft = 18,
.tilemapTop = 11,
@ -243,7 +306,7 @@ static const struct WindowTemplate sShopBuyMenuWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x018E,
},
{
[WIN_MESSAGE] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 15,
@ -268,9 +331,9 @@ static const struct WindowTemplate sShopBuyMenuYesNoWindowTemplates =
static const u8 sShopBuyMenuTextColors[][3] =
{
{1, 2, 3},
{0, 2, 3},
{0, 3, 2}
[COLORID_NORMAL] = {1, 2, 3},
[COLORID_ITEM_LIST] = {0, 2, 3},
[COLORID_GRAY_CURSOR] = {0, 3, 2},
};
static u8 CreateShopMenu(u8 martType)
@ -282,8 +345,7 @@ static u8 CreateShopMenu(u8 martType)
if (martType == MART_TYPE_NORMAL)
{
struct WindowTemplate winTemplate;
winTemplate = sShopMenuWindowTemplates[0];
struct WindowTemplate winTemplate = sShopMenuWindowTemplates[WIN_BUY_SELL_QUIT];
winTemplate.width = GetMaxWidthInMenuTable(sShopMenuActions_BuySellQuit, ARRAY_COUNT(sShopMenuActions_BuySellQuit));
sMartInfo.windowId = AddWindow(&winTemplate);
sMartInfo.menuActions = sShopMenuActions_BuySellQuit;
@ -291,8 +353,7 @@ static u8 CreateShopMenu(u8 martType)
}
else
{
struct WindowTemplate winTemplate;
winTemplate = sShopMenuWindowTemplates[1];
struct WindowTemplate winTemplate = sShopMenuWindowTemplates[WIN_BUY_QUIT];
winTemplate.width = GetMaxWidthInMenuTable(sShopMenuActions_BuyQuit, ARRAY_COUNT(sShopMenuActions_BuyQuit));
sMartInfo.windowId = AddWindow(&winTemplate);
sMartInfo.menuActions = sShopMenuActions_BuyQuit;
@ -320,6 +381,7 @@ static void SetShopItemsForSale(const u16 *items)
sMartInfo.itemList = items;
sMartInfo.itemCount = 0;
// Read items until ITEM_NONE / DECOR_NONE is reached
while (sMartInfo.itemList[i])
{
sMartInfo.itemCount++;
@ -344,11 +406,17 @@ static void Task_ShopMenu(u8 taskId)
}
}
#define tItemCount data[1]
#define tItemId data[5]
#define tListTaskId data[7]
#define tCallbackHi data[8]
#define tCallbackLo data[9]
static void Task_HandleShopMenuBuy(u8 taskId)
{
s16 *data = gTasks[taskId].data;
data[8] = (u32)CB2_InitBuyMenu >> 16;
data[9] = (u32)CB2_InitBuyMenu;
tCallbackHi = (u32)CB2_InitBuyMenu >> 16;
tCallbackLo = (u32)CB2_InitBuyMenu;
gTasks[taskId].func = Task_GoToBuyOrSellMenu;
FadeScreen(FADE_TO_BLACK, 0);
}
@ -356,8 +424,8 @@ static void Task_HandleShopMenuBuy(u8 taskId)
static void Task_HandleShopMenuSell(u8 taskId)
{
s16 *data = gTasks[taskId].data;
data[8] = (u32)CB2_GoToSellMenu >> 16;
data[9] = (u32)CB2_GoToSellMenu;
tCallbackHi = (u32)CB2_GoToSellMenu >> 16;
tCallbackLo = (u32)CB2_GoToSellMenu;
gTasks[taskId].func = Task_GoToBuyOrSellMenu;
FadeScreen(FADE_TO_BLACK, 0);
}
@ -386,7 +454,7 @@ static void Task_GoToBuyOrSellMenu(u8 taskId)
if (!gPaletteFade.active)
{
DestroyTask(taskId);
SetMainCallback2((void *)((u16)data[8] << 16 | (u16)data[9]));
SetMainCallback2((void *)((u16)tCallbackHi << 16 | (u16)tCallbackLo));
}
}
@ -429,10 +497,6 @@ static void VBlankCB_BuyMenu(void)
TransferPlttBuffer();
}
#define tItemCount data[1]
#define tItemId data[5]
#define tListTaskId data[7]
static void CB2_InitBuyMenu(void)
{
u8 taskId;
@ -472,8 +536,8 @@ static void CB2_InitBuyMenu(void)
BuyMenuAddScrollIndicatorArrows();
taskId = CreateTask(Task_BuyMenu, 8);
gTasks[taskId].tListTaskId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0);
BlendPalettes(PALETTES_ALL, 0x10, RGB_BLACK);
BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK);
BlendPalettes(PALETTES_ALL, 16, RGB_BLACK);
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK);
SetVBlankCallback(VBlankCB_BuyMenu);
SetMainCallback2(CB2_BuyMenu);
break;
@ -504,8 +568,8 @@ static void BuyMenuBuildListMenuTemplate(void)
gMultiuseListMenuTemplate = sShopBuyMenuListTemplate;
gMultiuseListMenuTemplate.items = sListMenuItems;
gMultiuseListMenuTemplate.totalItems = sMartInfo.itemCount + 1;
if (gMultiuseListMenuTemplate.totalItems > 8)
gMultiuseListMenuTemplate.maxShowed = 8;
if (gMultiuseListMenuTemplate.totalItems > MAX_ITEMS_SHOWN)
gMultiuseListMenuTemplate.maxShowed = MAX_ITEMS_SHOWN;
else
gMultiuseListMenuTemplate.maxShowed = gMultiuseListMenuTemplate.totalItems;
@ -532,7 +596,7 @@ static void BuyMenuPrintItemDescriptionAndShowItemIcon(s32 item, bool8 onInit, s
if (item != LIST_CANCEL)
BuyMenuAddItemIcon(item, sShopData->iconSlot);
else
BuyMenuAddItemIcon(-1, sShopData->iconSlot);
BuyMenuAddItemIcon(ITEM_LIST_END, sShopData->iconSlot);
BuyMenuRemoveItemIcon(item, sShopData->iconSlot ^ 1);
sShopData->iconSlot ^= 1;
@ -548,8 +612,8 @@ static void BuyMenuPrintItemDescriptionAndShowItemIcon(s32 item, bool8 onInit, s
description = gText_QuitShopping;
}
FillWindowPixelBuffer(2, PIXEL_FILL(0));
BuyMenuPrint(2, description, 3, 1, 0, 0);
FillWindowPixelBuffer(WIN_ITEM_DESCRIPTION, PIXEL_FILL(0));
BuyMenuPrint(WIN_ITEM_DESCRIPTION, description, 3, 1, 0, COLORID_NORMAL);
}
static void BuyMenuPrintPriceInList(u8 windowId, u32 itemId, u8 y)
@ -576,21 +640,21 @@ static void BuyMenuPrintPriceInList(u8 windowId, u32 itemId, u8 y)
}
StringExpandPlaceholders(gStringVar4, gText_PokedollarVar1);
x = GetStringRightAlignXOffset(FONT_NARROW, gStringVar4, 0x78);
AddTextPrinterParameterized4(windowId, FONT_NARROW, x, y, 0, 0, sShopBuyMenuTextColors[1], TEXT_SKIP_DRAW, gStringVar4);
x = GetStringRightAlignXOffset(FONT_NARROW, gStringVar4, 120);
AddTextPrinterParameterized4(windowId, FONT_NARROW, x, y, 0, 0, sShopBuyMenuTextColors[COLORID_ITEM_LIST], TEXT_SKIP_DRAW, gStringVar4);
}
}
static void BuyMenuAddScrollIndicatorArrows(void)
{
if (sShopData->scrollIndicatorsTaskId == TASK_NONE && sMartInfo.itemCount + 1 > 8)
if (sShopData->scrollIndicatorsTaskId == TASK_NONE && sMartInfo.itemCount + 1 > MAX_ITEMS_SHOWN)
{
sShopData->scrollIndicatorsTaskId = AddScrollIndicatorArrowPairParameterized(
SCROLL_ARROW_UP,
172,
12,
148,
sMartInfo.itemCount - 7,
sMartInfo.itemCount - (MAX_ITEMS_SHOWN - 1),
TAG_SCROLL_ARROW,
TAG_SCROLL_ARROW,
&sShopData->scrollOffset);
@ -609,7 +673,7 @@ static void BuyMenuRemoveScrollIndicatorArrows(void)
static void BuyMenuPrintCursor(u8 scrollIndicatorsTaskId, u8 colorSet)
{
u8 y = ListMenuGetYCoordForPrintingArrowCursor(scrollIndicatorsTaskId);
BuyMenuPrint(1, gText_SelectorArrow2, 0, y, 0, colorSet);
BuyMenuPrint(WIN_ITEM_LIST, gText_SelectorArrow2, 0, y, 0, colorSet);
}
static void BuyMenuAddItemIcon(u16 item, u8 iconSlot)
@ -619,7 +683,7 @@ static void BuyMenuAddItemIcon(u16 item, u8 iconSlot)
if (*spriteIdPtr != SPRITE_NONE)
return;
if (sMartInfo.martType == MART_TYPE_NORMAL || item == 0xFFFF)
if (sMartInfo.martType == MART_TYPE_NORMAL || item == ITEM_LIST_END)
{
spriteId = AddItemIconSprite(iconSlot + TAG_ITEM_ICON_BASE, iconSlot + TAG_ITEM_ICON_BASE, item);
if (spriteId != MAX_SPRITES)
@ -683,11 +747,11 @@ static void BuyMenuInitWindows(void)
{
InitWindows(sShopBuyMenuWindowTemplates);
DeactivateAllTextPrinters();
LoadUserWindowBorderGfx(0, 1, 0xD0);
LoadMessageBoxGfx(0, 0xA, 0xE0);
PutWindowTilemap(0);
PutWindowTilemap(1);
PutWindowTilemap(2);
LoadUserWindowBorderGfx(WIN_MONEY, 1, 0xD0);
LoadMessageBoxGfx(WIN_MONEY, 0xA, 0xE0);
PutWindowTilemap(WIN_MONEY);
PutWindowTilemap(WIN_ITEM_LIST);
PutWindowTilemap(WIN_ITEM_DESCRIPTION);
}
static void BuyMenuPrint(u8 windowId, const u8 *text, u8 x, u8 y, s8 speed, u8 colorSet)
@ -697,7 +761,7 @@ static void BuyMenuPrint(u8 windowId, const u8 *text, u8 x, u8 y, s8 speed, u8 c
static void BuyMenuDisplayMessage(u8 taskId, const u8 *text, TaskFunc callback)
{
DisplayMessageAndContinueTask(taskId, 5, 10, 14, FONT_NORMAL, GetPlayerTextSpeedDelay(), text, callback);
DisplayMessageAndContinueTask(taskId, WIN_MESSAGE, 10, 14, FONT_NORMAL, GetPlayerTextSpeedDelay(), text, callback);
ScheduleBgCopyTilemapToVram(0);
}
@ -706,7 +770,7 @@ static void BuyMenuDrawGraphics(void)
BuyMenuDrawMapGraphics();
BuyMenuCopyMenuBgToBg1TilemapBuffer();
AddMoneyLabelObject(19, 11);
PrintMoneyAmountInMoneyBoxWithBorder(0, 1, 13, GetMoney(&gSaveBlock1Ptr->money));
PrintMoneyAmountInMoneyBoxWithBorder(WIN_MONEY, 1, 13, GetMoney(&gSaveBlock1Ptr->money));
ScheduleBgCopyTilemapToVram(0);
ScheduleBgCopyTilemapToVram(1);
ScheduleBgCopyTilemapToVram(2);
@ -722,10 +786,8 @@ static void BuyMenuDrawMapGraphics(void)
static void BuyMenuDrawMapBg(void)
{
s16 i;
s16 j;
s16 x;
s16 y;
s16 i, j;
s16 x, y;
const struct MapLayout *mapLayout;
u16 metatile;
u8 metatileLayerType;
@ -746,16 +808,12 @@ static void BuyMenuDrawMapBg(void)
metatileLayerType = METATILE_LAYER_TYPE_COVERED;
if (metatile < NUM_METATILES_IN_PRIMARY)
{
BuyMenuDrawMapMetatile(i, j, (u16 *)mapLayout->primaryTileset->metatiles + metatile * 8, metatileLayerType);
}
else
{
BuyMenuDrawMapMetatile(i, j, (u16 *)mapLayout->secondaryTileset->metatiles + ((metatile - NUM_METATILES_IN_PRIMARY) * 8), metatileLayerType);
}
}
}
}
static void BuyMenuDrawMapMetatile(s16 x, s16 y, const u16 *src, u8 metatileLayerType)
{
@ -794,11 +852,13 @@ static void BuyMenuCollectObjectEventData(void)
s16 facingY;
u8 y;
u8 x;
u8 r8 = 0;
u8 numObjects = 0;
GetXYCoordsOneStepInFrontOfPlayer(&facingX, &facingY);
for (y = 0; y < OBJECT_EVENTS_COUNT; y++)
sShopData->viewportObjects[y][OBJ_EVENT_ID] = OBJECT_EVENTS_COUNT;
for (y = 0; y < 5; y++)
{
for (x = 0; x < 7; x++)
@ -807,28 +867,28 @@ static void BuyMenuCollectObjectEventData(void)
if (objEventId != OBJECT_EVENTS_COUNT)
{
sShopData->viewportObjects[r8][OBJ_EVENT_ID] = objEventId;
sShopData->viewportObjects[r8][X_COORD] = x;
sShopData->viewportObjects[r8][Y_COORD] = y;
sShopData->viewportObjects[r8][LAYER_TYPE] = MapGridGetMetatileLayerTypeAt(facingX - 4 + x, facingY - 2 + y);
sShopData->viewportObjects[numObjects][OBJ_EVENT_ID] = objEventId;
sShopData->viewportObjects[numObjects][X_COORD] = x;
sShopData->viewportObjects[numObjects][Y_COORD] = y;
sShopData->viewportObjects[numObjects][LAYER_TYPE] = MapGridGetMetatileLayerTypeAt(facingX - 4 + x, facingY - 2 + y);
switch (gObjectEvents[objEventId].facingDirection)
{
case DIR_SOUTH:
sShopData->viewportObjects[r8][ANIM_NUM] = 0;
sShopData->viewportObjects[numObjects][ANIM_NUM] = ANIM_STD_FACE_SOUTH;
break;
case DIR_NORTH:
sShopData->viewportObjects[r8][ANIM_NUM] = 1;
sShopData->viewportObjects[numObjects][ANIM_NUM] = ANIM_STD_FACE_NORTH;
break;
case DIR_WEST:
sShopData->viewportObjects[r8][ANIM_NUM] = 2;
sShopData->viewportObjects[numObjects][ANIM_NUM] = ANIM_STD_FACE_WEST;
break;
case DIR_EAST:
default:
sShopData->viewportObjects[r8][ANIM_NUM] = 3;
sShopData->viewportObjects[numObjects][ANIM_NUM] = ANIM_STD_FACE_EAST;
break;
}
r8++;
numObjects++;
}
}
}
@ -867,14 +927,10 @@ static void BuyMenuDrawObjectEvents(void)
static bool8 BuyMenuCheckIfObjectEventOverlapsMenuBg(s16 *object)
{
if (!BuyMenuCheckForOverlapWithMenuBg(object[X_COORD], object[Y_COORD] + 2) && object[LAYER_TYPE] != METATILE_LAYER_TYPE_COVERED)
{
return TRUE;
}
else
{
return FALSE;
}
}
static void BuyMenuCopyMenuBgToBg1TilemapBuffer(void)
{
@ -885,11 +941,9 @@ static void BuyMenuCopyMenuBgToBg1TilemapBuffer(void)
for (i = 0; i < 1024; i++)
{
if (src[i] != 0)
{
dest[i] = src[i] + 0xC3E3;
}
}
}
static bool8 BuyMenuCheckForOverlapWithMenuBg(int x, int y)
{
@ -901,9 +955,7 @@ static bool8 BuyMenuCheckForOverlapWithMenuBg(int x, int y)
metatile[offset2 + offset1 + 32] == 0 &&
metatile[offset2 + offset1 + 1] == 0 &&
metatile[offset2 + offset1 + 33] == 0)
{
return TRUE;
}
return FALSE;
}
@ -928,18 +980,14 @@ static void Task_BuyMenu(u8 taskId)
default:
PlaySE(SE_SELECT);
tItemId = itemId;
ClearWindowTilemap(2);
ClearWindowTilemap(WIN_ITEM_DESCRIPTION);
BuyMenuRemoveScrollIndicatorArrows();
BuyMenuPrintCursor(tListTaskId, 2);
BuyMenuPrintCursor(tListTaskId, COLORID_GRAY_CURSOR);
if (sMartInfo.martType == MART_TYPE_NORMAL)
{
sShopData->totalCost = (ItemId_GetPrice(itemId) >> IsPokeNewsActive(POKENEWS_SLATEPORT));
}
else
{
sShopData->totalCost = gDecorations[itemId].price;
}
if (!IsEnoughMoney(&gSaveBlock1Ptr->money, sShopData->totalCost))
{
@ -985,25 +1033,21 @@ static void Task_BuyHowManyDialogueInit(u8 taskId)
u16 quantityInBag = CountTotalItemQuantityInBag(tItemId);
u16 maxQuantity;
DrawStdFrameWithCustomTileAndPalette(3, FALSE, 1, 13);
DrawStdFrameWithCustomTileAndPalette(WIN_QUANTITY_IN_BAG, FALSE, 1, 13);
ConvertIntToDecimalStringN(gStringVar1, quantityInBag, STR_CONV_MODE_RIGHT_ALIGN, MAX_ITEM_DIGITS + 1);
StringExpandPlaceholders(gStringVar4, gText_InBagVar1);
BuyMenuPrint(3, gStringVar4, 0, 1, 0, 0);
BuyMenuPrint(WIN_QUANTITY_IN_BAG, gStringVar4, 0, 1, 0, COLORID_NORMAL);
tItemCount = 1;
DrawStdFrameWithCustomTileAndPalette(4, FALSE, 1, 13);
DrawStdFrameWithCustomTileAndPalette(WIN_QUANTITY_PRICE, FALSE, 1, 13);
BuyMenuPrintItemQuantityAndPrice(taskId);
ScheduleBgCopyTilemapToVram(0);
maxQuantity = GetMoney(&gSaveBlock1Ptr->money) / sShopData->totalCost;
if (maxQuantity > MAX_BAG_ITEM_CAPACITY)
{
sShopData->maxQuantity = MAX_BAG_ITEM_CAPACITY;
}
else
{
sShopData->maxQuantity = maxQuantity;
}
gTasks[taskId].func = Task_BuyHowManyDialogueHandleInput;
}
@ -1022,11 +1066,11 @@ static void Task_BuyHowManyDialogueHandleInput(u8 taskId)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
ClearStdWindowAndFrameToTransparent(4, FALSE);
ClearStdWindowAndFrameToTransparent(3, FALSE);
ClearWindowTilemap(4);
ClearWindowTilemap(3);
PutWindowTilemap(1);
ClearStdWindowAndFrameToTransparent(WIN_QUANTITY_PRICE, FALSE);
ClearStdWindowAndFrameToTransparent(WIN_QUANTITY_IN_BAG, FALSE);
ClearWindowTilemap(WIN_QUANTITY_PRICE);
ClearWindowTilemap(WIN_QUANTITY_IN_BAG);
PutWindowTilemap(WIN_ITEM_LIST);
CopyItemName(tItemId, gStringVar1);
ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, BAG_ITEM_CAPACITY_DIGITS);
ConvertIntToDecimalStringN(gStringVar3, sShopData->totalCost, STR_CONV_MODE_LEFT_ALIGN, 6);
@ -1035,10 +1079,10 @@ static void Task_BuyHowManyDialogueHandleInput(u8 taskId)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
ClearStdWindowAndFrameToTransparent(4, FALSE);
ClearStdWindowAndFrameToTransparent(3, FALSE);
ClearWindowTilemap(4);
ClearWindowTilemap(3);
ClearStdWindowAndFrameToTransparent(WIN_QUANTITY_PRICE, FALSE);
ClearStdWindowAndFrameToTransparent(WIN_QUANTITY_IN_BAG, FALSE);
ClearWindowTilemap(WIN_QUANTITY_PRICE);
ClearWindowTilemap(WIN_QUANTITY_IN_BAG);
BuyMenuReturnToItemList(taskId);
}
}
@ -1053,7 +1097,7 @@ static void BuyMenuTryMakePurchase(u8 taskId)
{
s16 *data = gTasks[taskId].data;
PutWindowTilemap(1);
PutWindowTilemap(WIN_ITEM_LIST);
if (sMartInfo.martType == MART_TYPE_NORMAL)
{
@ -1088,17 +1132,13 @@ static void BuyMenuSubtractMoney(u8 taskId)
IncrementGameStat(GAME_STAT_SHOPPED);
RemoveMoney(&gSaveBlock1Ptr->money, sShopData->totalCost);
PlaySE(SE_SHOP);
PrintMoneyAmountInMoneyBox(0, GetMoney(&gSaveBlock1Ptr->money), 0);
PrintMoneyAmountInMoneyBox(WIN_MONEY, GetMoney(&gSaveBlock1Ptr->money), 0);
if (sMartInfo.martType == MART_TYPE_NORMAL)
{
gTasks[taskId].func = Task_ReturnToItemListAfterItemPurchase;
}
else
{
gTasks[taskId].func = Task_ReturnToItemListAfterDecorationPurchase;
}
}
static void Task_ReturnToItemListAfterItemPurchase(u8 taskId)
{
@ -1107,16 +1147,14 @@ static void Task_ReturnToItemListAfterItemPurchase(u8 taskId)
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
PlaySE(SE_SELECT);
if (tItemId == ITEM_POKE_BALL && tItemCount > 9 && AddBagItem(ITEM_PREMIER_BALL, 1) == TRUE)
{
// Purchasing 10+ Poke Balls gets the player a Premier Ball
if (tItemId == ITEM_POKE_BALL && tItemCount >= 10 && AddBagItem(ITEM_PREMIER_BALL, 1) == TRUE)
BuyMenuDisplayMessage(taskId, gText_ThrowInPremierBall, BuyMenuReturnToItemList);
}
else
{
BuyMenuReturnToItemList(taskId);
}
}
}
static void Task_ReturnToItemListAfterDecorationPurchase(u8 taskId)
{
@ -1131,10 +1169,10 @@ static void BuyMenuReturnToItemList(u8 taskId)
{
s16 *data = gTasks[taskId].data;
ClearDialogWindowAndFrameToTransparent(5, FALSE);
BuyMenuPrintCursor(tListTaskId, 1);
PutWindowTilemap(1);
PutWindowTilemap(2);
ClearDialogWindowAndFrameToTransparent(WIN_MESSAGE, FALSE);
BuyMenuPrintCursor(tListTaskId, COLORID_ITEM_LIST);
PutWindowTilemap(WIN_ITEM_LIST);
PutWindowTilemap(WIN_ITEM_DESCRIPTION);
ScheduleBgCopyTilemapToVram(0);
BuyMenuAddScrollIndicatorArrows();
gTasks[taskId].func = Task_BuyMenu;
@ -1144,11 +1182,11 @@ static void BuyMenuPrintItemQuantityAndPrice(u8 taskId)
{
s16 *data = gTasks[taskId].data;
FillWindowPixelBuffer(4, PIXEL_FILL(1));
PrintMoneyAmount(4, 38, 1, sShopData->totalCost, TEXT_SKIP_DRAW);
FillWindowPixelBuffer(WIN_QUANTITY_PRICE, PIXEL_FILL(1));
PrintMoneyAmount(WIN_QUANTITY_PRICE, 38, 1, sShopData->totalCost, TEXT_SKIP_DRAW);
ConvertIntToDecimalStringN(gStringVar1, tItemCount, STR_CONV_MODE_LEADING_ZEROS, BAG_ITEM_CAPACITY_DIGITS);
StringExpandPlaceholders(gStringVar4, gText_xVar1);
BuyMenuPrint(4, gStringVar4, 0, 1, 0, 0);
BuyMenuPrint(WIN_QUANTITY_PRICE, gStringVar4, 0, 1, 0, COLORID_NORMAL);
}
static void ExitBuyMenu(u8 taskId)
@ -1204,6 +1242,8 @@ static void RecordItemPurchase(u8 taskId)
#undef tItemCount
#undef tItemId
#undef tListTaskId
#undef tCallbackHi
#undef tCallbackLo
void CreatePokemartMenu(const u16 *itemsForSale)
{

View File

@ -6433,6 +6433,20 @@ static const struct SpriteTemplate sSpriteTemplate_PikaPowerBolt =
.callback = SpriteCB_PikaPowerBolt
};
/*
[0 ][1 ]
[ ][ ]
[ ][ ]
[ ][ ]
[ ][ ]
[______________][______________] 128x128
[ ]+ <- Origin ]
[ ][ ]
[ ][ ]
[ ][ ]
[ ][ ]
[2 ][3 ]
*/
static const struct Subsprite sSubsprites_ReelBackground[] =
{
{
@ -6474,6 +6488,11 @@ static const struct SubspriteTable sSubspriteTable_ReelBackground[] =
ARRAY_COUNT(sSubsprites_ReelBackground), sSubsprites_ReelBackground
};
/* v-- Origin on 3
[0_____][1_____]
[2_____][3_____] 64x24
[4 ][5 ]
*/
static const struct Subsprite sSubsprites_ReelTimeMachineAntennae[] =
{
{
@ -6531,6 +6550,13 @@ static const struct SubspriteTable sSubspriteTable_ReelTimeMachineAntennae[] =
ARRAY_COUNT(sSubsprites_ReelTimeMachineAntennae), sSubsprites_ReelTimeMachineAntennae
};
/*
[0 ]
[ ]
[ + Origin]
[______________] 64x40
[1 ][2 ]
*/
static const struct Subsprite sSubsprites_ReelTimeMachine[] =
{
{
@ -6564,6 +6590,14 @@ static const struct SubspriteTable sSubspriteTable_ReelTimeMachine[] =
ARRAY_COUNT(sSubsprites_ReelTimeMachine), sSubsprites_ReelTimeMachine
};
/*
[0 ]
[ ]
[ + Origin]
[______________] 64x48
[1 ][2 ]
[3 ][4 ]
*/
static const struct Subsprite sSubsprites_BrokenReelTimeMachine[] =
{
{
@ -6613,6 +6647,10 @@ static const struct SubspriteTable sSubspriteTable_BrokenReelTimeMachine[] =
ARRAY_COUNT(sSubsprites_BrokenReelTimeMachine), sSubsprites_BrokenReelTimeMachine
};
/* v-- Origin on 3
[0_____][1_____]
[2 ][3 ] 64x16
*/
static const struct Subsprite sSubsprites_ReelTimeShadow[] =
{
{
@ -6654,6 +6692,11 @@ static const struct SubspriteTable sSubspriteTable_ReelTimeShadow[] =
ARRAY_COUNT(sSubsprites_ReelTimeShadow), sSubsprites_ReelTimeShadow
};
/*
[0_] 16x24
[1+] <--Origin
[2_]
*/
static const struct Subsprite sSubsprites_ReelTimeNumberGap[] =
{
{
@ -6687,6 +6730,14 @@ static const struct SubspriteTable sSubspriteTable_ReelTimeNumberGap[] =
ARRAY_COUNT(sSubsprites_ReelTimeNumberGap), sSubsprites_ReelTimeNumberGap
};
/*
[0 ]
[ ]
[ + Origin]
[______________] 64x48
[1 ][2 ]
[3 ][4 ]
*/
static const struct Subsprite sSubsprites_DigitalDisplay_Reel[] =
{
{
@ -6736,6 +6787,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_Reel[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_Reel), sSubsprites_DigitalDisplay_Reel
};
/* v-- Origin on 3
[0_____][1_____]
[2 ][3 ] 64x16
*/
static const struct Subsprite sSubsprites_DigitalDisplay_Time[] =
{
{
@ -6777,6 +6832,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_Time[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_Time), sSubsprites_DigitalDisplay_Time
};
/* v-- Origin on 3
[0_____][1_____]
[2 ][3 ] 64x16
*/
static const struct Subsprite sSubsprites_DigitalDisplay_Insert[] =
{
{
@ -6818,6 +6877,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_Insert[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_Insert), sSubsprites_DigitalDisplay_Insert
};
/* v-- Origin on 3
[0_____][1_____]
[2 ][3 ] 64x16
*/
static const struct Subsprite sSubsprites_DigitalDisplay_Unused1[] =
{
{
@ -6859,6 +6922,11 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_Unused1[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_Unused1), sSubsprites_DigitalDisplay_Unused1
};
/* v-- Origin on 3
[0_____][1_____]
[2_____][3_____]
[4 ][5 ] 64x24
*/
static const struct Subsprite sSubsprites_DigitalDisplay_Win[] =
{
{
@ -6950,6 +7018,14 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_Unused2[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_Unused2), sSubsprites_DigitalDisplay_Unused2
};
/*
[0_____][1_]
[2_____][3_]
[4_____][5_]
[6_____][7+] <-- Origin
[8_____][9_]
[10____][11]
*/
static const struct Subsprite sSubsprites_DigitalDisplay_Pokeball[] =
{
{
@ -6962,7 +7038,7 @@ static const struct Subsprite sSubsprites_DigitalDisplay_Pokeball[] =
},
{
.x = 8,
-24,
.y = -24,
.shape = SPRITE_SHAPE(16x8),
.size = SPRITE_SIZE(16x8),
.tileOffset = 4,
@ -7055,6 +7131,11 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_Pokeball[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_Pokeball), sSubsprites_DigitalDisplay_Pokeball
};
/*
[0 ] 32x24
[ + ] <- Origin
[1 ][2 ]
*/
static const struct Subsprite sSubsprites_DigitalDisplay_DPad[] =
{
{
@ -7088,6 +7169,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_DPad[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_DPad), sSubsprites_DigitalDisplay_DPad
};
/*
[0 ] 16x16
[1+] <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_StopS[] =
{
{
@ -7113,6 +7198,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_StopS[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_StopS), sSubsprites_DigitalDisplay_StopS
};
/*
[0 ] 16x16
[1+] <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_StopT[] =
{
{
@ -7138,6 +7227,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_StopT[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_StopT), sSubsprites_DigitalDisplay_StopT
};
/*
[0 ] 16x16
[1+] <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_StopO[] =
{
{
@ -7163,6 +7256,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_StopO[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_StopO), sSubsprites_DigitalDisplay_StopO
};
/*
[0 ] 16x16
[1+] <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_StopP[] =
{
{
@ -7188,6 +7285,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_StopP[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_StopP), sSubsprites_DigitalDisplay_StopP
};
/*
[0 ] 16x16
[1+] <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_BonusB[] =
{
{
@ -7213,6 +7314,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_BonusB[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_BonusB), sSubsprites_DigitalDisplay_BonusB
};
/*
[]<-0 16x16
[]<-1 <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_BonusO[] =
{
{
@ -7238,6 +7343,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_BonusO[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_BonusO), sSubsprites_DigitalDisplay_BonusO
};
/*
[0 ] 16x16
[1+] <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_BonusN[] =
{
{
@ -7263,6 +7372,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_BonusN[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_BonusN), sSubsprites_DigitalDisplay_BonusN
};
/*
[]<-0 16x16
[]<-1 <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_BonusU[] =
{
{
@ -7288,6 +7401,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_BonusU[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_BonusU), sSubsprites_DigitalDisplay_BonusU
};
/*
[0 ] 16x16
[1+] <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_BonusS[] =
{
{
@ -7313,6 +7430,12 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_BonusS[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_BonusS), sSubsprites_DigitalDisplay_BonusS
};
/*
[0_][] <-1
[2_][] <-3
[4_][] <-5
^-- Origin on 3
*/
static const struct Subsprite sSubsprites_DigitalDisplay_BigB[] =
{
{
@ -7370,6 +7493,11 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_BigB[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_BigB), sSubsprites_DigitalDisplay_BigB
};
/*
[0_] 16x24
[1+] <--Origin
[2_]
*/
static const struct Subsprite sSubsprites_DigitalDisplay_BigI[] =
{
{
@ -7403,6 +7531,12 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_BigI[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_BigI), sSubsprites_DigitalDisplay_BigI
};
/*
[0_][] <-1
[2_][] <-3
[4_][] <-5
^-- Origin on 3
*/
static const struct Subsprite sSubsprites_DigitalDisplay_BigG[] =
{
{
@ -7460,6 +7594,12 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_BigG[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_BigG), sSubsprites_DigitalDisplay_BigG
};
/*
[0_][] <-1
[2_][] <-3
[4_][] <-5
^-- Origin on 3
*/
static const struct Subsprite sSubsprites_DigitalDisplay_RegR[] =
{
{
@ -7517,6 +7657,11 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_RegR[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_RegR), sSubsprites_DigitalDisplay_RegR
};
/*
[0_] 16x24
[1+] <--Origin
[2_]
*/
static const struct Subsprite sSubsprites_DigitalDisplay_RegE[] =
{
{
@ -7550,6 +7695,12 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_RegE[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_RegE), sSubsprites_DigitalDisplay_RegE
};
/*
[0_][] <-1
[2_][] <-3
[4_][] <-5
^-- Origin on 3
*/
static const struct Subsprite sSubsprites_DigitalDisplay_RegG[] =
{
{

View File

@ -351,7 +351,7 @@ static void InitTradeMenu(void)
FillWindowPixelBuffer(i, PIXEL_FILL(0));
}
FillBgTilemapBufferRect(0, 0, 0, 0, 30, 20, 15);
FillBgTilemapBufferRect(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 15);
LoadUserWindowBorderGfx_(0, 20, 0xC0);
LoadUserWindowBorderGfx(2, 1, 0xE0);
LoadMonIconPalettes();
@ -2064,13 +2064,13 @@ static void RedrawTradeMenuParty(u8 whichParty)
static void Task_DrawSelectionSummary(u8 taskId)
{
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(0);
}
static void Task_DrawSelectionTrade(u8 taskId)
{
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(0);
}

View File

@ -3680,8 +3680,8 @@ static s32 ListMenuHandler_AllItemsAvailable(u8 *state, u8 *windowId, u8 *listMe
if (winTemplateCopy.width > maxWidth)
winTemplateCopy.width = maxWidth;
if (winTemplateCopy.tilemapLeft + winTemplateCopy.width > 29)
winTemplateCopy.tilemapLeft = max(29 - winTemplateCopy.width, 0);
if (winTemplateCopy.tilemapLeft + winTemplateCopy.width >= DISPLAY_TILE_WIDTH)
winTemplateCopy.tilemapLeft = max(DISPLAY_TILE_WIDTH - 1 - winTemplateCopy.width, 0);
*windowId = AddWindow(&winTemplateCopy);
DrawStdWindowFrame(*windowId, FALSE);

View File

@ -129,7 +129,7 @@ void CB2_UnionRoomBattle(void)
ClearWindowTilemap(0);
FillWindowPixelBuffer(0, PIXEL_FILL(0));
FillWindowPixelBuffer(0, PIXEL_FILL(1));
FillBgTilemapBufferRect(0, 0, 0, 0, 30, 20, 0xF);
FillBgTilemapBufferRect(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 0xF);
LoadUserWindowBorderGfx(0, 1, 0xD0);
LoadUserWindowBorderGfx_(0, 1, 0xD0);
Menu_LoadStdPal();