From 83be1bfc8fc071e26d2a3f8191a9c7ecc7161dce Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 29 Nov 2021 11:19:30 -0500 Subject: [PATCH 1/8] Remove sFiller from malloc.c --- gflib/malloc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/gflib/malloc.c b/gflib/malloc.c index 38fc8939e..d0b949763 100644 --- a/gflib/malloc.c +++ b/gflib/malloc.c @@ -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 From 1a08d8fcb4bb2aaa1dd36a5f751bb31519545a4b Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 29 Nov 2021 12:56:03 -0500 Subject: [PATCH 2/8] Add BUGFIX for roamer's status --- src/roamer.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/roamer.c b/src/roamer.c index 4811ac3b2..c17ec490c 100644 --- a/src/roamer.c +++ b/src/roamer.c @@ -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); From d501636730c0aaf83754a9ed71fcdce734d336b4 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 3 Dec 2021 16:36:18 -0500 Subject: [PATCH 3/8] Fix incorrect flag animation palettes --- .gitignore | 1 + .../anim/flag/0.png | Bin 230 -> 230 bytes .../anim/flag/1.png | Bin 227 -> 227 bytes .../anim/flag/2.png | Bin 225 -> 225 bytes .../anim/flag/3.png | Bin 228 -> 228 bytes .../anim/flag/0.png | Bin 230 -> 230 bytes .../anim/flag/1.png | Bin 227 -> 227 bytes .../anim/flag/2.png | Bin 225 -> 225 bytes .../anim/flag/3.png | Bin 228 -> 228 bytes 9 files changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fd16840c6..23b01d1e0 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ porymap.project.cfg *.sna *.diff *.sym +*.js diff --git a/data/tilesets/secondary/battle_frontier_outside_east/anim/flag/0.png b/data/tilesets/secondary/battle_frontier_outside_east/anim/flag/0.png index b5621be76ec6cc1aa1ca7eeda66abbc15fce1a72..1de3fe7c3da5135672c84b9bde57a3250cacd731 100644 GIT binary patch delta 62 zcmV-E0Kxy}0p6Iarip}R(EtDc?>&3B_w2JdTkbVCcPAxPJ9=gPXZT;d_gm7McOY`fy`b)+ SUd3yQk1k12+_G(AY$pI_lOxms diff --git a/data/tilesets/secondary/battle_frontier_outside_east/anim/flag/1.png b/data/tilesets/secondary/battle_frontier_outside_east/anim/flag/1.png index 56a46ce92a8c84bc7a096e7f6338314913887323..b9f80f08dfb3f6942275adc231ec16b3fbb459bf 100644 GIT binary patch delta 62 zcmV-E0Kxy`0pkIXDKuim0Hk7C|NsBJ&E}l6-h+dSVq$wiN@^)FTL0BCoQpB;lyl8N UQpJnStaG$t#Q?IBAH$Jdh6ku1v;Y7A delta 62 zcmaFN_?U5mrip}R(EtDc?>&3B_w2JdTkbVCcPAxPJ9=gPXZT;d_gm7McOY`fy`b)+ SUd3yQk1k12+_G(AY#RV&A|uNH diff --git a/data/tilesets/secondary/battle_frontier_outside_east/anim/flag/2.png b/data/tilesets/secondary/battle_frontier_outside_east/anim/flag/2.png index e51f5b531217847abbdf0e3874d2e698e5edc278..a03c965a878e8b9f7f7064871b525e2e6b983bb8 100644 GIT binary patch delta 62 zcmV-E0Kxy^0pS6VDKuim0Hk7C|NsBJ&E}l6-h+dSVq$wiN@^)FTL0BCoQpB;lyl8N UQpJnStaG$t#Q?IBAH$Jdga)!8t^fc4 delta 62 zcmaFJ_>ggerip}R(EtDc?>&3B_w2JdTkbVCcPAxPJ9=gPXZT;d_gm7McOY`fy`b)+ SUd3yQk1k12+_G(AYzqKnEF;AL diff --git a/data/tilesets/secondary/battle_frontier_outside_east/anim/flag/3.png b/data/tilesets/secondary/battle_frontier_outside_east/anim/flag/3.png index 3ec6ff703c7eb5017e114b14d4170da2be3dadcc..5bdf19a359b3ac9777b0f30ab4317b1cea399461 100644 GIT binary patch delta 62 zcmV-E0Kxy{0ptOYDKuim0Hk7C|NsBJ&E}l6-h+dSVq$wiN@^)FTL0BCoQpB;lyl8N UQpJnStaG$t#Q?IBAH$JdhX^Aew*UYD delta 62 zcmaFD_=ItSrip}R(EtDc?>&3B_w2JdTkbVCcPAxPJ9=gPXZT;d_gm7McOY`fy`b)+ SUd3yQk1k12+_G(AY&!sDog>Zw diff --git a/data/tilesets/secondary/battle_frontier_outside_west/anim/flag/0.png b/data/tilesets/secondary/battle_frontier_outside_west/anim/flag/0.png index b5621be76ec6cc1aa1ca7eeda66abbc15fce1a72..1de3fe7c3da5135672c84b9bde57a3250cacd731 100644 GIT binary patch delta 62 zcmV-E0Kxy}0p6Iarip}R(EtDc?>&3B_w2JdTkbVCcPAxPJ9=gPXZT;d_gm7McOY`fy`b)+ SUd3yQk1k12+_G(AY$pI_lOxms diff --git a/data/tilesets/secondary/battle_frontier_outside_west/anim/flag/1.png b/data/tilesets/secondary/battle_frontier_outside_west/anim/flag/1.png index 56a46ce92a8c84bc7a096e7f6338314913887323..b9f80f08dfb3f6942275adc231ec16b3fbb459bf 100644 GIT binary patch delta 62 zcmV-E0Kxy`0pkIXDKuim0Hk7C|NsBJ&E}l6-h+dSVq$wiN@^)FTL0BCoQpB;lyl8N UQpJnStaG$t#Q?IBAH$Jdh6ku1v;Y7A delta 62 zcmaFN_?U5mrip}R(EtDc?>&3B_w2JdTkbVCcPAxPJ9=gPXZT;d_gm7McOY`fy`b)+ SUd3yQk1k12+_G(AY#RV&A|uNH diff --git a/data/tilesets/secondary/battle_frontier_outside_west/anim/flag/2.png b/data/tilesets/secondary/battle_frontier_outside_west/anim/flag/2.png index e51f5b531217847abbdf0e3874d2e698e5edc278..a03c965a878e8b9f7f7064871b525e2e6b983bb8 100644 GIT binary patch delta 62 zcmV-E0Kxy^0pS6VDKuim0Hk7C|NsBJ&E}l6-h+dSVq$wiN@^)FTL0BCoQpB;lyl8N UQpJnStaG$t#Q?IBAH$Jdga)!8t^fc4 delta 62 zcmaFJ_>ggerip}R(EtDc?>&3B_w2JdTkbVCcPAxPJ9=gPXZT;d_gm7McOY`fy`b)+ SUd3yQk1k12+_G(AYzqKnEF;AL diff --git a/data/tilesets/secondary/battle_frontier_outside_west/anim/flag/3.png b/data/tilesets/secondary/battle_frontier_outside_west/anim/flag/3.png index 3ec6ff703c7eb5017e114b14d4170da2be3dadcc..5bdf19a359b3ac9777b0f30ab4317b1cea399461 100644 GIT binary patch delta 62 zcmV-E0Kxy{0ptOYDKuim0Hk7C|NsBJ&E}l6-h+dSVq$wiN@^)FTL0BCoQpB;lyl8N UQpJnStaG$t#Q?IBAH$JdhX^Aew*UYD delta 62 zcmaFD_=ItSrip}R(EtDc?>&3B_w2JdTkbVCcPAxPJ9=gPXZT;d_gm7McOY`fy`b)+ SUd3yQk1k12+_G(AY&!sDog>Zw From cc05b08227ac23d2ef8fd0f7379a2e61492d9283 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 6 Dec 2021 11:17:42 -0500 Subject: [PATCH 4/8] Fix incorrect ever grande flower animation palettes --- .../secondary/ever_grande/anim/flowers/0.png | Bin 257 -> 257 bytes .../secondary/ever_grande/anim/flowers/1.png | Bin 257 -> 257 bytes .../secondary/ever_grande/anim/flowers/2.png | Bin 253 -> 253 bytes .../secondary/ever_grande/anim/flowers/3.png | Bin 255 -> 255 bytes .../secondary/ever_grande/anim/flowers/4.png | Bin 257 -> 257 bytes .../secondary/ever_grande/anim/flowers/5.png | Bin 257 -> 257 bytes .../secondary/ever_grande/anim/flowers/6.png | Bin 254 -> 254 bytes .../secondary/ever_grande/anim/flowers/7.png | Bin 254 -> 254 bytes 8 files changed, 0 insertions(+), 0 deletions(-) diff --git a/data/tilesets/secondary/ever_grande/anim/flowers/0.png b/data/tilesets/secondary/ever_grande/anim/flowers/0.png index 6493e2e8217eaeef04ad9798ef20816610ebe025..ae9198645128c104f9b9f68e5fddf9df59ca602a 100644 GIT binary patch delta 59 zcmV-B0L1@+0)YaMEHTCZq=Us`TBI>SVi02PYWCi0_N*Yya|r*zq+(h@IWhmml-_D$%|TM6)x~qg Rq(QWU7^G^z9Dx~;U8EK_8-xG= diff --git a/data/tilesets/secondary/ever_grande/anim/flowers/1.png b/data/tilesets/secondary/ever_grande/anim/flowers/1.png index 6493e2e8217eaeef04ad9798ef20816610ebe025..ae9198645128c104f9b9f68e5fddf9df59ca602a 100644 GIT binary patch delta 59 zcmV-B0L1@+0)YaMEHTCZq=Us`TBI>SVi02PYWCi0_N*Yya|r*zq+(h@IWhmml-_D$%|TM6)x~qg Rq(QWU7^G^z9Dx~;U8EK_8-xG= diff --git a/data/tilesets/secondary/ever_grande/anim/flowers/2.png b/data/tilesets/secondary/ever_grande/anim/flowers/2.png index 0b1f568cbf46679eaade47d93f5e60dc08494d53..05b97963705e9260be60a95dc581137ca8c04162 100644 GIT binary patch delta 59 zcmV-B0L1_O0sR4xEHTCZq=Us`TBI>SVi02PYWCi0_N*Yya|r*zq+(h@IWhmml-_D$%|TM6)x~qg Rq(QWU7^G^z9Dx~;U7$_z9CiQz diff --git a/data/tilesets/secondary/ever_grande/anim/flowers/3.png b/data/tilesets/secondary/ever_grande/anim/flowers/3.png index edc7220b8fecd4939433a784ddadb90ea7598fba..a4cea04e63e102cf71a7655c1f32f81c49356122 100644 GIT binary patch delta 59 zcmV-B0L1_Q0sjGzEHTCZq=Us`TBI>SVi02PYWCi0_N*Yya|r*zq+(h@IWhmml-_D$%|TM6)x~qg Rq(QWU7^G^z9Dx~;U7}9g9DD!( diff --git a/data/tilesets/secondary/ever_grande/anim/flowers/4.png b/data/tilesets/secondary/ever_grande/anim/flowers/4.png index 6493e2e8217eaeef04ad9798ef20816610ebe025..ae9198645128c104f9b9f68e5fddf9df59ca602a 100644 GIT binary patch delta 59 zcmV-B0L1@+0)YaMEHTCZq=Us`TBI>SVi02PYWCi0_N*Yya|r*zq+(h@IWhmml-_D$%|TM6)x~qg Rq(QWU7^G^z9Dx~;U8EK_8-xG= diff --git a/data/tilesets/secondary/ever_grande/anim/flowers/5.png b/data/tilesets/secondary/ever_grande/anim/flowers/5.png index 6493e2e8217eaeef04ad9798ef20816610ebe025..ae9198645128c104f9b9f68e5fddf9df59ca602a 100644 GIT binary patch delta 59 zcmV-B0L1@+0)YaMEHTCZq=Us`TBI>SVi02PYWCi0_N*Yya|r*zq+(h@IWhmml-_D$%|TM6)x~qg Rq(QWU7^G^z9Dx~;U8EK_8-xG= diff --git a/data/tilesets/secondary/ever_grande/anim/flowers/6.png b/data/tilesets/secondary/ever_grande/anim/flowers/6.png index 4d43dfd0a9d6c1de80dd68476f017fcc0e91ea56..c45b6188cf41fd900b40e02431713bc160ffc040 100644 GIT binary patch delta 59 zcmV-B0L1_P0saAyEHTCZq=Us`TBI>SVi02PYWCi0_N*Yya|r*zq+(h@IWhmml-_D$%|TM6)x~qg Rq(QWU7^G^z9Dx~;U7=299C-i$ diff --git a/data/tilesets/secondary/ever_grande/anim/flowers/7.png b/data/tilesets/secondary/ever_grande/anim/flowers/7.png index 4d43dfd0a9d6c1de80dd68476f017fcc0e91ea56..c45b6188cf41fd900b40e02431713bc160ffc040 100644 GIT binary patch delta 59 zcmV-B0L1_P0saAyEHTCZq=Us`TBI>SVi02PYWCi0_N*Yya|r*zq+(h@IWhmml-_D$%|TM6)x~qg Rq(QWU7^G^z9Dx~;U7=299C-i$ From 660a3df929cd83365df8e0da7e79be61b52674f5 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Tue, 14 Dec 2021 14:47:04 -0300 Subject: [PATCH 5/8] Update trade.c --- src/trade.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/trade.c b/src/trade.c index 3e9f033b5..935a89b02 100644 --- a/src/trade.c +++ b/src/trade.c @@ -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++) From 961dbee5e3a9e29caac73b090123b7da649cefec Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sat, 4 Dec 2021 10:25:37 -0500 Subject: [PATCH 6/8] Clean up tileset_anims --- src/tileset_anims.c | 234 ++++++++++++++++++++++---------------------- 1 file changed, 117 insertions(+), 117 deletions(-) diff --git a/src/tileset_anims.c b/src/tileset_anims.c index 71f8044f9..3676006a6 100644 --- a/src/tileset_anims.c +++ b/src/tileset_anims.c @@ -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); From dbca24aa82bad91f48344d8e7d394e89febc1fd9 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Fri, 17 Dec 2021 18:18:10 -0300 Subject: [PATCH 7/8] [LEAK INFORMED] Documented the unk19 item field --- include/item.h | 4 ++-- src/data/items.h | 48 ++++++++++++++++++++++++------------------------ src/item.c | 4 ++-- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/item.h b/include/item.h index ceca83bd5..c4a26655f 100644 --- a/include/item.h +++ b/include/item.h @@ -14,7 +14,7 @@ struct Item u8 holdEffectParam; const u8 *description; u8 importance; - u8 unk19; + u8 registrability; 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); diff --git a/src/data/items.h b/src/data/items.h index 20ee057da..47169d33a 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -3146,7 +3146,7 @@ const struct Item gItems[] = .price = 0, .description = sMachBikeDesc, .importance = 1, - .unk19 = 1, + .registrability = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .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 = 1, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, diff --git a/src/item.c b/src/item.c index 156034262..63287693a 100644 --- a/src/item.c +++ b/src/item.c @@ -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) From 4a74d288d4b5123e88f4da7d4d99aa42b3109d46 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sat, 18 Dec 2021 00:01:50 -0300 Subject: [PATCH 8/8] Review corrections --- include/item.h | 2 +- src/data/items.h | 48 ++++++++++++++++++++++++------------------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/item.h b/include/item.h index c4a26655f..bcd9178e5 100644 --- a/include/item.h +++ b/include/item.h @@ -14,7 +14,7 @@ struct Item u8 holdEffectParam; const u8 *description; u8 importance; - u8 registrability; + bool8 registrability; // unused u8 pocket; u8 type; ItemUseFunc fieldUseFunc; diff --git a/src/data/items.h b/src/data/items.h index 47169d33a..072ec1bf5 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -3146,7 +3146,7 @@ const struct Item gItems[] = .price = 0, .description = sMachBikeDesc, .importance = 1, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 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, - .registrability = 1, + .registrability = TRUE, .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse,