Merge branch 'master' of https://github.com/pret/pokeemerald into sideways_stairs

This commit is contained in:
ghoulslash 2021-12-20 11:25:14 -05:00
commit 7a70fc0d73
24 changed files with 156 additions and 147 deletions

1
.gitignore vendored
View File

@ -36,3 +36,4 @@ porymap.project.cfg
*.sna
*.diff
*.sym
*.js

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 B

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 B

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 B

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 B

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 B

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 B

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 254 B

View File

@ -2,7 +2,6 @@
static void *sHeapStart;
static u32 sHeapSize;
static u32 sFiller; // needed to align dma3_manager.o(.bss)
#define MALLOC_SYSTEM_ID 0xA3A3

View File

@ -14,7 +14,7 @@ struct Item
u8 holdEffectParam;
const u8 *description;
u8 importance;
u8 unk19;
bool8 registrability; // unused
u8 pocket;
u8 type;
ItemUseFunc fieldUseFunc;
@ -68,7 +68,7 @@ u8 ItemId_GetHoldEffect(u16 itemId);
u8 ItemId_GetHoldEffectParam(u16 itemId);
const u8 *ItemId_GetDescription(u16 itemId);
u8 ItemId_GetImportance(u16 itemId);
u8 ItemId_GetUnknownValue(u16 itemId);
u8 ItemId_GetRegistrability(u16 itemId);
u8 ItemId_GetPocket(u16 itemId);
u8 ItemId_GetType(u16 itemId);
ItemUseFunc ItemId_GetFieldFunc(u16 itemId);

View File

@ -3146,7 +3146,7 @@ const struct Item gItems[] =
.price = 0,
.description = sMachBikeDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_FIELD,
.fieldUseFunc = ItemUseOutOfBattle_Bike,
@ -3172,7 +3172,7 @@ const struct Item gItems[] =
.price = 0,
.description = sItemfinderDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_FIELD,
.fieldUseFunc = ItemUseOutOfBattle_Itemfinder,
@ -3185,7 +3185,7 @@ const struct Item gItems[] =
.price = 0,
.description = sOldRodDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_FIELD,
.fieldUseFunc = ItemUseOutOfBattle_Rod,
@ -3199,7 +3199,7 @@ const struct Item gItems[] =
.price = 0,
.description = sGoodRodDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_FIELD,
.fieldUseFunc = ItemUseOutOfBattle_Rod,
@ -3213,7 +3213,7 @@ const struct Item gItems[] =
.price = 0,
.description = sSuperRodDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_FIELD,
.fieldUseFunc = ItemUseOutOfBattle_Rod,
@ -3310,7 +3310,7 @@ const struct Item gItems[] =
.price = 0,
.description = sAcroBikeDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_FIELD,
.fieldUseFunc = ItemUseOutOfBattle_Bike,
@ -3324,7 +3324,7 @@ const struct Item gItems[] =
.price = 0,
.description = sPokeblockCaseDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_PBLOCK_CASE,
.fieldUseFunc = ItemUseOutOfBattle_PokeblockCase,
@ -4322,7 +4322,7 @@ const struct Item gItems[] =
.price = 0,
.description = sBicycleDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_FIELD,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
@ -4335,7 +4335,7 @@ const struct Item gItems[] =
.price = 0,
.description = sTownMapDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
@ -4348,7 +4348,7 @@ const struct Item gItems[] =
.price = 0,
.description = sVSSeekerDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_FIELD,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
@ -4361,7 +4361,7 @@ const struct Item gItems[] =
.price = 0,
.description = sFameCheckerDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
@ -4374,7 +4374,7 @@ const struct Item gItems[] =
.price = 0,
.description = sTMCaseDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
@ -4387,7 +4387,7 @@ const struct Item gItems[] =
.price = 0,
.description = sBerryPouchDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
@ -4400,7 +4400,7 @@ const struct Item gItems[] =
.price = 0,
.description = sTeachyTVDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_FIELD,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
@ -4413,7 +4413,7 @@ const struct Item gItems[] =
.price = 0,
.description = sTriPassDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
@ -4426,7 +4426,7 @@ const struct Item gItems[] =
.price = 0,
.description = sRainbowPassDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
@ -4439,7 +4439,7 @@ const struct Item gItems[] =
.price = 0,
.description = sTeaDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
@ -4452,7 +4452,7 @@ const struct Item gItems[] =
.price = 0,
.description = sMysticTicketDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
@ -4465,7 +4465,7 @@ const struct Item gItems[] =
.price = 0,
.description = sAuroraTicketDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
@ -4478,7 +4478,7 @@ const struct Item gItems[] =
.price = 0,
.description = sPowderJarDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_PowderJar,
@ -4491,7 +4491,7 @@ const struct Item gItems[] =
.price = 0,
.description = sRubyDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
@ -4504,7 +4504,7 @@ const struct Item gItems[] =
.price = 0,
.description = sSapphireDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
@ -4519,7 +4519,7 @@ const struct Item gItems[] =
.price = 0,
.description = sMagmaEmblemDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
@ -4532,7 +4532,7 @@ const struct Item gItems[] =
.price = 0,
.description = sOldSeaMapDesc,
.importance = 1,
.unk19 = 1,
.registrability = TRUE,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,

