shop: document some constants s.t. object events don't break
This commit is contained in:
parent
aaf5d91c18
commit
5d752bbe49
2 changed files with 6 additions and 6 deletions
|
@ -41,7 +41,7 @@ struct ShopData
|
||||||
/*0x200B*/ u8 scrollIndicatorsTaskId;
|
/*0x200B*/ u8 scrollIndicatorsTaskId;
|
||||||
/*0x200C*/ u8 iconSlot;
|
/*0x200C*/ u8 iconSlot;
|
||||||
/*0x200D*/ u8 itemSpriteIds[2];
|
/*0x200D*/ u8 itemSpriteIds[2];
|
||||||
/*0x2010*/ s16 viewportObjects[16][5];
|
/*0x2010*/ s16 viewportObjects[OBJECT_EVENTS_COUNT][5];
|
||||||
};
|
};
|
||||||
|
|
||||||
void CreatePokemartMenu(const u16 *);
|
void CreatePokemartMenu(const u16 *);
|
||||||
|
|
10
src/shop.c
10
src/shop.c
|
@ -796,15 +796,15 @@ static void BuyMenuCollectObjectEventData(void)
|
||||||
u8 r8 = 0;
|
u8 r8 = 0;
|
||||||
|
|
||||||
GetXYCoordsOneStepInFrontOfPlayer(&facingX, &facingY);
|
GetXYCoordsOneStepInFrontOfPlayer(&facingX, &facingY);
|
||||||
for (y = 0; y < 16; y++)
|
for (y = 0; y < OBJECT_EVENTS_COUNT; y++)
|
||||||
gShopDataPtr->viewportObjects[y][OBJ_EVENT_ID] = 16;
|
gShopDataPtr->viewportObjects[y][OBJ_EVENT_ID] = OBJECT_EVENTS_COUNT;
|
||||||
for (y = 0; y < 5; y++)
|
for (y = 0; y < 5; y++)
|
||||||
{
|
{
|
||||||
for (x = 0; x < 7; x++)
|
for (x = 0; x < 7; x++)
|
||||||
{
|
{
|
||||||
u8 objEventId = GetObjectEventIdByXY(facingX - 4 + x, facingY - 2 + y);
|
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][OBJ_EVENT_ID] = objEventId;
|
||||||
gShopDataPtr->viewportObjects[r8][X_COORD] = x;
|
gShopDataPtr->viewportObjects[r8][X_COORD] = x;
|
||||||
|
@ -839,9 +839,9 @@ static void BuyMenuDrawObjectEvents(void)
|
||||||
u8 spriteId;
|
u8 spriteId;
|
||||||
const struct ObjectEventGraphicsInfo *graphicsInfo;
|
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;
|
continue;
|
||||||
|
|
||||||
graphicsInfo = GetObjectEventGraphicsInfo(gObjectEvents[gShopDataPtr->viewportObjects[i][OBJ_EVENT_ID]].graphicsId);
|
graphicsInfo = GetObjectEventGraphicsInfo(gObjectEvents[gShopDataPtr->viewportObjects[i][OBJ_EVENT_ID]].graphicsId);
|
||||||
|
|
Loading…
Reference in a new issue