diff --git a/INSTALL.md b/INSTALL.md index f6434c07be..7f1d47879f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -451,13 +451,6 @@ Replace `` with the number that the `nproc` command returned. `nproc` is not available on macOS. The alternative is `sysctl -n hw.ncpu` ([relevant Stack Overflow thread](https://stackoverflow.com/questions/1715580)). -## Debug info - -To build **pokeemerald.elf** with enhanced debug info: -```bash -make DINFO=1 -``` - ## devkitARM's C compiler This project supports the `arm-none-eabi-gcc` compiler included with devkitARM. If devkitARM (a.k.a. gba-dev) has already been installed as part of the platform-specific instructions, simply run: @@ -534,7 +527,7 @@ devkitARM is now installed. devkitARM is now installed. -## Installing devkitARM on Arch Linux +### Installing devkitARM on Arch Linux 1. Follow [devkitPro's instructions](https://devkitpro.org/wiki/devkitPro_pacman#Customising_Existing_Pacman_Install) to configure `pacman` to download devkitPro packages. 2. Install `gba-dev`: run the following command as root. @@ -552,7 +545,7 @@ devkitARM is now installed. devkitARM is now installed. -## Other toolchains +### Other toolchains To build using a toolchain other than devkitARM, override the `TOOLCHAIN` environment variable with the path to your toolchain, which must contain the subdirectory `bin`. ```bash @@ -564,6 +557,14 @@ make TOOLCHAIN="/usr/local/arm-none-eabi" ``` To compile the `modern` target with this toolchain, the subdirectories `lib`, `include`, and `arm-none-eabi` must also be present. +### Building with debug info under a modern toolchain + +To build **pokeemerald.elf** with debug symbols under a modern toolchain: +```bash +make modern DINFO=1 +``` +Note that this is not necessary for a non-modern build since those are built with debug symbols by default. + # Useful additional tools * [porymap](https://github.com/huderlem/porymap) for viewing and editing maps diff --git a/Makefile b/Makefile index 6283a87fe3..c36cc8e936 100644 --- a/Makefile +++ b/Makefile @@ -107,7 +107,7 @@ LIBPATH := -L ../../tools/agbcc/lib LIB := $(LIBPATH) -lgcc -lc -L../../libagbsyscall -lagbsyscall else CC1 = $(shell $(PATH_MODERNCC) --print-prog-name=cc1) -quiet -override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast -g +override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast ROM := $(MODERN_ROM_NAME) OBJ_DIR := $(MODERN_OBJ_DIR_NAME) LIBPATH := -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libnosys.a))" -L "$(dir $(shell $(PATH_MODERNCC) -mthumb -print-file-name=libc.a))" diff --git a/data/scripts/gift_altering_cave.inc b/data/scripts/gift_altering_cave.inc index 65ff87068a..0ea69aac02 100644 --- a/data/scripts/gift_altering_cave.inc +++ b/data/scripts/gift_altering_cave.inc @@ -12,7 +12,7 @@ MysteryGiftScript_AlteringCave_: release end -sText_MysteryGiftAlteringCave:: +sText_MysteryGiftAlteringCave: .string "Thank you for using the MYSTERY\n" .string "GIFT System.\p" .string "There appears to be a rumor about\n" diff --git a/data/text/pokedex_rating.inc b/data/text/pokedex_rating.inc index fcb26bc7d3..175aaccc6b 100644 --- a/data/text/pokedex_rating.inc +++ b/data/text/pokedex_rating.inc @@ -3,7 +3,7 @@ gBirchDexRatingText_AreYouCurious:: .string "Are you curious about how your\n" .string "POKéDEX is coming along?$" -gBirchDexRatingText_Cancel: +gBirchDexRatingText_Cancel:: .string "Hm? Oh, you haven't caught enough\n" .string "POKéMON to make it worthwhile.$" diff --git a/graphics/door_anims/abandoned_ship.png b/graphics/door_anims/abandoned_ship.png index e46aca9ba9..0030246b4e 100644 Binary files a/graphics/door_anims/abandoned_ship.png and b/graphics/door_anims/abandoned_ship.png differ diff --git a/graphics/door_anims/abandoned_ship_room.png b/graphics/door_anims/abandoned_ship_room.png index a5284af7e1..006922f5b6 100644 Binary files a/graphics/door_anims/abandoned_ship_room.png and b/graphics/door_anims/abandoned_ship_room.png differ diff --git a/graphics/door_anims/battle_arena.png b/graphics/door_anims/battle_arena.png index ef66528156..ad3350a595 100644 Binary files a/graphics/door_anims/battle_arena.png and b/graphics/door_anims/battle_arena.png differ diff --git a/graphics/door_anims/battle_arena_lobby.png b/graphics/door_anims/battle_arena_lobby.png index b9a2134e3f..78c344070c 100644 Binary files a/graphics/door_anims/battle_arena_lobby.png and b/graphics/door_anims/battle_arena_lobby.png differ diff --git a/graphics/door_anims/battle_dome.png b/graphics/door_anims/battle_dome.png index 729385b3fc..4bc9fab94b 100644 Binary files a/graphics/door_anims/battle_dome.png and b/graphics/door_anims/battle_dome.png differ diff --git a/graphics/door_anims/battle_dome_corridor.png b/graphics/door_anims/battle_dome_corridor.png index 198ad9acca..78e77869ea 100644 Binary files a/graphics/door_anims/battle_dome_corridor.png and b/graphics/door_anims/battle_dome_corridor.png differ diff --git a/graphics/door_anims/battle_dome_lobby.png b/graphics/door_anims/battle_dome_lobby.png index bd4e4e895b..631cdecced 100644 Binary files a/graphics/door_anims/battle_dome_lobby.png and b/graphics/door_anims/battle_dome_lobby.png differ diff --git a/graphics/door_anims/battle_factory.png b/graphics/door_anims/battle_factory.png index 7ed6c876b8..1d74d8b580 100644 Binary files a/graphics/door_anims/battle_factory.png and b/graphics/door_anims/battle_factory.png differ diff --git a/graphics/door_anims/battle_frontier.png b/graphics/door_anims/battle_frontier.png index bf758c03ed..c3dcd43245 100644 Binary files a/graphics/door_anims/battle_frontier.png and b/graphics/door_anims/battle_frontier.png differ diff --git a/graphics/door_anims/battle_frontier_sliding.png b/graphics/door_anims/battle_frontier_sliding.png index a43cf519dd..1359f4725b 100644 Binary files a/graphics/door_anims/battle_frontier_sliding.png and b/graphics/door_anims/battle_frontier_sliding.png differ diff --git a/graphics/door_anims/battle_palace_lobby.png b/graphics/door_anims/battle_palace_lobby.png index f106ae960d..a4aa998d46 100644 Binary files a/graphics/door_anims/battle_palace_lobby.png and b/graphics/door_anims/battle_palace_lobby.png differ diff --git a/graphics/door_anims/battle_tent.png b/graphics/door_anims/battle_tent.png index a0a88e4c5f..b278e33109 100644 Binary files a/graphics/door_anims/battle_tent.png and b/graphics/door_anims/battle_tent.png differ diff --git a/graphics/door_anims/battle_tent_interior.png b/graphics/door_anims/battle_tent_interior.png index f8edb5a1a3..036ec9d5aa 100644 Binary files a/graphics/door_anims/battle_tent_interior.png and b/graphics/door_anims/battle_tent_interior.png differ diff --git a/graphics/door_anims/battle_tower.png b/graphics/door_anims/battle_tower.png index 3b9fe547c1..3ec2b59bb6 100644 Binary files a/graphics/door_anims/battle_tower.png and b/graphics/door_anims/battle_tower.png differ diff --git a/graphics/door_anims/battle_tower_corridor.png b/graphics/door_anims/battle_tower_corridor.png deleted file mode 100644 index 06ad24c9fc..0000000000 Binary files a/graphics/door_anims/battle_tower_corridor.png and /dev/null differ diff --git a/graphics/door_anims/battle_tower_elevator.png b/graphics/door_anims/battle_tower_elevator.png index 1d95b5b6aa..fed07182e2 100644 Binary files a/graphics/door_anims/battle_tower_elevator.png and b/graphics/door_anims/battle_tower_elevator.png differ diff --git a/graphics/door_anims/battle_tower_multi_corridor.png b/graphics/door_anims/battle_tower_multi_corridor.png index 145dea7a50..cb32fbc70b 100644 Binary files a/graphics/door_anims/battle_tower_multi_corridor.png and b/graphics/door_anims/battle_tower_multi_corridor.png differ diff --git a/graphics/door_anims/battle_tower_old.png b/graphics/door_anims/battle_tower_old.png index 645c006138..326763f565 100644 Binary files a/graphics/door_anims/battle_tower_old.png and b/graphics/door_anims/battle_tower_old.png differ diff --git a/graphics/door_anims/birchs_lab.png b/graphics/door_anims/birchs_lab.png index 69bd93f890..0df0383c92 100644 Binary files a/graphics/door_anims/birchs_lab.png and b/graphics/door_anims/birchs_lab.png differ diff --git a/graphics/door_anims/cable_club.png b/graphics/door_anims/cable_club.png index a1dfd7bc27..3b45cb1010 100644 Binary files a/graphics/door_anims/cable_club.png and b/graphics/door_anims/cable_club.png differ diff --git a/graphics/door_anims/contest.png b/graphics/door_anims/contest.png index dc466be116..8719b23ad4 100644 Binary files a/graphics/door_anims/contest.png and b/graphics/door_anims/contest.png differ diff --git a/graphics/door_anims/cycling_road.png b/graphics/door_anims/cycling_road.png index 0c22c91823..cb1fb30343 100644 Binary files a/graphics/door_anims/cycling_road.png and b/graphics/door_anims/cycling_road.png differ diff --git a/graphics/door_anims/fallarbor_light_roof.png b/graphics/door_anims/fallarbor_light_roof.png index 4c81ba10e7..a4c959f883 100644 Binary files a/graphics/door_anims/fallarbor_light_roof.png and b/graphics/door_anims/fallarbor_light_roof.png differ diff --git a/graphics/door_anims/general.png b/graphics/door_anims/general.png index fdab84132b..7c9b7d64dc 100644 Binary files a/graphics/door_anims/general.png and b/graphics/door_anims/general.png differ diff --git a/graphics/door_anims/gym.png b/graphics/door_anims/gym.png index fce0007514..065181a9d9 100644 Binary files a/graphics/door_anims/gym.png and b/graphics/door_anims/gym.png differ diff --git a/graphics/door_anims/lilycove.png b/graphics/door_anims/lilycove.png index ad5e43cc35..17a120a325 100644 Binary files a/graphics/door_anims/lilycove.png and b/graphics/door_anims/lilycove.png differ diff --git a/graphics/door_anims/lilycove_dept_store.png b/graphics/door_anims/lilycove_dept_store.png index 4f036c51db..7c64ab6da8 100644 Binary files a/graphics/door_anims/lilycove_dept_store.png and b/graphics/door_anims/lilycove_dept_store.png differ diff --git a/graphics/door_anims/lilycove_wooden.png b/graphics/door_anims/lilycove_wooden.png index 99b94e72db..7c3680c289 100644 Binary files a/graphics/door_anims/lilycove_wooden.png and b/graphics/door_anims/lilycove_wooden.png differ diff --git a/graphics/door_anims/mauville.png b/graphics/door_anims/mauville.png index 63167408ad..fec5f344fb 100644 Binary files a/graphics/door_anims/mauville.png and b/graphics/door_anims/mauville.png differ diff --git a/graphics/door_anims/mossdeep_space_center.png b/graphics/door_anims/mossdeep_space_center.png index 4f2ccb6ffd..c778b17183 100644 Binary files a/graphics/door_anims/mossdeep_space_center.png and b/graphics/door_anims/mossdeep_space_center.png differ diff --git a/graphics/door_anims/pacifidlog.png b/graphics/door_anims/pacifidlog.png index 3e05288255..841c31658d 100644 Binary files a/graphics/door_anims/pacifidlog.png and b/graphics/door_anims/pacifidlog.png differ diff --git a/graphics/door_anims/petalburg_gym.png b/graphics/door_anims/petalburg_gym.png new file mode 100644 index 0000000000..42a1e1dfde Binary files /dev/null and b/graphics/door_anims/petalburg_gym.png differ diff --git a/graphics/door_anims/poke_center.png b/graphics/door_anims/poke_center.png index 8658107149..8bf5cb146d 100644 Binary files a/graphics/door_anims/poke_center.png and b/graphics/door_anims/poke_center.png differ diff --git a/graphics/door_anims/pokemon_league.png b/graphics/door_anims/pokemon_league.png index cac740f561..34419ac0ad 100644 Binary files a/graphics/door_anims/pokemon_league.png and b/graphics/door_anims/pokemon_league.png differ diff --git a/graphics/door_anims/rustboro_gray.png b/graphics/door_anims/rustboro_gray.png index 2cf62b6dac..99211c11a9 100644 Binary files a/graphics/door_anims/rustboro_gray.png and b/graphics/door_anims/rustboro_gray.png differ diff --git a/graphics/door_anims/rustboro_tan.png b/graphics/door_anims/rustboro_tan.png index d8a1b185e7..7a0ba149c6 100644 Binary files a/graphics/door_anims/rustboro_tan.png and b/graphics/door_anims/rustboro_tan.png differ diff --git a/graphics/door_anims/safari_zone.png b/graphics/door_anims/safari_zone.png index 89807f843f..eae6a0e3e5 100644 Binary files a/graphics/door_anims/safari_zone.png and b/graphics/door_anims/safari_zone.png differ diff --git a/graphics/door_anims/sootopolis.png b/graphics/door_anims/sootopolis.png index faac1f59db..3b3833daaa 100644 Binary files a/graphics/door_anims/sootopolis.png and b/graphics/door_anims/sootopolis.png differ diff --git a/graphics/door_anims/sootopolis_peaked_roof.png b/graphics/door_anims/sootopolis_peaked_roof.png index b4ccfb5f99..7d8ea1f33e 100644 Binary files a/graphics/door_anims/sootopolis_peaked_roof.png and b/graphics/door_anims/sootopolis_peaked_roof.png differ diff --git a/graphics/door_anims/trainer_hill_lobby_elevator.png b/graphics/door_anims/trainer_hill_lobby_elevator.png index aeb7eaf260..bdd1c3b271 100644 Binary files a/graphics/door_anims/trainer_hill_lobby_elevator.png and b/graphics/door_anims/trainer_hill_lobby_elevator.png differ diff --git a/graphics/door_anims/unknown.png b/graphics/door_anims/unused_battle_frontier.png similarity index 100% rename from graphics/door_anims/unknown.png rename to graphics/door_anims/unused_battle_frontier.png diff --git a/include/constants/battle.h b/include/constants/battle.h index d87a800e2b..31bc7fa3fb 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -319,7 +319,7 @@ #define B_WIN_TYPE_NORMAL 0 #define B_WIN_TYPE_ARENA 1 -// Window Ids for gStandardBattleWindowTemplates / gBattleArenaWindowTemplates +// Window Ids for sStandardBattleWindowTemplates / sBattleArenaWindowTemplates #define B_WIN_MSG 0 #define B_WIN_ACTION_PROMPT 1 // "What will {x} do?" #define B_WIN_ACTION_MENU 2 // "Fight/Pokémon/Bag/Run" menu diff --git a/include/constants/flags.h b/include/constants/flags.h index eacb2426db..8fbc246300 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -1634,7 +1634,7 @@ #define FLAGS_COUNT (DAILY_FLAGS_END + 1) -// Special Flags (Stored in EWRAM (gSpecialFlags), not in the SaveBlock) +// Special Flags (Stored in EWRAM (sSpecialFlags), not in the SaveBlock) #define SPECIAL_FLAGS_START 0x4000 #define FLAG_HIDE_MAP_NAME_POPUP (SPECIAL_FLAGS_START + 0x0) #define FLAG_DONT_TRANSITION_MUSIC (SPECIAL_FLAGS_START + 0x1) diff --git a/include/constants/metatile_labels.h b/include/constants/metatile_labels.h index 3c484e39a2..ff10f52ee1 100644 --- a/include/constants/metatile_labels.h +++ b/include/constants/metatile_labels.h @@ -99,6 +99,7 @@ #define METATILE_PetalburgGym_SlidingDoor_Frame2 0x21A #define METATILE_PetalburgGym_SlidingDoor_Frame3 0x21B #define METATILE_PetalburgGym_SlidingDoor_Frame4 0x21C +#define METATILE_PetalburgGym_Door 0x224 // gTileset_MossdeepGym from R/S #define METATILE_RS_MossdeepGym_RedArrow_Right 0x204 @@ -128,7 +129,6 @@ // gTileset_BattleFrontier #define METATILE_BattleFrontier_Door_Elevator 0x20E -#define METATILE_BattleFrontier_Door_Corridor 0x224 #define METATILE_BattleFrontier_Door_MultiCorridor 0x2AD #define METATILE_BattleFrontier_CorridorOpenDoor_Top 0x207 #define METATILE_BattleFrontier_CorridorOpenDoor_Bottom 0x20F diff --git a/include/contest.h b/include/contest.h index c5dc232d5f..d0630a8011 100644 --- a/include/contest.h +++ b/include/contest.h @@ -324,7 +324,6 @@ extern u16 gSpecialVar_ContestRank; extern u8 gNumLinkContestPlayers; extern u8 gHighestRibbonRank; extern struct ContestResources *gContestResources; -extern u8 sContestBgCopyFlags; extern struct ContestWinner gCurContestWinner; extern u8 gCurContestWinnerIsForArtist; extern u8 gCurContestWinnerSaveIdx; diff --git a/include/global.h b/include/global.h index 89f7251767..60476b13f1 100644 --- a/include/global.h +++ b/include/global.h @@ -135,6 +135,10 @@ #define NUM_FLAG_BYTES ROUND_BITS_TO_BYTES(FLAGS_COUNT) #define NUM_ADDITIONAL_PHRASE_BYTES ROUND_BITS_TO_BYTES(NUM_ADDITIONAL_PHRASES) +// This produces an error at compile-time if expr is zero. +// It looks like file.c:line: size of array `id' is negative +#define STATIC_ASSERT(expr, id) typedef char id[(expr) ? 1 : -1]; + struct Coords8 { s8 x; diff --git a/include/pokemon.h b/include/pokemon.h index 0da71e78ee..d173387fb9 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -212,8 +212,8 @@ struct BaseStats /* 0x0A */ u16 evYield_Speed:2; /* 0x0B */ u16 evYield_SpAttack:2; /* 0x0B */ u16 evYield_SpDefense:2; - /* 0x0C */ u16 item1; - /* 0x0E */ u16 item2; + /* 0x0C */ u16 itemCommon; + /* 0x0E */ u16 itemRare; /* 0x10 */ u8 genderRatio; /* 0x11 */ u8 eggCycles; /* 0x12 */ u8 friendship; diff --git a/include/region_map.h b/include/region_map.h index 02d711afa5..85793badcb 100644 --- a/include/region_map.h +++ b/include/region_map.h @@ -99,7 +99,7 @@ u8 DoRegionMapInputCallback(void); bool8 UpdateRegionMapZoom(void); void FreeRegionMapIconResources(void); u16 GetRegionMapSecIdAt(u16 x, u16 y); -void CreateRegionMapPlayerIcon(u16 x, u16 y); +void CreateRegionMapPlayerIcon(u16 tileTag, u16 paletteTag); void CreateRegionMapCursor(u16 tileTag, u16 paletteTag); bool32 IsEventIslandMapSecId(u8 mapSecId); u8 *GetMapName(u8 *, u16, u16); diff --git a/spritesheet_rules.mk b/spritesheet_rules.mk index 9fb184638a..87293669c7 100644 --- a/spritesheet_rules.mk +++ b/spritesheet_rules.mk @@ -674,3 +674,6 @@ $(FLDEFFGFXDIR)/secret_power_tree.4bpp: %.4bpp: %.png $(FLDEFFGFXDIR)/record_mix_lights.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 4 -mheight 1 + +graphics/door_anims/battle_tower_multi_corridor.4bpp: %.4bpp: %.png + $(GFX) $< $@ -mwidth 2 -mheight 4 diff --git a/src/agb_flash_1m.c b/src/agb_flash_1m.c index e249fab9a3..6fc4f3d600 100644 --- a/src/agb_flash_1m.c +++ b/src/agb_flash_1m.c @@ -3,7 +3,7 @@ static const char AgbLibFlashVersion[] = "FLASH1M_V103"; -const struct FlashSetupInfo * const sSetupInfos[] = +static const struct FlashSetupInfo * const sSetupInfos[] = { &MX29L010, &LE26FV10N1TS, diff --git a/src/battle_anim_dragon.c b/src/battle_anim_dragon.c index 029a5c30dd..4badd53627 100644 --- a/src/battle_anim_dragon.c +++ b/src/battle_anim_dragon.c @@ -15,7 +15,7 @@ static void AnimOverheatFlame_Step(struct Sprite *); static void AnimTask_DragonDanceWaver_Step(u8); static void UpdateDragonDanceScanlineEffect(struct Task *); -EWRAM_DATA static u16 gUnusedOverheatData[7] = {0}; +EWRAM_DATA static u16 sUnusedOverheatData[7] = {0}; static const union AnimCmd sAnim_OutrageOverheatFire_0[] = { @@ -426,7 +426,7 @@ static void AnimOverheatFlame(struct Sprite *sprite) sprite->data[3] = gBattleAnimArgs[3]; sprite->callback = AnimOverheatFlame_Step; for (i = 0; i < 7; i++) - gUnusedOverheatData[i] = sprite->data[i]; + sUnusedOverheatData[i] = sprite->data[i]; } static void AnimOverheatFlame_Step(struct Sprite *sprite) diff --git a/src/battle_anim_ghost.c b/src/battle_anim_ghost.c index 16af298604..a59e549001 100644 --- a/src/battle_anim_ghost.c +++ b/src/battle_anim_ghost.c @@ -653,9 +653,9 @@ static void AnimTask_SpiteTargetShadow_Step1(u8 taskId) startLine = 0; if (position == 1) - task->data[10] = ScanlineEffect_InitWave(startLine, startLine + 64, 2, 6, 0, SCANLINE_EFFECT_REG_BG1HOFS, 1); + task->data[10] = ScanlineEffect_InitWave(startLine, startLine + 64, 2, 6, 0, SCANLINE_EFFECT_REG_BG1HOFS, TRUE); else - task->data[10] = ScanlineEffect_InitWave(startLine, startLine + 64, 2, 6, 0, SCANLINE_EFFECT_REG_BG2HOFS, 1); + task->data[10] = ScanlineEffect_InitWave(startLine, startLine + 64, 2, 6, 0, SCANLINE_EFFECT_REG_BG2HOFS, TRUE); task->data[15]++; break; diff --git a/src/battle_anim_status_effects.c b/src/battle_anim_status_effects.c index 9be3d65dc4..f56d04ccd1 100644 --- a/src/battle_anim_status_effects.c +++ b/src/battle_anim_status_effects.c @@ -248,7 +248,7 @@ static const struct SubspriteTable sFrozenIceCubeSubspriteTable[] = {ARRAY_COUNT(sFrozenIceCubeSubsprites), sFrozenIceCubeSubsprites}, }; -static const struct SpriteTemplate gFrozenIceCubeSpriteTemplate = +static const struct SpriteTemplate sFrozenIceCubeSpriteTemplate = { .tileTag = ANIM_TAG_ICE_CUBE, .paletteTag = ANIM_TAG_ICE_CUBE, @@ -389,7 +389,7 @@ void AnimTask_FrozenIceCube(u8 taskId) x -= 6; SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16)); - spriteId = CreateSprite(&gFrozenIceCubeSpriteTemplate, x, y, 4); + spriteId = CreateSprite(&sFrozenIceCubeSpriteTemplate, x, y, 4); if (GetSpriteTileStartByTag(ANIM_TAG_ICE_CUBE) == 0xFFFF) gSprites[spriteId].invisible = TRUE; SetSubspriteTables(&gSprites[spriteId], sFrozenIceCubeSubspriteTable); @@ -549,7 +549,7 @@ void LaunchStatusAnimation(u8 battlerId, u8 statusAnimId) gBattleAnimAttacker = battlerId; gBattleAnimTarget = battlerId; - LaunchBattleAnimation(gBattleAnims_StatusConditions, statusAnimId, 0); + LaunchBattleAnimation(gBattleAnims_StatusConditions, statusAnimId, FALSE); taskId = CreateTask(Task_DoStatusAnimation, 10); gTasks[taskId].data[0] = battlerId; } diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c index d33c0c184e..b5455a19c9 100644 --- a/src/battle_anim_utility_funcs.c +++ b/src/battle_anim_utility_funcs.c @@ -594,8 +594,7 @@ static void StatsChangeAnimation_Step3(u8 taskId) if (gTasks[taskId].data[6] == 1) gSprites[gTasks[taskId].data[7]].oam.priority++; - Free(sAnimStatsChangeData); - sAnimStatsChangeData = NULL; + FREE_AND_SET_NULL(sAnimStatsChangeData); DestroyAnimVisualTask(taskId); break; } diff --git a/src/battle_bg.c b/src/battle_bg.c index f739a002f6..ed32c009cb 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -159,7 +159,7 @@ const struct BgTemplate gBattleBgTemplates[] = }, }; -static const struct WindowTemplate gStandardBattleWindowTemplates[] = +static const struct WindowTemplate sStandardBattleWindowTemplates[] = { [B_WIN_MSG] = { .bg = 0, @@ -380,7 +380,7 @@ static const struct WindowTemplate gStandardBattleWindowTemplates[] = DUMMY_WIN_TEMPLATE }; -static const struct WindowTemplate gBattleArenaWindowTemplates[] = +static const struct WindowTemplate sBattleArenaWindowTemplates[] = { [B_WIN_MSG] = { .bg = 0, @@ -594,8 +594,8 @@ static const struct WindowTemplate gBattleArenaWindowTemplates[] = const struct WindowTemplate * const gBattleWindowTemplates[] = { - [B_WIN_TYPE_NORMAL] = gStandardBattleWindowTemplates, - [B_WIN_TYPE_ARENA] = gBattleArenaWindowTemplates, + [B_WIN_TYPE_NORMAL] = sStandardBattleWindowTemplates, + [B_WIN_TYPE_ARENA] = sBattleArenaWindowTemplates, }; static const struct BattleBackground sBattleTerrainTable[] = diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c index 787dc47406..88e9347594 100644 --- a/src/battle_factory_screen.c +++ b/src/battle_factory_screen.c @@ -1131,8 +1131,7 @@ static void CB2_InitSelectScreen(void) switch (gMain.state) { case 0: - if (sFactorySelectMons != NULL) - FREE_AND_SET_NULL(sFactorySelectMons); + TRY_FREE_AND_SET_NULL(sFactorySelectMons); SetHBlankCallback(NULL); SetVBlankCallback(NULL); CpuFill32(0, (void *)VRAM, VRAM_SIZE); diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index d0981324f8..d547dec0f9 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -590,7 +590,7 @@ void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId) if (species == SPECIES_CASTFORM) { paletteOffset = 0x100 + battlerId * 16; - LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[CASTFORM_NORMAL]); + LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette); LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, 0x20); } @@ -653,7 +653,7 @@ void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId) if (species == SPECIES_CASTFORM) { paletteOffset = 0x100 + battlerId * 16; - LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[CASTFORM_NORMAL]); + LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette); LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, 0x20); } @@ -973,7 +973,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 castform) if (targetSpecies == SPECIES_CASTFORM) { gSprites[gBattlerSpriteIds[battlerAtk]].anims = gMonFrontAnimsPtrTable[targetSpecies]; - LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[CASTFORM_NORMAL]); + LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette); LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerDef]], paletteOffset, 32); } diff --git a/src/battle_main.c b/src/battle_main.c index 682849af73..f61d5eaae0 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -1498,8 +1498,7 @@ static void CB2_PreInitMultiBattle(void) gBattleTypeFlags = *savedBattleTypeFlags; gMain.savedCallback = *savedCallback; SetMainCallback2(CB2_InitBattleInternal); - Free(sMultiPartnerPartyBuffer); - sMultiPartnerPartyBuffer = NULL; + FREE_AND_SET_NULL(sMultiPartnerPartyBuffer); } } else if (gReceivedRemoteLinkPlayers == 0) @@ -1507,8 +1506,7 @@ static void CB2_PreInitMultiBattle(void) gBattleTypeFlags = *savedBattleTypeFlags; gMain.savedCallback = *savedCallback; SetMainCallback2(CB2_InitBattleInternal); - Free(sMultiPartnerPartyBuffer); - sMultiPartnerPartyBuffer = NULL; + FREE_AND_SET_NULL(sMultiPartnerPartyBuffer); } break; } @@ -1544,8 +1542,7 @@ static void CB2_PreInitIngamePlayerPartnerBattle(void) gBattleTypeFlags = *savedBattleTypeFlags; gMain.savedCallback = *savedCallback; SetMainCallback2(CB2_InitBattleInternal); - Free(sMultiPartnerPartyBuffer); - sMultiPartnerPartyBuffer = NULL; + FREE_AND_SET_NULL(sMultiPartnerPartyBuffer); } break; } diff --git a/src/battle_tower.c b/src/battle_tower.c index 989412e9e6..e652038ac0 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -687,7 +687,7 @@ struct { u32 facilityClass; const u8 *const *strings; -} const sPartnerTrainerTextTables[] = +} static const sPartnerTrainerTextTables[] = { {FACILITY_CLASS_LASS, sPartnerTextsLass}, {FACILITY_CLASS_YOUNGSTER, sPartnerTextsYoungster}, @@ -769,7 +769,7 @@ struct u8 nature; u8 evs[NUM_STATS]; u16 moves[MAX_MON_MOVES]; -} const sStevenMons[MULTI_PARTY_SIZE] = +} static const sStevenMons[MULTI_PARTY_SIZE] = { { .species = SPECIES_METANG, diff --git a/src/battle_util.c b/src/battle_util.c index 6bb6d9ae4a..f34c39eb04 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1190,7 +1190,7 @@ u8 DoFieldEndTurnEffects(void) s32 j; for (j = i + 1; j < gBattlersCount; j++) { - if (GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], 0)) + if (GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], FALSE)) SwapTurnOrder(i, j); } } diff --git a/src/berry_blender.c b/src/berry_blender.c index 9e510f7b39..bdf7858cee 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -1188,9 +1188,9 @@ static void SetBerrySpriteData(struct Sprite* sprite, s16 x, s16 y, s16 bounceSp #undef sXSpeed #undef sYDownSpeed -static void CreateBerrySprite(u16 a0, u8 playerId) +static void CreateBerrySprite(u16 itemId, u8 playerId) { - u8 spriteId = CreateSpinningBerrySprite(a0 + FIRST_BERRY_INDEX - 10, 0, 80, playerId & 1); + u8 spriteId = CreateSpinningBerrySprite(ITEM_TO_BERRY(itemId) - 1, 0, 80, playerId & 1); SetBerrySpriteData(&gSprites[spriteId], sBerrySpriteData[playerId][0], sBerrySpriteData[playerId][1], diff --git a/src/berry_crush.c b/src/berry_crush.c index e7a5df951c..e6e2d87427 100755 --- a/src/berry_crush.c +++ b/src/berry_crush.c @@ -2254,7 +2254,7 @@ static u32 Cmd_PrintMessage(struct BerryCrushGame *game, u8 *args) switch (game->cmdState) { case 0: - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); if (args[1] & F_MSG_EXPAND) { StringExpandPlaceholders(gStringVar4, sMessages[args[0]]); @@ -3241,7 +3241,7 @@ static u32 Cmd_SaveGame(struct BerryCrushGame *game, u8 *args) case 2: if (!IsLinkTaskFinished()) return 0; - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized2(0, FONT_NORMAL, gText_SavingDontTurnOffPower, 0, 0, 2, 1, 3); CopyWindowToVram(0, COPYWIN_FULL); CreateTask(Task_LinkFullSave, 0); @@ -3389,7 +3389,7 @@ static u32 Cmd_StopGame(struct BerryCrushGame *game, u8 *args) switch (game->cmdState) { case 0: - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); if (game->playAgainState == PLAY_AGAIN_NO_BERRIES) AddTextPrinterParameterized2(0, FONT_NORMAL, sMessages[MSG_NO_BERRIES], game->textSpeed, 0, 2, 1, 3); else diff --git a/src/coins.c b/src/coins.c index 17fd147b74..4c4739999b 100644 --- a/src/coins.c +++ b/src/coins.c @@ -8,7 +8,7 @@ #include "international_string_util.h" #include "constants/coins.h" -EWRAM_DATA u8 sCoinsWindowId = 0; +static EWRAM_DATA u8 sCoinsWindowId = 0; void PrintCoinsString(u32 coinAmount) { diff --git a/src/contest.c b/src/contest.c index 68bb521141..da57d9e289 100644 --- a/src/contest.c +++ b/src/contest.c @@ -352,7 +352,7 @@ EWRAM_DATA u16 gSpecialVar_ContestRank = 0; EWRAM_DATA u8 gNumLinkContestPlayers = 0; EWRAM_DATA u8 gHighestRibbonRank = 0; EWRAM_DATA struct ContestResources *gContestResources = NULL; -EWRAM_DATA u8 sContestBgCopyFlags = 0; +static EWRAM_DATA u8 sContestBgCopyFlags = 0; EWRAM_DATA struct ContestWinner gCurContestWinner = {0}; EWRAM_DATA bool8 gCurContestWinnerIsForArtist = 0; EWRAM_DATA u8 gCurContestWinnerSaveIdx = 0; @@ -625,7 +625,7 @@ static const struct SpriteTemplate sSpriteTemplate_ApplauseMeter = .callback = SpriteCallbackDummy }; -const struct OamData sOam_Judge = +static const struct OamData sOam_Judge = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, @@ -639,7 +639,7 @@ const struct OamData sOam_Judge = .paletteNum = 2, }; -const struct SpriteTemplate sSpriteTemplate_Judge = +static const struct SpriteTemplate sSpriteTemplate_Judge = { .tileTag = TAG_JUDGE, .paletteTag = TAG_JUDGE, @@ -650,7 +650,7 @@ const struct SpriteTemplate sSpriteTemplate_Judge = .callback = SpriteCallbackDummy }; -const struct CompressedSpriteSheet sSpriteSheet_Judge = +static const struct CompressedSpriteSheet sSpriteSheet_Judge = { .data = gContestJudgeGfx, .size = 0x800, @@ -664,13 +664,13 @@ static const struct CompressedSpriteSheet sSpriteSheet_JudgeSymbols = .tag = TAG_JUDGE_SYMBOLS_GFX }; -const struct CompressedSpritePalette sSpritePalette_JudgeSymbols = +static const struct CompressedSpritePalette sSpritePalette_JudgeSymbols = { .data = gContestJudgeSymbolsPal, .tag = TAG_CONTEST_SYMBOLS_PAL }; -const struct SpriteTemplate sSpriteTemplate_JudgeSpeechBubble = +static const struct SpriteTemplate sSpriteTemplate_JudgeSpeechBubble = { .tileTag = TAG_JUDGE_SYMBOLS_GFX, .paletteTag = TAG_CONTEST_SYMBOLS_PAL, @@ -876,7 +876,7 @@ static const struct SpritePalette sSpritePalettes_ContestantsTurnBlinkEffect[CON } }; -const struct OamData sOam_ContestantsTurnBlinkEffect = +static const struct OamData sOam_ContestantsTurnBlinkEffect = { .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, @@ -891,13 +891,13 @@ const struct OamData sOam_ContestantsTurnBlinkEffect = .affineParam = 0, }; -const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_0[] = +static const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_0[] = { AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), AFFINEANIMCMD_END }; -const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_1[] = +static const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_1[] = { AFFINEANIMCMD_FRAME(3, 3, 0, 15), AFFINEANIMCMD_FRAME(-3, -3, 0, 15), @@ -906,13 +906,13 @@ const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_1[] = AFFINEANIMCMD_END }; -const union AffineAnimCmd *const sAffineAnims_ContestantsTurnBlinkEffect[] = +static const union AffineAnimCmd *const sAffineAnims_ContestantsTurnBlinkEffect[] = { sAffineAnim_ContestantsTurnBlinkEffect_0, sAffineAnim_ContestantsTurnBlinkEffect_1 }; -const struct SpriteTemplate sSpriteTemplates_ContestantsTurnBlinkEffect[CONTESTANT_COUNT] = +static const struct SpriteTemplate sSpriteTemplates_ContestantsTurnBlinkEffect[CONTESTANT_COUNT] = { { .tileTag = TAG_BLINK_EFFECT_CONTESTANT0, @@ -952,7 +952,7 @@ const struct SpriteTemplate sSpriteTemplates_ContestantsTurnBlinkEffect[CONTESTA } }; -static const s8 gContestExcitementTable[CONTEST_CATEGORIES_COUNT][CONTEST_CATEGORIES_COUNT] = +static const s8 sContestExcitementTable[CONTEST_CATEGORIES_COUNT][CONTEST_CATEGORIES_COUNT] = { [CONTEST_CATEGORY_COOL] = { [CONTEST_CATEGORY_COOL] = +1, @@ -4744,7 +4744,7 @@ static void UpdateApplauseMeter(void) s8 Contest_GetMoveExcitement(u16 move) { - return gContestExcitementTable[gSpecialVar_ContestCategory][gContestMoves[move].contestCategory]; + return sContestExcitementTable[gSpecialVar_ContestCategory][gContestMoves[move].contestCategory]; } static u8 StartApplauseOverflowAnimation(void) diff --git a/src/contest_util.c b/src/contest_util.c index 1ca2175265..d8726d860f 100644 --- a/src/contest_util.c +++ b/src/contest_util.c @@ -77,7 +77,10 @@ enum { #define TAG_CONFETTI 3017 #define TAG_WIRELESS_INDICATOR_WINDOW 22222 -#define MAX_BAR_LENGTH 87 +// Length of the score bar on the results screen +#define NUM_BAR_SEGMENTS 11 +#define BAR_SEGMENT_LENGTH 8 // Each segment of the results bar is a single tile, so 8 pixels long +#define MAX_BAR_LENGTH (NUM_BAR_SEGMENTS * BAR_SEGMENT_LENGTH) // Starting x/y for the sliding results screen text box #define TEXT_BOX_X (DISPLAY_WIDTH + 32) @@ -96,7 +99,7 @@ struct ContestResultsInternal u8 winnerMonSpriteId; bool8 destroyConfetti; bool8 pointsFlashing; - s16 unkC[CONTESTANT_COUNT]; + s16 barLength[CONTESTANT_COUNT]; u8 numBarsUpdating; }; @@ -1748,7 +1751,7 @@ static void CalculateContestantsResultData(void) if ((*sContestResults->monResults)[i].lostPoints) barLengthRound2 *= -1; - if (barLengthPreliminary + barLengthRound2 == MAX_BAR_LENGTH + 1) + if (barLengthPreliminary + barLengthRound2 == MAX_BAR_LENGTH) { if (barLengthRound2 > 0) (*sContestResults->monResults)[i].barLengthRound2--; @@ -1841,47 +1844,52 @@ static void Task_UpdateContestResultBar(u8 taskId) s16 target = gTasks[taskId].tTarget; s16 decreasing = gTasks[taskId].tDecreasing; + // Has the results bar reached the limit? if (decreasing) { - if (sContestResults->data->unkC[monId] <= 0) + if (sContestResults->data->barLength[monId] <= 0) minMaxReached = TRUE; } else { - if (sContestResults->data->unkC[monId] > MAX_BAR_LENGTH) + if (sContestResults->data->barLength[monId] >= MAX_BAR_LENGTH) minMaxReached = TRUE; } - if (sContestResults->data->unkC[monId] == target) + if (sContestResults->data->barLength[monId] == target) targetReached = TRUE; if (!targetReached) { + // Target length has not been reached, update bar length if (minMaxReached) - sContestResults->data->unkC[monId] = target; + sContestResults->data->barLength[monId] = target; else if (decreasing) - sContestResults->data->unkC[monId] = sContestResults->data->unkC[monId] - 1; + sContestResults->data->barLength[monId]--; else - sContestResults->data->unkC[monId] = sContestResults->data->unkC[monId] + 1; + sContestResults->data->barLength[monId]++; } + // Update the tiles of the results bar if it's still changing if (!minMaxReached && !targetReached) { - u8 var0; + u8 tileOffset; u16 tileNum; - for (i = 0; i < 11; i++) + for (i = 0; i < NUM_BAR_SEGMENTS; i++) { - if (sContestResults->data->unkC[monId] >= (i + 1) * 8) - var0 = 8; - else if (sContestResults->data->unkC[monId] >= i * 8) - var0 = sContestResults->data->unkC[monId] % 8; + if (sContestResults->data->barLength[monId] >= (i + 1) * BAR_SEGMENT_LENGTH) + tileOffset = 8; // Bar segment is full + else if (sContestResults->data->barLength[monId] >= i * BAR_SEGMENT_LENGTH) + tileOffset = sContestResults->data->barLength[monId] % 8; // Bar segment is between full and empty else - var0 = 0; + tileOffset = 0; // Bar segment is empty - if (var0 < 4) - tileNum = 0x504C + var0; + // The first 4 bar segment tiles are not adjacent in the tileset to the + // remaining bar segment tiles; choose the base tile number accordingly. + if (tileOffset < 4) + tileNum = 0x504C + tileOffset; else - tileNum = 0x5057 + var0; + tileNum = 0x5057 + tileOffset; FillBgTilemapBufferRect_Palette0(2, tileNum, i + 7, monId * 3 + 6, 1, 1); } diff --git a/src/data/field_effects/field_effect_objects.h b/src/data/field_effects/field_effect_objects.h index 598b88932e..938b6bfc55 100755 --- a/src/data/field_effects/field_effect_objects.h +++ b/src/data/field_effects/field_effect_objects.h @@ -1272,7 +1272,7 @@ static const union AnimCmd *const sAnimTable_RayquazaSpotlightEffect[] = { sAnim_RayquazaSpotlightEffect, }; -const struct SpriteFrameImage sPicTable_RayquazaSpotlightEffect[] = { +static const struct SpriteFrameImage sPicTable_RayquazaSpotlightEffect[] = { overworld_frame(gObjectEventPic_Rayquaza, 4, 4, 0), }; diff --git a/src/data/pokemon/base_stats.h b/src/data/pokemon/base_stats.h index d851dfbe1a..6b6ab12aac 100644 --- a/src/data/pokemon/base_stats.h +++ b/src/data/pokemon/base_stats.h @@ -20,8 +20,8 @@ .evYield_Speed = 2, \ .evYield_SpAttack = 2, \ .evYield_SpDefense = 2, \ - .item1 = ITEM_NONE, \ - .item2 = ITEM_NONE, \ + .itemCommon = ITEM_NONE, \ + .itemRare = ITEM_NONE, \ .genderRatio = MON_GENDERLESS, \ .eggCycles = 120, \ .friendship = 0, \ @@ -56,8 +56,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -88,8 +88,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -120,8 +120,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -152,8 +152,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -184,8 +184,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -216,8 +216,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -248,8 +248,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -280,8 +280,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -312,8 +312,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -344,8 +344,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -376,8 +376,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -408,8 +408,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_SILVER_POWDER, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SILVER_POWDER, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -440,8 +440,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -472,8 +472,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -504,8 +504,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_POISON_BARB, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_POISON_BARB, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -536,8 +536,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -568,8 +568,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -600,8 +600,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 3, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -632,8 +632,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -664,8 +664,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -696,8 +696,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -728,8 +728,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SHARP_BEAK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SHARP_BEAK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -760,8 +760,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -792,8 +792,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -824,8 +824,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_ORAN_BERRY, - .item2 = ITEM_LIGHT_BALL, + .itemCommon = ITEM_ORAN_BERRY, + .itemRare = ITEM_LIGHT_BALL, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 10, .friendship = 70, @@ -856,8 +856,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 3, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_ORAN_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_ORAN_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 10, .friendship = 70, @@ -888,8 +888,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_QUICK_CLAW, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_QUICK_CLAW, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -920,8 +920,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_QUICK_CLAW, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_QUICK_CLAW, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -952,8 +952,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_FEMALE, .eggCycles = 20, .friendship = 70, @@ -984,8 +984,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_FEMALE, .eggCycles = 20, .friendship = 70, @@ -1016,8 +1016,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_FEMALE, .eggCycles = 20, .friendship = 70, @@ -1048,8 +1048,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 20, .friendship = 70, @@ -1080,8 +1080,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 20, .friendship = 70, @@ -1112,8 +1112,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 20, .friendship = 70, @@ -1144,8 +1144,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_LEPPA_BERRY, - .item2 = ITEM_MOON_STONE, + .itemCommon = ITEM_LEPPA_BERRY, + .itemRare = ITEM_MOON_STONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 10, .friendship = 140, @@ -1176,8 +1176,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_LEPPA_BERRY, - .item2 = ITEM_MOON_STONE, + .itemCommon = ITEM_LEPPA_BERRY, + .itemRare = ITEM_MOON_STONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 10, .friendship = 140, @@ -1208,8 +1208,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_RAWST_BERRY, - .item2 = ITEM_RAWST_BERRY, + .itemCommon = ITEM_RAWST_BERRY, + .itemRare = ITEM_RAWST_BERRY, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 20, .friendship = 70, @@ -1240,8 +1240,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_RAWST_BERRY, - .item2 = ITEM_RAWST_BERRY, + .itemCommon = ITEM_RAWST_BERRY, + .itemRare = ITEM_RAWST_BERRY, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 20, .friendship = 70, @@ -1272,8 +1272,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 10, .friendship = 70, @@ -1304,8 +1304,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 10, .friendship = 70, @@ -1336,8 +1336,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -1368,8 +1368,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -1400,8 +1400,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1432,8 +1432,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1464,8 +1464,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1496,8 +1496,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_TINY_MUSHROOM, - .item2 = ITEM_BIG_MUSHROOM, + .itemCommon = ITEM_TINY_MUSHROOM, + .itemRare = ITEM_BIG_MUSHROOM, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1528,8 +1528,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_TINY_MUSHROOM, - .item2 = ITEM_BIG_MUSHROOM, + .itemCommon = ITEM_TINY_MUSHROOM, + .itemRare = ITEM_BIG_MUSHROOM, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1560,8 +1560,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1592,8 +1592,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1624,8 +1624,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1656,8 +1656,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1688,8 +1688,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1720,8 +1720,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1752,8 +1752,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1784,8 +1784,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1816,8 +1816,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1848,8 +1848,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1880,8 +1880,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_RAWST_BERRY, - .item2 = ITEM_RAWST_BERRY, + .itemCommon = ITEM_RAWST_BERRY, + .itemRare = ITEM_RAWST_BERRY, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -1912,8 +1912,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_RAWST_BERRY, - .item2 = ITEM_RAWST_BERRY, + .itemCommon = ITEM_RAWST_BERRY, + .itemRare = ITEM_RAWST_BERRY, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -1944,8 +1944,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -1976,8 +1976,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_KINGS_ROCK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_KINGS_ROCK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2008,8 +2008,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_KINGS_ROCK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_KINGS_ROCK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2040,8 +2040,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_TWISTED_SPOON, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_TWISTED_SPOON, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -2072,8 +2072,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_TWISTED_SPOON, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_TWISTED_SPOON, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -2104,8 +2104,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_TWISTED_SPOON, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_TWISTED_SPOON, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -2136,8 +2136,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -2168,8 +2168,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -2200,8 +2200,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -2232,8 +2232,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2264,8 +2264,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2296,8 +2296,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2328,8 +2328,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2360,8 +2360,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2392,8 +2392,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_EVERSTONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_EVERSTONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -2424,8 +2424,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_EVERSTONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_EVERSTONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -2456,8 +2456,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_EVERSTONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_EVERSTONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -2488,8 +2488,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2520,8 +2520,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2552,8 +2552,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_KINGS_ROCK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_KINGS_ROCK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2584,8 +2584,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_KINGS_ROCK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_KINGS_ROCK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2616,8 +2616,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_METAL_COAT, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_METAL_COAT, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -2648,8 +2648,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_METAL_COAT, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_METAL_COAT, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -2680,8 +2680,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_STICK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_STICK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2712,8 +2712,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SHARP_BEAK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SHARP_BEAK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2744,8 +2744,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SHARP_BEAK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SHARP_BEAK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2776,8 +2776,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2808,8 +2808,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2840,8 +2840,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NUGGET, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NUGGET, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2872,8 +2872,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NUGGET, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NUGGET, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2904,8 +2904,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_PEARL, - .item2 = ITEM_BIG_PEARL, + .itemCommon = ITEM_PEARL, + .itemRare = ITEM_BIG_PEARL, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2936,8 +2936,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_PEARL, - .item2 = ITEM_BIG_PEARL, + .itemCommon = ITEM_PEARL, + .itemRare = ITEM_BIG_PEARL, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -2968,8 +2968,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3000,8 +3000,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3032,8 +3032,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3064,8 +3064,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -3096,8 +3096,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3128,8 +3128,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3160,8 +3160,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3192,8 +3192,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3224,8 +3224,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -3256,8 +3256,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -3288,8 +3288,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3320,8 +3320,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3352,8 +3352,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_THICK_CLUB, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_THICK_CLUB, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3384,8 +3384,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_THICK_CLUB, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_THICK_CLUB, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3416,8 +3416,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 25, .friendship = 70, @@ -3448,8 +3448,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 25, .friendship = 70, @@ -3480,8 +3480,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3512,8 +3512,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SMOKE_BALL, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SMOKE_BALL, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3544,8 +3544,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SMOKE_BALL, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SMOKE_BALL, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3576,8 +3576,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3608,8 +3608,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3640,8 +3640,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_LUCKY_EGG, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_LUCKY_EGG, .genderRatio = MON_FEMALE, .eggCycles = 40, .friendship = 140, @@ -3672,8 +3672,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3704,8 +3704,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_FEMALE, .eggCycles = 20, .friendship = 70, @@ -3736,8 +3736,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3768,8 +3768,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3800,8 +3800,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3832,8 +3832,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -3864,8 +3864,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_STARDUST, - .item2 = ITEM_STAR_PIECE, + .itemCommon = ITEM_STARDUST, + .itemRare = ITEM_STAR_PIECE, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -3896,8 +3896,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_STARDUST, - .item2 = ITEM_STAR_PIECE, + .itemCommon = ITEM_STARDUST, + .itemRare = ITEM_STAR_PIECE, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -3928,8 +3928,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_LEPPA_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_LEPPA_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -3960,8 +3960,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -3992,8 +3992,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_ASPEAR_BERRY, - .item2 = ITEM_ASPEAR_BERRY, + .itemCommon = ITEM_ASPEAR_BERRY, + .itemRare = ITEM_ASPEAR_BERRY, .genderRatio = MON_FEMALE, .eggCycles = 25, .friendship = 70, @@ -4024,8 +4024,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 25, .friendship = 70, @@ -4056,8 +4056,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_RAWST_BERRY, - .item2 = ITEM_RAWST_BERRY, + .itemCommon = ITEM_RAWST_BERRY, + .itemRare = ITEM_RAWST_BERRY, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 25, .friendship = 70, @@ -4088,8 +4088,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -4120,8 +4120,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 20, .friendship = 70, @@ -4152,8 +4152,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 5, .friendship = 70, @@ -4184,8 +4184,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 5, .friendship = 70, @@ -4216,8 +4216,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 70, @@ -4248,8 +4248,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_METAL_POWDER, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_METAL_POWDER, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -4280,8 +4280,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 35, .friendship = 70, @@ -4312,8 +4312,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 35, .friendship = 70, @@ -4344,8 +4344,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 35, .friendship = 70, @@ -4376,8 +4376,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 35, .friendship = 70, @@ -4408,8 +4408,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -4440,8 +4440,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 30, .friendship = 70, @@ -4472,8 +4472,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 30, .friendship = 70, @@ -4504,8 +4504,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 30, .friendship = 70, @@ -4536,8 +4536,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 30, .friendship = 70, @@ -4568,8 +4568,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 35, .friendship = 70, @@ -4600,8 +4600,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_LEFTOVERS, - .item2 = ITEM_LEFTOVERS, + .itemCommon = ITEM_LEFTOVERS, + .itemRare = ITEM_LEFTOVERS, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 40, .friendship = 70, @@ -4632,8 +4632,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -4664,8 +4664,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -4696,8 +4696,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -4728,8 +4728,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -4760,8 +4760,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -4792,8 +4792,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -4824,8 +4824,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 0, @@ -4856,8 +4856,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_LUM_BERRY, - .item2 = ITEM_LUM_BERRY, + .itemCommon = ITEM_LUM_BERRY, + .itemRare = ITEM_LUM_BERRY, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 100, @@ -4888,8 +4888,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -4920,8 +4920,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -4952,8 +4952,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -4984,8 +4984,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -5016,8 +5016,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -5048,8 +5048,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -5080,8 +5080,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -5112,8 +5112,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -5144,8 +5144,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -5176,8 +5176,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_ORAN_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_ORAN_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5208,8 +5208,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_ORAN_BERRY, - .item2 = ITEM_SITRUS_BERRY, + .itemCommon = ITEM_ORAN_BERRY, + .itemRare = ITEM_SITRUS_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5240,8 +5240,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5272,8 +5272,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5304,8 +5304,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5336,8 +5336,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5368,8 +5368,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5400,8 +5400,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5432,8 +5432,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 3, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -5464,8 +5464,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_YELLOW_SHARD, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_YELLOW_SHARD, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5496,8 +5496,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_YELLOW_SHARD, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_YELLOW_SHARD, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5528,8 +5528,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_ORAN_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_ORAN_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 10, .friendship = 70, @@ -5560,8 +5560,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_LEPPA_BERRY, - .item2 = ITEM_MOON_STONE, + .itemCommon = ITEM_LEPPA_BERRY, + .itemRare = ITEM_MOON_STONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 10, .friendship = 140, @@ -5592,8 +5592,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 10, .friendship = 70, @@ -5624,8 +5624,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 10, .friendship = 70, @@ -5656,8 +5656,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 10, .friendship = 70, @@ -5688,8 +5688,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5720,8 +5720,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5752,8 +5752,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5784,8 +5784,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5816,8 +5816,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5848,8 +5848,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5880,8 +5880,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 10, .friendship = 70, @@ -5912,8 +5912,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 10, .friendship = 70, @@ -5944,8 +5944,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -5976,8 +5976,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_KINGS_ROCK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_KINGS_ROCK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6008,8 +6008,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6040,8 +6040,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6072,8 +6072,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 3, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6104,8 +6104,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6136,8 +6136,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6168,8 +6168,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6200,8 +6200,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6232,8 +6232,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6264,8 +6264,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6296,8 +6296,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 35, .friendship = 70, @@ -6328,8 +6328,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 35, .friendship = 35, @@ -6360,8 +6360,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -6392,8 +6392,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_KINGS_ROCK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_KINGS_ROCK, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6424,8 +6424,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_SPELL_TAG, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SPELL_TAG, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 35, @@ -6456,8 +6456,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 40, .friendship = 70, @@ -6488,8 +6488,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6520,8 +6520,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_PERSIM_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_PERSIM_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6552,8 +6552,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6584,8 +6584,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6616,8 +6616,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6648,8 +6648,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6680,8 +6680,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_METAL_COAT, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_METAL_COAT, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -6712,8 +6712,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 20, .friendship = 70, @@ -6744,8 +6744,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 20, .friendship = 70, @@ -6776,8 +6776,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6808,8 +6808,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -6840,8 +6840,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_ORAN_BERRY, - .item2 = ITEM_ORAN_BERRY, + .itemCommon = ITEM_ORAN_BERRY, + .itemRare = ITEM_ORAN_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6872,8 +6872,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -6904,8 +6904,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_QUICK_CLAW, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_QUICK_CLAW, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -6936,8 +6936,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -6968,8 +6968,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7000,8 +7000,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7032,8 +7032,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7064,8 +7064,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7096,8 +7096,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7128,8 +7128,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_RED_SHARD, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_RED_SHARD, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 20, .friendship = 70, @@ -7160,8 +7160,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7192,8 +7192,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7224,8 +7224,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7256,8 +7256,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -7288,8 +7288,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -7320,8 +7320,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -7352,8 +7352,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -7384,8 +7384,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7416,8 +7416,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7448,8 +7448,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7480,8 +7480,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -7512,8 +7512,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7544,8 +7544,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -7576,8 +7576,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 25, .friendship = 70, @@ -7608,8 +7608,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 25, .friendship = 70, @@ -7640,8 +7640,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_ASPEAR_BERRY, - .item2 = ITEM_ASPEAR_BERRY, + .itemCommon = ITEM_ASPEAR_BERRY, + .itemRare = ITEM_ASPEAR_BERRY, .genderRatio = MON_FEMALE, .eggCycles = 25, .friendship = 70, @@ -7672,8 +7672,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 25, .friendship = 70, @@ -7704,8 +7704,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_RAWST_BERRY, - .item2 = ITEM_RAWST_BERRY, + .itemCommon = ITEM_RAWST_BERRY, + .itemRare = ITEM_RAWST_BERRY, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 25, .friendship = 70, @@ -7736,8 +7736,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_MOOMOO_MILK, - .item2 = ITEM_MOOMOO_MILK, + .itemCommon = ITEM_MOOMOO_MILK, + .itemRare = ITEM_MOOMOO_MILK, .genderRatio = MON_FEMALE, .eggCycles = 20, .friendship = 70, @@ -7768,8 +7768,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_LUCKY_EGG, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_LUCKY_EGG, .genderRatio = MON_FEMALE, .eggCycles = 40, .friendship = 140, @@ -7800,8 +7800,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -7832,8 +7832,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -7864,8 +7864,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -7896,8 +7896,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -7928,8 +7928,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -7960,8 +7960,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -7992,8 +7992,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 0, @@ -8024,8 +8024,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_SACRED_ASH, - .item2 = ITEM_SACRED_ASH, + .itemCommon = ITEM_SACRED_ASH, + .itemRare = ITEM_SACRED_ASH, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 0, @@ -8056,8 +8056,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_LUM_BERRY, - .item2 = ITEM_LUM_BERRY, + .itemCommon = ITEM_LUM_BERRY, + .itemRare = ITEM_LUM_BERRY, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 100, @@ -8138,8 +8138,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8170,8 +8170,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8202,8 +8202,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 3, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8234,8 +8234,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8266,8 +8266,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8298,8 +8298,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8330,8 +8330,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8362,8 +8362,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8394,8 +8394,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 20, .friendship = 70, @@ -8426,8 +8426,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_PECHA_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_PECHA_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8458,8 +8458,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_PECHA_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_PECHA_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8490,8 +8490,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_ORAN_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_ORAN_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8522,8 +8522,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_ORAN_BERRY, - .item2 = ITEM_SITRUS_BERRY, + .itemCommon = ITEM_ORAN_BERRY, + .itemRare = ITEM_SITRUS_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8554,8 +8554,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8586,8 +8586,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8618,8 +8618,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SILVER_POWDER, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SILVER_POWDER, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8650,8 +8650,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8682,8 +8682,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_SILVER_POWDER, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SILVER_POWDER, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8714,8 +8714,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8746,8 +8746,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8778,8 +8778,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8810,8 +8810,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8842,8 +8842,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8874,8 +8874,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8906,8 +8906,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8938,8 +8938,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -8970,8 +8970,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 15, .friendship = 70, @@ -9002,8 +9002,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9034,8 +9034,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9066,8 +9066,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9098,8 +9098,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9130,8 +9130,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_CHESTO_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_CHESTO_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9162,8 +9162,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9194,8 +9194,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9226,8 +9226,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9258,8 +9258,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_SILVER_POWDER, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SILVER_POWDER, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9290,8 +9290,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 70, @@ -9322,8 +9322,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 70, @@ -9354,8 +9354,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_LEPPA_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_LEPPA_BERRY, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 15, .friendship = 70, @@ -9386,8 +9386,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_LEPPA_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_LEPPA_BERRY, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 15, .friendship = 70, @@ -9418,8 +9418,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_PERSIM_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_PERSIM_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9450,8 +9450,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -9482,8 +9482,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 20, .friendship = 70, @@ -9514,8 +9514,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9546,8 +9546,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9578,8 +9578,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 35, @@ -9610,8 +9610,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9642,8 +9642,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9674,8 +9674,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_HEART_SCALE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_HEART_SCALE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 20, .friendship = 70, @@ -9706,8 +9706,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9738,8 +9738,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -9770,8 +9770,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9802,8 +9802,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9834,8 +9834,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -9866,8 +9866,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -9898,8 +9898,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SOFT_SAND, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SOFT_SAND, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9930,8 +9930,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9962,8 +9962,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -9994,8 +9994,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -10026,8 +10026,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_KINGS_ROCK, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_KINGS_ROCK, .genderRatio = PERCENT_FEMALE(25), .eggCycles = 20, .friendship = 70, @@ -10058,8 +10058,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10090,8 +10090,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10122,8 +10122,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_RAWST_BERRY, - .item2 = ITEM_RAWST_BERRY, + .itemCommon = ITEM_RAWST_BERRY, + .itemRare = ITEM_RAWST_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10154,8 +10154,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_RAWST_BERRY, - .item2 = ITEM_RAWST_BERRY, + .itemCommon = ITEM_RAWST_BERRY, + .itemRare = ITEM_RAWST_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10186,8 +10186,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10218,8 +10218,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10250,8 +10250,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10282,8 +10282,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_POISON_BARB, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_POISON_BARB, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -10314,8 +10314,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_POISON_BARB, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_POISON_BARB, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -10346,8 +10346,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10378,8 +10378,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NEVER_MELT_ICE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NEVER_MELT_ICE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10410,8 +10410,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_MOON_STONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_MOON_STONE, .genderRatio = MON_GENDERLESS, .eggCycles = 25, .friendship = 70, @@ -10442,8 +10442,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SUN_STONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SUN_STONE, .genderRatio = MON_GENDERLESS, .eggCycles = 25, .friendship = 70, @@ -10474,8 +10474,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(75), .eggCycles = 10, .friendship = 70, @@ -10506,8 +10506,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10538,8 +10538,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10570,8 +10570,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10602,8 +10602,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10634,8 +10634,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10666,8 +10666,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10698,8 +10698,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10730,8 +10730,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10762,8 +10762,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10794,8 +10794,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10826,8 +10826,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_SPELL_TAG, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SPELL_TAG, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 35, @@ -10858,8 +10858,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_SPELL_TAG, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SPELL_TAG, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 35, @@ -10890,8 +10890,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_POISON_BARB, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_POISON_BARB, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -10922,8 +10922,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -10954,8 +10954,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 2, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -10986,8 +10986,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 15, .friendship = 70, @@ -11018,8 +11018,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_BIG_PEARL, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_BIG_PEARL, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11050,8 +11050,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_BIG_PEARL, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_BIG_PEARL, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11082,8 +11082,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -11114,8 +11114,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_CHESTO_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_CHESTO_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11146,8 +11146,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_CHESTO_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_CHESTO_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11178,8 +11178,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_CHESTO_BERRY, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_CHESTO_BERRY, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11210,8 +11210,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_BLUE_SHARD, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_BLUE_SHARD, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11242,8 +11242,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11274,8 +11274,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11306,8 +11306,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 35, @@ -11338,8 +11338,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SPELL_TAG, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SPELL_TAG, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 35, @@ -11370,8 +11370,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_SPELL_TAG, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_SPELL_TAG, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 35, @@ -11402,8 +11402,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11434,8 +11434,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 70, @@ -11466,8 +11466,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_GREEN_SHARD, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_GREEN_SHARD, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 40, .friendship = 70, @@ -11498,8 +11498,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_HARD_STONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_HARD_STONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 35, .friendship = 35, @@ -11530,8 +11530,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_HARD_STONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_HARD_STONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 35, .friendship = 35, @@ -11562,8 +11562,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_HARD_STONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_HARD_STONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 35, .friendship = 35, @@ -11594,8 +11594,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_MYSTIC_WATER, - .item2 = ITEM_MYSTIC_WATER, + .itemCommon = ITEM_MYSTIC_WATER, + .itemRare = ITEM_MYSTIC_WATER, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, @@ -11626,8 +11626,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 15, .friendship = 70, @@ -11658,8 +11658,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_FEMALE, .eggCycles = 15, .friendship = 70, @@ -11690,8 +11690,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 30, .friendship = 70, @@ -11722,8 +11722,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 2, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 30, .friendship = 70, @@ -11754,8 +11754,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 30, .friendship = 70, @@ -11786,8 +11786,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(12.5), .eggCycles = 30, .friendship = 70, @@ -11818,8 +11818,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -11850,8 +11850,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 2, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -11882,8 +11882,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 20, .friendship = 35, @@ -11914,8 +11914,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -11946,8 +11946,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -11978,8 +11978,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_DRAGON_SCALE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_DRAGON_SCALE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 40, .friendship = 35, @@ -12010,8 +12010,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_METAL_COAT, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_METAL_COAT, .genderRatio = MON_GENDERLESS, .eggCycles = 40, .friendship = 35, @@ -12042,8 +12042,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_METAL_COAT, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_METAL_COAT, .genderRatio = MON_GENDERLESS, .eggCycles = 40, .friendship = 35, @@ -12074,8 +12074,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_METAL_COAT, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_METAL_COAT, .genderRatio = MON_GENDERLESS, .eggCycles = 40, .friendship = 35, @@ -12106,8 +12106,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -12138,8 +12138,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -12170,8 +12170,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 80, .friendship = 35, @@ -12202,8 +12202,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 0, @@ -12234,8 +12234,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 0, @@ -12266,8 +12266,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 0, @@ -12298,8 +12298,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 3, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_FEMALE, .eggCycles = 120, .friendship = 90, @@ -12330,8 +12330,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 3, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_MALE, .eggCycles = 120, .friendship = 90, @@ -12362,8 +12362,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 0, .evYield_SpDefense = 0, - .item1 = ITEM_STAR_PIECE, - .item2 = ITEM_STAR_PIECE, + .itemCommon = ITEM_STAR_PIECE, + .itemRare = ITEM_STAR_PIECE, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 100, @@ -12394,8 +12394,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 1, .evYield_SpAttack = 1, .evYield_SpDefense = 0, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = MON_GENDERLESS, .eggCycles = 120, .friendship = 0, @@ -12426,8 +12426,8 @@ const struct BaseStats gBaseStats[] = .evYield_Speed = 0, .evYield_SpAttack = 1, .evYield_SpDefense = 1, - .item1 = ITEM_NONE, - .item2 = ITEM_NONE, + .itemCommon = ITEM_NONE, + .itemRare = ITEM_NONE, .genderRatio = PERCENT_FEMALE(50), .eggCycles = 25, .friendship = 70, diff --git a/src/data/trade.h b/src/data/trade.h index b260727636..80d17a49ba 100644 --- a/src/data/trade.h +++ b/src/data/trade.h @@ -174,10 +174,10 @@ static const struct SpriteTemplate sSpriteTemplate_MenuText = .callback = SpriteCallbackDummy, }; -static const u16 TradeScreenTextPalette[] = INCBIN_U16("graphics/trade/text.gbapal"); -static const struct SpritePalette gSpritePalette_TradeScreenText = +static const u16 sTradeScreenTextPalette[] = INCBIN_U16("graphics/trade/text.gbapal"); +static const struct SpritePalette sSpritePalette_TradeScreenText = { - .data = TradeScreenTextPalette, + .data = sTradeScreenTextPalette, .tag = PALTAG_MENU_TEXT }; diff --git a/src/data/trainer_graphics/back_pic_anims.h b/src/data/trainer_graphics/back_pic_anims.h index 821039cb3b..ed12e0cb41 100644 --- a/src/data/trainer_graphics/back_pic_anims.h +++ b/src/data/trainer_graphics/back_pic_anims.h @@ -1,4 +1,4 @@ -static const union AnimCmd gAnimCmd_Brendan_1[] = +static const union AnimCmd sAnimCmd_Brendan_1[] = { ANIMCMD_FRAME(0, 24), ANIMCMD_FRAME(1, 9), @@ -8,7 +8,7 @@ static const union AnimCmd gAnimCmd_Brendan_1[] = ANIMCMD_END, }; -static const union AnimCmd gAnimCmd_May_Steven_1[] = +static const union AnimCmd sAnimCmd_May_Steven_1[] = { ANIMCMD_FRAME(0, 24), ANIMCMD_FRAME(1, 9), @@ -18,7 +18,7 @@ static const union AnimCmd gAnimCmd_May_Steven_1[] = ANIMCMD_END, }; -static const union AnimCmd gAnimCmd_Wally_1[] = +static const union AnimCmd sAnimCmd_Wally_1[] = { ANIMCMD_FRAME(0, 24), ANIMCMD_FRAME(1, 9), @@ -28,7 +28,7 @@ static const union AnimCmd gAnimCmd_Wally_1[] = ANIMCMD_END, }; -static const union AnimCmd gAnimCmd_Red_1[] = +static const union AnimCmd sAnimCmd_Red_1[] = { ANIMCMD_FRAME(1, 20), ANIMCMD_FRAME(2, 6), @@ -38,7 +38,7 @@ static const union AnimCmd gAnimCmd_Red_1[] = ANIMCMD_END, }; -static const union AnimCmd gAnimCmd_Leaf_1[] = +static const union AnimCmd sAnimCmd_Leaf_1[] = { ANIMCMD_FRAME(1, 20), ANIMCMD_FRAME(2, 6), @@ -48,7 +48,7 @@ static const union AnimCmd gAnimCmd_Leaf_1[] = ANIMCMD_END, }; -static const union AnimCmd gAnimCmd_RubySapphireBrendan_1[] = +static const union AnimCmd sAnimCmd_RubySapphireBrendan_1[] = { ANIMCMD_FRAME(0, 24), ANIMCMD_FRAME(1, 9), @@ -58,7 +58,7 @@ static const union AnimCmd gAnimCmd_RubySapphireBrendan_1[] = ANIMCMD_END, }; -static const union AnimCmd gAnimCmd_RubySapphireMay_1[] = +static const union AnimCmd sAnimCmd_RubySapphireMay_1[] = { ANIMCMD_FRAME(0, 24), ANIMCMD_FRAME(1, 9), @@ -71,49 +71,49 @@ static const union AnimCmd gAnimCmd_RubySapphireMay_1[] = static const union AnimCmd *const sBackAnims_Brendan[] = { sAnim_GeneralFrame3, - gAnimCmd_Brendan_1, + sAnimCmd_Brendan_1, }; static const union AnimCmd *const sBackAnims_May[] = { sAnim_GeneralFrame3, - gAnimCmd_May_Steven_1, + sAnimCmd_May_Steven_1, }; static const union AnimCmd *const sBackAnims_Red[] = { sAnim_GeneralFrame0, - gAnimCmd_Red_1, + sAnimCmd_Red_1, }; static const union AnimCmd *const sBackAnims_Leaf[] = { sAnim_GeneralFrame0, - gAnimCmd_Leaf_1, + sAnimCmd_Leaf_1, }; static const union AnimCmd *const sBackAnims_RubySapphireBrendan[] = { sAnim_GeneralFrame3, - gAnimCmd_RubySapphireBrendan_1, + sAnimCmd_RubySapphireBrendan_1, }; static const union AnimCmd *const sBackAnims_RubySapphireMay[] = { sAnim_GeneralFrame3, - gAnimCmd_RubySapphireMay_1, + sAnimCmd_RubySapphireMay_1, }; static const union AnimCmd *const sBackAnims_Wally[] = { sAnim_GeneralFrame3, - gAnimCmd_Wally_1, + sAnimCmd_Wally_1, }; static const union AnimCmd *const sBackAnims_Steven[] = { sAnim_GeneralFrame3, - gAnimCmd_May_Steven_1, + sAnimCmd_May_Steven_1, }; const union AnimCmd *const *const gTrainerBackAnimsPtrTable[] = diff --git a/src/decoration.c b/src/decoration.c index 7e102251a4..547b05acf4 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -826,7 +826,7 @@ static void ReturnToActionsMenuFromCategories(u8 taskId) { RemoveDecorationWindow(WINDOW_DECORATION_CATEGORIES); AddDecorationActionsWindow(); - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); PrintCurMainMenuDescription(); gTasks[taskId].func = HandleDecorationActionsMenuInput; } @@ -2664,7 +2664,7 @@ static void FieldCB_StopPuttingAwayDecorations(void) u8 taskId; FadeInFromBlack(); - DrawDialogueFrame(0, 1); + DrawDialogueFrame(0, TRUE); InitDecorationActionsWindow(); taskId = CreateTask(Task_ReinitializeDecorationMenuHandler, 8); gTasks[taskId].tState = 0; diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index 620fe59e5e..b87fe3092b 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -4546,7 +4546,7 @@ struct { u8 id; void (*func)(void); -} const sGfxFuncs[] = +} static const sGfxFuncs[] = { {GFXFUNC_LOAD, LoadGfx}, // Element not used, LoadGfx is passed directly to SetGfxFunc {GFXFUNC_SHOW_NAMES, ShowNames}, diff --git a/src/easy_chat.c b/src/easy_chat.c index 734fd4f18b..4d6006f1c6 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -1672,8 +1672,7 @@ static bool8 InitEasyChatScreenStruct(u8 type, u16 *words, u8 displayedPersonTyp static void FreeEasyChatScreenStruct(void) { - if (sEasyChatScreen != NULL) - FREE_AND_SET_NULL(sEasyChatScreen); + TRY_FREE_AND_SET_NULL(sEasyChatScreen); } // Returns the function ID of the action to take as a result of player's input. @@ -3075,8 +3074,7 @@ static bool8 LoadEasyChatScreen(void) static void FreeEasyChatScreenControl(void) { - if (sScreenControl) - FREE_AND_SET_NULL(sScreenControl); + TRY_FREE_AND_SET_NULL(sScreenControl); } static void StartEasyChatFunction(u16 funcId) @@ -5573,8 +5571,7 @@ static bool8 InitEasyChatScreenWordData(void) static void FreeEasyChatScreenWordData(void) { - if (sWordData) - FREE_AND_SET_NULL(sWordData); + TRY_FREE_AND_SET_NULL(sWordData); } static void SetUnlockedEasyChatGroups(void) diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c index ac6e0e1e1c..cf3ca16c31 100755 --- a/src/ereader_helpers.c +++ b/src/ereader_helpers.c @@ -15,6 +15,8 @@ #include "constants/items.h" #include "constants/trainer_hill.h" +STATIC_ASSERT(sizeof(struct TrainerHillChallenge) <= SECTOR_DATA_SIZE, TrainerHillChallengeFreeSpace); + struct SendRecvMgr { bool8 isParent; diff --git a/src/event_data.c b/src/event_data.c index e2af6c3d0d..22ebdb0d1d 100644 --- a/src/event_data.c +++ b/src/event_data.c @@ -30,7 +30,7 @@ EWRAM_DATA u16 gSpecialVar_Facing = 0; EWRAM_DATA u16 gSpecialVar_MonBoxId = 0; EWRAM_DATA u16 gSpecialVar_MonBoxPos = 0; EWRAM_DATA u16 gSpecialVar_Unused_0x8014 = 0; -EWRAM_DATA static u8 gSpecialFlags[SPECIAL_FLAGS_SIZE] = {0}; +EWRAM_DATA static u8 sSpecialFlags[SPECIAL_FLAGS_SIZE] = {0}; extern u16 *const gSpecialVars[]; @@ -38,7 +38,7 @@ void InitEventData(void) { memset(gSaveBlock1Ptr->flags, 0, sizeof(gSaveBlock1Ptr->flags)); memset(gSaveBlock1Ptr->vars, 0, sizeof(gSaveBlock1Ptr->vars)); - memset(gSpecialFlags, 0, sizeof(gSpecialFlags)); + memset(sSpecialFlags, 0, sizeof(sSpecialFlags)); } void ClearTempFieldEventData(void) @@ -205,7 +205,7 @@ u8 *GetFlagPointer(u16 id) else if (id < SPECIAL_FLAGS_START) return &gSaveBlock1Ptr->flags[id / 8]; else - return &gSpecialFlags[(id - SPECIAL_FLAGS_START) / 8]; + return &sSpecialFlags[(id - SPECIAL_FLAGS_START) / 8]; } u8 FlagSet(u16 id) diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 07ce2ed08e..90e713e638 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -8251,11 +8251,11 @@ static const SpriteStepFunc *const sNpcStepFuncTables[] = { }; static const s16 sStepTimes[] = { - [MOVE_SPEED_NORMAL] = 16, - [MOVE_SPEED_FAST_1] = 8, - [MOVE_SPEED_FAST_2] = 6, - [MOVE_SPEED_FASTER] = 4, - [MOVE_SPEED_FASTEST] = 2, + [MOVE_SPEED_NORMAL] = ARRAY_COUNT(sStep1Funcs), + [MOVE_SPEED_FAST_1] = ARRAY_COUNT(sStep2Funcs), + [MOVE_SPEED_FAST_2] = ARRAY_COUNT(sStep3Funcs), + [MOVE_SPEED_FASTER] = ARRAY_COUNT(sStep4Funcs), + [MOVE_SPEED_FASTEST] = ARRAY_COUNT(sStep8Funcs), }; static bool8 NpcTakeStep(struct Sprite *sprite) diff --git a/src/evolution_scene.c b/src/evolution_scene.c index bde11ddb5e..eb458d39d4 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -816,8 +816,7 @@ static void Task_EvolutionScene(u8 taskId) DestroyTask(taskId); FreeMonSpritesGfx(); - Free(sEvoStructPtr); - sEvoStructPtr = NULL; + FREE_AND_SET_NULL(sEvoStructPtr); FreeAllWindowBuffers(); SetMainCallback2(gCB2_AfterEvolution); } @@ -1223,8 +1222,7 @@ static void Task_TradeEvolutionScene(u8 taskId) if (!IsTextPrinterActive(0)) { DestroyTask(taskId); - Free(sEvoStructPtr); - sEvoStructPtr = NULL; + FREE_AND_SET_NULL(sEvoStructPtr); gTextFlags.useAlternateDownArrow = 0; SetMainCallback2(gCB2_AfterEvolution); } diff --git a/src/field_camera.c b/src/field_camera.c index 4ccf70db9c..95c7ed9522 100644 --- a/src/field_camera.c +++ b/src/field_camera.c @@ -212,13 +212,13 @@ void CurrentMapDrawMetatileAt(int x, int y) } } -void DrawDoorMetatileAt(int x, int y, u16 *arr) +void DrawDoorMetatileAt(int x, int y, u16 *tiles) { int offset = MapPosToBgTilemapOffset(&sFieldCameraOffset, x, y); if (offset >= 0) { - DrawMetatile(METATILE_LAYER_TYPE_COVERED, arr, offset); + DrawMetatile(METATILE_LAYER_TYPE_COVERED, tiles, offset); sFieldCameraOffset.copyBGToVRAM = TRUE; } } diff --git a/src/field_door.c b/src/field_door.c index 988ea615d0..756d0dabf1 100644 --- a/src/field_door.c +++ b/src/field_door.c @@ -18,7 +18,7 @@ struct DoorGraphics u8 sound; u8 size; const void *tiles; - const void *palette; + const void *palettes; }; struct DoorAnimFrame @@ -74,7 +74,7 @@ static const u8 sDoorAnimTiles_PokemonLeague[] = INCBIN_U8("graphics/door_anims/ static const u16 sDoorNullPalette20[16] = {}; static const u8 sDoorAnimTiles_Pacifidlog[] = INCBIN_U8("graphics/door_anims/pacifidlog.4bpp"); static const u16 sDoorNullPalette21[16] = {}; -static const u8 sDoorAnimTiles_BattleTowerCorridor[] = INCBIN_U8("graphics/door_anims/battle_tower_corridor.4bpp"); +static const u8 sDoorAnimTiles_PetalburgGym[] = INCBIN_U8("graphics/door_anims/petalburg_gym.4bpp"); static const u16 sDoorNullPalette22[16] = {}; static const u8 sDoorAnimTiles_CyclingRoad[] = INCBIN_U8("graphics/door_anims/cycling_road.4bpp"); static const u16 sDoorNullPalette23[16] = {}; @@ -98,7 +98,7 @@ static const u8 sDoorAnimTiles_BattleTowerOld[] = INCBIN_U8("graphics/door_anims static const u16 sDoorNullPalette32[16] = {}; static const u8 sDoorAnimTiles_BattleTowerElevator[] = INCBIN_U8("graphics/door_anims/battle_tower_elevator.4bpp"); static const u16 sDoorNullPalette33[16] = {}; -static const u8 sDoorAnimTiles_34[] = INCBIN_U8("graphics/door_anims/unknown.4bpp"); +static const u8 sDoorAnimTiles_UnusedBattleFrontier[] = INCBIN_U8("graphics/door_anims/unused_battle_frontier.4bpp"); static const u16 sDoorNullPalette34[16] = {}; static const u8 sDoorAnimTiles_BattleDome[] = INCBIN_U8("graphics/door_anims/battle_dome.4bpp"); static const u16 sDoorNullPalette35[16] = {}; @@ -190,7 +190,7 @@ static const u8 sDoorAnimPalettes_Mauville[] = {7, 7, 7, 7, 7, 7, 7, 7}; static const u8 sDoorAnimPalettes_Verdanturf[] = {6, 6, 5, 5, 5, 5, 5, 5}; static const u8 sDoorAnimPalettes_LilycoveWooden[] = {5, 5, 5, 5, 5, 5, 5, 5}; static const u8 sDoorAnimPalettes_Contest[] = {1, 1, 1, 1, 1, 1, 1, 1}; -static const u8 sDoorAnimPalettes_BattleTowerCorridor[] = {6, 6, 6, 6, 6, 6, 6, 6}; +static const u8 sDoorAnimPalettes_PetalburgGym[] = {6, 6, 6, 6, 6, 6, 6, 6}; static const u8 sDoorAnimPalettes_CyclingRoad[] = {7, 7, 7, 7, 7, 7, 7, 7}; static const u8 sDoorAnimPalettes_LilycoveDeptStore[] = {5, 5, 5, 5, 5, 5, 5, 5}; static const u8 sDoorAnimPalettes_SafariZone[] = {9, 9, 9, 9, 9, 9, 9, 9}; @@ -202,7 +202,7 @@ static const u8 sDoorAnimPalettes_AbandonedShipRoom[] = {7, 7, 7, 7, 7, 7, 7, 7} static const u8 sDoorAnimPalettes_LilycoveDeptStoreElevator[] = {6, 6, 7, 7, 7, 7, 7, 7}; static const u8 sDoorAnimPalettes_BattleTowerOld[] = {9, 9, 9, 9, 9, 9, 9, 9}; static const u8 sDoorAnimPalettes_BattleTowerElevator[] = {7, 7, 7, 7, 7, 7, 7, 7}; -static const u8 sDoorAnimPalettes_34[] = {9, 9, 9, 9, 9, 9, 9, 9}; +static const u8 sDoorAnimPalettes_UnusedBattleFrontier[] = {9, 9, 9, 9, 9, 9, 9, 9}; static const u8 sDoorAnimPalettes_BattleDome[] = {1, 1, 1, 1, 1, 1, 1, 1}; static const u8 sDoorAnimPalettes_BattleFactory[] = {9, 9, 9, 9, 9, 9, 9, 9}; static const u8 sDoorAnimPalettes_BattleTower[] = {0, 0, 0, 0, 0, 0, 0, 0}; @@ -244,7 +244,7 @@ static const struct DoorGraphics sDoorAnimGraphicsTable[] = {METATILE_Sootopolis_Door, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_Sootopolis, sDoorAnimPalettes_Sootopolis}, {METATILE_EverGrande_Door_PokemonLeague, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_PokemonLeague, sDoorAnimPalettes_PokemonLeague}, {METATILE_Pacifidlog_Door, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_Pacifidlog, sDoorAnimPalettes_Pacifidlog}, - {METATILE_BattleFrontier_Door_Corridor, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_BattleTowerCorridor, sDoorAnimPalettes_BattleTowerCorridor}, + {METATILE_PetalburgGym_Door, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_PetalburgGym, sDoorAnimPalettes_PetalburgGym}, {METATILE_Mauville_Door_CyclingRoad, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_CyclingRoad, sDoorAnimPalettes_CyclingRoad}, {METATILE_Lilycove_Door_DeptStore, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_LilycoveDeptStore, sDoorAnimPalettes_LilycoveDeptStore}, {METATILE_Lilycove_Door_SafariZone, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_SafariZone, sDoorAnimPalettes_SafariZone}, @@ -256,7 +256,9 @@ static const struct DoorGraphics sDoorAnimGraphicsTable[] = {METATILE_Shop_Door_Elevator, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_LilycoveDeptStoreElevator, sDoorAnimPalettes_LilycoveDeptStoreElevator}, {METATILE_Dewford_Door_BattleTower, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleTowerOld, sDoorAnimPalettes_BattleTowerOld}, {METATILE_BattleFrontier_Door_Elevator, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleTowerElevator, sDoorAnimPalettes_BattleTowerElevator}, - {0x3B0, /* TODO: Missing metatile ID */ DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_34, sDoorAnimPalettes_34}, + // The metatile for this door doesn't seem to correspond to a door in any Emerald tileset. Given the surrounding door animations, it was likely cut from the Battle Frontier. + // From the palettes array we know it uses palette 9, and the door's shadow looks correct using either the Battle Tent or Battle Frontier Outside's 9th palette. + {0x3B0, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_UnusedBattleFrontier, sDoorAnimPalettes_UnusedBattleFrontier}, {METATILE_BattleFrontierOutsideWest_Door_BattleDome, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleDome, sDoorAnimPalettes_BattleDome}, {METATILE_BattleFrontierOutsideWest_Door_BattleFactory, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleFactory, sDoorAnimPalettes_BattleFactory}, {METATILE_BattleFrontierOutsideEast_Door_BattleTower, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleTower, sDoorAnimPalettes_BattleTower}, @@ -278,52 +280,71 @@ static const struct DoorGraphics sDoorAnimGraphicsTable[] = {}, }; +// NOTE: The tiles of a door's animation must be copied to VRAM because they are not already part of any given tileset. +// This means that if there are any pre-existing tiles in this copied region that are visible when the door +// animation is played they will be overwritten. +#define DOOR_TILE_START_SIZE1 (NUM_TILES_TOTAL - 8) +#define DOOR_TILE_START_SIZE2 (NUM_TILES_TOTAL - 16) + static void CopyDoorTilesToVram(const struct DoorGraphics *gfx, const struct DoorAnimFrame *frame) { if (gfx->size == 2) - CpuFastSet(gfx->tiles + frame->offset, (void *)(VRAM + 0x7E00), 0x80); + CpuFastCopy(gfx->tiles + frame->offset, (void *)(VRAM + TILE_OFFSET_4BPP(DOOR_TILE_START_SIZE2)), 16 * TILE_SIZE_4BPP); else - CpuFastSet(gfx->tiles + frame->offset, (void *)(VRAM + 0x7F00), 0x40); + CpuFastCopy(gfx->tiles + frame->offset, (void *)(VRAM + TILE_OFFSET_4BPP(DOOR_TILE_START_SIZE1)), 8 * TILE_SIZE_4BPP); } -static void door_build_blockdef(u16 *a, u16 b, const u8 *c) +static void BuildDoorTiles(u16 *tiles, u16 tileNum, const u8 *paletteNums) { int i; - u16 unk; + u16 tile; + // Only the first 4 tiles of each metatile (bottom layer) actually use the door tiles for (i = 0; i < 4; i++) { - unk = *(c++) << 12; - a[i] = unk | (b + i); + tile = *(paletteNums++) << 12; + tiles[i] = tile | (tileNum + i); } + + // The remaining layers are left as tile 0 (with the same palette) for (; i < 8; i++) { - unk = *(c++) << 12; - a[i] = unk; + tile = *(paletteNums++) << 12; + tiles[i] = tile; } } -static void DrawCurrentDoorAnimFrame(const struct DoorGraphics *gfx, u32 x, u32 y, const u8 *pal) +static void DrawCurrentDoorAnimFrame(const struct DoorGraphics *gfx, u32 x, u32 y, const u8 *paletteNums) { - u16 arr[24]; + u16 tiles[24]; if (gfx->size == 2) { - door_build_blockdef(&arr[8], 0x3F0, pal); - DrawDoorMetatileAt(x, y - 1, &arr[8]); - door_build_blockdef(&arr[8], 0x3F4, pal + 4); - DrawDoorMetatileAt(x, y, &arr[8]); - door_build_blockdef(&arr[8], 0x3F8, pal); - DrawDoorMetatileAt(x + 1, y - 1, &arr[8]); - door_build_blockdef(&arr[8], 0x3FC, pal + 4); - DrawDoorMetatileAt(x + 1, y, &arr[8]); + // Top left metatile + BuildDoorTiles(&tiles[8], DOOR_TILE_START_SIZE2 + 0, &paletteNums[0]); + DrawDoorMetatileAt(x, y - 1, &tiles[8]); + + // Bottom left metatile + BuildDoorTiles(&tiles[8], DOOR_TILE_START_SIZE2 + 4, &paletteNums[4]); + DrawDoorMetatileAt(x, y, &tiles[8]); + + // Top right metatile + BuildDoorTiles(&tiles[8], DOOR_TILE_START_SIZE2 + 8, &paletteNums[0]); + DrawDoorMetatileAt(x + 1, y - 1, &tiles[8]); + + // Bottom right metatile + BuildDoorTiles(&tiles[8], DOOR_TILE_START_SIZE2 + 12, &paletteNums[4]); + DrawDoorMetatileAt(x + 1, y, &tiles[8]); } else { - door_build_blockdef(&arr[0], 0x3F8, pal); - DrawDoorMetatileAt(x, y - 1, &arr[0]); - door_build_blockdef(&arr[0], 0x3FC, pal + 4); - DrawDoorMetatileAt(x, y, &arr[0]); + // Top metatile + BuildDoorTiles(&tiles[0], DOOR_TILE_START_SIZE1 + 0, &paletteNums[0]); + DrawDoorMetatileAt(x, y - 1, &tiles[0]); + + // Bottom metatile + BuildDoorTiles(&tiles[0], DOOR_TILE_START_SIZE1 + 4, &paletteNums[4]); + DrawDoorMetatileAt(x, y, &tiles[0]); } } @@ -350,9 +371,9 @@ static void DrawDoor(const struct DoorGraphics *gfx, const struct DoorAnimFrame else { CopyDoorTilesToVram(gfx, frame); - DrawCurrentDoorAnimFrame(gfx, x, y, gfx->palette); + DrawCurrentDoorAnimFrame(gfx, x, y, gfx->palettes); if (ShouldUseMultiCorridorDoor()) - DrawCurrentDoorAnimFrame(gfx, gSpecialVar_0x8004 + MAP_OFFSET, gSpecialVar_0x8005 + MAP_OFFSET, gfx->palette); + DrawCurrentDoorAnimFrame(gfx, gSpecialVar_0x8004 + MAP_OFFSET, gSpecialVar_0x8005 + MAP_OFFSET, gfx->palettes); } } diff --git a/src/field_effect.c b/src/field_effect.c index f57ce8cddc..369239f6b6 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -481,13 +481,13 @@ static const struct Subsprite sSubsprites_HofMonitorBig[] = static const struct SubspriteTable sSubspriteTable_HofMonitorBig = subsprite_table(sSubsprites_HofMonitorBig); -const union AnimCmd sAnim_Static[] = +static const union AnimCmd sAnim_Static[] = { ANIMCMD_FRAME(.imageValue = 0, .duration = 1), ANIMCMD_JUMP(0) }; -const union AnimCmd sAnim_Flicker[] = +static const union AnimCmd sAnim_Flicker[] = { ANIMCMD_FRAME(.imageValue = 0, .duration = 16), ANIMCMD_FRAME(.imageValue = 1, .duration = 16), @@ -501,7 +501,7 @@ const union AnimCmd sAnim_Flicker[] = }; // Flicker on and off, for the Pokéballs / monitors during the PokéCenter heal effect -const union AnimCmd *const sAnims_Flicker[] = +static const union AnimCmd *const sAnims_Flicker[] = { sAnim_Static, sAnim_Flicker @@ -556,7 +556,7 @@ static const struct SpriteTemplate sSpriteTemplate_HofMonitorSmall = .callback = SpriteCB_HallOfFameMonitor }; -void (*const sPokecenterHealEffectFuncs[])(struct Task *) = +static void (*const sPokecenterHealEffectFuncs[])(struct Task *) = { PokecenterHealEffect_Init, PokecenterHealEffect_WaitForBallPlacement, @@ -564,7 +564,7 @@ void (*const sPokecenterHealEffectFuncs[])(struct Task *) = PokecenterHealEffect_WaitForSoundAndEnd }; -void (*const sHallOfFameRecordEffectFuncs[])(struct Task *) = +static void (*const sHallOfFameRecordEffectFuncs[])(struct Task *) = { HallOfFameRecordEffect_Init, HallOfFameRecordEffect_WaitForBallPlacement, @@ -572,7 +572,7 @@ void (*const sHallOfFameRecordEffectFuncs[])(struct Task *) = HallOfFameRecordEffect_WaitForSoundAndEnd }; -void (*const sPokeballGlowEffectFuncs[])(struct Sprite *) = +static void (*const sPokeballGlowEffectFuncs[])(struct Sprite *) = { PokeballGlowEffect_PlaceBalls, PokeballGlowEffect_TryPlaySe, @@ -598,7 +598,7 @@ static const u8 sPokeballGlowReds[] = {16, 12, 8, 0}; static const u8 sPokeballGlowGreens[] = {16, 12, 8, 0}; static const u8 sPokeballGlowBlues[] = { 0, 0, 0, 0}; -bool8 (*const sFallWarpFieldEffectFuncs[])(struct Task *) = +static bool8 (*const sFallWarpFieldEffectFuncs[])(struct Task *) = { FallWarpEffect_Init, FallWarpEffect_WaitWeather, @@ -609,7 +609,7 @@ bool8 (*const sFallWarpFieldEffectFuncs[])(struct Task *) = FallWarpEffect_End, }; -bool8 (*const sEscalatorWarpOutFieldEffectFuncs[])(struct Task *) = +static bool8 (*const sEscalatorWarpOutFieldEffectFuncs[])(struct Task *) = { EscalatorWarpOut_Init, EscalatorWarpOut_WaitForPlayer, @@ -619,7 +619,7 @@ bool8 (*const sEscalatorWarpOutFieldEffectFuncs[])(struct Task *) = EscalatorWarpOut_Down_End, }; -bool8 (*const sEscalatorWarpInFieldEffectFuncs[])(struct Task *) = +static bool8 (*const sEscalatorWarpInFieldEffectFuncs[])(struct Task *) = { EscalatorWarpIn_Init, EscalatorWarpIn_Down_Init, @@ -630,7 +630,7 @@ bool8 (*const sEscalatorWarpInFieldEffectFuncs[])(struct Task *) = EscalatorWarpIn_End, }; -bool8 (*const sWaterfallFieldEffectFuncs[])(struct Task *, struct ObjectEvent *) = +static bool8 (*const sWaterfallFieldEffectFuncs[])(struct Task *, struct ObjectEvent *) = { WaterfallFieldEffect_Init, WaterfallFieldEffect_ShowMon, @@ -639,14 +639,14 @@ bool8 (*const sWaterfallFieldEffectFuncs[])(struct Task *, struct ObjectEvent *) WaterfallFieldEffect_ContinueRideOrEnd, }; -bool8 (*const sDiveFieldEffectFuncs[])(struct Task *) = +static bool8 (*const sDiveFieldEffectFuncs[])(struct Task *) = { DiveFieldEffect_Init, DiveFieldEffect_ShowMon, DiveFieldEffect_TryWarp, }; -bool8 (*const sLavaridgeGymB1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = +static bool8 (*const sLavaridgeGymB1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = { LavaridgeGymB1FWarpEffect_Init, LavaridgeGymB1FWarpEffect_CameraShake, @@ -656,7 +656,7 @@ bool8 (*const sLavaridgeGymB1FWarpEffectFuncs[])(struct Task *, struct ObjectEve LavaridgeGymB1FWarpEffect_Warp, }; -bool8 (*const sLavaridgeGymB1FWarpExitEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = +static bool8 (*const sLavaridgeGymB1FWarpExitEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = { LavaridgeGymB1FWarpExitEffect_Init, LavaridgeGymB1FWarpExitEffect_StartPopOut, @@ -664,7 +664,7 @@ bool8 (*const sLavaridgeGymB1FWarpExitEffectFuncs[])(struct Task *, struct Objec LavaridgeGymB1FWarpExitEffect_End, }; -bool8 (*const sLavaridgeGym1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = +static bool8 (*const sLavaridgeGym1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) = { LavaridgeGym1FWarpEffect_Init, LavaridgeGym1FWarpEffect_AshPuff, @@ -673,7 +673,7 @@ bool8 (*const sLavaridgeGym1FWarpEffectFuncs[])(struct Task *, struct ObjectEven LavaridgeGym1FWarpEffect_Warp, }; -void (*const sEscapeRopeWarpOutEffectFuncs[])(struct Task *) = +static void (*const sEscapeRopeWarpOutEffectFuncs[])(struct Task *) = { EscapeRopeWarpOutEffect_Init, EscapeRopeWarpOutEffect_Spin, @@ -2277,7 +2277,7 @@ static void EscapeRopeWarpOutEffect_Spin(struct Task *task) } } -void (*const sEscapeRopeWarpInEffectFuncs[])(struct Task *) = { +static void (*const sEscapeRopeWarpInEffectFuncs[])(struct Task *) = { EscapeRopeWarpInEffect_Init, EscapeRopeWarpInEffect_Spin }; @@ -2448,7 +2448,7 @@ static void FieldCallback_TeleportWarpIn(void) CreateTask(Task_TeleportWarpIn, 0); } -void (*const sTeleportWarpInFieldEffectFuncs[])(struct Task *) = { +static void (*const sTeleportWarpInFieldEffectFuncs[])(struct Task *) = { TeleportWarpInFieldEffect_Init, TeleportWarpInFieldEffect_SpinEnter, TeleportWarpInFieldEffect_SpinGround @@ -2582,7 +2582,7 @@ bool8 FldEff_FieldMoveShowMonInit(void) return FALSE; } -void (*const sFieldMoveShowMonOutdoorsEffectFuncs[])(struct Task *) = { +static void (*const sFieldMoveShowMonOutdoorsEffectFuncs[])(struct Task *) = { FieldMoveShowMonOutdoorsEffect_Init, FieldMoveShowMonOutdoorsEffect_LoadGfx, FieldMoveShowMonOutdoorsEffect_CreateBanner, @@ -2750,7 +2750,7 @@ static void LoadFieldMoveOutdoorStreaksTilemap(u16 offs) #define tBgOffset data[4] #define tMonSpriteId data[15] -void (*const sFieldMoveShowMonIndoorsEffectFuncs[])(struct Task *) = { +static void (*const sFieldMoveShowMonIndoorsEffectFuncs[])(struct Task *) = { FieldMoveShowMonIndoorsEffect_Init, FieldMoveShowMonIndoorsEffect_LoadGfx, FieldMoveShowMonIndoorsEffect_SlideBannerOn, @@ -2978,7 +2978,7 @@ u8 FldEff_UseSurf(void) return FALSE; } -void (*const sSurfFieldEffectFuncs[])(struct Task *) = { +static void (*const sSurfFieldEffectFuncs[])(struct Task *) = { SurfFieldEffect_Init, SurfFieldEffect_FieldMovePose, SurfFieldEffect_ShowMon, @@ -3154,7 +3154,7 @@ u8 FldEff_UseFly(void) return 0; } -void (*const sFlyOutFieldEffectFuncs[])(struct Task *) = { +static void (*const sFlyOutFieldEffectFuncs[])(struct Task *) = { FlyOutFieldEffect_FieldMovePose, FlyOutFieldEffect_ShowMon, FlyOutFieldEffect_BirdLeaveBall, @@ -3444,7 +3444,7 @@ u8 FldEff_FlyIn(void) return 0; } -void (*const sFlyInFieldEffectFuncs[])(struct Task *) = { +static void (*const sFlyInFieldEffectFuncs[])(struct Task *) = { FlyInFieldEffect_BirdSwoopDown, FlyInFieldEffect_FlyInWithBird, FlyInFieldEffect_JumpOffBird, @@ -3675,7 +3675,7 @@ static void StartEndingDeoxysRockCameraShake(u8 taskId) #undef tEndDelay #undef tEnding -void (*const sDestroyDeoxysRockEffectFuncs[])(s16*, u8) = { +static void (*const sDestroyDeoxysRockEffectFuncs[])(s16*, u8) = { DestroyDeoxysRockEffect_CameraShake, DestroyDeoxysRockEffect_RockFragments, DestroyDeoxysRockEffect_WaitAndEnd, diff --git a/src/field_message_box.c b/src/field_message_box.c index 74afb56776..95d0a94c96 100755 --- a/src/field_message_box.c +++ b/src/field_message_box.c @@ -33,7 +33,7 @@ static void Task_DrawFieldMessage(u8 taskId) task->tState++; break; case 1: - DrawDialogueFrame(0, 1); + DrawDialogueFrame(0, TRUE); task->tState++; break; case 2: diff --git a/src/field_region_map.c b/src/field_region_map.c index 26ae736a68..adf5e4ed7a 100644 --- a/src/field_region_map.c +++ b/src/field_region_map.c @@ -192,10 +192,7 @@ static void FieldUpdateRegionMap(void) { FreeRegionMapIconResources(); SetMainCallback2(sFieldRegionMapHandler->callback); - if (sFieldRegionMapHandler != NULL) - { - FREE_AND_SET_NULL(sFieldRegionMapHandler); - } + TRY_FREE_AND_SET_NULL(sFieldRegionMapHandler); FreeAllWindowBuffers(); } break; diff --git a/src/field_screen_effect.c b/src/field_screen_effect.c index eda1467258..77978c2690 100644 --- a/src/field_screen_effect.c +++ b/src/field_screen_effect.c @@ -53,7 +53,7 @@ static void Task_EnableScriptAfterMusicFade(u8 taskId); static const u16 sFlashLevelToRadius[] = { 200, 72, 64, 56, 48, 40, 32, 24, 0 }; const s32 gMaxFlashLevel = ARRAY_COUNT(sFlashLevelToRadius) - 1; -const struct ScanlineEffectParams sFlashEffectParams = +static const struct ScanlineEffectParams sFlashEffectParams = { ®_WIN0H, ((DMA_ENABLE | DMA_START_HBLANK | DMA_REPEAT | DMA_DEST_RELOAD) << 16) | 1, diff --git a/src/field_special_scene.c b/src/field_special_scene.c index 31e75613e4..7493467288 100644 --- a/src/field_special_scene.c +++ b/src/field_special_scene.c @@ -170,7 +170,7 @@ static void Task_Truck3(u8 taskId) { cameraXpan = sTruckCamera_HorizontalTable[tMoveStep]; cameraYpan = 0; - SetCameraPanning(cameraXpan, 0); + SetCameraPanning(cameraXpan, cameraYpan); SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX1_X_OFFSET - cameraXpan, BOX1_Y_OFFSET + cameraYpan); SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX2_X_OFFSET - cameraXpan, BOX2_Y_OFFSET + cameraYpan); SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX3_X_OFFSET - cameraXpan, BOX3_Y_OFFSET + cameraYpan); diff --git a/src/field_weather.c b/src/field_weather.c index a9d007e168..f7a7f81291 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -72,7 +72,7 @@ static const u8 *sPaletteGammaTypes; // The drought weather effect uses a precalculated color lookup table. Presumably this // is because the underlying color shift calculation is slow. -const u16 sDroughtWeatherColors[][0x1000] = { +static const u16 sDroughtWeatherColors[][0x1000] = { INCBIN_U16("graphics/weather/drought/colors_0.bin"), INCBIN_U16("graphics/weather/drought/colors_1.bin"), INCBIN_U16("graphics/weather/drought/colors_2.bin"), diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index c10867062f..8349de559f 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -14,8 +14,8 @@ #include "trig.h" #include "gpu_regs.h" -EWRAM_DATA static u8 gCurrentAbnormalWeather = 0; -EWRAM_DATA static u16 gUnusedWeatherRelated = 0; +EWRAM_DATA static u8 sCurrentAbnormalWeather = 0; +EWRAM_DATA static u16 sUnusedWeatherRelated = 0; const u16 gCloudsWeatherPalette[] = INCBIN_U16("graphics/weather/cloud.gbapal"); const u16 gSandstormWeatherPalette[] = INCBIN_U16("graphics/weather/sandstorm.gbapal"); @@ -1813,7 +1813,7 @@ static void UpdateFogDiagonalMovement(void) gWeatherPtr->fogDPosY = gSpriteCoordOffsetY + gWeatherPtr->fogDYOffset; } -static const struct SpriteSheet gFogDiagonalSpriteSheet = +static const struct SpriteSheet sFogDiagonalSpriteSheet = { .data = gWeatherFogDiagonalTiles, .size = sizeof(gWeatherFogDiagonalTiles), @@ -1868,7 +1868,7 @@ static void CreateFogDiagonalSprites(void) if (!gWeatherPtr->fogDSpritesCreated) { - fogDiagonalSpriteSheet = gFogDiagonalSpriteSheet; + fogDiagonalSpriteSheet = sFogDiagonalSpriteSheet; LoadSpriteSheet(&fogDiagonalSpriteSheet); for (i = 0; i < NUM_FOG_DIAGONAL_SPRITES; i++) { @@ -2427,8 +2427,8 @@ static void UpdateBubbleSprite(struct Sprite *sprite) // Unused function. static void UnusedSetCurrentAbnormalWeather(u32 weather, u32 unknown) { - gCurrentAbnormalWeather = weather; - gUnusedWeatherRelated = unknown; + sCurrentAbnormalWeather = weather; + sUnusedWeatherRelated = unknown; } #define tState data[0] @@ -2446,7 +2446,7 @@ static void Task_DoAbnormalWeather(u8 taskId) if (tDelay-- <= 0) { SetNextWeather(tWeatherA); - gCurrentAbnormalWeather = tWeatherA; + sCurrentAbnormalWeather = tWeatherA; tDelay = 600; tState++; } @@ -2455,7 +2455,7 @@ static void Task_DoAbnormalWeather(u8 taskId) if (tDelay-- <= 0) { SetNextWeather(tWeatherB); - gCurrentAbnormalWeather = tWeatherB; + sCurrentAbnormalWeather = tWeatherB; tDelay = 600; tState = 0; } @@ -2469,13 +2469,13 @@ static void CreateAbnormalWeatherTask(void) s16 *data = gTasks[taskId].data; tDelay = 600; - if (gCurrentAbnormalWeather == WEATHER_DOWNPOUR) + if (sCurrentAbnormalWeather == WEATHER_DOWNPOUR) { // Currently Downpour, next will be Drought tWeatherA = WEATHER_DROUGHT; tWeatherB = WEATHER_DOWNPOUR; } - else if (gCurrentAbnormalWeather == WEATHER_DROUGHT) + else if (sCurrentAbnormalWeather == WEATHER_DROUGHT) { // Currently Drought, next will be Downpour tWeatherA = WEATHER_DOWNPOUR; @@ -2484,7 +2484,7 @@ static void CreateAbnormalWeatherTask(void) else { // Default to starting with Downpour - gCurrentAbnormalWeather = WEATHER_DOWNPOUR; + sCurrentAbnormalWeather = WEATHER_DOWNPOUR; tWeatherA = WEATHER_DROUGHT; tWeatherB = WEATHER_DOWNPOUR; } @@ -2537,13 +2537,13 @@ void DoCurrentWeather(void) { if (!FuncIsActiveTask(Task_DoAbnormalWeather)) CreateAbnormalWeatherTask(); - weather = gCurrentAbnormalWeather; + weather = sCurrentAbnormalWeather; } else { if (FuncIsActiveTask(Task_DoAbnormalWeather)) DestroyTask(FindTaskIdByFunc(Task_DoAbnormalWeather)); - gCurrentAbnormalWeather = WEATHER_DOWNPOUR; + sCurrentAbnormalWeather = WEATHER_DOWNPOUR; } SetNextWeather(weather); } @@ -2556,13 +2556,13 @@ void ResumePausedWeather(void) { if (!FuncIsActiveTask(Task_DoAbnormalWeather)) CreateAbnormalWeatherTask(); - weather = gCurrentAbnormalWeather; + weather = sCurrentAbnormalWeather; } else { if (FuncIsActiveTask(Task_DoAbnormalWeather)) DestroyTask(FindTaskIdByFunc(Task_DoAbnormalWeather)); - gCurrentAbnormalWeather = WEATHER_DOWNPOUR; + sCurrentAbnormalWeather = WEATHER_DOWNPOUR; } SetCurrentAndNextWeather(weather); } diff --git a/src/fieldmap.c b/src/fieldmap.c index 4dbf981cf5..a02355e721 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -25,10 +25,10 @@ struct ConnectionFlags u8 east:1; }; -EWRAM_DATA static u16 gBackupMapData[MAX_MAP_DATA_SIZE] = {0}; +EWRAM_DATA static u16 sBackupMapData[MAX_MAP_DATA_SIZE] = {0}; EWRAM_DATA struct MapHeader gMapHeader = {0}; EWRAM_DATA struct Camera gCamera = {0}; -EWRAM_DATA static struct ConnectionFlags gMapConnectionFlags = {0}; +EWRAM_DATA static struct ConnectionFlags sMapConnectionFlags = {0}; EWRAM_DATA static u32 sFiller = 0; // without this, the next file won't align properly struct BackupMapLayout gBackupMapLayout; @@ -87,14 +87,14 @@ void InitMapFromSavedGame(void) void InitBattlePyramidMap(bool8 setPlayerPosition) { - CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData)); - GenerateBattlePyramidFloorLayout(gBackupMapData, setPlayerPosition); + CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData)); + GenerateBattlePyramidFloorLayout(sBackupMapData, setPlayerPosition); } void InitTrainerHillMap(void) { - CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData)); - GenerateTrainerHillFloorLayout(gBackupMapData); + CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData)); + GenerateTrainerHillFloorLayout(sBackupMapData); } static void InitMapLayoutData(struct MapHeader *mapHeader) @@ -103,8 +103,8 @@ static void InitMapLayoutData(struct MapHeader *mapHeader) int width; int height; mapLayout = mapHeader->mapLayout; - CpuFastFill16(MAPGRID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData)); - gBackupMapLayout.map = gBackupMapData; + CpuFastFill16(MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData)); + gBackupMapLayout.map = sBackupMapData; width = mapLayout->width + MAP_OFFSET_W; gBackupMapLayout.width = width; height = mapLayout->height + MAP_OFFSET_H; @@ -140,7 +140,7 @@ static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader) { count = mapHeader->connections->count; connection = mapHeader->connections->connections; - gMapConnectionFlags = sDummyConnectionFlags; + sMapConnectionFlags = sDummyConnectionFlags; for (i = 0; i < count; i++, connection++) { struct MapHeader const *cMap = GetMapHeaderFromConnection(connection); @@ -149,19 +149,19 @@ static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader) { case CONNECTION_SOUTH: FillSouthConnection(mapHeader, cMap, offset); - gMapConnectionFlags.south = TRUE; + sMapConnectionFlags.south = TRUE; break; case CONNECTION_NORTH: FillNorthConnection(mapHeader, cMap, offset); - gMapConnectionFlags.north = TRUE; + sMapConnectionFlags.north = TRUE; break; case CONNECTION_WEST: FillWestConnection(mapHeader, cMap, offset); - gMapConnectionFlags.west = TRUE; + sMapConnectionFlags.west = TRUE; break; case CONNECTION_EAST: FillEastConnection(mapHeader, cMap, offset); - gMapConnectionFlags.east = TRUE; + sMapConnectionFlags.east = TRUE; break; } } @@ -436,7 +436,7 @@ void SaveMapView(void) for (i = y; i < y + MAP_OFFSET_H; i++) { for (j = x; j < x + MAP_OFFSET_W; j++) - *mapView++ = gBackupMapData[width * i + j]; + *mapView++ = sBackupMapData[width * i + j]; } } @@ -491,8 +491,8 @@ static void LoadSavedMapView(void) for (j = x; j < x + MAP_OFFSET_W; j++) { - if (!SkipCopyingMetatileFromSavedMap(&gBackupMapData[j + width * i], width, yMode)) - gBackupMapData[j + width * i] = *mapView; + if (!SkipCopyingMetatileFromSavedMap(&sBackupMapData[j + width * i], width, yMode)) + sBackupMapData[j + width * i] = *mapView; mapView++; } } @@ -554,7 +554,7 @@ static void MoveMapViewToBackup(u8 direction) desti = width * (y + y0); srci = (y + r8) * MAP_OFFSET_W + r9; src = &mapView[srci + i]; - dest = &gBackupMapData[x0 + desti + j]; + dest = &sBackupMapData[x0 + desti + j]; *dest = *src; i++; j++; @@ -570,28 +570,28 @@ int GetMapBorderIdAt(int x, int y) if (x >= (gBackupMapLayout.width - (MAP_OFFSET + 1))) { - if (!gMapConnectionFlags.east) + if (!sMapConnectionFlags.east) return CONNECTION_INVALID; return CONNECTION_EAST; } else if (x < MAP_OFFSET) { - if (!gMapConnectionFlags.west) + if (!sMapConnectionFlags.west) return CONNECTION_INVALID; return CONNECTION_WEST; } else if (y >= (gBackupMapLayout.height - MAP_OFFSET)) { - if (!gMapConnectionFlags.south) + if (!sMapConnectionFlags.south) return CONNECTION_INVALID; return CONNECTION_SOUTH; } else if (y < MAP_OFFSET) { - if (!gMapConnectionFlags.north) + if (!sMapConnectionFlags.north) return CONNECTION_INVALID; return CONNECTION_NORTH; diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index d134f22654..38f096af84 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -52,6 +52,8 @@ struct HallofFameTeam struct HallofFameMon mon[PARTY_SIZE]; }; +STATIC_ASSERT(sizeof(struct HallofFameTeam) * HALL_OF_FAME_MAX_TEAMS <= SECTOR_DATA_SIZE * NUM_HOF_SECTORS, HallOfFameFreeSpace); + struct HofGfx { u16 state; @@ -512,7 +514,7 @@ static void Task_Hof_InitTeamSaveData(u8 taskId) } *lastSavedTeam = *sHofMonPtr; - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized2(0, FONT_NORMAL, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3); CopyWindowToVram(0, COPYWIN_FULL); gTasks[taskId].func = Task_Hof_TrySaveData; @@ -527,10 +529,8 @@ static void Task_Hof_TrySaveData(u8 taskId) UnsetBgTilemapBuffer(3); FreeAllWindowBuffers(); - if (sHofGfxPtr != NULL) - FREE_AND_SET_NULL(sHofGfxPtr); - if (sHofMonPtr != NULL) - FREE_AND_SET_NULL(sHofMonPtr); + TRY_FREE_AND_SET_NULL(sHofGfxPtr); + TRY_FREE_AND_SET_NULL(sHofMonPtr); DestroyTask(taskId); } @@ -722,7 +722,7 @@ static void Task_Hof_WaitAndPrintPlayerInfo(u8 taskId) { FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); HallOfFame_PrintPlayerInfo(1, 2); - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized2(0, FONT_NORMAL, gText_LeagueChamp, 0, NULL, 2, 1, 3); CopyWindowToVram(0, COPYWIN_FULL); gTasks[taskId].func = Task_Hof_ExitOnKeyPressed; @@ -771,10 +771,8 @@ static void Task_Hof_HandleExit(u8 taskId) ResetBgsAndClearDma3BusyFlags(0); DestroyTask(taskId); - if (sHofGfxPtr != NULL) - FREE_AND_SET_NULL(sHofGfxPtr); - if (sHofMonPtr != NULL) - FREE_AND_SET_NULL(sHofMonPtr); + TRY_FREE_AND_SET_NULL(sHofGfxPtr); + TRY_FREE_AND_SET_NULL(sHofMonPtr); StartCredits(); } @@ -1079,10 +1077,8 @@ static void Task_HofPC_HandleExit(u8 taskId) ResetBgsAndClearDma3BusyFlags(0); DestroyTask(taskId); - if (sHofGfxPtr != NULL) - FREE_AND_SET_NULL(sHofGfxPtr); - if (sHofMonPtr != NULL) - FREE_AND_SET_NULL(sHofMonPtr); + TRY_FREE_AND_SET_NULL(sHofGfxPtr); + TRY_FREE_AND_SET_NULL(sHofMonPtr); ReturnFromHallOfFamePC(); } @@ -1091,7 +1087,7 @@ static void Task_HofPC_HandleExit(u8 taskId) static void Task_HofPC_PrintDataIsCorrupted(u8 taskId) { HofPCTopBar_Print(gText_AButtonExit, 8, TRUE); - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized2(0, FONT_NORMAL, gText_HOFCorrupted, 0, NULL, 2, 1, 3); CopyWindowToVram(0, COPYWIN_FULL); gTasks[taskId].func = Task_HofPC_ExitOnButtonPress; diff --git a/src/intro.c b/src/intro.c index 827ce80be8..a1d0508f4f 100644 --- a/src/intro.c +++ b/src/intro.c @@ -1848,7 +1848,7 @@ static void Task_Scene3_StartGroudon(u8 taskId) { gTasks[taskId].tState = 0; gTasks[taskId].func = Task_Scene3_Groudon; - ScanlineEffect_InitWave(0, 160, 4, 4, 1, SCANLINE_EFFECT_REG_BG1HOFS, 0); + ScanlineEffect_InitWave(0, 160, 4, 4, 1, SCANLINE_EFFECT_REG_BG1HOFS, FALSE); } #define tScreenX data[1] @@ -2058,7 +2058,7 @@ static void Task_Scene3_LoadKyogre(u8 taskId) gTasks[taskId].tDelay = 16; gTasks[taskId].tZoom = 256; PanFadeAndZoomScreen(gTasks[taskId].tScreenX, gTasks[taskId].tScreenY, gTasks[taskId].tZoom, 0); - ScanlineEffect_InitWave(0, 0xA0, 4, 4, 1, SCANLINE_EFFECT_REG_BG1VOFS, 0); + ScanlineEffect_InitWave(0, 0xA0, 4, 4, 1, SCANLINE_EFFECT_REG_BG1VOFS, FALSE); } static void Task_Scene3_Kyogre(u8 taskId) diff --git a/src/item_menu.c b/src/item_menu.c index 9eaca9597d..cd0bc159d6 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -1344,7 +1344,7 @@ static void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, bool16 skipEraseLis DrawPocketIndicatorSquare(newPocket, TRUE); FillBgTilemapBufferRect_Palette0(2, 11, 14, 2, 15, 16); ScheduleBgCopyTilemapToVram(2); - SetBagVisualPocketId(newPocket, 1); + SetBagVisualPocketId(newPocket, TRUE); RemoveBagSprite(ITEMMENUSPRITE_BALL); AddSwitchPocketRotatingBallSprite(deltaBagPocketId); SetTaskFuncWithFollowupFunc(taskId, Task_SwitchBagPocket, gTasks[taskId].func); diff --git a/src/item_menu_icons.c b/src/item_menu_icons.c index a5c265f908..b1e1634992 100644 --- a/src/item_menu_icons.c +++ b/src/item_menu_icons.c @@ -35,8 +35,8 @@ static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite); // static const rom data static const u16 sRotatingBall_Pal[] = INCBIN_U16("graphics/bag/rotating_ball.gbapal"); static const u8 sRotatingBall_Gfx[] = INCBIN_U8("graphics/bag/rotating_ball.4bpp"); -static const u8 gCherryUnused[] = INCBIN_U8("graphics/unused/cherry.4bpp"); -static const u16 gCherryUnused_Pal[] = INCBIN_U16("graphics/unused/cherry.gbapal"); +static const u8 sCherryUnused[] = INCBIN_U8("graphics/unused/cherry.4bpp"); +static const u16 sCherryUnused_Pal[] = INCBIN_U16("graphics/unused/cherry.gbapal"); static const struct OamData sBagOamData = { @@ -269,7 +269,7 @@ static const struct SpriteFrameImage sBerryPicSpriteImageTable[] = {&gDecompressionBuffer[0], 0x800}, }; -static const struct SpriteTemplate gBerryPicSpriteTemplate = +static const struct SpriteTemplate sBerryPicSpriteTemplate = { .tileTag = TAG_NONE, .paletteTag = TAG_BERRY_PIC_PAL, @@ -308,7 +308,7 @@ static const union AffineAnimCmd *const sBerryPicRotatingAnimCmds[] = sSpriteAffineAnim_BerryPicRotation2 }; -static const struct SpriteTemplate gBerryPicRotatingSpriteTemplate = +static const struct SpriteTemplate sBerryPicRotatingSpriteTemplate = { .tileTag = TAG_NONE, .paletteTag = TAG_BERRY_PIC_PAL, @@ -404,7 +404,7 @@ static const union AnimCmd *const sBerryCheckCircleSpriteAnimTable[] = sSpriteAnim_BerryCheckCircle }; -static const struct SpriteTemplate gBerryCheckCircleSpriteTemplate = +static const struct SpriteTemplate sBerryCheckCircleSpriteTemplate = { .tileTag = TAG_BERRY_CHECK_CIRCLE_GFX, .paletteTag = TAG_BERRY_CHECK_CIRCLE_GFX, @@ -609,7 +609,7 @@ static void LoadBerryGfx(u8 berryId) u8 CreateBerryTagSprite(u8 id, s16 x, s16 y) { LoadBerryGfx(id); - return CreateSprite(&gBerryPicSpriteTemplate, x, y, 0); + return CreateSprite(&sBerryPicSpriteTemplate, x, y, 0); } void FreeBerryTagSpritePalette(void) @@ -624,7 +624,7 @@ u8 CreateSpinningBerrySprite(u8 berryId, u8 x, u8 y, bool8 startAffine) FreeSpritePaletteByTag(TAG_BERRY_PIC_PAL); LoadBerryGfx(berryId); - spriteId = CreateSprite(&gBerryPicRotatingSpriteTemplate, x, y, 0); + spriteId = CreateSprite(&sBerryPicRotatingSpriteTemplate, x, y, 0); if (startAffine == TRUE) StartSpriteAffineAnim(&gSprites[spriteId], 1); @@ -633,5 +633,5 @@ u8 CreateSpinningBerrySprite(u8 berryId, u8 x, u8 y, bool8 startAffine) u8 CreateBerryFlavorCircleSprite(s16 x) { - return CreateSprite(&gBerryCheckCircleSpriteTemplate, x, 116, 0); + return CreateSprite(&sBerryCheckCircleSpriteTemplate, x, 116, 0); } diff --git a/src/landmark.c b/src/landmark.c index 52d52500aa..615a9bfe3e 100644 --- a/src/landmark.c +++ b/src/landmark.c @@ -336,7 +336,7 @@ static const struct Landmark *const Landmarks_MtChimney_2[] = NULL, }; -static const struct LandmarkList gLandmarkLists[] = +static const struct LandmarkList sLandmarkLists[] = { {MAPSEC_ROUTE_103, 2, Landmarks_Route103_2}, {MAPSEC_ROUTE_104, 0, Landmarks_Route104_0}, @@ -420,21 +420,21 @@ static const struct Landmark *const *GetLandmarks(u8 mapSection, u8 id) { u16 i = 0; - for (; gLandmarkLists[i].mapSection != MAPSEC_NONE; i++) + for (; sLandmarkLists[i].mapSection != MAPSEC_NONE; i++) { - if (gLandmarkLists[i].mapSection > mapSection) + if (sLandmarkLists[i].mapSection > mapSection) return NULL; - if (gLandmarkLists[i].mapSection == mapSection) + if (sLandmarkLists[i].mapSection == mapSection) break; } - if (gLandmarkLists[i].mapSection == MAPSEC_NONE) + if (sLandmarkLists[i].mapSection == MAPSEC_NONE) return NULL; - for (; gLandmarkLists[i].mapSection == mapSection; i++) + for (; sLandmarkLists[i].mapSection == mapSection; i++) { - if (gLandmarkLists[i].id == id) - return gLandmarkLists[i].landmarks; + if (sLandmarkLists[i].id == id) + return sLandmarkLists[i].landmarks; } return NULL; diff --git a/src/m4a_1.s b/src/m4a_1.s index cc5d3238d6..3f15788061 100644 --- a/src/m4a_1.s +++ b/src/m4a_1.s @@ -680,7 +680,7 @@ SoundMainRAM_Unk2: ldr r1, [r4, o_SoundChannel_wav] add r2, r2, r1 add r2, r2, 0x10 - ldr r5, =gDecodingBuffer + ldr r5, =sDecodingBuffer ldr r6, =gDeltaEncodingTable mov r7, 0x40 ldrb lr, [r2], 1 @@ -701,7 +701,7 @@ _081DD57C: subs r7, r7, 2 bgt _081DD568 _081DD594: - ldr r5, =gDecodingBuffer + ldr r5, =sDecodingBuffer and r0, r3, 0x3F ldrsb r1, [r5, r0] pop {r0,r2,r5-r7,pc} @@ -1911,6 +1911,6 @@ _081DDD90: .align 2, 0 @ Don't pad with nop. .bss -gDecodingBuffer: @ Used as a buffer for audio decoded from compressed DPCM +sDecodingBuffer: @ Used as a buffer for audio decoded from compressed DPCM .space 0x40 - .size gDecodingBuffer, .-gDecodingBuffer + .size sDecodingBuffer, .-sDecodingBuffer diff --git a/src/main.c b/src/main.c index 2b96a8698c..5fd236447b 100644 --- a/src/main.c +++ b/src/main.c @@ -69,7 +69,7 @@ u8 gLinkVSyncDisabled; u32 IntrMain_Buffer[0x200]; s8 gPcmDmaCounter; -static EWRAM_DATA u16 gTrainerId = 0; +static EWRAM_DATA u16 sTrainerId = 0; //EWRAM_DATA void (**gFlashTimerIntrFunc)(void) = NULL; @@ -201,12 +201,12 @@ void SeedRngAndSetTrainerId(void) u16 val = REG_TM1CNT_L; SeedRng(val); REG_TM1CNT_H = 0; - gTrainerId = val; + sTrainerId = val; } u16 GetGeneratedTrainerIdLower(void) { - return gTrainerId; + return sTrainerId; } void EnableVCountIntrAtLine150(void) diff --git a/src/main_menu.c b/src/main_menu.c index 361118e544..a69f73d178 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -371,7 +371,7 @@ static const struct WindowTemplate sWindowTemplates_MainMenu[] = DUMMY_WIN_TEMPLATE }; -static const struct WindowTemplate gNewGameBirchSpeechTextWindows[] = +static const struct WindowTemplate sNewGameBirchSpeechTextWindows[] = { { .bg = 0, @@ -457,7 +457,7 @@ static const struct MenuAction sMenuActions_Gender[] = { {gText_BirchGirl, NULL} }; -static const u8 *const gMalePresetNames[] = { +static const u8 *const sMalePresetNames[] = { gText_DefaultNameStu, gText_DefaultNameMilton, gText_DefaultNameTom, @@ -480,7 +480,7 @@ static const u8 *const gMalePresetNames[] = { gText_DefaultNameQuincy }; -static const u8 *const gFemalePresetNames[] = { +static const u8 *const sFemalePresetNames[] = { gText_DefaultNameKimmy, gText_DefaultNameTiara, gText_DefaultNameBella, @@ -1325,7 +1325,7 @@ static void Task_NewGameBirchSpeech_WaitForSpriteFadeInWelcome(u8 taskId) } else { - InitWindows(gNewGameBirchSpeechTextWindows); + InitWindows(sNewGameBirchSpeechTextWindows); LoadMainMenuWindowFrameTiles(0, 0xF3); LoadMessageBoxGfx(0, 0xFC, 0xF0); NewGameBirchSpeech_ShowDialogueWindow(0, 1); @@ -1851,7 +1851,7 @@ static void CB2_NewGameBirchSpeech_ReturnFromNamingScreen(void) REG_IME = savedIme; SetVBlankCallback(VBlankCB_MainMenu); SetMainCallback2(CB2_MainMenu); - InitWindows(gNewGameBirchSpeechTextWindows); + InitWindows(sNewGameBirchSpeechTextWindows); LoadMainMenuWindowFrameTiles(0, 0xF3); LoadMessageBoxGfx(0, 0xFC, 0xF0); PutWindowTilemap(0); @@ -2087,7 +2087,7 @@ static void NewGameBirchSpeech_StartFadePlatformOut(u8 taskId, u8 delay) static void NewGameBirchSpeech_ShowGenderMenu(void) { - DrawMainMenuWindowBorder(&gNewGameBirchSpeechTextWindows[1], 0xF3); + DrawMainMenuWindowBorder(&sNewGameBirchSpeechTextWindows[1], 0xF3); FillWindowPixelBuffer(1, PIXEL_FILL(1)); PrintMenuTable(1, ARRAY_COUNT(sMenuActions_Gender), sMenuActions_Gender); InitMenuInUpperLeftCornerNormal(1, ARRAY_COUNT(sMenuActions_Gender), 0); @@ -2106,9 +2106,9 @@ static void NewGameBirchSpeech_SetDefaultPlayerName(u8 nameId) u8 i; if (gSaveBlock2Ptr->playerGender == MALE) - name = gMalePresetNames[nameId]; + name = sMalePresetNames[nameId]; else - name = gFemalePresetNames[nameId]; + name = sFemalePresetNames[nameId]; for (i = 0; i < PLAYER_NAME_LENGTH; i++) gSaveBlock2Ptr->playerName[i] = name[i]; gSaveBlock2Ptr->playerName[PLAYER_NAME_LENGTH] = EOS; diff --git a/src/map_name_popup.c b/src/map_name_popup.c index 8cf1a6bab1..363f2bc061 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -176,25 +176,25 @@ static const u8 sRegionMapSectionId_To_PopUpThemeIdMapping[] = [MAPSEC_TRAINER_HILL - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_MARBLE }; -static const u8 gText_PyramidFloor1[] = _("PYRAMID FLOOR 1"); -static const u8 gText_PyramidFloor2[] = _("PYRAMID FLOOR 2"); -static const u8 gText_PyramidFloor3[] = _("PYRAMID FLOOR 3"); -static const u8 gText_PyramidFloor4[] = _("PYRAMID FLOOR 4"); -static const u8 gText_PyramidFloor5[] = _("PYRAMID FLOOR 5"); -static const u8 gText_PyramidFloor6[] = _("PYRAMID FLOOR 6"); -static const u8 gText_PyramidFloor7[] = _("PYRAMID FLOOR 7"); -static const u8 gText_Pyramid[] = _("PYRAMID"); +static const u8 sText_PyramidFloor1[] = _("PYRAMID FLOOR 1"); +static const u8 sText_PyramidFloor2[] = _("PYRAMID FLOOR 2"); +static const u8 sText_PyramidFloor3[] = _("PYRAMID FLOOR 3"); +static const u8 sText_PyramidFloor4[] = _("PYRAMID FLOOR 4"); +static const u8 sText_PyramidFloor5[] = _("PYRAMID FLOOR 5"); +static const u8 sText_PyramidFloor6[] = _("PYRAMID FLOOR 6"); +static const u8 sText_PyramidFloor7[] = _("PYRAMID FLOOR 7"); +static const u8 sText_Pyramid[] = _("PYRAMID"); -static const u8 * const gBattlePyramid_MapHeaderStrings[] = +static const u8 * const sBattlePyramid_MapHeaderStrings[] = { - gText_PyramidFloor1, - gText_PyramidFloor2, - gText_PyramidFloor3, - gText_PyramidFloor4, - gText_PyramidFloor5, - gText_PyramidFloor6, - gText_PyramidFloor7, - gText_Pyramid, + sText_PyramidFloor1, + sText_PyramidFloor2, + sText_PyramidFloor3, + sText_PyramidFloor4, + sText_PyramidFloor5, + sText_PyramidFloor6, + sText_PyramidFloor7, + sText_Pyramid, }; // Unused @@ -309,12 +309,12 @@ static void ShowMapNamePopUpWindow(void) if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP) { withoutPrefixPtr = &(mapDisplayHeader[3]); - mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[7]; + mapDisplayHeaderSource = sBattlePyramid_MapHeaderStrings[7]; } else { withoutPrefixPtr = &(mapDisplayHeader[3]); - mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[gSaveBlock2Ptr->frontier.curChallengeBattleNum]; + mapDisplayHeaderSource = sBattlePyramid_MapHeaderStrings[gSaveBlock2Ptr->frontier.curChallengeBattleNum]; } StringCopy(withoutPrefixPtr, mapDisplayHeaderSource); } diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 637bf2c7f8..2b6c71c8a2 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -445,7 +445,7 @@ static void DisableTextPrinters(struct TextPrinterTemplate * printer, u16 render static void DrawSongTextWindow(const u8 * str) { - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized(0, FONT_NORMAL, str, 0, 1, 1, DisableTextPrinters); gDisableTextPrinters = TRUE; CopyWindowToVram(0, COPYWIN_FULL); diff --git a/src/mystery_gift_client.c b/src/mystery_gift_client.c index 9405b133cc..12e9356d5c 100644 --- a/src/mystery_gift_client.c +++ b/src/mystery_gift_client.c @@ -44,8 +44,7 @@ u32 MysteryGiftClient_Run(u16 * endVal) { *endVal = sClient->param; MysteryGiftClient_Free(sClient); - Free(sClient); - sClient = NULL; + FREE_AND_SET_NULL(sClient); } return result; } diff --git a/src/mystery_gift_server.c b/src/mystery_gift_server.c index 0e0acb6428..891870659d 100644 --- a/src/mystery_gift_server.c +++ b/src/mystery_gift_server.c @@ -44,8 +44,7 @@ u32 MysterGiftServer_Run(u16 * endVal) { *endVal = sServer->param; MysteryGiftServer_Free(sServer); - Free(sServer); - sServer = NULL; + FREE_AND_SET_NULL(sServer); } return result; } diff --git a/src/mystery_gift_view.c b/src/mystery_gift_view.c index 3047a219e8..ff34c88536 100644 --- a/src/mystery_gift_view.c +++ b/src/mystery_gift_view.c @@ -207,8 +207,7 @@ void WonderCard_Destroy(void) if (sWonderCardData != NULL) { *sWonderCardData = (struct WonderCardData){}; - Free(sWonderCardData); - sWonderCardData = NULL; + FREE_AND_SET_NULL(sWonderCardData); } } @@ -660,8 +659,7 @@ void WonderNews_Destroy(void) if (sWonderNewsData != NULL) { *sWonderNewsData = (struct WonderNewsData){}; - Free(sWonderNewsData); - sWonderNewsData = NULL; + FREE_AND_SET_NULL(sWonderNewsData); } } diff --git a/src/overworld.c b/src/overworld.c index dc7eda4223..a2b6a6433d 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -318,7 +318,7 @@ static u8 MovementEventModeCB_Normal(struct LinkPlayerObjectEvent *, struct Obje static u8 MovementEventModeCB_Ignored(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8); static u8 MovementEventModeCB_Scripted(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8); -static u8 (*const gLinkPlayerMovementModes[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8) = +static u8 (*const sLinkPlayerMovementModes[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8) = { [MOVEMENT_MODE_FREE] = MovementEventModeCB_Normal, [MOVEMENT_MODE_FROZEN] = MovementEventModeCB_Ignored, @@ -330,7 +330,7 @@ static u8 FacingHandler_DpadMovement(struct LinkPlayerObjectEvent *, struct Obje static u8 FacingHandler_ForcedFacingChange(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8); // These handlers return TRUE if the movement was scripted and successful, and FALSE otherwise. -static bool8 (*const gLinkPlayerFacingHandlers[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8) = +static bool8 (*const sLinkPlayerFacingHandlers[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8) = { FacingHandler_DoNothing, FacingHandler_DpadMovement, @@ -349,7 +349,7 @@ static void MovementStatusHandler_EnterFreeMode(struct LinkPlayerObjectEvent *, static void MovementStatusHandler_TryAdvanceScript(struct LinkPlayerObjectEvent *, struct ObjectEvent *); // These handlers are run after an attempted movement. -static void (*const gMovementStatusHandler[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *) = +static void (*const sMovementStatusHandler[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *) = { // FALSE: MovementStatusHandler_EnterFreeMode, @@ -3048,9 +3048,9 @@ static void SetPlayerFacingDirection(u8 linkPlayerId, u8 facing) { // This is a hack to split this code onto two separate lines, without declaring a local variable. // C++ style inline variables would be nice here. - #define TEMP gLinkPlayerMovementModes[linkPlayerObjEvent->movementMode](linkPlayerObjEvent, objEvent, facing) + #define TEMP sLinkPlayerMovementModes[linkPlayerObjEvent->movementMode](linkPlayerObjEvent, objEvent, facing) - gMovementStatusHandler[TEMP](linkPlayerObjEvent, objEvent); + sMovementStatusHandler[TEMP](linkPlayerObjEvent, objEvent); // Clean up the hack. #undef TEMP @@ -3061,7 +3061,7 @@ static void SetPlayerFacingDirection(u8 linkPlayerId, u8 facing) static u8 MovementEventModeCB_Normal(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 dir) { - return gLinkPlayerFacingHandlers[dir](linkPlayerObjEvent, objEvent, dir); + return sLinkPlayerFacingHandlers[dir](linkPlayerObjEvent, objEvent, dir); } static u8 MovementEventModeCB_Ignored(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 dir) @@ -3072,7 +3072,7 @@ static u8 MovementEventModeCB_Ignored(struct LinkPlayerObjectEvent *linkPlayerOb // Identical to MovementEventModeCB_Normal static u8 MovementEventModeCB_Scripted(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 dir) { - return gLinkPlayerFacingHandlers[dir](linkPlayerObjEvent, objEvent, dir); + return sLinkPlayerFacingHandlers[dir](linkPlayerObjEvent, objEvent, dir); } static bool8 FacingHandler_DoNothing(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 dir) diff --git a/src/palette.c b/src/palette.c index 23ad02b737..577257eff3 100644 --- a/src/palette.c +++ b/src/palette.c @@ -60,13 +60,13 @@ static void Task_BlendPalettesGradually(u8 taskId); // unaligned word reads are issued in BlendPalette otherwise ALIGNED(4) EWRAM_DATA u16 gPlttBufferUnfaded[PLTT_BUFFER_SIZE] = {0}; ALIGNED(4) EWRAM_DATA u16 gPlttBufferFaded[PLTT_BUFFER_SIZE] = {0}; -EWRAM_DATA struct PaletteStruct sPaletteStructs[NUM_PALETTE_STRUCTS] = {0}; +static EWRAM_DATA struct PaletteStruct sPaletteStructs[NUM_PALETTE_STRUCTS] = {0}; EWRAM_DATA struct PaletteFadeControl gPaletteFade = {0}; static EWRAM_DATA u32 sFiller = 0; static EWRAM_DATA u32 sPlttBufferTransferPending = 0; EWRAM_DATA u8 gPaletteDecompressionBuffer[PLTT_DECOMP_BUFFER_SIZE] = {0}; -static const struct PaletteStructTemplate gDummyPaletteStructTemplate = { +static const struct PaletteStructTemplate sDummyPaletteStructTemplate = { .id = 0xFFFF, .state = 1 }; @@ -352,7 +352,7 @@ void PaletteStruct_ResetById(u16 id) static void PaletteStruct_Reset(u8 paletteNum) { - sPaletteStructs[paletteNum].template = &gDummyPaletteStructTemplate; + sPaletteStructs[paletteNum].template = &sDummyPaletteStructTemplate; sPaletteStructs[paletteNum].active = FALSE; sPaletteStructs[paletteNum].baseDestOffset = 0; sPaletteStructs[paletteNum].destOffset = 0; diff --git a/src/party_menu.c b/src/party_menu.c index e15d001c6d..cbe127bb9e 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -4969,7 +4969,7 @@ static void Task_TryLearnNewMoves(u8 taskId) { u16 learnMove; - if (WaitFanfare(0) && ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON)))) + if (WaitFanfare(FALSE) && ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON)))) { RemoveLevelUpStatsWindow(); learnMove = MonTryLearningNewMove(&gPlayerParty[gPartyMenu.slotId], TRUE); diff --git a/src/player_pc.c b/src/player_pc.c index 9e3d7b166b..0ca78dea86 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -518,7 +518,7 @@ static void InitItemStorageMenu(u8 taskId, u8 var) static void ItemStorageMenuPrint(const u8 *textPtr) { - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized(0, FONT_NORMAL, textPtr, 0, 1, 0, 0); } @@ -572,7 +572,7 @@ void CB2_PlayerPCExitBagMenu(void) static void ItemStorage_ReshowAfterBagMenu(void) { LoadMessageBoxAndBorderGfx(); - DrawDialogueFrame(0, 1); + DrawDialogueFrame(0, TRUE); InitItemStorageMenu(CreateTask(ItemStorage_HandleReturnToProcessInput, 0), 1); FadeInFromBlack(); } @@ -1241,7 +1241,7 @@ static void ItemStorage_ReturnToMenuSelect(u8 taskId) s16 *data = gTasks[taskId].data; if (!IsDma3ManagerBusyWithBgCopy()) { - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); // Select Withdraw/Toss by default depending on which was just exited if (!tInTossMenu) diff --git a/src/pokedex.c b/src/pokedex.c index b247c8c8d2..9592aee9ce 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -840,7 +840,7 @@ static const u8 sText_No000[] = _("{NO}000"); static const u8 sCaughtBall_Gfx[] = INCBIN_U8("graphics/pokedex/caught_ball.4bpp"); static const u8 sText_TenDashes[] = _("----------"); -ALIGNED(4) static const u8 gExpandedPlaceholder_PokedexDescription[] = _(""); +ALIGNED(4) static const u8 sExpandedPlaceholder_PokedexDescription[] = _(""); #include "data/pokemon/pokedex_text.h" #include "data/pokemon/pokedex_entries.h" @@ -4138,7 +4138,7 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry) if (owned) description = gPokedexEntries[num].description; else - description = gExpandedPlaceholder_PokedexDescription; + description = sExpandedPlaceholder_PokedexDescription; PrintInfoScreenText(description, GetStringCenterAlignXOffset(FONT_NORMAL, description, 0xF0), 0x5F); } diff --git a/src/pokemon.c b/src/pokemon.c index db0febe26b..62b5358047 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6587,12 +6587,12 @@ void SetWildMonHeldItem(void) u16 rnd = Random() % 100; u16 species = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, 0); u16 chanceNoItem = 45; - u16 chanceCommon = 95; + u16 chanceNotRare = 95; if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG, 0) && GetMonAbility(&gPlayerParty[0]) == ABILITY_COMPOUND_EYES) { chanceNoItem = 20; - chanceCommon = 80; + chanceNotRare = 80; } if (gMapHeader.mapLayoutId == LAYOUT_ALTERING_CAVE) { @@ -6600,7 +6600,7 @@ void SetWildMonHeldItem(void) if (alteringCaveId != 0) { // In active Altering Cave, use special item list - if (rnd < chanceCommon) + if (rnd < chanceNotRare) return; SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &sAlteringCaveWildMonHeldItems[alteringCaveId].item); } @@ -6609,27 +6609,27 @@ void SetWildMonHeldItem(void) // In inactive Altering Cave, use normal items if (rnd < chanceNoItem) return; - if (rnd < chanceCommon) - SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1); + if (rnd < chanceNotRare) + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemCommon); else - SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item2); + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemRare); } } else { - if (gBaseStats[species].item1 == gBaseStats[species].item2 && gBaseStats[species].item1 != ITEM_NONE) + if (gBaseStats[species].itemCommon == gBaseStats[species].itemRare && gBaseStats[species].itemCommon != ITEM_NONE) { // Both held items are the same, 100% chance to hold item - SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1); + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemCommon); } else { if (rnd < chanceNoItem) return; - if (rnd < chanceCommon) - SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1); + if (rnd < chanceNotRare) + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemCommon); else - SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item2); + SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemRare); } } } diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index e38d46c845..008fae3c96 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1040,7 +1040,7 @@ static const struct BgTemplate sBgTemplates[] = }, }; -static const struct SpritePalette gWaveformSpritePalette = +static const struct SpritePalette sWaveformSpritePalette = { sWaveform_Pal, PALTAG_MISC_2 }; @@ -3844,7 +3844,7 @@ static bool8 InitPokeStorageWindows(void) static void LoadWaveformSpritePalette(void) { - LoadSpritePalette(&gWaveformSpritePalette); + LoadSpritePalette(&sWaveformSpritePalette); } static void InitPalettesAndSprites(void) @@ -5417,8 +5417,7 @@ static bool32 WaitForWallpaperGfxLoad(void) if (IsDma3ManagerBusyWithBgCopy()) return FALSE; - if (sStorage->wallpaperTiles != NULL) - FREE_AND_SET_NULL(sStorage->wallpaperTiles); + TRY_FREE_AND_SET_NULL(sStorage->wallpaperTiles); return TRUE; } diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index e33e79460d..c25d58ae65 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -2314,69 +2314,69 @@ u8 GetMoveSlotToReplace(void) static void DrawPagination(void) // Updates the pagination dots at the top of the summary screen { - u16 *alloced = Alloc(32); + u16 *tilemap = Alloc(8 * PSS_PAGE_COUNT); u8 i; - for (i = 0; i < 4; i++) + for (i = 0; i < PSS_PAGE_COUNT; i++) { u8 j = i * 2; if (i < sMonSummaryScreen->minPageIndex) { - alloced[j + 0] = 0x40; - alloced[j + 1] = 0x40; - alloced[j + 8] = 0x50; - alloced[j + 9] = 0x50; + tilemap[j + 0] = 0x40; + tilemap[j + 1] = 0x40; + tilemap[j + 2 * PSS_PAGE_COUNT] = 0x50; + tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x50; } else if (i > sMonSummaryScreen->maxPageIndex) { - alloced[j + 0] = 0x4A; - alloced[j + 1] = 0x4A; - alloced[j + 8] = 0x5A; - alloced[j + 9] = 0x5A; + tilemap[j + 0] = 0x4A; + tilemap[j + 1] = 0x4A; + tilemap[j + 2 * PSS_PAGE_COUNT] = 0x5A; + tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x5A; } else if (i < sMonSummaryScreen->currPageIndex) { - alloced[j + 0] = 0x46; - alloced[j + 1] = 0x47; - alloced[j + 8] = 0x56; - alloced[j + 9] = 0x57; + tilemap[j + 0] = 0x46; + tilemap[j + 1] = 0x47; + tilemap[j + 2 * PSS_PAGE_COUNT] = 0x56; + tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x57; } else if (i == sMonSummaryScreen->currPageIndex) { if (i != sMonSummaryScreen->maxPageIndex) { - alloced[j + 0] = 0x41; - alloced[j + 1] = 0x42; - alloced[j + 8] = 0x51; - alloced[j + 9] = 0x52; + tilemap[j + 0] = 0x41; + tilemap[j + 1] = 0x42; + tilemap[j + 2 * PSS_PAGE_COUNT] = 0x51; + tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x52; } else { - alloced[j + 0] = 0x4B; - alloced[j + 1] = 0x4C; - alloced[j + 8] = 0x5B; - alloced[j + 9] = 0x5C; + tilemap[j + 0] = 0x4B; + tilemap[j + 1] = 0x4C; + tilemap[j + 2 * PSS_PAGE_COUNT] = 0x5B; + tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x5C; } } else if (i != sMonSummaryScreen->maxPageIndex) { - alloced[j + 0] = 0x43; - alloced[j + 1] = 0x44; - alloced[j + 8] = 0x53; - alloced[j + 9] = 0x54; + tilemap[j + 0] = 0x43; + tilemap[j + 1] = 0x44; + tilemap[j + 2 * PSS_PAGE_COUNT] = 0x53; + tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x54; } else { - alloced[j + 0] = 0x48; - alloced[j + 1] = 0x49; - alloced[j + 8] = 0x58; - alloced[j + 9] = 0x59; + tilemap[j + 0] = 0x48; + tilemap[j + 1] = 0x49; + tilemap[j + 2 * PSS_PAGE_COUNT] = 0x58; + tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x59; } } - CopyToBgTilemapBufferRect_ChangePalette(3, alloced, 11, 0, 8, 2, 16); + CopyToBgTilemapBufferRect_ChangePalette(3, tilemap, 11, 0, PSS_PAGE_COUNT * 2, 2, 16); ScheduleBgCopyTilemapToVram(3); - Free(alloced); + Free(tilemap); } static void ChangeTilemap(const struct TilemapCtrl *unkStruct, u16 *dest, u8 c, bool8 d) @@ -2439,7 +2439,7 @@ static void Task_ShowPowerAccWindow(u8 taskId) { if (data[0] < 0) { - if (sMonSummaryScreen->currPageIndex == 2) + if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES) PutWindowTilemap(PSS_LABEL_WINDOW_MOVES_POWER_ACC); } else @@ -2492,7 +2492,7 @@ static void Task_ShowAppealJamWindow(u8 taskId) { if (data[0] < 0) { - if (sMonSummaryScreen->currPageIndex == 3 && FuncIsActiveTask(PssScrollRight) == 0) + if (sMonSummaryScreen->currPageIndex == PSS_PAGE_CONTEST_MOVES && FuncIsActiveTask(PssScrollRight) == 0) PutWindowTilemap(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM); DrawContestMoveHearts(data[2]); } diff --git a/src/pokenav.c b/src/pokenav.c index 5e8727c642..03f48ee366 100644 --- a/src/pokenav.c +++ b/src/pokenav.c @@ -557,8 +557,7 @@ void *GetSubstructPtr(u32 index) void FreePokenavSubstruct(u32 index) { - if (gPokenavResources->substructPtrs[index] != NULL) - FREE_AND_SET_NULL(gPokenavResources->substructPtrs[index]); + TRY_FREE_AND_SET_NULL(gPokenavResources->substructPtrs[index]); } u32 GetPokenavMode(void) diff --git a/src/pokenav_main_menu.c b/src/pokenav_main_menu.c index 318ed520d8..7d668c67f2 100644 --- a/src/pokenav_main_menu.c +++ b/src/pokenav_main_menu.c @@ -105,7 +105,7 @@ static const u8 sHelpBarTextColors[3] = TEXT_COLOR_RED, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY }; -static const struct CompressedSpriteSheet gSpinningPokenavSpriteSheet[] = +static const struct CompressedSpriteSheet sSpinningPokenavSpriteSheet[] = { { .data = sSpinningPokenav_Gfx, @@ -114,7 +114,7 @@ static const struct CompressedSpriteSheet gSpinningPokenavSpriteSheet[] = } }; -static const struct SpritePalette gSpinningNavgearPalettes[] = +static const struct SpritePalette sSpinningNavgearPalettes[] = { { .data = sSpinningPokenav_Pal, @@ -583,10 +583,10 @@ static void InitPokenavMainMenuResources(void) u8 spriteId; struct Pokenav_MainMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_MAIN_MENU); - for (i = 0; i < ARRAY_COUNT(gSpinningPokenavSpriteSheet); i++) - LoadCompressedSpriteSheet(&gSpinningPokenavSpriteSheet[i]); + for (i = 0; i < ARRAY_COUNT(sSpinningPokenavSpriteSheet); i++) + LoadCompressedSpriteSheet(&sSpinningPokenavSpriteSheet[i]); - Pokenav_AllocAndLoadPalettes(gSpinningNavgearPalettes); + Pokenav_AllocAndLoadPalettes(sSpinningNavgearPalettes); menu->palettes = ~1 & ~(0x10000 << IndexOfSpritePaletteTag(0)); spriteId = CreateSprite(&sSpinningPokenavSpriteTemplate, 220, 12, 0); menu->spinningPokenav = &gSprites[spriteId]; diff --git a/src/pokenav_match_call_data.c b/src/pokenav_match_call_data.c index 29dd62621b..2e8cc40b5c 100644 --- a/src/pokenav_match_call_data.c +++ b/src/pokenav_match_call_data.c @@ -324,7 +324,7 @@ static const match_call_text_data_t sWallyTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -const struct MatchCallLocationOverride sWallyLocationData[] = { +static const struct MatchCallLocationOverride sWallyLocationData[] = { { FLAG_HIDE_MAUVILLE_CITY_WALLY, MAPSEC_VERDANTURF_TOWN }, { FLAG_GROUDON_AWAKENED_MAGMA_HIDEOUT, MAPSEC_NONE }, { FLAG_HIDE_VICTORY_ROAD_ENTRANCE_WALLY, MAPSEC_VICTORY_ROAD }, diff --git a/src/pokenav_region_map.c b/src/pokenav_region_map.c index 16ba480703..828bd525df 100755 --- a/src/pokenav_region_map.c +++ b/src/pokenav_region_map.c @@ -146,7 +146,7 @@ static const struct WindowTemplate sMapSecInfoWindowTemplate = #include "data/region_map/city_map_entries.h" -const struct OamData sCityZoomTextSprite_OamData = +static const struct OamData sCityZoomTextSprite_OamData = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, diff --git a/src/record_mixing.c b/src/record_mixing.c index 6efded8388..4365f2cb3d 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -285,7 +285,7 @@ static void ReceiveExchangePacket(u32 multiplayerId) static void PrintTextOnRecordMixing(const u8 *src) { - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized(0, FONT_NORMAL, src, 0, 1, 0, NULL); CopyWindowToVram(0, COPYWIN_FULL); } diff --git a/src/recorded_battle.c b/src/recorded_battle.c index fd2b3a06b3..951572636a 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -67,6 +67,8 @@ struct RecordedBattleSave u32 checksum; }; +STATIC_ASSERT(sizeof(struct RecordedBattleSave) <= SECTOR_DATA_SIZE, RecordedBattleSaveFreeSpace); + EWRAM_DATA u32 gRecordedBattleRngSeed = 0; EWRAM_DATA u32 gBattlePalaceMoveSelectionRngValue = 0; EWRAM_DATA static u8 sBattleRecords[MAX_BATTLERS_COUNT][BATTLER_RECORD_SIZE] = {0}; diff --git a/src/region_map.c b/src/region_map.c index 09e2d69bf2..a4db1cb048 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -64,7 +64,7 @@ struct MultiNameFlyDest // Static RAM declarations -static EWRAM_DATA struct RegionMap *gRegionMap = NULL; +static EWRAM_DATA struct RegionMap *sRegionMap = NULL; static EWRAM_DATA struct { void (*callback)(void); @@ -516,49 +516,49 @@ void InitRegionMap(struct RegionMap *regionMap, bool8 zoomed) void InitRegionMapData(struct RegionMap *regionMap, const struct BgTemplate *template, bool8 zoomed) { - gRegionMap = regionMap; - gRegionMap->initStep = 0; - gRegionMap->zoomed = zoomed; - gRegionMap->inputCallback = zoomed == TRUE ? ProcessRegionMapInput_Zoomed : ProcessRegionMapInput_Full; + sRegionMap = regionMap; + sRegionMap->initStep = 0; + sRegionMap->zoomed = zoomed; + sRegionMap->inputCallback = zoomed == TRUE ? ProcessRegionMapInput_Zoomed : ProcessRegionMapInput_Full; if (template != NULL) { - gRegionMap->bgNum = template->bg; - gRegionMap->charBaseIdx = template->charBaseIndex; - gRegionMap->mapBaseIdx = template->mapBaseIndex; - gRegionMap->bgManaged = TRUE; + sRegionMap->bgNum = template->bg; + sRegionMap->charBaseIdx = template->charBaseIndex; + sRegionMap->mapBaseIdx = template->mapBaseIndex; + sRegionMap->bgManaged = TRUE; } else { - gRegionMap->bgNum = 2; - gRegionMap->charBaseIdx = 2; - gRegionMap->mapBaseIdx = 28; - gRegionMap->bgManaged = FALSE; + sRegionMap->bgNum = 2; + sRegionMap->charBaseIdx = 2; + sRegionMap->mapBaseIdx = 28; + sRegionMap->bgManaged = FALSE; } } void ShowRegionMapForPokedexAreaScreen(struct RegionMap *regionMap) { - gRegionMap = regionMap; + sRegionMap = regionMap; InitMapBasedOnPlayerLocation(); - gRegionMap->playerIconSpritePosX = gRegionMap->cursorPosX; - gRegionMap->playerIconSpritePosY = gRegionMap->cursorPosY; + sRegionMap->playerIconSpritePosX = sRegionMap->cursorPosX; + sRegionMap->playerIconSpritePosY = sRegionMap->cursorPosY; } bool8 LoadRegionMapGfx(void) { - switch (gRegionMap->initStep) + switch (sRegionMap->initStep) { case 0: - if (gRegionMap->bgManaged) - DecompressAndCopyTileDataToVram(gRegionMap->bgNum, sRegionMapBg_GfxLZ, 0, 0, 0); + if (sRegionMap->bgManaged) + DecompressAndCopyTileDataToVram(sRegionMap->bgNum, sRegionMapBg_GfxLZ, 0, 0, 0); else LZ77UnCompVram(sRegionMapBg_GfxLZ, (u16 *)BG_CHAR_ADDR(2)); break; case 1: - if (gRegionMap->bgManaged) + if (sRegionMap->bgManaged) { if (!FreeTempTileDataBuffersIfPossible()) - DecompressAndCopyTileDataToVram(gRegionMap->bgNum, sRegionMapBg_TilemapLZ, 0, 0, 1); + DecompressAndCopyTileDataToVram(sRegionMap->bgNum, sRegionMapBg_TilemapLZ, 0, 0, 1); } else { @@ -570,54 +570,54 @@ bool8 LoadRegionMapGfx(void) LoadPalette(sRegionMapBg_Pal, 0x70, 0x60); break; case 3: - LZ77UnCompWram(sRegionMapCursorSmallGfxLZ, gRegionMap->cursorSmallImage); + LZ77UnCompWram(sRegionMapCursorSmallGfxLZ, sRegionMap->cursorSmallImage); break; case 4: - LZ77UnCompWram(sRegionMapCursorLargeGfxLZ, gRegionMap->cursorLargeImage); + LZ77UnCompWram(sRegionMapCursorLargeGfxLZ, sRegionMap->cursorLargeImage); break; case 5: InitMapBasedOnPlayerLocation(); - gRegionMap->playerIconSpritePosX = gRegionMap->cursorPosX; - gRegionMap->playerIconSpritePosY = gRegionMap->cursorPosY; - gRegionMap->mapSecId = CorrectSpecialMapSecId_Internal(gRegionMap->mapSecId); - gRegionMap->mapSecType = GetMapsecType(gRegionMap->mapSecId); - GetMapName(gRegionMap->mapSecName, gRegionMap->mapSecId, MAP_NAME_LENGTH); + sRegionMap->playerIconSpritePosX = sRegionMap->cursorPosX; + sRegionMap->playerIconSpritePosY = sRegionMap->cursorPosY; + sRegionMap->mapSecId = CorrectSpecialMapSecId_Internal(sRegionMap->mapSecId); + sRegionMap->mapSecType = GetMapsecType(sRegionMap->mapSecId); + GetMapName(sRegionMap->mapSecName, sRegionMap->mapSecId, MAP_NAME_LENGTH); break; case 6: - if (gRegionMap->zoomed == FALSE) + if (sRegionMap->zoomed == FALSE) { CalcZoomScrollParams(0, 0, 0, 0, 0x100, 0x100, 0); } else { - gRegionMap->scrollX = gRegionMap->cursorPosX * 8 - 0x34; - gRegionMap->scrollY = gRegionMap->cursorPosY * 8 - 0x44; - gRegionMap->zoomedCursorPosX = gRegionMap->cursorPosX; - gRegionMap->zoomedCursorPosY = gRegionMap->cursorPosY; - CalcZoomScrollParams(gRegionMap->scrollX, gRegionMap->scrollY, 0x38, 0x48, 0x80, 0x80, 0); + sRegionMap->scrollX = sRegionMap->cursorPosX * 8 - 0x34; + sRegionMap->scrollY = sRegionMap->cursorPosY * 8 - 0x44; + sRegionMap->zoomedCursorPosX = sRegionMap->cursorPosX; + sRegionMap->zoomedCursorPosY = sRegionMap->cursorPosY; + CalcZoomScrollParams(sRegionMap->scrollX, sRegionMap->scrollY, 0x38, 0x48, 0x80, 0x80, 0); } break; case 7: GetPositionOfCursorWithinMapSec(); UpdateRegionMapVideoRegs(); - gRegionMap->cursorSprite = NULL; - gRegionMap->playerIconSprite = NULL; - gRegionMap->cursorMovementFrameCounter = 0; - gRegionMap->blinkPlayerIcon = FALSE; - if (gRegionMap->bgManaged) + sRegionMap->cursorSprite = NULL; + sRegionMap->playerIconSprite = NULL; + sRegionMap->cursorMovementFrameCounter = 0; + sRegionMap->blinkPlayerIcon = FALSE; + if (sRegionMap->bgManaged) { - SetBgAttribute(gRegionMap->bgNum, BG_ATTR_SCREENSIZE, 2); - SetBgAttribute(gRegionMap->bgNum, BG_ATTR_CHARBASEINDEX, gRegionMap->charBaseIdx); - SetBgAttribute(gRegionMap->bgNum, BG_ATTR_MAPBASEINDEX, gRegionMap->mapBaseIdx); - SetBgAttribute(gRegionMap->bgNum, BG_ATTR_WRAPAROUND, 1); - SetBgAttribute(gRegionMap->bgNum, BG_ATTR_PALETTEMODE, 1); + SetBgAttribute(sRegionMap->bgNum, BG_ATTR_SCREENSIZE, 2); + SetBgAttribute(sRegionMap->bgNum, BG_ATTR_CHARBASEINDEX, sRegionMap->charBaseIdx); + SetBgAttribute(sRegionMap->bgNum, BG_ATTR_MAPBASEINDEX, sRegionMap->mapBaseIdx); + SetBgAttribute(sRegionMap->bgNum, BG_ATTR_WRAPAROUND, 1); + SetBgAttribute(sRegionMap->bgNum, BG_ATTR_PALETTEMODE, 1); } - gRegionMap->initStep++; + sRegionMap->initStep++; return FALSE; default: return FALSE; } - gRegionMap->initStep++; + sRegionMap->initStep++; return TRUE; } @@ -629,23 +629,23 @@ void BlendRegionMap(u16 color, u32 coeff) void FreeRegionMapIconResources(void) { - if (gRegionMap->cursorSprite != NULL) + if (sRegionMap->cursorSprite != NULL) { - DestroySprite(gRegionMap->cursorSprite); - FreeSpriteTilesByTag(gRegionMap->cursorTileTag); - FreeSpritePaletteByTag(gRegionMap->cursorPaletteTag); + DestroySprite(sRegionMap->cursorSprite); + FreeSpriteTilesByTag(sRegionMap->cursorTileTag); + FreeSpritePaletteByTag(sRegionMap->cursorPaletteTag); } - if (gRegionMap->playerIconSprite != NULL) + if (sRegionMap->playerIconSprite != NULL) { - DestroySprite(gRegionMap->playerIconSprite); - FreeSpriteTilesByTag(gRegionMap->playerIconTileTag); - FreeSpritePaletteByTag(gRegionMap->playerIconPaletteTag); + DestroySprite(sRegionMap->playerIconSprite); + FreeSpriteTilesByTag(sRegionMap->playerIconTileTag); + FreeSpritePaletteByTag(sRegionMap->playerIconPaletteTag); } } u8 DoRegionMapInputCallback(void) { - return gRegionMap->inputCallback(); + return sRegionMap->inputCallback(); } static u8 ProcessRegionMapInput_Full(void) @@ -653,26 +653,26 @@ static u8 ProcessRegionMapInput_Full(void) u8 input; input = MAP_INPUT_NONE; - gRegionMap->cursorDeltaX = 0; - gRegionMap->cursorDeltaY = 0; - if (JOY_HELD(DPAD_UP) && gRegionMap->cursorPosY > MAPCURSOR_Y_MIN) + sRegionMap->cursorDeltaX = 0; + sRegionMap->cursorDeltaY = 0; + if (JOY_HELD(DPAD_UP) && sRegionMap->cursorPosY > MAPCURSOR_Y_MIN) { - gRegionMap->cursorDeltaY = -1; + sRegionMap->cursorDeltaY = -1; input = MAP_INPUT_MOVE_START; } - if (JOY_HELD(DPAD_DOWN) && gRegionMap->cursorPosY < MAPCURSOR_Y_MAX) + if (JOY_HELD(DPAD_DOWN) && sRegionMap->cursorPosY < MAPCURSOR_Y_MAX) { - gRegionMap->cursorDeltaY = +1; + sRegionMap->cursorDeltaY = +1; input = MAP_INPUT_MOVE_START; } - if (JOY_HELD(DPAD_LEFT) && gRegionMap->cursorPosX > MAPCURSOR_X_MIN) + if (JOY_HELD(DPAD_LEFT) && sRegionMap->cursorPosX > MAPCURSOR_X_MIN) { - gRegionMap->cursorDeltaX = -1; + sRegionMap->cursorDeltaX = -1; input = MAP_INPUT_MOVE_START; } - if (JOY_HELD(DPAD_RIGHT) && gRegionMap->cursorPosX < MAPCURSOR_X_MAX) + if (JOY_HELD(DPAD_RIGHT) && sRegionMap->cursorPosX < MAPCURSOR_X_MAX) { - gRegionMap->cursorDeltaX = +1; + sRegionMap->cursorDeltaX = +1; input = MAP_INPUT_MOVE_START; } if (JOY_NEW(A_BUTTON)) @@ -685,8 +685,8 @@ static u8 ProcessRegionMapInput_Full(void) } if (input == MAP_INPUT_MOVE_START) { - gRegionMap->cursorMovementFrameCounter = 4; - gRegionMap->inputCallback = MoveRegionMapCursor_Full; + sRegionMap->cursorMovementFrameCounter = 4; + sRegionMap->inputCallback = MoveRegionMapCursor_Full; } return input; } @@ -695,35 +695,35 @@ static u8 MoveRegionMapCursor_Full(void) { u16 mapSecId; - if (gRegionMap->cursorMovementFrameCounter != 0) + if (sRegionMap->cursorMovementFrameCounter != 0) return MAP_INPUT_MOVE_CONT; - if (gRegionMap->cursorDeltaX > 0) + if (sRegionMap->cursorDeltaX > 0) { - gRegionMap->cursorPosX++; + sRegionMap->cursorPosX++; } - if (gRegionMap->cursorDeltaX < 0) + if (sRegionMap->cursorDeltaX < 0) { - gRegionMap->cursorPosX--; + sRegionMap->cursorPosX--; } - if (gRegionMap->cursorDeltaY > 0) + if (sRegionMap->cursorDeltaY > 0) { - gRegionMap->cursorPosY++; + sRegionMap->cursorPosY++; } - if (gRegionMap->cursorDeltaY < 0) + if (sRegionMap->cursorDeltaY < 0) { - gRegionMap->cursorPosY--; + sRegionMap->cursorPosY--; } - mapSecId = GetMapSecIdAt(gRegionMap->cursorPosX, gRegionMap->cursorPosY); - gRegionMap->mapSecType = GetMapsecType(mapSecId); - if (mapSecId != gRegionMap->mapSecId) + mapSecId = GetMapSecIdAt(sRegionMap->cursorPosX, sRegionMap->cursorPosY); + sRegionMap->mapSecType = GetMapsecType(mapSecId); + if (mapSecId != sRegionMap->mapSecId) { - gRegionMap->mapSecId = mapSecId; - GetMapName(gRegionMap->mapSecName, gRegionMap->mapSecId, MAP_NAME_LENGTH); + sRegionMap->mapSecId = mapSecId; + GetMapName(sRegionMap->mapSecName, sRegionMap->mapSecId, MAP_NAME_LENGTH); } GetPositionOfCursorWithinMapSec(); - gRegionMap->inputCallback = ProcessRegionMapInput_Full; + sRegionMap->inputCallback = ProcessRegionMapInput_Full; return MAP_INPUT_MOVE_END; } @@ -732,26 +732,26 @@ static u8 ProcessRegionMapInput_Zoomed(void) u8 input; input = MAP_INPUT_NONE; - gRegionMap->zoomedCursorDeltaX = 0; - gRegionMap->zoomedCursorDeltaY = 0; - if (JOY_HELD(DPAD_UP) && gRegionMap->scrollY > -0x34) + sRegionMap->zoomedCursorDeltaX = 0; + sRegionMap->zoomedCursorDeltaY = 0; + if (JOY_HELD(DPAD_UP) && sRegionMap->scrollY > -0x34) { - gRegionMap->zoomedCursorDeltaY = -1; + sRegionMap->zoomedCursorDeltaY = -1; input = MAP_INPUT_MOVE_START; } - if (JOY_HELD(DPAD_DOWN) && gRegionMap->scrollY < 0x3c) + if (JOY_HELD(DPAD_DOWN) && sRegionMap->scrollY < 0x3c) { - gRegionMap->zoomedCursorDeltaY = +1; + sRegionMap->zoomedCursorDeltaY = +1; input = MAP_INPUT_MOVE_START; } - if (JOY_HELD(DPAD_LEFT) && gRegionMap->scrollX > -0x2c) + if (JOY_HELD(DPAD_LEFT) && sRegionMap->scrollX > -0x2c) { - gRegionMap->zoomedCursorDeltaX = -1; + sRegionMap->zoomedCursorDeltaX = -1; input = MAP_INPUT_MOVE_START; } - if (JOY_HELD(DPAD_RIGHT) && gRegionMap->scrollX < 0xac) + if (JOY_HELD(DPAD_RIGHT) && sRegionMap->scrollX < 0xac) { - gRegionMap->zoomedCursorDeltaX = +1; + sRegionMap->zoomedCursorDeltaX = +1; input = MAP_INPUT_MOVE_START; } if (JOY_NEW(A_BUTTON)) @@ -764,8 +764,8 @@ static u8 ProcessRegionMapInput_Zoomed(void) } if (input == MAP_INPUT_MOVE_START) { - gRegionMap->inputCallback = MoveRegionMapCursor_Zoomed; - gRegionMap->zoomedCursorMovementFrameCounter = 0; + sRegionMap->inputCallback = MoveRegionMapCursor_Zoomed; + sRegionMap->zoomedCursorMovementFrameCounter = 0; } return input; } @@ -776,29 +776,29 @@ static u8 MoveRegionMapCursor_Zoomed(void) u16 y; u16 mapSecId; - gRegionMap->scrollY += gRegionMap->zoomedCursorDeltaY; - gRegionMap->scrollX += gRegionMap->zoomedCursorDeltaX; - RegionMap_SetBG2XAndBG2Y(gRegionMap->scrollX, gRegionMap->scrollY); - gRegionMap->zoomedCursorMovementFrameCounter++; - if (gRegionMap->zoomedCursorMovementFrameCounter == 8) + sRegionMap->scrollY += sRegionMap->zoomedCursorDeltaY; + sRegionMap->scrollX += sRegionMap->zoomedCursorDeltaX; + RegionMap_SetBG2XAndBG2Y(sRegionMap->scrollX, sRegionMap->scrollY); + sRegionMap->zoomedCursorMovementFrameCounter++; + if (sRegionMap->zoomedCursorMovementFrameCounter == 8) { - x = (gRegionMap->scrollX + 0x2c) / 8 + 1; - y = (gRegionMap->scrollY + 0x34) / 8 + 2; - if (x != gRegionMap->zoomedCursorPosX || y != gRegionMap->zoomedCursorPosY) + x = (sRegionMap->scrollX + 0x2c) / 8 + 1; + y = (sRegionMap->scrollY + 0x34) / 8 + 2; + if (x != sRegionMap->zoomedCursorPosX || y != sRegionMap->zoomedCursorPosY) { - gRegionMap->zoomedCursorPosX = x; - gRegionMap->zoomedCursorPosY = y; + sRegionMap->zoomedCursorPosX = x; + sRegionMap->zoomedCursorPosY = y; mapSecId = GetMapSecIdAt(x, y); - gRegionMap->mapSecType = GetMapsecType(mapSecId); - if (mapSecId != gRegionMap->mapSecId) + sRegionMap->mapSecType = GetMapsecType(mapSecId); + if (mapSecId != sRegionMap->mapSecId) { - gRegionMap->mapSecId = mapSecId; - GetMapName(gRegionMap->mapSecName, gRegionMap->mapSecId, MAP_NAME_LENGTH); + sRegionMap->mapSecId = mapSecId; + GetMapName(sRegionMap->mapSecName, sRegionMap->mapSecId, MAP_NAME_LENGTH); } GetPositionOfCursorWithinMapSec(); } - gRegionMap->zoomedCursorMovementFrameCounter = 0; - gRegionMap->inputCallback = ProcessRegionMapInput_Zoomed; + sRegionMap->zoomedCursorMovementFrameCounter = 0; + sRegionMap->inputCallback = ProcessRegionMapInput_Zoomed; return MAP_INPUT_MOVE_END; } return MAP_INPUT_MOVE_CONT; @@ -806,35 +806,35 @@ static u8 MoveRegionMapCursor_Zoomed(void) void SetRegionMapDataForZoom(void) { - if (gRegionMap->zoomed == FALSE) + if (sRegionMap->zoomed == FALSE) { - gRegionMap->scrollY = 0; - gRegionMap->scrollX = 0; - gRegionMap->unk_040 = 0; - gRegionMap->unk_03c = 0; - gRegionMap->unk_060 = gRegionMap->cursorPosX * 8 - 0x34; - gRegionMap->unk_062 = gRegionMap->cursorPosY * 8 - 0x44; - gRegionMap->unk_044 = (gRegionMap->unk_060 << 8) / 16; - gRegionMap->unk_048 = (gRegionMap->unk_062 << 8) / 16; - gRegionMap->zoomedCursorPosX = gRegionMap->cursorPosX; - gRegionMap->zoomedCursorPosY = gRegionMap->cursorPosY; - gRegionMap->unk_04c = 0x10000; - gRegionMap->unk_050 = -0x800; + sRegionMap->scrollY = 0; + sRegionMap->scrollX = 0; + sRegionMap->unk_040 = 0; + sRegionMap->unk_03c = 0; + sRegionMap->unk_060 = sRegionMap->cursorPosX * 8 - 0x34; + sRegionMap->unk_062 = sRegionMap->cursorPosY * 8 - 0x44; + sRegionMap->unk_044 = (sRegionMap->unk_060 << 8) / 16; + sRegionMap->unk_048 = (sRegionMap->unk_062 << 8) / 16; + sRegionMap->zoomedCursorPosX = sRegionMap->cursorPosX; + sRegionMap->zoomedCursorPosY = sRegionMap->cursorPosY; + sRegionMap->unk_04c = 0x10000; + sRegionMap->unk_050 = -0x800; } else { - gRegionMap->unk_03c = gRegionMap->scrollX * 0x100; - gRegionMap->unk_040 = gRegionMap->scrollY * 0x100; - gRegionMap->unk_060 = 0; - gRegionMap->unk_062 = 0; - gRegionMap->unk_044 = -(gRegionMap->unk_03c / 16); - gRegionMap->unk_048 = -(gRegionMap->unk_040 / 16); - gRegionMap->cursorPosX = gRegionMap->zoomedCursorPosX; - gRegionMap->cursorPosY = gRegionMap->zoomedCursorPosY; - gRegionMap->unk_04c = 0x8000; - gRegionMap->unk_050 = 0x800; + sRegionMap->unk_03c = sRegionMap->scrollX * 0x100; + sRegionMap->unk_040 = sRegionMap->scrollY * 0x100; + sRegionMap->unk_060 = 0; + sRegionMap->unk_062 = 0; + sRegionMap->unk_044 = -(sRegionMap->unk_03c / 16); + sRegionMap->unk_048 = -(sRegionMap->unk_040 / 16); + sRegionMap->cursorPosX = sRegionMap->zoomedCursorPosX; + sRegionMap->cursorPosY = sRegionMap->zoomedCursorPosY; + sRegionMap->unk_04c = 0x8000; + sRegionMap->unk_050 = 0x800; } - gRegionMap->unk_06e = 0; + sRegionMap->unk_06e = 0; FreeRegionMapCursorSprite(); HideRegionMapPlayerIcon(); } @@ -843,60 +843,60 @@ bool8 UpdateRegionMapZoom(void) { bool8 retVal; - if (gRegionMap->unk_06e >= 16) + if (sRegionMap->unk_06e >= 16) { return FALSE; } - gRegionMap->unk_06e++; - if (gRegionMap->unk_06e == 16) + sRegionMap->unk_06e++; + if (sRegionMap->unk_06e == 16) { - gRegionMap->unk_044 = 0; - gRegionMap->unk_048 = 0; - gRegionMap->scrollX = gRegionMap->unk_060; - gRegionMap->scrollY = gRegionMap->unk_062; - gRegionMap->unk_04c = (gRegionMap->zoomed == FALSE) ? (128 << 8) : (256 << 8); - gRegionMap->zoomed = !gRegionMap->zoomed; - gRegionMap->inputCallback = (gRegionMap->zoomed == FALSE) ? ProcessRegionMapInput_Full : ProcessRegionMapInput_Zoomed; - CreateRegionMapCursor(gRegionMap->cursorTileTag, gRegionMap->cursorPaletteTag); + sRegionMap->unk_044 = 0; + sRegionMap->unk_048 = 0; + sRegionMap->scrollX = sRegionMap->unk_060; + sRegionMap->scrollY = sRegionMap->unk_062; + sRegionMap->unk_04c = (sRegionMap->zoomed == FALSE) ? (128 << 8) : (256 << 8); + sRegionMap->zoomed = !sRegionMap->zoomed; + sRegionMap->inputCallback = (sRegionMap->zoomed == FALSE) ? ProcessRegionMapInput_Full : ProcessRegionMapInput_Zoomed; + CreateRegionMapCursor(sRegionMap->cursorTileTag, sRegionMap->cursorPaletteTag); UnhideRegionMapPlayerIcon(); retVal = FALSE; } else { - gRegionMap->unk_03c += gRegionMap->unk_044; - gRegionMap->unk_040 += gRegionMap->unk_048; - gRegionMap->scrollX = gRegionMap->unk_03c >> 8; - gRegionMap->scrollY = gRegionMap->unk_040 >> 8; - gRegionMap->unk_04c += gRegionMap->unk_050; - if ((gRegionMap->unk_044 < 0 && gRegionMap->scrollX < gRegionMap->unk_060) || (gRegionMap->unk_044 > 0 && gRegionMap->scrollX > gRegionMap->unk_060)) + sRegionMap->unk_03c += sRegionMap->unk_044; + sRegionMap->unk_040 += sRegionMap->unk_048; + sRegionMap->scrollX = sRegionMap->unk_03c >> 8; + sRegionMap->scrollY = sRegionMap->unk_040 >> 8; + sRegionMap->unk_04c += sRegionMap->unk_050; + if ((sRegionMap->unk_044 < 0 && sRegionMap->scrollX < sRegionMap->unk_060) || (sRegionMap->unk_044 > 0 && sRegionMap->scrollX > sRegionMap->unk_060)) { - gRegionMap->scrollX = gRegionMap->unk_060; - gRegionMap->unk_044 = 0; + sRegionMap->scrollX = sRegionMap->unk_060; + sRegionMap->unk_044 = 0; } - if ((gRegionMap->unk_048 < 0 && gRegionMap->scrollY < gRegionMap->unk_062) || (gRegionMap->unk_048 > 0 && gRegionMap->scrollY > gRegionMap->unk_062)) + if ((sRegionMap->unk_048 < 0 && sRegionMap->scrollY < sRegionMap->unk_062) || (sRegionMap->unk_048 > 0 && sRegionMap->scrollY > sRegionMap->unk_062)) { - gRegionMap->scrollY = gRegionMap->unk_062; - gRegionMap->unk_048 = 0; + sRegionMap->scrollY = sRegionMap->unk_062; + sRegionMap->unk_048 = 0; } - if (gRegionMap->zoomed == FALSE) + if (sRegionMap->zoomed == FALSE) { - if (gRegionMap->unk_04c < (128 << 8)) + if (sRegionMap->unk_04c < (128 << 8)) { - gRegionMap->unk_04c = (128 << 8); - gRegionMap->unk_050 = 0; + sRegionMap->unk_04c = (128 << 8); + sRegionMap->unk_050 = 0; } } else { - if (gRegionMap->unk_04c > (256 << 8)) + if (sRegionMap->unk_04c > (256 << 8)) { - gRegionMap->unk_04c = (256 << 8); - gRegionMap->unk_050 = 0; + sRegionMap->unk_04c = (256 << 8); + sRegionMap->unk_050 = 0; } } retVal = TRUE; } - CalcZoomScrollParams(gRegionMap->scrollX, gRegionMap->scrollY, 0x38, 0x48, gRegionMap->unk_04c >> 8, gRegionMap->unk_04c >> 8, 0); + CalcZoomScrollParams(sRegionMap->scrollX, sRegionMap->scrollY, 0x38, 0x48, sRegionMap->unk_04c >> 8, sRegionMap->unk_04c >> 8, 0); return retVal; } @@ -907,42 +907,42 @@ static void CalcZoomScrollParams(s16 scrollX, s16 scrollY, s16 c, s16 d, u16 e, s32 var3; s32 var4; - gRegionMap->bg2pa = e * gSineTable[rotation + 64] >> 8; - gRegionMap->bg2pc = e * -gSineTable[rotation] >> 8; - gRegionMap->bg2pb = f * gSineTable[rotation] >> 8; - gRegionMap->bg2pd = f * gSineTable[rotation + 64] >> 8; + sRegionMap->bg2pa = e * gSineTable[rotation + 64] >> 8; + sRegionMap->bg2pc = e * -gSineTable[rotation] >> 8; + sRegionMap->bg2pb = f * gSineTable[rotation] >> 8; + sRegionMap->bg2pd = f * gSineTable[rotation + 64] >> 8; var1 = (scrollX << 8) + (c << 8); - var2 = d * gRegionMap->bg2pb + gRegionMap->bg2pa * c; - gRegionMap->bg2x = var1 - var2; + var2 = d * sRegionMap->bg2pb + sRegionMap->bg2pa * c; + sRegionMap->bg2x = var1 - var2; var3 = (scrollY << 8) + (d << 8); - var4 = gRegionMap->bg2pd * d + gRegionMap->bg2pc * c; - gRegionMap->bg2y = var3 - var4; + var4 = sRegionMap->bg2pd * d + sRegionMap->bg2pc * c; + sRegionMap->bg2y = var3 - var4; - gRegionMap->needUpdateVideoRegs = TRUE; + sRegionMap->needUpdateVideoRegs = TRUE; } static void RegionMap_SetBG2XAndBG2Y(s16 x, s16 y) { - gRegionMap->bg2x = (x << 8) + 0x1c00; - gRegionMap->bg2y = (y << 8) + 0x2400; - gRegionMap->needUpdateVideoRegs = TRUE; + sRegionMap->bg2x = (x << 8) + 0x1c00; + sRegionMap->bg2y = (y << 8) + 0x2400; + sRegionMap->needUpdateVideoRegs = TRUE; } void UpdateRegionMapVideoRegs(void) { - if (gRegionMap->needUpdateVideoRegs) + if (sRegionMap->needUpdateVideoRegs) { - SetGpuReg(REG_OFFSET_BG2PA, gRegionMap->bg2pa); - SetGpuReg(REG_OFFSET_BG2PB, gRegionMap->bg2pb); - SetGpuReg(REG_OFFSET_BG2PC, gRegionMap->bg2pc); - SetGpuReg(REG_OFFSET_BG2PD, gRegionMap->bg2pd); - SetGpuReg(REG_OFFSET_BG2X_L, gRegionMap->bg2x); - SetGpuReg(REG_OFFSET_BG2X_H, gRegionMap->bg2x >> 16); - SetGpuReg(REG_OFFSET_BG2Y_L, gRegionMap->bg2y); - SetGpuReg(REG_OFFSET_BG2Y_H, gRegionMap->bg2y >> 16); - gRegionMap->needUpdateVideoRegs = FALSE; + SetGpuReg(REG_OFFSET_BG2PA, sRegionMap->bg2pa); + SetGpuReg(REG_OFFSET_BG2PB, sRegionMap->bg2pb); + SetGpuReg(REG_OFFSET_BG2PC, sRegionMap->bg2pc); + SetGpuReg(REG_OFFSET_BG2PD, sRegionMap->bg2pd); + SetGpuReg(REG_OFFSET_BG2X_L, sRegionMap->bg2x); + SetGpuReg(REG_OFFSET_BG2X_H, sRegionMap->bg2x >> 16); + SetGpuReg(REG_OFFSET_BG2Y_L, sRegionMap->bg2y); + SetGpuReg(REG_OFFSET_BG2Y_H, sRegionMap->bg2y >> 16); + sRegionMap->needUpdateVideoRegs = FALSE; } } @@ -950,10 +950,10 @@ void PokedexAreaScreen_UpdateRegionMapVariablesAndVideoRegs(s16 x, s16 y) { CalcZoomScrollParams(x, y, 0x38, 0x48, 0x100, 0x100, 0); UpdateRegionMapVideoRegs(); - if (gRegionMap->playerIconSprite != NULL) + if (sRegionMap->playerIconSprite != NULL) { - gRegionMap->playerIconSprite->x2 = -x; - gRegionMap->playerIconSprite->y2 = -y; + sRegionMap->playerIconSprite->x2 = -x; + sRegionMap->playerIconSprite->y2 = -y; } } @@ -996,22 +996,22 @@ static void InitMapBasedOnPlayerLocation(void) case MAP_TYPE_ROUTE: case MAP_TYPE_UNDERWATER: case MAP_TYPE_OCEAN_ROUTE: - gRegionMap->mapSecId = gMapHeader.regionMapSectionId; - gRegionMap->playerIsInCave = FALSE; + sRegionMap->mapSecId = gMapHeader.regionMapSectionId; + sRegionMap->playerIsInCave = FALSE; mapWidth = gMapHeader.mapLayout->width; mapHeight = gMapHeader.mapLayout->height; x = gSaveBlock1Ptr->pos.x; y = gSaveBlock1Ptr->pos.y; - if (gRegionMap->mapSecId == MAPSEC_UNDERWATER_SEAFLOOR_CAVERN || gRegionMap->mapSecId == MAPSEC_UNDERWATER_MARINE_CAVE) - gRegionMap->playerIsInCave = TRUE; + if (sRegionMap->mapSecId == MAPSEC_UNDERWATER_SEAFLOOR_CAVERN || sRegionMap->mapSecId == MAPSEC_UNDERWATER_MARINE_CAVE) + sRegionMap->playerIsInCave = TRUE; break; case MAP_TYPE_UNDERGROUND: case MAP_TYPE_UNKNOWN: if (gMapHeader.allowEscaping) { mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->escapeWarp.mapGroup, gSaveBlock1Ptr->escapeWarp.mapNum); - gRegionMap->mapSecId = mapHeader->regionMapSectionId; - gRegionMap->playerIsInCave = TRUE; + sRegionMap->mapSecId = mapHeader->regionMapSectionId; + sRegionMap->playerIsInCave = TRUE; mapWidth = mapHeader->mapLayout->width; mapHeight = mapHeader->mapLayout->height; x = gSaveBlock1Ptr->escapeWarp.x; @@ -1019,8 +1019,8 @@ static void InitMapBasedOnPlayerLocation(void) } else { - gRegionMap->mapSecId = gMapHeader.regionMapSectionId; - gRegionMap->playerIsInCave = TRUE; + sRegionMap->mapSecId = gMapHeader.regionMapSectionId; + sRegionMap->playerIsInCave = TRUE; mapWidth = 1; mapHeight = 1; x = 1; @@ -1029,16 +1029,16 @@ static void InitMapBasedOnPlayerLocation(void) break; case MAP_TYPE_SECRET_BASE: mapHeader = Overworld_GetMapHeaderByGroupAndId((u16)gSaveBlock1Ptr->dynamicWarp.mapGroup, (u16)gSaveBlock1Ptr->dynamicWarp.mapNum); - gRegionMap->mapSecId = mapHeader->regionMapSectionId; - gRegionMap->playerIsInCave = TRUE; + sRegionMap->mapSecId = mapHeader->regionMapSectionId; + sRegionMap->playerIsInCave = TRUE; mapWidth = mapHeader->mapLayout->width; mapHeight = mapHeader->mapLayout->height; x = gSaveBlock1Ptr->dynamicWarp.x; y = gSaveBlock1Ptr->dynamicWarp.y; break; case MAP_TYPE_INDOOR: - gRegionMap->mapSecId = gMapHeader.regionMapSectionId; - if (gRegionMap->mapSecId != MAPSEC_DYNAMIC) + sRegionMap->mapSecId = gMapHeader.regionMapSectionId; + if (sRegionMap->mapSecId != MAPSEC_DYNAMIC) { warp = &gSaveBlock1Ptr->escapeWarp; mapHeader = Overworld_GetMapHeaderByGroupAndId(warp->mapGroup, warp->mapNum); @@ -1047,13 +1047,13 @@ static void InitMapBasedOnPlayerLocation(void) { warp = &gSaveBlock1Ptr->dynamicWarp; mapHeader = Overworld_GetMapHeaderByGroupAndId(warp->mapGroup, warp->mapNum); - gRegionMap->mapSecId = mapHeader->regionMapSectionId; + sRegionMap->mapSecId = mapHeader->regionMapSectionId; } - if (IsPlayerInAquaHideout(gRegionMap->mapSecId)) - gRegionMap->playerIsInCave = TRUE; + if (IsPlayerInAquaHideout(sRegionMap->mapSecId)) + sRegionMap->playerIsInCave = TRUE; else - gRegionMap->playerIsInCave = FALSE; + sRegionMap->playerIsInCave = FALSE; mapWidth = mapHeader->mapLayout->width; mapHeight = mapHeader->mapLayout->height; @@ -1064,29 +1064,29 @@ static void InitMapBasedOnPlayerLocation(void) xOnMap = x; - dimensionScale = mapWidth / gRegionMapEntries[gRegionMap->mapSecId].width; + dimensionScale = mapWidth / gRegionMapEntries[sRegionMap->mapSecId].width; if (dimensionScale == 0) { dimensionScale = 1; } x /= dimensionScale; - if (x >= gRegionMapEntries[gRegionMap->mapSecId].width) + if (x >= gRegionMapEntries[sRegionMap->mapSecId].width) { - x = gRegionMapEntries[gRegionMap->mapSecId].width - 1; + x = gRegionMapEntries[sRegionMap->mapSecId].width - 1; } - dimensionScale = mapHeight / gRegionMapEntries[gRegionMap->mapSecId].height; + dimensionScale = mapHeight / gRegionMapEntries[sRegionMap->mapSecId].height; if (dimensionScale == 0) { dimensionScale = 1; } y /= dimensionScale; - if (y >= gRegionMapEntries[gRegionMap->mapSecId].height) + if (y >= gRegionMapEntries[sRegionMap->mapSecId].height) { - y = gRegionMapEntries[gRegionMap->mapSecId].height - 1; + y = gRegionMapEntries[sRegionMap->mapSecId].height - 1; } - switch (gRegionMap->mapSecId) + switch (sRegionMap->mapSecId) { case MAPSEC_ROUTE_114: if (y != 0) @@ -1116,11 +1116,11 @@ static void InitMapBasedOnPlayerLocation(void) x++; break; case MAPSEC_UNDERWATER_MARINE_CAVE: - GetMarineCaveCoords(&gRegionMap->cursorPosX, &gRegionMap->cursorPosY); + GetMarineCaveCoords(&sRegionMap->cursorPosX, &sRegionMap->cursorPosY); return; } - gRegionMap->cursorPosX = gRegionMapEntries[gRegionMap->mapSecId].x + x + MAPCURSOR_X_MIN; - gRegionMap->cursorPosY = gRegionMapEntries[gRegionMap->mapSecId].y + y + MAPCURSOR_Y_MIN; + sRegionMap->cursorPosX = gRegionMapEntries[sRegionMap->mapSecId].x + x + MAPCURSOR_X_MIN; + sRegionMap->cursorPosY = gRegionMapEntries[sRegionMap->mapSecId].y + y + MAPCURSOR_Y_MIN; } static void RegionMap_InitializeStateBasedOnSSTidalLocation(void) @@ -1139,40 +1139,40 @@ static void RegionMap_InitializeStateBasedOnSSTidalLocation(void) switch (GetSSTidalLocation(&mapGroup, &mapNum, &xOnMap, &yOnMap)) { case SS_TIDAL_LOCATION_SLATEPORT: - gRegionMap->mapSecId = MAPSEC_SLATEPORT_CITY; + sRegionMap->mapSecId = MAPSEC_SLATEPORT_CITY; break; case SS_TIDAL_LOCATION_LILYCOVE: - gRegionMap->mapSecId = MAPSEC_LILYCOVE_CITY; + sRegionMap->mapSecId = MAPSEC_LILYCOVE_CITY; break; case SS_TIDAL_LOCATION_ROUTE124: - gRegionMap->mapSecId = MAPSEC_ROUTE_124; + sRegionMap->mapSecId = MAPSEC_ROUTE_124; break; case SS_TIDAL_LOCATION_ROUTE131: - gRegionMap->mapSecId = MAPSEC_ROUTE_131; + sRegionMap->mapSecId = MAPSEC_ROUTE_131; break; default: case SS_TIDAL_LOCATION_CURRENTS: mapHeader = Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum); - gRegionMap->mapSecId = mapHeader->regionMapSectionId; - dimensionScale = mapHeader->mapLayout->width / gRegionMapEntries[gRegionMap->mapSecId].width; + sRegionMap->mapSecId = mapHeader->regionMapSectionId; + dimensionScale = mapHeader->mapLayout->width / gRegionMapEntries[sRegionMap->mapSecId].width; if (dimensionScale == 0) dimensionScale = 1; x = xOnMap / dimensionScale; - if (x >= gRegionMapEntries[gRegionMap->mapSecId].width) - x = gRegionMapEntries[gRegionMap->mapSecId].width - 1; + if (x >= gRegionMapEntries[sRegionMap->mapSecId].width) + x = gRegionMapEntries[sRegionMap->mapSecId].width - 1; - dimensionScale = mapHeader->mapLayout->height / gRegionMapEntries[gRegionMap->mapSecId].height; + dimensionScale = mapHeader->mapLayout->height / gRegionMapEntries[sRegionMap->mapSecId].height; if (dimensionScale == 0) dimensionScale = 1; y = yOnMap / dimensionScale; - if (y >= gRegionMapEntries[gRegionMap->mapSecId].height) - y = gRegionMapEntries[gRegionMap->mapSecId].height - 1; + if (y >= gRegionMapEntries[sRegionMap->mapSecId].height) + y = gRegionMapEntries[sRegionMap->mapSecId].height - 1; break; } - gRegionMap->playerIsInCave = FALSE; - gRegionMap->cursorPosX = gRegionMapEntries[gRegionMap->mapSecId].x + x + MAPCURSOR_X_MIN; - gRegionMap->cursorPosY = gRegionMapEntries[gRegionMap->mapSecId].y + y + MAPCURSOR_Y_MIN; + sRegionMap->playerIsInCave = FALSE; + sRegionMap->cursorPosX = gRegionMapEntries[sRegionMap->mapSecId].x + x + MAPCURSOR_X_MIN; + sRegionMap->cursorPosY = gRegionMapEntries[sRegionMap->mapSecId].y + y + MAPCURSOR_Y_MIN; } static u8 GetMapsecType(u16 mapSecId) @@ -1300,20 +1300,20 @@ static void GetPositionOfCursorWithinMapSec(void) u16 y; u16 posWithinMapSec; - if (gRegionMap->mapSecId == MAPSEC_NONE) + if (sRegionMap->mapSecId == MAPSEC_NONE) { - gRegionMap->posWithinMapSec = 0; + sRegionMap->posWithinMapSec = 0; return; } - if (!gRegionMap->zoomed) + if (!sRegionMap->zoomed) { - x = gRegionMap->cursorPosX; - y = gRegionMap->cursorPosY; + x = sRegionMap->cursorPosX; + y = sRegionMap->cursorPosY; } else { - x = gRegionMap->zoomedCursorPosX; - y = gRegionMap->zoomedCursorPosY; + x = sRegionMap->zoomedCursorPosX; + y = sRegionMap->zoomedCursorPosY; } posWithinMapSec = 0; while (1) @@ -1333,13 +1333,13 @@ static void GetPositionOfCursorWithinMapSec(void) else { x--; - if (GetMapSecIdAt(x, y) == gRegionMap->mapSecId) + if (GetMapSecIdAt(x, y) == sRegionMap->mapSecId) { posWithinMapSec++; } } } - gRegionMap->posWithinMapSec = posWithinMapSec; + sRegionMap->posWithinMapSec = posWithinMapSec; } static bool8 RegionMap_IsMapSecIdInNextRow(u16 y) @@ -1352,7 +1352,7 @@ static bool8 RegionMap_IsMapSecIdInNextRow(u16 y) } for (x = MAPCURSOR_X_MIN; x <= MAPCURSOR_X_MAX; x++) { - if (GetMapSecIdAt(x, y) == gRegionMap->mapSecId) + if (GetMapSecIdAt(x, y) == sRegionMap->mapSecId) { return TRUE; } @@ -1362,11 +1362,11 @@ static bool8 RegionMap_IsMapSecIdInNextRow(u16 y) static void SpriteCB_CursorMapFull(struct Sprite *sprite) { - if (gRegionMap->cursorMovementFrameCounter != 0) + if (sRegionMap->cursorMovementFrameCounter != 0) { - sprite->x += 2 * gRegionMap->cursorDeltaX; - sprite->y += 2 * gRegionMap->cursorDeltaY; - gRegionMap->cursorMovementFrameCounter--; + sprite->x += 2 * sRegionMap->cursorDeltaX; + sprite->y += 2 * sRegionMap->cursorDeltaY; + sRegionMap->cursorMovementFrameCounter--; } } @@ -1386,20 +1386,20 @@ void CreateRegionMapCursor(u16 tileTag, u16 paletteTag) template = sRegionMapCursorSpriteTemplate; sheet.tag = tileTag; template.tileTag = tileTag; - gRegionMap->cursorTileTag = tileTag; + sRegionMap->cursorTileTag = tileTag; palette.tag = paletteTag; template.paletteTag = paletteTag; - gRegionMap->cursorPaletteTag = paletteTag; - if (!gRegionMap->zoomed) + sRegionMap->cursorPaletteTag = paletteTag; + if (!sRegionMap->zoomed) { - sheet.data = gRegionMap->cursorSmallImage; - sheet.size = sizeof(gRegionMap->cursorSmallImage); + sheet.data = sRegionMap->cursorSmallImage; + sheet.size = sizeof(sRegionMap->cursorSmallImage); template.callback = SpriteCB_CursorMapFull; } else { - sheet.data = gRegionMap->cursorLargeImage; - sheet.size = sizeof(gRegionMap->cursorLargeImage); + sheet.data = sRegionMap->cursorLargeImage; + sheet.size = sizeof(sRegionMap->cursorLargeImage); template.callback = SpriteCB_CursorMapZoomed; } LoadSpriteSheet(&sheet); @@ -1407,46 +1407,46 @@ void CreateRegionMapCursor(u16 tileTag, u16 paletteTag) spriteId = CreateSprite(&template, 0x38, 0x48, 0); if (spriteId != MAX_SPRITES) { - gRegionMap->cursorSprite = &gSprites[spriteId]; - if (gRegionMap->zoomed == TRUE) + sRegionMap->cursorSprite = &gSprites[spriteId]; + if (sRegionMap->zoomed == TRUE) { - gRegionMap->cursorSprite->oam.size = SPRITE_SIZE(32x32); - gRegionMap->cursorSprite->x -= 8; - gRegionMap->cursorSprite->y -= 8; - StartSpriteAnim(gRegionMap->cursorSprite, 1); + sRegionMap->cursorSprite->oam.size = SPRITE_SIZE(32x32); + sRegionMap->cursorSprite->x -= 8; + sRegionMap->cursorSprite->y -= 8; + StartSpriteAnim(sRegionMap->cursorSprite, 1); } else { - gRegionMap->cursorSprite->oam.size = SPRITE_SIZE(16x16); - gRegionMap->cursorSprite->x = 8 * gRegionMap->cursorPosX + 4; - gRegionMap->cursorSprite->y = 8 * gRegionMap->cursorPosY + 4; + sRegionMap->cursorSprite->oam.size = SPRITE_SIZE(16x16); + sRegionMap->cursorSprite->x = 8 * sRegionMap->cursorPosX + 4; + sRegionMap->cursorSprite->y = 8 * sRegionMap->cursorPosY + 4; } - gRegionMap->cursorSprite->data[1] = 2; - gRegionMap->cursorSprite->data[2] = (IndexOfSpritePaletteTag(paletteTag) << 4) + 0x101; - gRegionMap->cursorSprite->data[3] = TRUE; + sRegionMap->cursorSprite->data[1] = 2; + sRegionMap->cursorSprite->data[2] = (IndexOfSpritePaletteTag(paletteTag) << 4) + 0x101; + sRegionMap->cursorSprite->data[3] = TRUE; } } static void FreeRegionMapCursorSprite(void) { - if (gRegionMap->cursorSprite != NULL) + if (sRegionMap->cursorSprite != NULL) { - DestroySprite(gRegionMap->cursorSprite); - FreeSpriteTilesByTag(gRegionMap->cursorTileTag); - FreeSpritePaletteByTag(gRegionMap->cursorPaletteTag); + DestroySprite(sRegionMap->cursorSprite); + FreeSpriteTilesByTag(sRegionMap->cursorTileTag); + FreeSpritePaletteByTag(sRegionMap->cursorPaletteTag); } } // Unused static void SetUnkCursorSpriteData(void) { - gRegionMap->cursorSprite->data[3] = TRUE; + sRegionMap->cursorSprite->data[3] = TRUE; } // Unused static void ClearUnkCursorSpriteData(void) { - gRegionMap->cursorSprite->data[3] = FALSE; + sRegionMap->cursorSprite->data[3] = FALSE; } void CreateRegionMapPlayerIcon(u16 tileTag, u16 paletteTag) @@ -1458,7 +1458,7 @@ void CreateRegionMapPlayerIcon(u16 tileTag, u16 paletteTag) if (IsEventIslandMapSecId(gMapHeader.regionMapSectionId)) { - gRegionMap->playerIconSprite = NULL; + sRegionMap->playerIconSprite = NULL; return; } if (gSaveBlock2Ptr->playerGender == FEMALE) @@ -1469,49 +1469,49 @@ void CreateRegionMapPlayerIcon(u16 tileTag, u16 paletteTag) LoadSpriteSheet(&sheet); LoadSpritePalette(&palette); spriteId = CreateSprite(&template, 0, 0, 1); - gRegionMap->playerIconSprite = &gSprites[spriteId]; - if (!gRegionMap->zoomed) + sRegionMap->playerIconSprite = &gSprites[spriteId]; + if (!sRegionMap->zoomed) { - gRegionMap->playerIconSprite->x = gRegionMap->playerIconSpritePosX * 8 + 4; - gRegionMap->playerIconSprite->y = gRegionMap->playerIconSpritePosY * 8 + 4; - gRegionMap->playerIconSprite->callback = SpriteCB_PlayerIconMapFull; + sRegionMap->playerIconSprite->x = sRegionMap->playerIconSpritePosX * 8 + 4; + sRegionMap->playerIconSprite->y = sRegionMap->playerIconSpritePosY * 8 + 4; + sRegionMap->playerIconSprite->callback = SpriteCB_PlayerIconMapFull; } else { - gRegionMap->playerIconSprite->x = gRegionMap->playerIconSpritePosX * 16 - 0x30; - gRegionMap->playerIconSprite->y = gRegionMap->playerIconSpritePosY * 16 - 0x42; - gRegionMap->playerIconSprite->callback = SpriteCB_PlayerIconMapZoomed; + sRegionMap->playerIconSprite->x = sRegionMap->playerIconSpritePosX * 16 - 0x30; + sRegionMap->playerIconSprite->y = sRegionMap->playerIconSpritePosY * 16 - 0x42; + sRegionMap->playerIconSprite->callback = SpriteCB_PlayerIconMapZoomed; } } static void HideRegionMapPlayerIcon(void) { - if (gRegionMap->playerIconSprite != NULL) + if (sRegionMap->playerIconSprite != NULL) { - gRegionMap->playerIconSprite->invisible = TRUE; - gRegionMap->playerIconSprite->callback = SpriteCallbackDummy; + sRegionMap->playerIconSprite->invisible = TRUE; + sRegionMap->playerIconSprite->callback = SpriteCallbackDummy; } } static void UnhideRegionMapPlayerIcon(void) { - if (gRegionMap->playerIconSprite != NULL) + if (sRegionMap->playerIconSprite != NULL) { - if (gRegionMap->zoomed == TRUE) + if (sRegionMap->zoomed == TRUE) { - gRegionMap->playerIconSprite->x = gRegionMap->playerIconSpritePosX * 16 - 0x30; - gRegionMap->playerIconSprite->y = gRegionMap->playerIconSpritePosY * 16 - 0x42; - gRegionMap->playerIconSprite->callback = SpriteCB_PlayerIconMapZoomed; - gRegionMap->playerIconSprite->invisible = FALSE; + sRegionMap->playerIconSprite->x = sRegionMap->playerIconSpritePosX * 16 - 0x30; + sRegionMap->playerIconSprite->y = sRegionMap->playerIconSpritePosY * 16 - 0x42; + sRegionMap->playerIconSprite->callback = SpriteCB_PlayerIconMapZoomed; + sRegionMap->playerIconSprite->invisible = FALSE; } else { - gRegionMap->playerIconSprite->x = gRegionMap->playerIconSpritePosX * 8 + 4; - gRegionMap->playerIconSprite->y = gRegionMap->playerIconSpritePosY * 8 + 4; - gRegionMap->playerIconSprite->x2 = 0; - gRegionMap->playerIconSprite->y2 = 0; - gRegionMap->playerIconSprite->callback = SpriteCB_PlayerIconMapFull; - gRegionMap->playerIconSprite->invisible = FALSE; + sRegionMap->playerIconSprite->x = sRegionMap->playerIconSpritePosX * 8 + 4; + sRegionMap->playerIconSprite->y = sRegionMap->playerIconSpritePosY * 8 + 4; + sRegionMap->playerIconSprite->x2 = 0; + sRegionMap->playerIconSprite->y2 = 0; + sRegionMap->playerIconSprite->callback = SpriteCB_PlayerIconMapFull; + sRegionMap->playerIconSprite->invisible = FALSE; } } } @@ -1523,8 +1523,8 @@ static void UnhideRegionMapPlayerIcon(void) static void SpriteCB_PlayerIconMapZoomed(struct Sprite *sprite) { - sprite->x2 = -2 * gRegionMap->scrollX; - sprite->y2 = -2 * gRegionMap->scrollY; + sprite->x2 = -2 * sRegionMap->scrollX; + sprite->y2 = -2 * sRegionMap->scrollY; sprite->sY = sprite->y + sprite->y2 + sprite->centerToCornerVecY; sprite->sX = sprite->x + sprite->x2 + sprite->centerToCornerVecX; if (sprite->sY < -8 || sprite->sY > DISPLAY_HEIGHT + 8 || sprite->sX < -8 || sprite->sX > DISPLAY_WIDTH + 8) @@ -1545,7 +1545,7 @@ static void SpriteCB_PlayerIconMapFull(struct Sprite *sprite) static void SpriteCB_PlayerIcon(struct Sprite *sprite) { - if (gRegionMap->blinkPlayerIcon) + if (sRegionMap->blinkPlayerIcon) { if (++sprite->sTimer > 16) { @@ -1561,8 +1561,8 @@ static void SpriteCB_PlayerIcon(struct Sprite *sprite) void TrySetPlayerIconBlink(void) { - if (gRegionMap->playerIsInCave) - gRegionMap->blinkPlayerIcon = TRUE; + if (sRegionMap->playerIsInCave) + sRegionMap->blinkPlayerIcon = TRUE; } #undef sY @@ -1634,7 +1634,7 @@ static void GetMapSecDimensions(u16 mapSecId, u16 *x, u16 *y, u16 *width, u16 *h bool8 IsRegionMapZoomed(void) { - return gRegionMap->zoomed; + return sRegionMap->zoomed; } bool32 IsEventIslandMapSecId(u8 mapSecId) @@ -2024,11 +2024,7 @@ static void CB_ExitFlyMap(void) { SetMainCallback2(CB2_ReturnToPartyMenuFromFlyMap); } - if (sFlyMap != NULL) - { - free(sFlyMap); - sFlyMap = NULL; - } + TRY_FREE_AND_SET_NULL(sFlyMap); FreeAllWindowBuffers(); } break; diff --git a/src/rotating_gate.c b/src/rotating_gate.c index f839d22c30..e2fd575a18 100644 --- a/src/rotating_gate.c +++ b/src/rotating_gate.c @@ -612,12 +612,10 @@ static const u8 sRotatingGate_ArmLayout[][4 * 2] = }, }; -// ewram -static EWRAM_DATA u8 gRotatingGate_GateSpriteIds[ROTATING_GATE_PUZZLE_MAX] = {0}; -static EWRAM_DATA const struct RotatingGatePuzzle *gRotatingGate_PuzzleConfig = NULL; -static EWRAM_DATA u8 gRotatingGate_PuzzleCount = 0; +static EWRAM_DATA u8 sRotatingGate_GateSpriteIds[ROTATING_GATE_PUZZLE_MAX] = {0}; +static EWRAM_DATA const struct RotatingGatePuzzle *sRotatingGate_PuzzleConfig = NULL; +static EWRAM_DATA u8 sRotatingGate_PuzzleCount = 0; -// text static s32 GetCurrentMapRotatingGatePuzzleType(void) { if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(FORTREE_CITY_GYM) && @@ -640,9 +638,9 @@ static void RotatingGate_ResetAllGateOrientations(void) s32 i; u8 *ptr = (u8 *)GetVarPointer(VAR_TEMP_0); - for (i = 0; i < gRotatingGate_PuzzleCount; i++) + for (i = 0; i < sRotatingGate_PuzzleCount; i++) { - ptr[i] = gRotatingGate_PuzzleConfig[i].orientation; + ptr[i] = sRotatingGate_PuzzleConfig[i].orientation; } } @@ -683,12 +681,12 @@ static void RotatingGate_LoadPuzzleConfig(void) switch (puzzleType) { case PUZZLE_FORTREE_CITY_GYM: - gRotatingGate_PuzzleConfig = sRotatingGate_FortreePuzzleConfig; - gRotatingGate_PuzzleCount = ARRAY_COUNT(sRotatingGate_FortreePuzzleConfig); + sRotatingGate_PuzzleConfig = sRotatingGate_FortreePuzzleConfig; + sRotatingGate_PuzzleCount = ARRAY_COUNT(sRotatingGate_FortreePuzzleConfig); break; case PUZZLE_ROUTE110_TRICK_HOUSE_PUZZLE6: - gRotatingGate_PuzzleConfig = sRotatingGate_TrickHousePuzzleConfig; - gRotatingGate_PuzzleCount = ARRAY_COUNT(sRotatingGate_TrickHousePuzzleConfig); + sRotatingGate_PuzzleConfig = sRotatingGate_TrickHousePuzzleConfig; + sRotatingGate_PuzzleCount = ARRAY_COUNT(sRotatingGate_TrickHousePuzzleConfig); break; case PUZZLE_NONE: default: @@ -696,7 +694,7 @@ static void RotatingGate_LoadPuzzleConfig(void) } for (i = 0; i < ROTATING_GATE_PUZZLE_MAX - 1; i++) - gRotatingGate_GateSpriteIds[i] = MAX_SPRITES; + sRotatingGate_GateSpriteIds[i] = MAX_SPRITES; } static void RotatingGate_CreateGatesWithinViewport(s16 deltaX, s16 deltaY) @@ -710,15 +708,15 @@ static void RotatingGate_CreateGatesWithinViewport(s16 deltaX, s16 deltaY) s16 y = gSaveBlock1Ptr->pos.y - 2; s16 y2 = gSaveBlock1Ptr->pos.y + MAP_OFFSET_H; - for (i = 0; i < gRotatingGate_PuzzleCount; i++) + for (i = 0; i < sRotatingGate_PuzzleCount; i++) { - s16 x3 = gRotatingGate_PuzzleConfig[i].x + MAP_OFFSET; - s16 y3 = gRotatingGate_PuzzleConfig[i].y + MAP_OFFSET; + s16 x3 = sRotatingGate_PuzzleConfig[i].x + MAP_OFFSET; + s16 y3 = sRotatingGate_PuzzleConfig[i].y + MAP_OFFSET; if (y <= y3 && y2 >= y3 && x <= x3 && x2 >= x3 && - gRotatingGate_GateSpriteIds[i] == MAX_SPRITES) + sRotatingGate_GateSpriteIds[i] == MAX_SPRITES) { - gRotatingGate_GateSpriteIds[i] = RotatingGate_CreateGate(i, deltaX, deltaY); + sRotatingGate_GateSpriteIds[i] = RotatingGate_CreateGate(i, deltaX, deltaY); } } } @@ -730,7 +728,7 @@ static u8 RotatingGate_CreateGate(u8 gateId, s16 deltaX, s16 deltaY) u8 spriteId; s16 x, y; - const struct RotatingGatePuzzle *gate = &gRotatingGate_PuzzleConfig[gateId]; + const struct RotatingGatePuzzle *gate = &sRotatingGate_PuzzleConfig[gateId]; if (gate->shape == GATE_SHAPE_L1 || gate->shape == GATE_SHAPE_T1) template = sSpriteTemplate_RotatingGateRegular; @@ -827,20 +825,20 @@ static void RotatingGate_DestroyGatesOutsideViewport(void) s16 y = gSaveBlock1Ptr->pos.y - 2; s16 y2 = gSaveBlock1Ptr->pos.y + MAP_OFFSET_H; - for (i = 0; i < gRotatingGate_PuzzleCount; i++) + for (i = 0; i < sRotatingGate_PuzzleCount; i++) { - s16 xGate = gRotatingGate_PuzzleConfig[i].x + MAP_OFFSET; - s16 yGate = gRotatingGate_PuzzleConfig[i].y + MAP_OFFSET; + s16 xGate = sRotatingGate_PuzzleConfig[i].x + MAP_OFFSET; + s16 yGate = sRotatingGate_PuzzleConfig[i].y + MAP_OFFSET; - if (gRotatingGate_GateSpriteIds[i] == MAX_SPRITES) + if (sRotatingGate_GateSpriteIds[i] == MAX_SPRITES) continue; if (xGate < x || xGate > x2 || yGate < y || yGate > y2) { - struct Sprite *sprite = &gSprites[gRotatingGate_GateSpriteIds[i]]; + struct Sprite *sprite = &gSprites[sRotatingGate_GateSpriteIds[i]]; FreeSpriteOamMatrix(sprite); DestroySprite(sprite); - gRotatingGate_GateSpriteIds[i] = MAX_SPRITES; + sRotatingGate_GateSpriteIds[i] = MAX_SPRITES; } } } @@ -862,9 +860,9 @@ static s32 RotatingGate_CanRotate(u8 gateId, s32 rotationDirection) orientation = RotatingGate_GetGateOrientation(gateId); - shape = gRotatingGate_PuzzleConfig[gateId].shape; - x = gRotatingGate_PuzzleConfig[gateId].x + MAP_OFFSET; - y = gRotatingGate_PuzzleConfig[gateId].y + MAP_OFFSET; + shape = sRotatingGate_PuzzleConfig[gateId].shape; + x = sRotatingGate_PuzzleConfig[gateId].x + MAP_OFFSET; + y = sRotatingGate_PuzzleConfig[gateId].y + MAP_OFFSET; // Loop through the gate's "arms" clockwise (north, south, east, west) for (i = GATE_ARM_NORTH; i <= GATE_ARM_WEST; i++) @@ -891,15 +889,15 @@ static s32 RotatingGate_HasArm(u8 gateId, u8 armInfo) s32 isLongArm = armInfo % 2; s8 armOrientation = (arm - RotatingGate_GetGateOrientation(gateId) + 4) % 4; - s32 shape = gRotatingGate_PuzzleConfig[gateId].shape; + s32 shape = sRotatingGate_PuzzleConfig[gateId].shape; return sRotatingGate_ArmLayout[shape][armOrientation * 2 + isLongArm]; } static void RotatingGate_TriggerRotationAnimation(u8 gateId, s32 rotationDirection) { - if (gRotatingGate_GateSpriteIds[gateId] != MAX_SPRITES) + if (sRotatingGate_GateSpriteIds[gateId] != MAX_SPRITES) { - struct Sprite *sprite = &gSprites[gRotatingGate_GateSpriteIds[gateId]]; + struct Sprite *sprite = &gSprites[sRotatingGate_GateSpriteIds[gateId]]; sprite->data[1] = rotationDirection; sprite->data[2] = RotatingGate_GetGateOrientation(gateId); } @@ -957,10 +955,10 @@ bool8 CheckForRotatingGatePuzzleCollision(u8 direction, s16 x, s16 y) if (!GetCurrentMapRotatingGatePuzzleType()) return FALSE; - for (i = 0; i < gRotatingGate_PuzzleCount; i++) + for (i = 0; i < sRotatingGate_PuzzleCount; i++) { - s16 gateX = gRotatingGate_PuzzleConfig[i].x + MAP_OFFSET; - s16 gateY = gRotatingGate_PuzzleConfig[i].y + MAP_OFFSET; + s16 gateX = sRotatingGate_PuzzleConfig[i].x + MAP_OFFSET; + s16 gateY = sRotatingGate_PuzzleConfig[i].y + MAP_OFFSET; if (gateX - 2 <= x && x <= gateX + 1 && gateY - 2 <= y && y <= gateY + 1) { @@ -995,10 +993,10 @@ bool8 CheckForRotatingGatePuzzleCollisionWithoutAnimation(u8 direction, s16 x, s if (!GetCurrentMapRotatingGatePuzzleType()) return FALSE; - for (i = 0; i < gRotatingGate_PuzzleCount; i++) + for (i = 0; i < sRotatingGate_PuzzleCount; i++) { - s16 gateX = gRotatingGate_PuzzleConfig[i].x + MAP_OFFSET; - s16 gateY = gRotatingGate_PuzzleConfig[i].y + MAP_OFFSET; + s16 gateX = sRotatingGate_PuzzleConfig[i].x + MAP_OFFSET; + s16 gateY = sRotatingGate_PuzzleConfig[i].y + MAP_OFFSET; if (gateX - 2 <= x && x <= gateX + 1 && gateY - 2 <= y && y <= gateY + 1) { diff --git a/src/rotating_tile_puzzle.c b/src/rotating_tile_puzzle.c index a95d8624ed..4581f6e5be 100644 --- a/src/rotating_tile_puzzle.c +++ b/src/rotating_tile_puzzle.c @@ -98,8 +98,7 @@ void FreeRotatingTilePuzzle(void) { u8 id; - if (sRotatingTilePuzzle != NULL) - FREE_AND_SET_NULL(sRotatingTilePuzzle); + TRY_FREE_AND_SET_NULL(sRotatingTilePuzzle); id = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0); ObjectEventClearHeldMovementIfFinished(&gObjectEvents[id]); diff --git a/src/save.c b/src/save.c index dafc20868e..52cdaa5ddc 100644 --- a/src/save.c +++ b/src/save.c @@ -73,6 +73,12 @@ struct SAVEBLOCK_CHUNK(struct PokemonStorage, 8), // SECTOR_ID_PKMN_STORAGE_END }; +// These will produce an error if a save struct is larger than the space +// alloted for it in the flash. +STATIC_ASSERT(sizeof(struct SaveBlock2) <= SECTOR_DATA_SIZE, SaveBlock2FreeSpace); +STATIC_ASSERT(sizeof(struct SaveBlock1) <= SECTOR_DATA_SIZE * (SECTOR_ID_SAVEBLOCK1_END - SECTOR_ID_SAVEBLOCK1_START + 1), SaveBlock1FreeSpace); +STATIC_ASSERT(sizeof(struct PokemonStorage) <= SECTOR_DATA_SIZE * (SECTOR_ID_PKMN_STORAGE_END - SECTOR_ID_PKMN_STORAGE_START + 1), PokemonStorageFreeSpace); + u16 gLastWrittenSector; u32 gLastSaveCounter; u16 gLastKnownGoodSector; diff --git a/src/script_movement.c b/src/script_movement.c index 92f36e92d9..10517dfc8e 100644 --- a/src/script_movement.c +++ b/src/script_movement.c @@ -6,7 +6,6 @@ #include "constants/event_objects.h" #include "constants/event_object_movement.h" -// static functions static void ScriptMovement_StartMoveObjects(u8 priority); static u8 GetMoveObjectsTaskId(void); static bool8 ScriptMovement_TryAddNewMovement(u8 taskId, u8 objEventId, const u8 *movementScript); @@ -17,10 +16,8 @@ static void ScriptMovement_UnfreezeActiveObjects(u8 taskId); static void ScriptMovement_MoveObjects(u8 taskId); static void ScriptMovement_TakeStep(u8 taskId, u8 moveScrId, u8 objEventId, const u8 *movementScript); -// EWRAM_DATA -static EWRAM_DATA const u8 *gMovementScripts[OBJECT_EVENTS_COUNT] = {0}; +static EWRAM_DATA const u8 *sMovementScripts[OBJECT_EVENTS_COUNT] = {0}; -// text bool8 ScriptMovement_StartObjectMovementScript(u8 localId, u8 mapNum, u8 mapGroup, const u8 *movementScript) { u8 objEventId; @@ -167,12 +164,12 @@ static bool8 IsMovementScriptFinished(u8 taskId, u8 moveScrId) static void SetMovementScript(u8 moveScrId, const u8 *movementScript) { - gMovementScripts[moveScrId] = movementScript; + sMovementScripts[moveScrId] = movementScript; } static const u8 *GetMovementScript(u8 moveScrId) { - return gMovementScripts[moveScrId]; + return sMovementScripts[moveScrId]; } static void ScriptMovement_AddNewMovement(u8 taskId, u8 moveScrId, u8 objEventId, const u8 *movementScript) diff --git a/src/siirtc.c b/src/siirtc.c index 5f4fc0a23c..0e598f7172 100644 --- a/src/siirtc.c +++ b/src/siirtc.c @@ -4,6 +4,7 @@ #include "gba/gba.h" #include "siirtc.h" +#include "config.h" #define STATUS_INTFE 0x02 // frequency interrupt enable #define STATUS_INTME 0x08 // per-minute interrupt enable diff --git a/src/slot_machine.c b/src/slot_machine.c index 60b53f5a48..cb6a380d67 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -1390,7 +1390,7 @@ static bool8 SlotTask_HandleBetInput(struct Task *task) // SLOTTASK_MSG_NEED_3_COINS static bool8 SlotTask_PrintMsg_Need3Coins(struct Task *task) { - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouDontHaveThreeCoins, 0, 1, 0, 0); CopyWindowToVram(0, COPYWIN_FULL); sSlotMachine->state = SLOTTASK_WAIT_MSG_NEED_3_COINS; @@ -1655,7 +1655,7 @@ static bool8 SlotTask_NoMatches(struct Task *task) // SLOTTASK_ASK_QUIT static bool8 SlotTask_AskQuit(struct Task *task) { - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized(0, FONT_NORMAL, gText_QuitTheGame, 0, 1, 0, 0); CopyWindowToVram(0, COPYWIN_FULL); CreateYesNoMenuParameterized(0x15, 7, 0x214, 0x180, 0xE, 0xF); @@ -1687,7 +1687,7 @@ static bool8 SlotTask_HandleQuitInput(struct Task *task) // SLOTTASK_MSG_MAX_COINS static bool8 SlotTask_PrintMsg_MaxCoins(struct Task *task) { - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouveGot9999Coins, 0, 1, 0, 0); CopyWindowToVram(0, COPYWIN_FULL); sSlotMachine->state = SLOTTASK_WAIT_MSG_MAX_COINS; @@ -1708,7 +1708,7 @@ static bool8 SlotTask_WaitMsg_MaxCoins(struct Task *task) // SLOTTASK_MSG_NO_MORE_COINS static bool8 SlotTask_PrintMsg_NoMoreCoins(struct Task *task) { - DrawDialogueFrame(0, 0); + DrawDialogueFrame(0, FALSE); AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouveRunOutOfCoins, 0, 1, 0, 0); CopyWindowToVram(0, COPYWIN_FULL); sSlotMachine->state = SLOTTASK_WAIT_MSG_NO_MORE_COINS; @@ -1756,14 +1756,10 @@ static bool8 SlotTask_FreeDataStructures(struct Task *task) FREE_AND_SET_NULL(sImageTable_DigitalDisplay_Number); FREE_AND_SET_NULL(sImageTable_DigitalDisplay_Pokeball); FREE_AND_SET_NULL(sImageTable_DigitalDisplay_DPad); - if (sImageTable_ReelTimePikachu != NULL) - FREE_AND_SET_NULL(sImageTable_ReelTimePikachu); - if (sImageTable_ReelTimeMachineAntennae != NULL) - FREE_AND_SET_NULL(sImageTable_ReelTimeMachineAntennae); - if (sImageTable_ReelTimeMachine != NULL) - FREE_AND_SET_NULL(sImageTable_ReelTimeMachine); - if (sImageTable_BrokenReelTimeMachine != NULL) - FREE_AND_SET_NULL(sImageTable_BrokenReelTimeMachine); + TRY_FREE_AND_SET_NULL(sImageTable_ReelTimePikachu); + TRY_FREE_AND_SET_NULL(sImageTable_ReelTimeMachineAntennae); + TRY_FREE_AND_SET_NULL(sImageTable_ReelTimeMachine); + TRY_FREE_AND_SET_NULL(sImageTable_BrokenReelTimeMachine); FREE_AND_SET_NULL(sMenuGfx); FREE_AND_SET_NULL(sSelectedPikaPowerTile); FREE_AND_SET_NULL(sReelOverlay_Tilemap); @@ -4184,8 +4180,7 @@ static void CreateReelTimePikachuSprite(void) static void DestroyReelTimePikachuSprite(void) { DestroySprite(&gSprites[sSlotMachine->reelTimePikachuSpriteId]); - if (sImageTable_ReelTimePikachu != NULL) - FREE_AND_SET_NULL(sImageTable_ReelTimePikachu); + TRY_FREE_AND_SET_NULL(sImageTable_ReelTimePikachu); } static void SpriteCB_ReelTimePikachu(struct Sprite *sprite) @@ -4314,10 +4309,8 @@ static void DestroyReelTimeMachineSprites(void) for (i = 0; i < ARRAY_COUNT(sSlotMachine->reelTimeMachineSpriteIds); i++) DestroySprite(&gSprites[sSlotMachine->reelTimeMachineSpriteIds[i]]); - if (sImageTable_ReelTimeMachineAntennae != NULL) - FREE_AND_SET_NULL(sImageTable_ReelTimeMachineAntennae); - if (sImageTable_ReelTimeMachine != NULL) - FREE_AND_SET_NULL(sImageTable_ReelTimeMachine); + TRY_FREE_AND_SET_NULL(sImageTable_ReelTimeMachineAntennae); + TRY_FREE_AND_SET_NULL(sImageTable_ReelTimeMachine); for (i = 0; i < ARRAY_COUNT(sSlotMachine->reelTimeNumberSpriteIds); i++) DestroySprite(&gSprites[sSlotMachine->reelTimeNumberSpriteIds[i]]); @@ -4334,8 +4327,7 @@ static void DestroyReelTimeShadowSprites(void) static void DestroyBrokenReelTimeMachineSprite(void) { DestroySprite(&gSprites[sSlotMachine->reelTimeBrokenMachineSpriteId]); - if (sImageTable_BrokenReelTimeMachine != NULL) - FREE_AND_SET_NULL(sImageTable_BrokenReelTimeMachine); + TRY_FREE_AND_SET_NULL(sImageTable_BrokenReelTimeMachine); } #define sDelayTimer data[0] diff --git a/src/tileset_anims.c b/src/tileset_anims.c index 3676006a6a..6a7589e36f 100644 --- a/src/tileset_anims.c +++ b/src/tileset_anims.c @@ -537,7 +537,7 @@ const u16 *const gTilesetAnims_BattlePyramid_StatueShadow[] = { gTilesetAnims_BattlePyramid_StatueShadow_Frame2 }; -static const u16 *const gTilesetAnims_BattleDomeFloorLightPals[] = { +static const u16 *const sTilesetAnims_BattleDomeFloorLightPals[] = { gTilesetAnims_BattleDomePals0_0, gTilesetAnims_BattleDomePals0_1, gTilesetAnims_BattleDomePals0_2, @@ -1167,7 +1167,7 @@ static void QueueAnimTiles_BattlePyramid_StatueShadow(u16 timer) static void BlendAnimPalette_BattleDome_FloorLights(u16 timer) { - CpuCopy16(gTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(gTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[0x80], 32); + CpuCopy16(sTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(sTilesetAnims_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 % ARRAY_COUNT(gTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[0x80], 32); + CpuCopy16(sTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(sTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[0x80], 32); if ((u8)FindTaskIdByFunc(Task_BattleTransition_Intro) == TASK_NONE) { BlendPalette(0x80, 16, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF); diff --git a/src/trade.c b/src/trade.c index 5e311f3135..df3cb4d338 100644 --- a/src/trade.c +++ b/src/trade.c @@ -2195,7 +2195,7 @@ static bool8 LoadTradeMenuSpriteSheetsAndPalettes(void) sTradeMenuData->timer++; break; case GFXTAG_MENU_TEXT_COUNT: - LoadSpritePalette(&gSpritePalette_TradeScreenText); + LoadSpritePalette(&sSpritePalette_TradeScreenText); sTradeMenuData->timer++; break; case GFXTAG_MENU_TEXT_COUNT + 1: diff --git a/src/tv.c b/src/tv.c index 2c8233a2f4..3364cc32de 100644 --- a/src/tv.c +++ b/src/tv.c @@ -723,7 +723,7 @@ static const u8 *const sTVInSearchOfTrainersTextGroup[] = { // Secret Base Secrets TV Show states for actions that can be taken in a secret base // The flags that determine whether or not the action was taken are commented -const u8 sTVSecretBaseSecretsActions[NUM_SECRET_BASE_FLAGS] = +static const u8 sTVSecretBaseSecretsActions[NUM_SECRET_BASE_FLAGS] = { SBSECRETS_STATE_USED_CHAIR, // SECRET_BASE_USED_CHAIR SBSECRETS_STATE_USED_BALLOON, // SECRET_BASE_USED_BALLOON diff --git a/src/union_room_chat.c b/src/union_room_chat.c index 9890bc1f88..f8513b9f46 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -2160,8 +2160,7 @@ static bool32 IsDisplaySubtask0Active(void) static void FreeDisplay(void) { FreeSprites(); - if (sDisplay) - FREE_AND_SET_NULL(sDisplay); + TRY_FREE_AND_SET_NULL(sDisplay); FreeAllWindowBuffers(); gScanlineEffect.state = 3;