shop: document some constants s.t. object events don't break

This commit is contained in:
SBird 2020-06-03 14:26:22 +02:00 committed by huderlem
parent aaf5d91c18
commit 5d752bbe49
2 changed files with 6 additions and 6 deletions

View file

@ -41,7 +41,7 @@ struct ShopData
/*0x200B*/ u8 scrollIndicatorsTaskId;
/*0x200C*/ u8 iconSlot;
/*0x200D*/ u8 itemSpriteIds[2];
/*0x2010*/ s16 viewportObjects[16][5];
/*0x2010*/ s16 viewportObjects[OBJECT_EVENTS_COUNT][5];
};
void CreatePokemartMenu(const u16 *);

View file

@ -796,15 +796,15 @@ static void BuyMenuCollectObjectEventData(void)
u8 r8 = 0;
GetXYCoordsOneStepInFrontOfPlayer(&facingX, &facingY);
for (y = 0; y < 16; y++)
gShopDataPtr->viewportObjects[y][OBJ_EVENT_ID] = 16;
for (y = 0; y < OBJECT_EVENTS_COUNT; y++)
gShopDataPtr->viewportObjects[y][OBJ_EVENT_ID] = OBJECT_EVENTS_COUNT;
for (y = 0; y < 5; y++)
{
for (x = 0; x < 7; x++)
{
u8 objEventId = GetObjectEventIdByXY(facingX - 4 + x, facingY - 2 + y);
if (objEventId != 16)
if (objEventId != OBJECT_EVENTS_COUNT)
{
gShopDataPtr->viewportObjects[r8][OBJ_EVENT_ID] = objEventId;
gShopDataPtr->viewportObjects[r8][X_COORD] = x;
@ -839,9 +839,9 @@ static void BuyMenuDrawObjectEvents(void)
u8 spriteId;
const struct ObjectEventGraphicsInfo *graphicsInfo;
for (i = 0; i < 16; i++) // max objects?
for (i = 0; i < OBJECT_EVENTS_COUNT; i++) // max objects?
{
if (gShopDataPtr->viewportObjects[i][OBJ_EVENT_ID] == 16)
if (gShopDataPtr->viewportObjects[i][OBJ_EVENT_ID] == OBJECT_EVENTS_COUNT)
continue;
graphicsInfo = GetObjectEventGraphicsInfo(gObjectEvents[gShopDataPtr->viewportObjects[i][OBJ_EVENT_ID]].graphicsId);