View File

@ -913,9 +913,9 @@ u8 ItemId_GetImportance(u16 itemId)
}
// unused
u8 ItemId_GetUnknownValue(u16 itemId)
u8 ItemId_GetRegistrability(u16 itemId)
{
return gItems[SanitizeItemId(itemId)].unk19;
return gItems[SanitizeItemId(itemId)].registrability;
}
u8 ItemId_GetPocket(u16 itemId)

View File

@ -193,10 +193,18 @@ bool8 IsRoamerAt(u8 mapGroup, u8 mapNum)
void CreateRoamerMonInstance(void)
{
u32 status;
struct Pokemon *mon = &gEnemyParty[0];
ZeroEnemyPartyMons();
CreateMonWithIVsPersonality(mon, ROAMER->species, ROAMER->level, ROAMER->ivs, ROAMER->personality);
// The roamer's status field is u8, but SetMonData expects status to be u32, so will set the roamer's status
// using the status field and the following 3 bytes (cool, beauty, and cute).
#ifdef BUGFIX
status = ROAMER->status;
SetMonData(mon, MON_DATA_STATUS, &status);
#else
SetMonData(mon, MON_DATA_STATUS, &ROAMER->status);
#endif
SetMonData(mon, MON_DATA_HP, &ROAMER->hp);
SetMonData(mon, MON_DATA_COOL, &ROAMER->cool);
SetMonData(mon, MON_DATA_BEAUTY, &ROAMER->beauty);

View File

@ -632,45 +632,45 @@ void InitTilesetAnim_Building(void)
static void TilesetAnim_General(u16 timer)
{
if (timer % 16 == 0)
QueueAnimTiles_General_Flower(timer >> 4);
QueueAnimTiles_General_Flower(timer / 16);
if (timer % 16 == 1)
QueueAnimTiles_General_Water(timer >> 4);
QueueAnimTiles_General_Water(timer / 16);
if (timer % 16 == 2)
QueueAnimTiles_General_SandWaterEdge(timer >> 4);
QueueAnimTiles_General_SandWaterEdge(timer / 16);
if (timer % 16 == 3)
QueueAnimTiles_General_Waterfall(timer >> 4);
QueueAnimTiles_General_Waterfall(timer / 16);
if (timer % 16 == 4)
QueueAnimTiles_General_LandWaterEdge(timer >> 4);
QueueAnimTiles_General_LandWaterEdge(timer / 16);
}
static void TilesetAnim_Building(u16 timer)
{
if (timer % 8 == 0)
QueueAnimTiles_Building_TVTurnedOn(timer >> 3);
QueueAnimTiles_Building_TVTurnedOn(timer / 8);
}
static void QueueAnimTiles_General_Flower(u16 timer)
{
u16 i = timer % 4;
AppendTilesetAnimToBuffer(gTilesetAnims_General_Flower[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(508)), 0x80);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_General_Flower);
AppendTilesetAnimToBuffer(gTilesetAnims_General_Flower[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(508)), 4 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_General_Water(u16 timer)
{
u8 i = timer % 8;
AppendTilesetAnimToBuffer(gTilesetAnims_General_Water[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(432)), 0x3C0);
u8 i = timer % ARRAY_COUNT(gTilesetAnims_General_Water);
AppendTilesetAnimToBuffer(gTilesetAnims_General_Water[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(432)), 30 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_General_SandWaterEdge(u16 timer)
{
u16 i = timer % 8;
AppendTilesetAnimToBuffer(gTilesetAnims_General_SandWaterEdge[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(464)), 0x140);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_General_SandWaterEdge);
AppendTilesetAnimToBuffer(gTilesetAnims_General_SandWaterEdge[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(464)), 10 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_General_Waterfall(u16 timer)
{
u16 i = timer % 4;
AppendTilesetAnimToBuffer(gTilesetAnims_General_Waterfall[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(496)), 0xc0);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_General_Waterfall);
AppendTilesetAnimToBuffer(gTilesetAnims_General_Waterfall[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(496)), 6 * TILE_SIZE_4BPP);
}
void InitTilesetAnim_Petalburg(void)
@ -838,336 +838,336 @@ static void TilesetAnim_Rustboro(u16 timer)
{
if (timer % 8 == 0)
{
QueueAnimTiles_Rustboro_WindyWater(timer >> 3, 0);
QueueAnimTiles_Rustboro_Fountain(timer >> 3);
QueueAnimTiles_Rustboro_WindyWater(timer / 8, 0);
QueueAnimTiles_Rustboro_Fountain(timer / 8);
}
if (timer % 8 == 1)
QueueAnimTiles_Rustboro_WindyWater(timer >> 3, 1);
QueueAnimTiles_Rustboro_WindyWater(timer / 8, 1);
if (timer % 8 == 2)
QueueAnimTiles_Rustboro_WindyWater(timer >> 3, 2);
QueueAnimTiles_Rustboro_WindyWater(timer / 8, 2);
if (timer % 8 == 3)
QueueAnimTiles_Rustboro_WindyWater(timer >> 3, 3);
QueueAnimTiles_Rustboro_WindyWater(timer / 8, 3);
if (timer % 8 == 4)
QueueAnimTiles_Rustboro_WindyWater(timer >> 3, 4);
QueueAnimTiles_Rustboro_WindyWater(timer / 8, 4);
if (timer % 8 == 5)
QueueAnimTiles_Rustboro_WindyWater(timer >> 3, 5);
QueueAnimTiles_Rustboro_WindyWater(timer / 8, 5);
if (timer % 8 == 6)
QueueAnimTiles_Rustboro_WindyWater(timer >> 3, 6);
QueueAnimTiles_Rustboro_WindyWater(timer / 8, 6);
if (timer % 8 == 7)
QueueAnimTiles_Rustboro_WindyWater(timer >> 3, 7);
QueueAnimTiles_Rustboro_WindyWater(timer / 8, 7);
}
static void TilesetAnim_Dewford(u16 timer)
{
if (timer % 8 == 0)
QueueAnimTiles_Dewford_Flag(timer >> 3);
QueueAnimTiles_Dewford_Flag(timer / 8);
}
static void TilesetAnim_Slateport(u16 timer)
{
if (timer % 16 == 0)
QueueAnimTiles_Slateport_Balloons(timer >> 4);
QueueAnimTiles_Slateport_Balloons(timer / 16);
}
static void TilesetAnim_Mauville(u16 timer)
{
if (timer % 8 == 0)
QueueAnimTiles_Mauville_Flowers(timer >> 3, 0);
QueueAnimTiles_Mauville_Flowers(timer / 8, 0);
if (timer % 8 == 1)
QueueAnimTiles_Mauville_Flowers(timer >> 3, 1);
QueueAnimTiles_Mauville_Flowers(timer / 8, 1);
if (timer % 8 == 2)
QueueAnimTiles_Mauville_Flowers(timer >> 3, 2);
QueueAnimTiles_Mauville_Flowers(timer / 8, 2);
if (timer % 8 == 3)
QueueAnimTiles_Mauville_Flowers(timer >> 3, 3);
QueueAnimTiles_Mauville_Flowers(timer / 8, 3);
if (timer % 8 == 4)
QueueAnimTiles_Mauville_Flowers(timer >> 3, 4);
QueueAnimTiles_Mauville_Flowers(timer / 8, 4);
if (timer % 8 == 5)
QueueAnimTiles_Mauville_Flowers(timer >> 3, 5);
QueueAnimTiles_Mauville_Flowers(timer / 8, 5);
if (timer % 8 == 6)
QueueAnimTiles_Mauville_Flowers(timer >> 3, 6);
QueueAnimTiles_Mauville_Flowers(timer / 8, 6);
if (timer % 8 == 7)
QueueAnimTiles_Mauville_Flowers(timer >> 3, 7);
QueueAnimTiles_Mauville_Flowers(timer / 8, 7);
}
static void TilesetAnim_Lavaridge(u16 timer)
{
if (timer % 16 == 0)
QueueAnimTiles_Lavaridge_Steam(timer >> 4);
QueueAnimTiles_Lavaridge_Steam(timer / 16);
if (timer % 16 == 1)
QueueAnimTiles_Lavaridge_Lava(timer >> 4);
QueueAnimTiles_Lavaridge_Lava(timer / 16);
}
static void TilesetAnim_EverGrande(u16 timer)
{
if (timer % 8 == 0)
QueueAnimTiles_EverGrande_Flowers(timer >> 3, 0);
QueueAnimTiles_EverGrande_Flowers(timer / 8, 0);
if (timer % 8 == 1)
QueueAnimTiles_EverGrande_Flowers(timer >> 3, 1);
QueueAnimTiles_EverGrande_Flowers(timer / 8, 1);
if (timer % 8 == 2)
QueueAnimTiles_EverGrande_Flowers(timer >> 3, 2);
QueueAnimTiles_EverGrande_Flowers(timer / 8, 2);
if (timer % 8 == 3)
QueueAnimTiles_EverGrande_Flowers(timer >> 3, 3);
QueueAnimTiles_EverGrande_Flowers(timer / 8, 3);
if (timer % 8 == 4)
QueueAnimTiles_EverGrande_Flowers(timer >> 3, 4);
QueueAnimTiles_EverGrande_Flowers(timer / 8, 4);
if (timer % 8 == 5)
QueueAnimTiles_EverGrande_Flowers(timer >> 3, 5);
QueueAnimTiles_EverGrande_Flowers(timer / 8, 5);
if (timer % 8 == 6)
QueueAnimTiles_EverGrande_Flowers(timer >> 3, 6);
QueueAnimTiles_EverGrande_Flowers(timer / 8, 6);
if (timer % 8 == 7)
QueueAnimTiles_EverGrande_Flowers(timer >> 3, 7);
QueueAnimTiles_EverGrande_Flowers(timer / 8, 7);
}
static void TilesetAnim_Pacifidlog(u16 timer)
{
if (timer % 16 == 0)
QueueAnimTiles_Pacifidlog_LogBridges(timer >> 4);
QueueAnimTiles_Pacifidlog_LogBridges(timer / 16);
if (timer % 16 == 1)
QueueAnimTiles_Pacifidlog_WaterCurrents(timer >> 4);
QueueAnimTiles_Pacifidlog_WaterCurrents(timer / 16);
}
static void TilesetAnim_Sootopolis(u16 timer)
{
if (timer % 16 == 0)
QueueAnimTiles_Sootopolis_StormyWater(timer >> 4);
QueueAnimTiles_Sootopolis_StormyWater(timer / 16);
}
static void TilesetAnim_Underwater(u16 timer)
{
if (timer % 16 == 0)
QueueAnimTiles_Underwater_Seaweed(timer >> 4);
QueueAnimTiles_Underwater_Seaweed(timer / 16);
}
static void TilesetAnim_Cave(u16 timer)
{
if (timer % 16 == 1)
QueueAnimTiles_Cave_Lava(timer >> 4);
QueueAnimTiles_Cave_Lava(timer / 16);
}
static void TilesetAnim_BattleFrontierOutsideWest(u16 timer)
{
if (timer % 8 == 0)
QueueAnimTiles_BattleFrontierOutsideWest_Flag(timer >> 3);
QueueAnimTiles_BattleFrontierOutsideWest_Flag(timer / 8);
}
static void TilesetAnim_BattleFrontierOutsideEast(u16 timer)
{
if (timer % 8 == 0)
QueueAnimTiles_BattleFrontierOutsideEast_Flag(timer >> 3);
QueueAnimTiles_BattleFrontierOutsideEast_Flag(timer / 8);
}
static void QueueAnimTiles_General_LandWaterEdge(u16 timer)
{
u16 i = timer % 4;
AppendTilesetAnimToBuffer(gTilesetAnims_General_LandWaterEdge[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(480)), 0x140);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_General_LandWaterEdge);
AppendTilesetAnimToBuffer(gTilesetAnims_General_LandWaterEdge[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(480)), 10 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_Lavaridge_Steam(u8 timer)
{
u8 i = timer % 4;
AppendTilesetAnimToBuffer(gTilesetAnims_Lavaridge_Steam[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 288)), 0x80);
u8 i = timer % ARRAY_COUNT(gTilesetAnims_Lavaridge_Steam);
AppendTilesetAnimToBuffer(gTilesetAnims_Lavaridge_Steam[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 288)), 4 * TILE_SIZE_4BPP);
i = (timer + 2) % 4;
AppendTilesetAnimToBuffer(gTilesetAnims_Lavaridge_Steam[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 292)), 0x80);
i = (timer + 2) % (int)ARRAY_COUNT(gTilesetAnims_Lavaridge_Steam);
AppendTilesetAnimToBuffer(gTilesetAnims_Lavaridge_Steam[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 292)), 4 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_Pacifidlog_LogBridges(u8 timer)
{
u8 i = timer % 4;
AppendTilesetAnimToBuffer(gTilesetAnims_Pacifidlog_LogBridges[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 464)), 0x3C0);
u8 i = timer % ARRAY_COUNT(gTilesetAnims_Pacifidlog_LogBridges);
AppendTilesetAnimToBuffer(gTilesetAnims_Pacifidlog_LogBridges[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 464)), 30 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_Underwater_Seaweed(u8 timer)
{
u8 i = timer % 4;
AppendTilesetAnimToBuffer(gTilesetAnims_Underwater_Seaweed[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 496)), 0x80);
u8 i = timer % ARRAY_COUNT(gTilesetAnims_Underwater_Seaweed);
AppendTilesetAnimToBuffer(gTilesetAnims_Underwater_Seaweed[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 496)), 4 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_Pacifidlog_WaterCurrents(u8 timer)
{
u8 i = timer % 8;
AppendTilesetAnimToBuffer(gTilesetAnims_Pacifidlog_WaterCurrents[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 496)), 0x100);
u8 i = timer % ARRAY_COUNT(gTilesetAnims_Pacifidlog_WaterCurrents);
AppendTilesetAnimToBuffer(gTilesetAnims_Pacifidlog_WaterCurrents[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 496)), 8 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_Mauville_Flowers(u16 timer_div, u8 timer_mod)
{
timer_div -= timer_mod;
if (timer_div < 12) // almost certainly a typo
if (timer_div < min(ARRAY_COUNT(gTilesetAnims_Mauville_Flower1), ARRAY_COUNT(gTilesetAnims_Mauville_Flower2)))
{
timer_div %= 12;
AppendTilesetAnimToBuffer(gTilesetAnims_Mauville_Flower1[timer_div], gTilesetAnims_Mauville_Flower1_VDests[timer_mod], 0x80);
AppendTilesetAnimToBuffer(gTilesetAnims_Mauville_Flower2[timer_div], gTilesetAnims_Mauville_Flower2_VDests[timer_mod], 0x80);
timer_div %= min(ARRAY_COUNT(gTilesetAnims_Mauville_Flower1), ARRAY_COUNT(gTilesetAnims_Mauville_Flower2));
AppendTilesetAnimToBuffer(gTilesetAnims_Mauville_Flower1[timer_div], gTilesetAnims_Mauville_Flower1_VDests[timer_mod], 4 * TILE_SIZE_4BPP);
AppendTilesetAnimToBuffer(gTilesetAnims_Mauville_Flower2[timer_div], gTilesetAnims_Mauville_Flower2_VDests[timer_mod], 4 * TILE_SIZE_4BPP);
}
else
{
timer_div %= 4;
AppendTilesetAnimToBuffer(gTilesetAnims_Mauville_Flower1_B[timer_div], gTilesetAnims_Mauville_Flower1_VDests[timer_mod], 0x80);
AppendTilesetAnimToBuffer(gTilesetAnims_Mauville_Flower2_B[timer_div], gTilesetAnims_Mauville_Flower2_VDests[timer_mod], 0x80);
timer_div %= min(ARRAY_COUNT(gTilesetAnims_Mauville_Flower1_B), ARRAY_COUNT(gTilesetAnims_Mauville_Flower2_B));
AppendTilesetAnimToBuffer(gTilesetAnims_Mauville_Flower1_B[timer_div], gTilesetAnims_Mauville_Flower1_VDests[timer_mod], 4 * TILE_SIZE_4BPP);
AppendTilesetAnimToBuffer(gTilesetAnims_Mauville_Flower2_B[timer_div], gTilesetAnims_Mauville_Flower2_VDests[timer_mod], 4 * TILE_SIZE_4BPP);
}
}
static void QueueAnimTiles_Rustboro_WindyWater(u16 timer_div, u8 timer_mod)
{
timer_div -= timer_mod;
timer_div %= 8;
timer_div %= ARRAY_COUNT(gTilesetAnims_Rustboro_WindyWater);
if (gTilesetAnims_Rustboro_WindyWater[timer_div])
AppendTilesetAnimToBuffer(gTilesetAnims_Rustboro_WindyWater[timer_div], gTilesetAnims_Rustboro_WindyWater_VDests[timer_mod], 0x80);
AppendTilesetAnimToBuffer(gTilesetAnims_Rustboro_WindyWater[timer_div], gTilesetAnims_Rustboro_WindyWater_VDests[timer_mod], 4 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_Rustboro_Fountain(u16 timer)
{
u16 i = timer % 2;
AppendTilesetAnimToBuffer(gTilesetAnims_Rustboro_Fountain[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 448)), 0x80);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_Rustboro_Fountain);
AppendTilesetAnimToBuffer(gTilesetAnims_Rustboro_Fountain[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 448)), 4 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_Lavaridge_Lava(u16 timer)
{
u16 i = timer % 4;
AppendTilesetAnimToBuffer(gTilesetAnims_Lavaridge_Cave_Lava[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 160)), 0x80);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_Lavaridge_Cave_Lava);
AppendTilesetAnimToBuffer(gTilesetAnims_Lavaridge_Cave_Lava[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 160)), 4 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_EverGrande_Flowers(u16 timer_div, u8 timer_mod)
{
timer_div -= timer_mod;
timer_div %= 8;
timer_div %= ARRAY_COUNT(gTilesetAnims_EverGrande_Flowers);
AppendTilesetAnimToBuffer(gTilesetAnims_EverGrande_Flowers[timer_div], gTilesetAnims_EverGrande_VDests[timer_mod], 0x80);
AppendTilesetAnimToBuffer(gTilesetAnims_EverGrande_Flowers[timer_div], gTilesetAnims_EverGrande_VDests[timer_mod], 4 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_Cave_Lava(u16 timer)
{
u16 i = timer % 4;
AppendTilesetAnimToBuffer(gTilesetAnims_Lavaridge_Cave_Lava[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 416)), 0x80);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_Lavaridge_Cave_Lava);
AppendTilesetAnimToBuffer(gTilesetAnims_Lavaridge_Cave_Lava[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 416)), 4 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_Dewford_Flag(u16 timer)
{
u16 id = timer % 4;
AppendTilesetAnimToBuffer(gTilesetAnims_Dewford_Flag[id], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 170)), 0xC0);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_Dewford_Flag);
AppendTilesetAnimToBuffer(gTilesetAnims_Dewford_Flag[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 170)), 6 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_BattleFrontierOutsideWest_Flag(u16 timer)
{
u16 i = timer % 4;
AppendTilesetAnimToBuffer(gTilesetAnims_BattleFrontierOutsideWest_Flag[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 218)), 0xC0);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_BattleFrontierOutsideWest_Flag);
AppendTilesetAnimToBuffer(gTilesetAnims_BattleFrontierOutsideWest_Flag[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 218)), 6 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_BattleFrontierOutsideEast_Flag(u16 timer)
{
u16 i = timer % 4;
AppendTilesetAnimToBuffer(gTilesetAnims_BattleFrontierOutsideEast_Flag[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 218)), 0xC0);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_BattleFrontierOutsideEast_Flag);
AppendTilesetAnimToBuffer(gTilesetAnims_BattleFrontierOutsideEast_Flag[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 218)), 6 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_Slateport_Balloons(u16 timer)
{
u16 i = timer % 4;
AppendTilesetAnimToBuffer(gTilesetAnims_Slateport_Balloons[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 224)), 0x80);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_Slateport_Balloons);
AppendTilesetAnimToBuffer(gTilesetAnims_Slateport_Balloons[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 224)), 4 * TILE_SIZE_4BPP);
}
static void TilesetAnim_MauvilleGym(u16 timer)
{
if (timer % 2 == 0)
QueueAnimTiles_MauvilleGym_ElectricGates(timer >> 1);
QueueAnimTiles_MauvilleGym_ElectricGates(timer / 2);
}
static void TilesetAnim_SootopolisGym(u16 timer)
{
if (timer % 8 == 0)
QueueAnimTiles_SootopolisGym_Waterfalls(timer >> 3);
QueueAnimTiles_SootopolisGym_Waterfalls(timer / 8);
}
static void TilesetAnim_EliteFour(u16 timer)
{
if (timer % 64 == 1)
QueueAnimTiles_EliteFour_GroundLights(timer >> 6);
QueueAnimTiles_EliteFour_GroundLights(timer / 64);
if (timer % 8 == 1)
QueueAnimTiles_EliteFour_WallLights(timer >> 3);
QueueAnimTiles_EliteFour_WallLights(timer / 8);
}
static void TilesetAnim_BikeShop(u16 timer)
{
if (timer % 4 == 0)
QueueAnimTiles_BikeShop_BlinkingLights(timer >> 2);
QueueAnimTiles_BikeShop_BlinkingLights(timer / 4);
}
static void TilesetAnim_BattlePyramid(u16 timer)
{
if (timer % 8 == 0)
{
QueueAnimTiles_BattlePyramid_Torch(timer >> 3);
QueueAnimTiles_BattlePyramid_StatueShadow(timer >> 3);
QueueAnimTiles_BattlePyramid_Torch(timer / 8);
QueueAnimTiles_BattlePyramid_StatueShadow(timer / 8);
}
}
static void TilesetAnim_BattleDome(u16 timer)
{
if (timer % 4 == 0)
BlendAnimPalette_BattleDome_FloorLights(timer >> 2);
BlendAnimPalette_BattleDome_FloorLights(timer / 4);
}
static void TilesetAnim_BattleDome2(u16 timer)
{
if (timer % 4 == 0)
BlendAnimPalette_BattleDome_FloorLightsNoBlend(timer >> 2);
BlendAnimPalette_BattleDome_FloorLightsNoBlend(timer / 4);
}
static void QueueAnimTiles_Building_TVTurnedOn(u16 timer)
{
u16 i = timer % 2;
AppendTilesetAnimToBuffer(gTilesetAnims_Building_TvTurnedOn[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(496)), 0x80);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_Building_TvTurnedOn);
AppendTilesetAnimToBuffer(gTilesetAnims_Building_TvTurnedOn[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(496)), 4 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_SootopolisGym_Waterfalls(u16 timer)
{
u16 i = timer % 3;
AppendTilesetAnimToBuffer(gTilesetAnims_SootopolisGym_SideWaterfall[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 496)), 0x180);
AppendTilesetAnimToBuffer(gTilesetAnims_SootopolisGym_FrontWaterfall[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 464)), 0x280);
u16 i = timer % min(ARRAY_COUNT(gTilesetAnims_SootopolisGym_SideWaterfall), ARRAY_COUNT(gTilesetAnims_SootopolisGym_FrontWaterfall));
AppendTilesetAnimToBuffer(gTilesetAnims_SootopolisGym_SideWaterfall[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 496)), 12 * TILE_SIZE_4BPP);
AppendTilesetAnimToBuffer(gTilesetAnims_SootopolisGym_FrontWaterfall[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 464)), 20 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_EliteFour_WallLights(u16 timer)
{
u16 i = timer % 4;
AppendTilesetAnimToBuffer(gTilesetAnims_EliteFour_WallLights[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 504)), 0x20);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_EliteFour_WallLights);
AppendTilesetAnimToBuffer(gTilesetAnims_EliteFour_WallLights[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 504)), 1 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_EliteFour_GroundLights(u16 timer)
{
u16 i = timer % 2;
AppendTilesetAnimToBuffer(gTilesetAnims_EliteFour_FloorLight[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 480)), 0x80);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_EliteFour_FloorLight);
AppendTilesetAnimToBuffer(gTilesetAnims_EliteFour_FloorLight[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 480)), 4 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_MauvilleGym_ElectricGates(u16 timer)
{
u16 i = timer % 2;
AppendTilesetAnimToBuffer(gTilesetAnims_MauvilleGym_ElectricGates[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 144)), 0x200);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_MauvilleGym_ElectricGates);
AppendTilesetAnimToBuffer(gTilesetAnims_MauvilleGym_ElectricGates[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 144)), 16 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_BikeShop_BlinkingLights(u16 timer)
{
u16 i = timer % 2;
AppendTilesetAnimToBuffer(gTilesetAnims_BikeShop_BlinkingLights[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 496)), 0x120);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_BikeShop_BlinkingLights);
AppendTilesetAnimToBuffer(gTilesetAnims_BikeShop_BlinkingLights[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 496)), 9 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_Sootopolis_StormyWater(u16 timer)
{
u16 i = timer % 8;
AppendTilesetAnimToBuffer(gTilesetAnims_Sootopolis_StormyWater[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 240)), 0xc00);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_Sootopolis_StormyWater);
AppendTilesetAnimToBuffer(gTilesetAnims_Sootopolis_StormyWater[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 240)), 96 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_BattlePyramid_Torch(u16 timer)
{
u16 i = timer % 3;
AppendTilesetAnimToBuffer(gTilesetAnims_BattlePyramid_Torch[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 151)), 0x100);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_BattlePyramid_Torch);
AppendTilesetAnimToBuffer(gTilesetAnims_BattlePyramid_Torch[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 151)), 8 * TILE_SIZE_4BPP);
}
static void QueueAnimTiles_BattlePyramid_StatueShadow(u16 timer)
{
u16 i = timer % 3;
AppendTilesetAnimToBuffer(gTilesetAnims_BattlePyramid_StatueShadow[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 135)), 0x100);
u16 i = timer % ARRAY_COUNT(gTilesetAnims_BattlePyramid_StatueShadow);
AppendTilesetAnimToBuffer(gTilesetAnims_BattlePyramid_StatueShadow[i], (u16 *)(BG_VRAM + TILE_OFFSET_4BPP(NUM_TILES_IN_PRIMARY + 135)), 8 * TILE_SIZE_4BPP);
}
static void BlendAnimPalette_BattleDome_FloorLights(u16 timer)
{
CpuCopy16(gTilesetAnims_BattleDomeFloorLightPals[timer % 4], gPlttBufferUnfaded + 0x80, 32);
CpuCopy16(gTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(gTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[0x80], 32);
BlendPalette(0x80, 16, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF);
if ((u8)FindTaskIdByFunc(Task_BattleTransition_Intro) != TASK_NONE)
{
@ -1178,7 +1178,7 @@ static void BlendAnimPalette_BattleDome_FloorLights(u16 timer)
static void BlendAnimPalette_BattleDome_FloorLightsNoBlend(u16 timer)
{
CpuCopy16(gTilesetAnims_BattleDomeFloorLightPals[timer % 4], gPlttBufferUnfaded + 0x80, 32);
CpuCopy16(gTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(gTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[0x80], 32);
if ((u8)FindTaskIdByFunc(Task_BattleTransition_Intro) == TASK_NONE)
{
BlendPalette(0x80, 16, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF);

View File

@ -4531,7 +4531,8 @@ static void _CreateInGameTradePokemon(u8 whichPlayerMon, u8 whichInGameTrade)
CalculateMonStats(&gEnemyParty[0]);
}
static void SetInGameTradeMail(struct Mail *mail, const struct InGameTrade *trade) {
static void SetInGameTradeMail(struct Mail *mail, const struct InGameTrade *trade)
{
s32 i;
for (i = 0; i < MAIL_WORDS_COUNT; i++)