diff options
83 files changed, 1469 insertions, 1462 deletions
diff --git a/data/battle_ai_scripts.s b/data/battle_ai_scripts.s index d1dd1caed..56be92c5e 100644 --- a/data/battle_ai_scripts.s +++ b/data/battle_ai_scripts.s @@ -462,18 +462,18 @@ AI_CBM_Attract: @ 82DC5F5 get_ability AI_TARGET if_equal ABILITY_OBLIVIOUS, Score_Minus10 get_gender AI_USER - if_equal 0, AI_CBM_Attract_CheckIfTargetIsFemale - if_equal 254, AI_CBM_Attract_CheckIfTargetIsMale + if_equal MON_MALE, AI_CBM_Attract_CheckIfTargetIsFemale + if_equal MON_FEMALE, AI_CBM_Attract_CheckIfTargetIsMale goto Score_Minus10 AI_CBM_Attract_CheckIfTargetIsFemale: @ 82DC61A get_gender AI_TARGET - if_equal 254, AI_CBM_Attract_End + if_equal MON_FEMALE, AI_CBM_Attract_End goto Score_Minus10 AI_CBM_Attract_CheckIfTargetIsMale: @ 82DC627 get_gender AI_TARGET - if_equal 0, AI_CBM_Attract_End + if_equal MON_MALE, AI_CBM_Attract_End goto Score_Minus10 AI_CBM_Attract_End: @ 82DC634 @@ -2057,12 +2057,22 @@ AI_CV_Protect_ScoreDown2: AI_CV_Protect_End: end +@ BUG: Foresight is only encouraged if the user is Ghost type or +@ has high evasion, but should check target instead AI_CV_Foresight: +.ifdef BUGFIX + get_target_type1 + if_equal TYPE_GHOST, AI_CV_Foresight2 + get_target_type2 + if_equal TYPE_GHOST, AI_CV_Foresight2 + if_stat_level_more_than AI_TARGET, STAT_EVASION, 8, AI_CV_Foresight3 +.else get_user_type1 if_equal TYPE_GHOST, AI_CV_Foresight2 get_user_type2 if_equal TYPE_GHOST, AI_CV_Foresight2 if_stat_level_more_than AI_USER, STAT_EVASION, 8, AI_CV_Foresight3 +.endif score -2 goto AI_CV_Foresight_End @@ -2329,13 +2339,13 @@ AI_CV_SemiInvulnerable2: if_status2 AI_TARGET, STATUS2_CURSED, AI_CV_SemiInvulnerable_TryEncourage if_status3 AI_TARGET, STATUS3_LEECHSEED, AI_CV_SemiInvulnerable_TryEncourage get_weather - .ifdef BUGFIX +.ifdef BUGFIX if_equal AI_WEATHER_HAIL, AI_CV_SemiInvulnerable_CheckIceType if_equal AI_WEATHER_SANDSTORM, AI_CV_SemiInvulnerable_CheckSandstormTypes - .else +.else if_equal AI_WEATHER_HAIL, AI_CV_SemiInvulnerable_CheckSandstormTypes if_equal AI_WEATHER_SANDSTORM, AI_CV_SemiInvulnerable_CheckIceType - .endif +.endif goto AI_CV_SemiInvulnerable5 AI_CV_SemiInvulnerable_CheckSandstormTypes: @@ -2404,11 +2414,11 @@ AI_CV_Hail_End: @ BUG: Facade score is increased if the target is statused, but should be if the user is AI_CV_Facade: - .ifdef BUGFIX +.ifdef BUGFIX if_not_status AI_USER, STATUS1_POISON | STATUS1_BURN | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON, AI_CV_Facade_End - .else +.else if_not_status AI_TARGET, STATUS1_POISON | STATUS1_BURN | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON, AI_CV_Facade_End - .endif +.endif score +1 AI_CV_Facade_End: end diff --git a/data/maps/CaveOfOrigin_1F/scripts.inc b/data/maps/CaveOfOrigin_1F/scripts.inc index de1d979d4..943a9e9ed 100644 --- a/data/maps/CaveOfOrigin_1F/scripts.inc +++ b/data/maps/CaveOfOrigin_1F/scripts.inc @@ -3,5 +3,5 @@ CaveOfOrigin_1F_MapScripts:: @ 8235768 .byte 0 CaveOfOrigin_1F_OnTransition: @ 823576E - call_if_set FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE, CaveOfOrigin_EventScript_SetTempVars + call_if_set FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE, CaveOfOrigin_EventScript_DisableTriggers end diff --git a/data/maps/CaveOfOrigin_UnusedRubySapphireMap1/scripts.inc b/data/maps/CaveOfOrigin_UnusedRubySapphireMap1/scripts.inc index 326ea21e3..9f3fefdeb 100644 --- a/data/maps/CaveOfOrigin_UnusedRubySapphireMap1/scripts.inc +++ b/data/maps/CaveOfOrigin_UnusedRubySapphireMap1/scripts.inc @@ -3,5 +3,5 @@ CaveOfOrigin_UnusedRubySapphireMap1_MapScripts:: @ 8235778 .byte 0 CaveOfOrigin_UnusedRubySapphireMap1_OnTransition: @ 823577E - call_if_set FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE, CaveOfOrigin_EventScript_SetTempVars + call_if_set FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE, CaveOfOrigin_EventScript_DisableTriggers end diff --git a/data/maps/CaveOfOrigin_UnusedRubySapphireMap2/scripts.inc b/data/maps/CaveOfOrigin_UnusedRubySapphireMap2/scripts.inc index 5e92a7d45..60b1f0cca 100644 --- a/data/maps/CaveOfOrigin_UnusedRubySapphireMap2/scripts.inc +++ b/data/maps/CaveOfOrigin_UnusedRubySapphireMap2/scripts.inc @@ -3,6 +3,6 @@ CaveOfOrigin_UnusedRubySapphireMap2_MapScripts:: @ 8235788 .byte 0 CaveOfOrigin_UnusedRubySapphireMap2_OnTransition: @ 823578E - call_if_set FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE, CaveOfOrigin_EventScript_SetTempVars + call_if_set FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE, CaveOfOrigin_EventScript_DisableTriggers end diff --git a/data/maps/CaveOfOrigin_UnusedRubySapphireMap3/scripts.inc b/data/maps/CaveOfOrigin_UnusedRubySapphireMap3/scripts.inc index 2f0e2b66c..e30b50cbe 100644 --- a/data/maps/CaveOfOrigin_UnusedRubySapphireMap3/scripts.inc +++ b/data/maps/CaveOfOrigin_UnusedRubySapphireMap3/scripts.inc @@ -3,6 +3,6 @@ CaveOfOrigin_UnusedRubySapphireMap3_MapScripts:: @ 8235798 .byte 0 CaveOfOrigin_UnusedRubySapphireMap3_OnTransition: @ 823579E - call_if_set FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE, CaveOfOrigin_EventScript_SetTempVars + call_if_set FLAG_UNUSED_RS_LEGENDARY_BATTLE_DONE, CaveOfOrigin_EventScript_DisableTriggers end diff --git a/data/scripts/cave_of_origin.inc b/data/scripts/cave_of_origin.inc index 52a1da84f..579efdb89 100644 --- a/data/scripts/cave_of_origin.inc +++ b/data/scripts/cave_of_origin.inc @@ -36,7 +36,7 @@ CaveOfOrigin_EventScript_Shake:: @ 82722A7 releaseall end -CaveOfOrigin_EventScript_SetTempVars:: @ 82722C1 +CaveOfOrigin_EventScript_DisableTriggers:: @ 82722C1 setvar VAR_TEMP_1, 1 setvar VAR_TEMP_2, 1 setvar VAR_TEMP_3, 1 diff --git a/data/scripts/pkmn_center_nurse.inc b/data/scripts/pkmn_center_nurse.inc index a26e9e22a..6b4bbe2ef 100644 --- a/data/scripts/pkmn_center_nurse.inc +++ b/data/scripts/pkmn_center_nurse.inc @@ -65,7 +65,7 @@ EventScript_PkmnCenterNurse_ReturnPkmn:: @ 82719E2 goto_if_eq EventScript_PkmnCenterNurse_ReturnPkmn2 message gText_RestoredPkmnToFullHealth waitmessage - applymovement VAR_0x800B, EventScript_PkmnCenterNurse_Bow + applymovement VAR_0x800B, Movement_PkmnCenterNurse_Bow waitmovement 0 message gText_WeHopeToSeeYouAgain return @@ -73,7 +73,7 @@ EventScript_PkmnCenterNurse_ReturnPkmn:: @ 82719E2 EventScript_PkmnCenterNurse_ReturnPkmn2:: @ 8271A03 message gText_ThankYouForWaiting waitmessage - applymovement VAR_0x800B, EventScript_PkmnCenterNurse_Bow + applymovement VAR_0x800B, Movement_PkmnCenterNurse_Bow waitmovement 0 message gText_WeHopeToSeeYouAgain2 return @@ -84,7 +84,7 @@ EventScript_PkmnCenterNurse_PlayerWaitingInUnionRoom:: @ 8271A19 setflag FLAG_NURSE_UNION_ROOM_REMINDER message CableClub_Text_PlayerIsWaiting waitmessage - applymovement VAR_0x800B, EventScript_PkmnCenterNurse_Bow + applymovement VAR_0x800B, Movement_PkmnCenterNurse_Bow waitmovement 0 message gText_WeHopeToSeeYouAgain return @@ -129,7 +129,7 @@ EventScript_PkmnCenterNurse_GoldCardHealPkmn:: @ 8271AC5 goto EventScript_PkmnCenterNurse_HealPkmn end -EventScript_PkmnCenterNurse_Bow: @ 8271AD0 +Movement_PkmnCenterNurse_Bow: @ 8271AD0 nurse_joy_bow delay_4 step_end diff --git a/data/scripts/record_mix.inc b/data/scripts/record_mix.inc index 23f224ae4..e058816ab 100644 --- a/data/scripts/record_mix.inc +++ b/data/scripts/record_mix.inc @@ -6,16 +6,15 @@ EventScript_MixRecordsPrompt:: @ 8271D5E compare VAR_RESULT, YES goto_if_eq EventScript_MixRecords compare VAR_RESULT, NO - goto_if_eq EventScript_DeclineMixRecords - goto EventScript_DeclineMixRecords + goto_if_eq EventScript_EndMixRecords + goto EventScript_EndMixRecords EventScript_MixRecords:: @ 8271D83 special RecordMixingPlayerSpotTriggered waitstate lock faceplayer - -EventScript_DeclineMixRecords:: @ 8271D89 +EventScript_EndMixRecords:: @ 8271D89 message Text_WeHopeToSeeYouAgain waitmessage waitbuttonpress diff --git a/gflib/malloc.c b/gflib/malloc.c index 4d1a9fe5c..38fc8939e 100644 --- a/gflib/malloc.c +++ b/gflib/malloc.c @@ -2,7 +2,7 @@ static void *sHeapStart; static u32 sHeapSize; -static u32 malloc_c_unused_0300000c; // needed to align dma3_manager.o(.bss) +static u32 sFiller; // needed to align dma3_manager.o(.bss) #define MALLOC_SYSTEM_ID 0xA3A3 diff --git a/gflib/text.c b/gflib/text.c index 4cbad1376..ffce2cb56 100644 --- a/gflib/text.c +++ b/gflib/text.c @@ -165,7 +165,6 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi { int i; u16 j; - u8 *ptr; if (!gFonts) return FALSE; @@ -1235,7 +1234,6 @@ s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing) bool8 isJapanese; int minGlyphWidth; u32 (*func)(u16 glyphId, bool32 isJapanese); - s32 result; int localLetterSpacing; u32 lineWidth; const u8 *bufferPointer; diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index b54f01353..cc62208fa 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -216,4 +216,6 @@ #define EFFECT_DRAGON_DANCE 212 #define EFFECT_CAMOUFLAGE 213 +#define NUM_BATTLE_MOVE_EFFECTS 214 + #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/items.h b/include/constants/items.h index 95c6aacfe..71338da8e 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -17,7 +17,11 @@ #define ITEM_LUXURY_BALL 11 #define ITEM_PREMIER_BALL 12 -#define LAST_BALL ITEM_PREMIER_BALL +// Note: If moving ball IDs around, updating FIRST_BALL/LAST_BALL is not sufficient +// Several places expect the ball IDs to be first and contiguous (e.g. gBattlescriptsForBallThrow and MON_DATA_POKEBALL) +// If adding new balls, it's easiest to insert them after the last ball and increment the below IDs (and removing ITEM_034 for example) +#define FIRST_BALL ITEM_MASTER_BALL +#define LAST_BALL ITEM_PREMIER_BALL // Pokemon Items #define ITEM_POTION 13 @@ -145,6 +149,8 @@ #define ITEM_FAB_MAIL 131 #define ITEM_RETRO_MAIL 132 +#define FIRST_MAIL_INDEX ITEM_ORANGE_MAIL + // Berries #define ITEM_CHERI_BERRY 133 #define ITEM_CHESTO_BERRY 134 @@ -189,6 +195,10 @@ #define ITEM_LANSAT_BERRY 173 #define ITEM_STARF_BERRY 174 #define ITEM_ENIGMA_BERRY 175 + +#define FIRST_BERRY_INDEX ITEM_CHERI_BERRY +#define LAST_BERRY_INDEX ITEM_ENIGMA_BERRY + #define ITEM_0B0 176 #define ITEM_0B1 177 #define ITEM_0B2 178 @@ -467,9 +477,6 @@ #define ITEMS_COUNT 377 #define ITEM_FIELD_ARROW ITEMS_COUNT -#define FIRST_BERRY_INDEX ITEM_CHERI_BERRY -#define LAST_BERRY_INDEX ITEM_ENIGMA_BERRY - // Range of berries given out by various NPCS #define FIRST_BERRY_MASTER_BERRY ITEM_POMEG_BERRY #define LAST_BERRY_MASTER_BERRY ITEM_NOMEL_BERRY @@ -506,6 +513,21 @@ #define GOOD_ROD 1 #define SUPER_ROD 2 +// Secondary IDs for bikes +#define MACH_BIKE 0 +#define ACRO_BIKE 1 + +// Item type IDs (used to determine the exit callback) +#define ITEM_USE_MAIL 0 +#define ITEM_USE_PARTY_MENU 1 +#define ITEM_USE_FIELD 2 +#define ITEM_USE_PBLOCK_CASE 3 +#define ITEM_USE_BAG_MENU 4 // No exit callback, stays in bag menu + +// Item battle usage IDs (only checked to see if nonzero) +#define ITEM_B_USE_MEDICINE 1 +#define ITEM_B_USE_OTHER 2 + // Check if the item is one that can be used on a Pokemon. #define ITEM_HAS_EFFECT(item) ((item) >= ITEM_POTION && (item) <= ITEM_0B2) diff --git a/include/constants/rgb.h b/include/constants/rgb.h index 1896250d2..be3049d3c 100644 --- a/include/constants/rgb.h +++ b/include/constants/rgb.h @@ -5,18 +5,21 @@ #define GET_G(color) (((color) >> 5) & 0x1F) #define GET_B(color) (((color) >> 10) & 0x1F) -#define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10)) +#define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10)) #define RGB2(r, g, b) (((b) << 10) | ((g) << 5) | (r)) #define _RGB(r, g, b) ((((b) & 0x1F) << 10) + (((g) & 0x1F) << 5) + ((r) & 0x1F)) -#define RGB_BLACK RGB(0, 0, 0) -#define RGB_WHITE RGB(31, 31, 31) -#define RGB_RED RGB(31, 0, 0) -#define RGB_GREEN RGB(0, 31, 0) -#define RGB_BLUE RGB(0, 0, 31) -#define RGB_YELLOW RGB(31, 31, 0) -#define RGB_MAGENTA RGB(31, 0, 31) -#define RGB_CYAN RGB(0, 31, 31) -#define RGB_WHITEALPHA (RGB_WHITE | 0x8000) +#define RGB_ALPHA (1 << 15) +#define IS_ALPHA(color) ((color) & RGB_ALPHA) + +#define RGB_BLACK RGB(0, 0, 0) +#define RGB_WHITE RGB(31, 31, 31) +#define RGB_RED RGB(31, 0, 0) +#define RGB_GREEN RGB(0, 31, 0) +#define RGB_BLUE RGB(0, 0, 31) +#define RGB_YELLOW RGB(31, 31, 0) +#define RGB_MAGENTA RGB(31, 0, 31) +#define RGB_CYAN RGB(0, 31, 31) +#define RGB_WHITEALPHA (RGB_WHITE | RGB_ALPHA) #endif // GUARD_RGB_H diff --git a/include/event_object_movement.h b/include/event_object_movement.h index 9b4d9302f..cd76cac11 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -16,14 +16,22 @@ enum SpinnerRunnerFollowPatterns RUNFOLLOW_SOUTH_EAST_WEST }; +enum ReflectionTypes +{ + REFL_TYPE_NONE, + REFL_TYPE_ICE, + REFL_TYPE_WATER, + NUM_REFLECTION_TYPES +}; + #define FIGURE_8_LENGTH 72 #define GROUND_EFFECT_FLAG_TALL_GRASS_ON_SPAWN (1 << 0) #define GROUND_EFFECT_FLAG_TALL_GRASS_ON_MOVE (1 << 1) #define GROUND_EFFECT_FLAG_LONG_GRASS_ON_SPAWN (1 << 2) #define GROUND_EFFECT_FLAG_LONG_GRASS_ON_MOVE (1 << 3) -#define GROUND_EFFECT_FLAG_ICE_REFLECTION (1 << 4) -#define GROUND_EFFECT_FLAG_REFLECTION (1 << 5) +#define GROUND_EFFECT_FLAG_WATER_REFLECTION (1 << 4) +#define GROUND_EFFECT_FLAG_ICE_REFLECTION (1 << 5) #define GROUND_EFFECT_FLAG_SHALLOW_FLOWING_WATER (1 << 6) #define GROUND_EFFECT_FLAG_SAND (1 << 7) #define GROUND_EFFECT_FLAG_DEEP_SAND (1 << 8) @@ -414,10 +422,10 @@ u8 MovementType_RunInPlace_Step0(struct ObjectEvent *, struct Sprite *); u8 MovementType_Invisible_Step0(struct ObjectEvent *, struct Sprite *); u8 MovementType_Invisible_Step1(struct ObjectEvent *, struct Sprite *); u8 MovementType_Invisible_Step2(struct ObjectEvent *, struct Sprite *); -void SetObjectEventSpriteInvisibility(u8 var, bool32 var2); -bool32 IsObjectEventSpriteInvisible(u8 var); -void SetObjectEventSpriteGraphics(u8 var1, u8 graphicsId); -void SetObjectEventSpriteAnim(u8 var1, u8 var2); -bool32 IsObjectEventSpriteAnimating(u8 var); +void SetObjectEventSpriteInvisibility(u8 objectEventId, bool32 invisible); +bool32 IsObjectEventSpriteInvisible(u8 objectEventId); +void SetObjectEventSpriteGraphics(u8 objectEventId, u8 graphicsId); +void SetObjectEventSpriteAnim(u8 objectEventId, u8 animNum); +bool32 IsObjectEventSpriteAnimating(u8 objectEventId); #endif //GUARD_EVENT_OBJECT_MOVEMENT_H diff --git a/include/pokemon.h b/include/pokemon.h index addf580e9..0ff635a3f 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -238,6 +238,15 @@ struct Evolution u16 targetSpecies; }; +#define NUM_UNOWN_FORMS 28 + +#define GET_UNOWN_LETTER(personality) (( \ + (((personality) & 0x03000000) >> 18) \ + | (((personality) & 0x00030000) >> 12) \ + | (((personality) & 0x00000300) >> 6) \ + | (((personality) & 0x00000003) >> 0) \ +) % NUM_UNOWN_FORMS) + extern u8 gPlayerPartyCount; extern struct Pokemon gPlayerParty[PARTY_SIZE]; extern u8 gEnemyPartyCount; diff --git a/include/tv.h b/include/tv.h index 4dc14143c..482909499 100644 --- a/include/tv.h +++ b/include/tv.h @@ -8,7 +8,7 @@ extern u8 *const gTVStringVarPtrs[3]; void ClearTVShowData(void); void sub_80EE184(void); -void sub_80EE35C(u16 foeSpecies, u16 species, u8 moveIdx, const u16 *movePtr, u16 betterMove); +void TryPutBattleSeminarOnAir(u16 foeSpecies, u16 species, u8 moveIdx, const u16 *movePtr, u16 betterMove); void TryPutFrontierTVShowOnAir(u16 winStreak, u8 facility); void DoTVShow(void); void DoTVShowInSearchOfTrainers(void); diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index 9e50a8477..f73a2dee7 100755 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -4947,7 +4947,6 @@ static void AnimTask_OdorSleuthMovementWaitFinish(u8 taskId) static void MoveOdorSleuthClone(struct Sprite *sprite) { - int zero = 0; if (++sprite->data[1] > 1) { sprite->data[1] = 0; diff --git a/src/battle_anim_flying.c b/src/battle_anim_flying.c index f8d47f4ec..7d96fed8c 100644 --- a/src/battle_anim_flying.c +++ b/src/battle_anim_flying.c @@ -708,7 +708,6 @@ static void sub_810E520(struct Sprite *sprite) } } data->unk0_0d = 0; - data->unk2; } data->unk0_1 = 0; break; diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index d626e1604..0c3d4ea47 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -16,13 +16,6 @@ #include "util.h" #include "constants/battle_anim.h" -#define GET_UNOWN_LETTER(personality) (( \ - (((personality & 0x03000000) >> 24) << 6) \ - | (((personality & 0x00030000) >> 16) << 4) \ - | (((personality & 0x00000300) >> 8) << 2) \ - | (((personality & 0x00000003) >> 0) << 0) \ -) % 28) - #define IS_DOUBLE_BATTLE() ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) extern const struct OamData gOamData_AffineNormal_ObjNormal_64x64; diff --git a/src/battle_anim_normal.c b/src/battle_anim_normal.c index f7df9a4a9..e32ff3151 100644 --- a/src/battle_anim_normal.c +++ b/src/battle_anim_normal.c @@ -564,8 +564,6 @@ static void AnimTask_BlendColorCycleExcludeLoop(u8 taskId) // See AnimTask_BlendColorCycle. Same, but selects palette by ANIM_TAG_* void AnimTask_BlendColorCycleByTag(u8 taskId) { - u8 paletteIndex; - gTasks[taskId].tPalTag = gBattleAnimArgs[0]; gTasks[taskId].tDelay = gBattleAnimArgs[1]; gTasks[taskId].tNumBlends = gBattleAnimArgs[2]; diff --git a/src/battle_anim_throw.c b/src/battle_anim_throw.c index fef301326..0da766036 100755 --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -1551,8 +1551,6 @@ static void SpriteCB_Ball_Block_Step(struct Sprite *sprite) static void LoadBallParticleGfx(u8 ballId) { - u8 taskId; - if (GetSpriteTileStartByTag(sBallParticleSpriteSheets[ballId].tag) == 0xFFFF) { LoadCompressedSpriteSheetUsingHeap(&sBallParticleSpriteSheets[ballId]); diff --git a/src/battle_anim_water.c b/src/battle_anim_water.c index 2bb90e585..f157102b0 100644 --- a/src/battle_anim_water.c +++ b/src/battle_anim_water.c @@ -881,8 +881,6 @@ static void AnimTask_CreateSurfWave_Step1(u8 taskId) u16 rgbBuffer; u16 *BGptrX = &gBattle_BG1_X; u16 *BGptrY = &gBattle_BG1_Y; - u32 palOffset; - u16 palNum; *BGptrX += gTasks[taskId].data[0]; *BGptrY += gTasks[taskId].data[1]; diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 269b4c1b4..718fe30c9 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -1693,7 +1693,6 @@ static void LinkOpponentHandleIntroSlide(void) static void LinkOpponentHandleIntroTrainerBallThrow(void) { - u8 paletteNum; u8 taskId; SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index 2f1153612..d241d335f 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -1858,7 +1858,6 @@ static void OpponentHandleIntroSlide(void) static void OpponentHandleIntroTrainerBallThrow(void) { - u8 paletteNum; u8 taskId; SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 895ca6b39..23269dbad 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -1633,7 +1633,6 @@ static void RecordedOpponentHandleIntroSlide(void) static void RecordedOpponentHandleIntroTrainerBallThrow(void) { - u8 paletteNum; u8 taskId; SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]); diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index b5a8b1bb6..b357c689f 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -470,8 +470,6 @@ static void SafariHandleChooseMove(void) static void SafariHandleChooseItem(void) { - s32 i; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); gBattlerControllerFuncs[gActiveBattler] = SafariOpenPokeblockCase; gBattlerInMenuId = gActiveBattler; diff --git a/src/battle_interface.c b/src/battle_interface.c index adbef019d..df123630c 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -1897,7 +1897,6 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon) { u8 nickname[POKEMON_NAME_LENGTH + 1]; void *ptr; - const u8 *genderTxt; u32 windowId, spriteTileNum; u8 *windowTileData; u16 species; diff --git a/src/battle_main.c b/src/battle_main.c index 7e8966597..940fab8ff 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -2722,7 +2722,7 @@ void SpriteCB_FaintOpponentMon(struct Sprite *sprite) if (species == SPECIES_UNOWN) { u32 personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_PERSONALITY); - u16 unownForm = ((((personalityValue & 0x3000000) >> 18) | ((personalityValue & 0x30000) >> 12) | ((personalityValue & 0x300) >> 6) | (personalityValue & 3)) % 0x1C); + u16 unownForm = GET_UNOWN_LETTER(personalityValue); u16 unownSpecies; if (unownForm == 0) diff --git a/src/battle_tv.c b/src/battle_tv.c index 7aac51d4f..8c8ea90ab 100644 --- a/src/battle_tv.c +++ b/src/battle_tv.c @@ -8,15 +8,68 @@ #include "constants/moves.h" #include "battle_message.h" #include "tv.h" +#include "constants/battle_move_effects.h" // this file's functions -static bool8 sub_817E0B8(u16 stringId); +static bool8 IsNotSpecialBattleString(u16 stringId); static void AddMovePoints(u8 caseId, u16 arg1, u8 arg2, u8 arg3); static void TrySetBattleSeminarShow(void); static void AddPointsOnFainting(bool8 targetFainted); static void AddPointsBasedOnWeather(u16 weatherFlags, u16 moveId, u8 moveSlot); static bool8 ShouldCalculateDamage(u16 moveId, s32 *dmg, u16 *powerOverride); +#define TABLE_END ((u16)-1) + +enum { + PTS_MOVE_EFFECT, + PTS_EFFECTIVENESS, + PTS_SET_UP, // Broadly. Used by Wish, Future Sight, Ingrain, etc. + PTS_RAIN, + PTS_SUN, + PTS_SANDSTORM, + PTS_HAIL, + PTS_ELECTRIC, + PTS_STATUS_DMG, + PTS_STATUS, + PTS_SPIKES, + PTS_WATER_SPORT, + PTS_MUD_SPORT, + PTS_REFLECT, + PTS_LIGHT_SCREEN, + PTS_SAFEGUARD, + PTS_MIST, + PTS_BREAK_WALL, + PTS_CRITICAL_HIT, + PTS_FAINT, + PTS_FAINT_SET_UP, + PTS_FLINCHED, + PTS_STAT_INCREASE_1, + PTS_STAT_INCREASE_2, + PTS_STAT_DECREASE_SELF, + PTS_STAT_DECREASE_1, + PTS_STAT_DECREASE_2, + PTS_STAT_INCREASE_NOT_SELF, +}; + +enum { + FNT_NONE, + FNT_CURSE, + FNT_LEECH_SEED, + FNT_POISON, + FNT_BURN, + FNT_NIGHTMARE, + FNT_WRAP, + FNT_SPIKES, + FNT_FUTURE_SIGHT, + FNT_DOOM_DESIRE, + FNT_PERISH_SONG, + FNT_DESTINY_BOND, + FNT_CONFUSION, + FNT_EXPLOSION, + FNT_RECOIL, + FNT_OTHER, +}; + // const rom data static const u16 sVariableDmgMoves[] = { @@ -26,180 +79,462 @@ static const u16 sVariableDmgMoves[] = MOVE_WATER_SPOUT, MOVE_DREAM_EATER, MOVE_WEATHER_BALL, MOVE_SNORE, MOVE_PAIN_SPLIT, MOVE_GUILLOTINE, MOVE_FRUSTRATION, MOVE_RETURN, MOVE_ENDEAVOR, - MOVE_PRESENT, MOVE_REVENGE, 0xFFFF, + MOVE_PRESENT, MOVE_REVENGE, TABLE_END, // those are handled by the function itself - MOVE_MAGNITUDE, MOVE_PSYWAVE, 0xFFFF + MOVE_MAGNITUDE, MOVE_PSYWAVE, TABLE_END }; -static const u16 sUnknown_0860A4E0[] = -{ - 0x0001, 0x0001, 0x0001, 0x0004, 0x0001, 0x0001, 0x0001, 0x0000, 0x0005, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0002, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0005, 0x0005, 0x0004, 0x0005, 0x0001, 0x0003, 0x0001, - 0x0003, 0x0005, 0x0001, 0x0007, 0x0001, 0x0007, 0x0007, 0x0001, 0x0005, 0x0002, 0x0004, 0x0001, 0x0001, 0x0001, 0x0005, 0x0001, - 0x0002, 0x0004, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0007, 0x0004, 0x0004, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0004, 0x0001, 0x0001, 0x0001, 0x0004, - 0x0005, 0x0002, 0x0004, 0x0001, 0x0004, 0x0001, 0x0007, 0x0002, 0x0001, 0x0005, 0x0007, 0x0003, 0x0003, 0x0004, 0x0003, 0x0003, - 0x0003, 0x0003, 0x0003, 0x0002, 0x0004, 0x0001, 0x0005, 0x0001, 0x0001, 0x0004, 0x0005, 0x0003, 0x0001, 0x0002, 0x0001, 0x0005, - 0x0004, 0x0003, 0x0006, 0x0004, 0x0003, 0x0003, 0x0003, 0x0002, 0x0004, 0x0001, 0x0001, 0x0001, 0x0005, 0x0001, 0x0001, 0x0007, - 0x0002, 0x0002, 0x0001, 0x0001, 0x0004, 0x0004, 0x0004, 0x0001, 0x0004, 0x0004, 0x0001, 0x0001, 0x0001, 0x0001, 0x0007, 0x0007, - 0x0006, 0x0003, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0003, 0x0001, 0x0001, 0x0004, 0x0004, - 0x0003, 0x0003, 0x0003, 0x0001, 0x0004, 0x0007, 0x0007, 0x0005, 0x0007, 0x0001, 0x0007, 0x0001, 0x0005, 0x0000, 0x0004, 0x0004, - 0x0004, 0x0004, 0x0004, 0x0002, 0x0002, 0x0006, 0x0003, 0x0006, 0x0004, 0x0004, 0x0002, 0x0005, 0x0002, 0x0001, 0x0001, 0x0006, - 0x0006, 0x0006, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0006, 0x0001, 0x0004, 0x0001, 0x0001, 0x0003, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0004, 0x0001, 0x0001, 0x0003 -}; -static const u16 sUnknown_0860A68C[] = -{ - 0x0004, 0xfffd, 0xfffa -}; -static const u16 sUnknown_0860A692[] = -{ - 0x0004, 0x0004, 0x0006, 0x0006, 0x0007, 0x0006, 0x0002 -}; -static const u16 sUnknown_0860A6A0[] = -{ - 0x0091, 0x0003, 0x00fa, 0x0003, 0x00be, 0x0003, 0x0080, 0x0003, 0x006e, 0x0003, 0x0098, 0x0003, 0x0143, 0x0003, 0x0123, 0x0003, - 0x007f, 0x0003, 0x014a, 0x0003, 0x0039, 0x0003, 0x0134, 0x0003, 0x0038, 0x0003, 0x003d, 0x0003, 0x015a, 0x0000, 0x0037, 0x0003, - 0x0160, 0x0003, 0x0137, 0x0003, 0x0057, 0x0003, 0x004c, 0xfffc, 0x013b, 0xfffc, 0x00ac, 0xfffc, 0x0035, 0xfffc, 0x00dd, 0xfffc, - 0x007e, 0xfffc, 0x0101, 0xfffc, 0x0034, 0xfffc, 0x0133, 0xfffc, 0x012b, 0xfffc, 0x011c, 0xfffc, 0x0053, 0xfffc, 0x0007, 0xfffc, - 0x004c, 0xfffc, 0xffff, 0x0000 -}; -static const u16 sUnknown_0860A728[] = -{ - 0x013b, 0x0003, 0x00ac, 0x0003, 0x0035, 0x0003, 0x00dd, 0x0003, 0x007e, 0x0003, 0x0101, 0x0003, 0x0034, 0x0003, 0x0133, 0x0003, - 0x012b, 0x0003, 0x011c, 0x0003, 0x0053, 0x0003, 0x0007, 0x0003, 0x004c, 0x0005, 0x00eb, 0x0003, 0x00ea, 0x0003, 0x00ec, 0x0003, - 0x0137, 0x0003, 0xffff, 0x0000 -}; -static const u16 sUnknown_0860A770[] = -{ - 0x0137, 0x0003, 0x004c, 0xfffd, 0xffff, 0x0000 -}; -static const u16 sUnknown_0860A77C[] = +static const u16 sPoints_MoveEffect[NUM_BATTLE_MOVE_EFFECTS] = { - 0x0137, 0x0003, 0x004c, 0xfffd, 0xffff, 0x0000 + [EFFECT_HIT] = 1, + [EFFECT_SLEEP] = 1, + [EFFECT_POISON_HIT] = 1, + [EFFECT_ABSORB] = 4, + [EFFECT_BURN_HIT] = 1, + [EFFECT_FREEZE_HIT] = 1, + [EFFECT_PARALYZE_HIT] = 1, + [EFFECT_EXPLOSION] = 0, + [EFFECT_DREAM_EATER] = 5, + [EFFECT_MIRROR_MOVE] = 1, + [EFFECT_ATTACK_UP] = 1, + [EFFECT_DEFENSE_UP] = 1, + [EFFECT_SPEED_UP] = 1, + [EFFECT_SPECIAL_ATTACK_UP] = 1, + [EFFECT_SPECIAL_DEFENSE_UP] = 1, + [EFFECT_ACCURACY_UP] = 1, + [EFFECT_EVASION_UP] = 1, + [EFFECT_ALWAYS_HIT] = 2, + [EFFECT_ATTACK_DOWN] = 1, + [EFFECT_DEFENSE_DOWN] = 1, + [EFFECT_SPEED_DOWN] = 1, + [EFFECT_SPECIAL_ATTACK_DOWN] = 1, + [EFFECT_SPECIAL_DEFENSE_DOWN] = 1, + [EFFECT_ACCURACY_DOWN] = 1, + [EFFECT_EVASION_DOWN] = 1, + [EFFECT_HAZE] = 5, + [EFFECT_BIDE] = 5, + [EFFECT_RAMPAGE] = 4, + [EFFECT_ROAR] = 5, + [EFFECT_MULTI_HIT] = 1, + [EFFECT_CONVERSION] = 3, + [EFFECT_FLINCH_HIT] = 1, + [EFFECT_RESTORE_HP] = 3, + [EFFECT_TOXIC] = 5, + [EFFECT_PAY_DAY] = 1, + [EFFECT_LIGHT_SCREEN] = 7, + [EFFECT_TRI_ATTACK] = 1, + [EFFECT_REST] = 7, + [EFFECT_OHKO] = 7, + [EFFECT_RAZOR_WIND] = 1, + [EFFECT_SUPER_FANG] = 5, + [EFFECT_DRAGON_RAGE] = 2, + [EFFECT_TRAP] = 4, + [EFFECT_HIGH_CRITICAL] = 1, + [EFFECT_DOUBLE_HIT] = 1, + [EFFECT_RECOIL_IF_MISS] = 1, + [EFFECT_MIST] = 5, + [EFFECT_FOCUS_ENERGY] = 1, + [EFFECT_RECOIL] = 2, + [EFFECT_CONFUSE] = 4, + [EFFECT_ATTACK_UP_2] = 1, + [EFFECT_DEFENSE_UP_2] = 1, + [EFFECT_SPEED_UP_2] = 1, + [EFFECT_SPECIAL_ATTACK_UP_2] = 1, + [EFFECT_SPECIAL_DEFENSE_UP_2] = 1, + [EFFECT_ACCURACY_UP_2] = 1, + [EFFECT_EVASION_UP_2] = 1, + [EFFECT_TRANSFORM] = 0, + [EFFECT_ATTACK_DOWN_2] = 1, + [EFFECT_DEFENSE_DOWN_2] = 1, + [EFFECT_SPEED_DOWN_2] = 1, + [EFFECT_SPECIAL_ATTACK_DOWN_2] = 1, + [EFFECT_SPECIAL_DEFENSE_DOWN_2] = 1, + [EFFECT_ACCURACY_DOWN_2] = 1, + [EFFECT_EVASION_DOWN_2] = 1, + [EFFECT_REFLECT] = 7, + [EFFECT_POISON] = 4, + [EFFECT_PARALYZE] = 4, + [EFFECT_ATTACK_DOWN_HIT] = 1, + [EFFECT_DEFENSE_DOWN_HIT] = 1, + [EFFECT_SPEED_DOWN_HIT] = 1, + [EFFECT_SPECIAL_ATTACK_DOWN_HIT] = 1, + [EFFECT_SPECIAL_DEFENSE_DOWN_HIT] = 1, + [EFFECT_ACCURACY_DOWN_HIT] = 1, + [EFFECT_EVASION_DOWN_HIT] = 1, + [EFFECT_SKY_ATTACK] = 4, + [EFFECT_CONFUSE_HIT] = 1, + [EFFECT_TWINEEDLE] = 1, + [EFFECT_VITAL_THROW] = 1, + [EFFECT_SUBSTITUTE] = 4, + [EFFECT_RECHARGE] = 5, + [EFFECT_RAGE] = 2, + [EFFECT_MIMIC] = 4, + [EFFECT_METRONOME] = 1, + [EFFECT_LEECH_SEED] = 4, + [EFFECT_SPLASH] = 1, + [EFFECT_DISABLE] = 7, + [EFFECT_LEVEL_DAMAGE] = 2, + [EFFECT_PSYWAVE] = 1, + [EFFECT_COUNTER] = 5, + [EFFECT_ENCORE] = 7, + [EFFECT_PAIN_SPLIT] = 3, + [EFFECT_SNORE] = 3, + [EFFECT_CONVERSION_2] = 4, + [EFFECT_LOCK_ON] = 3, + [EFFECT_SKETCH] = 3, + [EFFECT_UNUSED_60] = 3, + [EFFECT_SLEEP_TALK] = 3, + [EFFECT_DESTINY_BOND] = 3, + [EFFECT_FLAIL] = 2, + [EFFECT_SPITE] = 4, + [EFFECT_FALSE_SWIPE] = 1, + [EFFECT_HEAL_BELL] = 5, + [EFFECT_QUICK_ATTACK] = 1, + [EFFECT_TRIPLE_KICK] = 1, + [EFFECT_THIEF] = 4, + [EFFECT_MEAN_LOOK] = 5, + [EFFECT_NIGHTMARE] = 3, + [EFFECT_MINIMIZE] = 1, + [EFFECT_CURSE] = 2, + [EFFECT_UNUSED_6E] = 1, + [EFFECT_PROTECT] = 5, + [EFFECT_SPIKES] = 4, + [EFFECT_FORESIGHT] = 3, + [EFFECT_PERISH_SONG] = 6, + [EFFECT_SANDSTORM] = 4, + [EFFECT_ENDURE] = 3, + [EFFECT_ROLLOUT] = 3, + [EFFECT_SWAGGER] = 3, + [EFFECT_FURY_CUTTER] = 2, + [EFFECT_ATTRACT] = 4, + [EFFECT_RETURN] = 1, + [EFFECT_PRESENT] = 1, + [EFFECT_FRUSTRATION] = 1, + [EFFECT_SAFEGUARD] = 5, + [EFFECT_THAW_HIT] = 1, + [EFFECT_MAGNITUDE] = 1, + [EFFECT_BATON_PASS] = 7, + [EFFECT_PURSUIT] = 2, + [EFFECT_RAPID_SPIN] = 2, + [EFFECT_SONICBOOM] = 1, + [EFFECT_UNUSED_83] = 1, + [EFFECT_MORNING_SUN] = 4, + [EFFECT_SYNTHESIS] = 4, + [EFFECT_MOONLIGHT] = 4, + [EFFECT_HIDDEN_POWER] = 1, + [EFFECT_RAIN_DANCE] = 4, + [EFFECT_SUNNY_DAY] = 4, + [EFFECT_DEFENSE_UP_HIT] = 1, + [EFFECT_ATTACK_UP_HIT] = 1, + [EFFECT_ALL_STATS_UP_HIT] = 1, + [EFFECT_UNUSED_8D] = 1, + [EFFECT_BELLY_DRUM] = 7, + [EFFECT_PSYCH_UP] = 7, + [EFFECT_MIRROR_COAT] = 6, + [EFFECT_SKULL_BASH] = 3, + [EFFECT_TWISTER] = 1, + [EFFECT_EARTHQUAKE] = 1, + [EFFECT_FUTURE_SIGHT] = 1, + [EFFECT_GUST] = 1, + [EFFECT_FLINCH_MINIMIZE_HIT] = 1, + [EFFECT_SOLARBEAM] = 1, + [EFFECT_THUNDER] = 1, + [EFFECT_TELEPORT] = 1, + [EFFECT_BEAT_UP] = 2, + [EFFECT_SEMI_INVULNERABLE] = 3, + [EFFECT_DEFENSE_CURL] = 1, + [EFFECT_SOFTBOILED] = 1, + [EFFECT_FAKE_OUT] = 4, + [EFFECT_UPROAR] = 4, + [EFFECT_STOCKPILE] = 3, + [EFFECT_SPIT_UP] = 3, + [EFFECT_SWALLOW] = 3, + [EFFECT_UNUSED_A3] = 1, + [EFFECT_HAIL] = 4, + [EFFECT_TORMENT] = 7, + [EFFECT_FLATTER] = 7, + [EFFECT_WILL_O_WISP] = 5, + [EFFECT_MEMENTO] = 7, + [EFFECT_FACADE] = 1, + [EFFECT_FOCUS_PUNCH] = 7, + [EFFECT_SMELLINGSALT] = 1, + [EFFECT_FOLLOW_ME] = 5, + [EFFECT_NATURE_POWER] = 0, + [EFFECT_CHARGE] = 4, + [EFFECT_TAUNT] = 4, + [EFFECT_HELPING_HAND] = 4, + [EFFECT_TRICK] = 4, + [EFFECT_ROLE_PLAY] = 4, + [EFFECT_WISH] = 2, + [EFFECT_ASSIST] = 2, + [EFFECT_INGRAIN] = 6, + [EFFECT_SUPERPOWER] = 3, + [EFFECT_MAGIC_COAT] = 6, + [EFFECT_RECYCLE] = 4, + [EFFECT_REVENGE] = 4, + [EFFECT_BRICK_BREAK] = 2, + [EFFECT_YAWN] = 5, + [EFFECT_KNOCK_OFF] = 2, + [EFFECT_ENDEAVOR] = 1, + [EFFECT_ERUPTION] = 1, + [EFFECT_SKILL_SWAP] = 6, + [EFFECT_IMPRISON] = 6, + [EFFECT_REFRESH] = 6, + [EFFECT_GRUDGE] = 1, + [EFFECT_SNATCH] = 1, + [EFFECT_LOW_KICK] = 1, + [EFFECT_SECRET_POWER] = 1, + [EFFECT_DOUBLE_EDGE] = 2, + [EFFECT_TEETER_DANCE] = 6, + [EFFECT_BLAZE_KICK] = 1, + [EFFECT_MUD_SPORT] = 4, + [EFFECT_POISON_FANG] = 1, + [EFFECT_WEATHER_BALL] = 1, + [EFFECT_OVERHEAT] = 3, + [EFFECT_TICKLE] = 1, + [EFFECT_COSMIC_POWER] = 1, + [EFFECT_SKY_UPPERCUT] = 1, + [EFFECT_BULK_UP] = 1, + [EFFECT_POISON_TAIL] = 1, + [EFFECT_WATER_SPORT] = 4, + [EFFECT_CALM_MIND] = 1, + [EFFECT_DRAGON_DANCE] = 1, + [EFFECT_CAMOUFLAGE] = 3 }; -static const u16 sUnknown_0860A788[] = -{ - 0x0055, 0x0003, 0x0009, 0x0003, 0x00d1, 0x0003, 0x0054, 0x0003, 0x00c0, 0x0003, 0x015f, 0x0003, 0x0056, 0x0000, 0x0057, 0x0003, - 0x0158, 0x0003, 0xffff, 0x0000 -}; -static const u16 sUnknown_0860A7B0[] = -{ - 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003 -}; -static const u16 sUnknown_0860A7BE[] = -{ - 0x0005, 0x0005, 0x0005, 0x0005, 0x0005 -}; -static const u16 sUnknown_0860A7C8[] = -{ - 0x0004 -}; -static const u16 sUnknown_0860A7CA[] = -{ - 0x0005 -}; -static const u16 sUnknown_0860A7CC[] = + +static const u16 sPoints_Effectiveness[] = { - 0x0005 + 4, // Super Effective + -3, // Not Very Effective + -6 // No Effect }; -static const u16 sUnknown_0860A7CE[] = +static const u16 sPoints_SetUp[] = { - 0x0003 + 4, // Future Sight + 4, // Doom Desire + 6, + 6, // Wish + 7, // Grudge + 6, + 2 // Ingrain }; -static const u16 sUnknown_0860A7D0[] = +static const u16 sPoints_RainMoves[] = { - 0x0003 + MOVE_BUBBLE, 3, + MOVE_WHIRLPOOL, 3, + MOVE_OCTAZOOKA, 3, + MOVE_CLAMP, 3, + MOVE_WITHDRAW, 3, + MOVE_CRABHAMMER, 3, + MOVE_WATER_SPOUT, 3, + MOVE_DIVE, 3, + MOVE_WATERFALL, 3, + MOVE_MUDDY_WATER, 3, + MOVE_SURF, 3, + MOVE_HYDRO_CANNON, 3, + MOVE_HYDRO_PUMP, 3, + MOVE_BUBBLE_BEAM, 3, + MOVE_WATER_SPORT, 0, // Unnecessary, unlisted moves are already given 0 points + MOVE_WATER_GUN, 3, + MOVE_WATER_PULSE, 3, + MOVE_WEATHER_BALL, 3, + MOVE_THUNDER, 3, + MOVE_SOLAR_BEAM, -4, + MOVE_OVERHEAT, -4, + MOVE_FLAME_WHEEL, -4, + MOVE_FLAMETHROWER, -4, + MOVE_SACRED_FIRE, -4, + MOVE_FIRE_BLAST, -4, + MOVE_HEAT_WAVE, -4, + MOVE_EMBER, -4, + MOVE_BLAST_BURN, -4, + MOVE_BLAZE_KICK, -4, + MOVE_ERUPTION, -4, + MOVE_FIRE_SPIN, -4, + MOVE_FIRE_PUNCH, -4, + MOVE_SOLAR_BEAM, -4, // Repeated + TABLE_END, 0 }; -static const u16 sUnknown_0860A7D2[] = +static const u16 sPoints_SunMoves[] = { - 0x0004 + MOVE_OVERHEAT, 3, + MOVE_FLAME_WHEEL, 3, + MOVE_FLAMETHROWER, 3, + MOVE_SACRED_FIRE, 3, + MOVE_FIRE_BLAST, 3, + MOVE_HEAT_WAVE, 3, + MOVE_EMBER, 3, + MOVE_BLAST_BURN, 3, + MOVE_BLAZE_KICK, 3, + MOVE_ERUPTION, 3, + MOVE_FIRE_SPIN, 3, + MOVE_FIRE_PUNCH, 3, + MOVE_SOLAR_BEAM, 5, + MOVE_SYNTHESIS, 3, + MOVE_MORNING_SUN, 3, + MOVE_MOONLIGHT, 3, + MOVE_WEATHER_BALL, 3, + TABLE_END, 0 }; -static const u16 sUnknown_0860A7D4[] = +static const u16 sPoints_SandstormMoves[] = { - 0x0003 + MOVE_WEATHER_BALL, 3, + MOVE_SOLAR_BEAM, -3, + TABLE_END, 0 }; -static const u16 sUnknown_0860A7D6[] = +static const u16 sPoints_HailMoves[] = { - 0x0006 + MOVE_WEATHER_BALL, 3, + MOVE_SOLAR_BEAM, -3, + TABLE_END, 0 }; -static const u16 sUnknown_0860A7D8[] = +static const u16 sPoints_ElectricMoves[] = { - 0x0006 + MOVE_THUNDERBOLT, 3, + MOVE_THUNDER_PUNCH, 3, + MOVE_SPARK, 3, + MOVE_THUNDER_SHOCK, 3, + MOVE_ZAP_CANNON, 3, + MOVE_SHOCK_WAVE, 3, + MOVE_THUNDER_WAVE, 0, // Unnecessary, unlisted moves are already given 0 points + MOVE_THUNDER, 3, + MOVE_VOLT_TACKLE, 3, + TABLE_END, 0 }; -static const u16 sUnknown_0860A7DA[] = +static const u16 sPoints_StatusDmg[] = { - 0x0006 + 5, // Curse + 3, // Leech Seed + 3, // Poison + 3, // Toxic + 3, // Burn + 3, // Nightmare + 3 // Wrap (Trapping move) }; -static const u16 sUnknown_0860A7DC[] = +static const u16 sPoints_Status[] = { - 0x0004 + 5, // Attraction + 5, // Confusion + 5, // Paralysis + 5, // Sleep + 5 // Freeze }; -static const u16 sUnknown_0860A7DE[] = + +static const u16 sPoints_Spikes[] = { 4 }; +static const u16 sPoints_WaterSport[] = { 5 }; +static const u16 sPoints_MudSport[] = { 5 }; +static const u16 sPoints_Reflect[] = { 3 }; +static const u16 sPoints_LightScreen[] = { 3 }; +static const u16 sPoints_Safeguard[] = { 4 }; +static const u16 sPoints_Mist[] = { 3 }; +static const u16 sPoints_BreakWall[] = { 6 }; +static const u16 sPoints_CriticalHit[] = { 6 }; +static const u16 sPoints_Faint[] = { 6 }; +static const u16 sPoints_Flinched[] = { 4 }; + +static const u16 sPoints_StatIncrease1[NUM_BATTLE_STATS - 1] = { - 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002 + [STAT_ATK - 1] = 2, + [STAT_DEF - 1] = 2, + [STAT_SPEED - 1] = 2, + [STAT_SPATK - 1] = 2, + [STAT_SPDEF - 1] = 2, + [STAT_ACC - 1] = 2, + [STAT_EVASION - 1] = 2 }; -static const u16 sUnknown_0860A7EC[] = +static const u16 sPoints_StatIncrease2[NUM_BATTLE_STATS - 1] = { - 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004 + [STAT_ATK - 1] = 4, + [STAT_DEF - 1] = 4, + [STAT_SPEED - 1] = 4, + [STAT_SPATK - 1] = 4, + [STAT_SPDEF - 1] = 4, + [STAT_ACC - 1] = 4, + [STAT_EVASION - 1] = 4 }; -static const u16 sUnknown_0860A7FA[] = +static const u16 sPoints_StatDecreaseSelf[NUM_BATTLE_STATS - 1] = { - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff + [STAT_ATK - 1] = -1, + [STAT_DEF - 1] = -1, + [STAT_SPEED - 1] = -1, + [STAT_SPATK - 1] = -1, + [STAT_SPDEF - 1] = -1, + [STAT_ACC - 1] = -1, + [STAT_EVASION - 1] = -1 }; -static const u16 sUnknown_0860A808[] = +static const u16 sPoints_StatDecrease1[NUM_BATTLE_STATS - 1] = { - 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002 + [STAT_ATK - 1] = 2, + [STAT_DEF - 1] = 2, + [STAT_SPEED - 1] = 2, + [STAT_SPATK - 1] = 2, + [STAT_SPDEF - 1] = 2, + [STAT_ACC - 1] = 2, + [STAT_EVASION - 1] = 2 }; -static const u16 sUnknown_0860A816[] = +static const u16 sPoints_StatDecrease2[NUM_BATTLE_STATS - 1] = { - 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004 + [STAT_ATK - 1] = 4, + [STAT_DEF - 1] = 4, + [STAT_SPEED - 1] = 4, + [STAT_SPATK - 1] = 4, + [STAT_SPDEF - 1] = 4, + [STAT_ACC - 1] = 4, + [STAT_EVASION - 1] = 4 }; -static const u16 sUnknown_0860A824[] = +static const u16 sPoints_StatIncreaseNotSelf[NUM_BATTLE_STATS - 1] = { - 0xfffe, 0xfffe, 0xfffe, 0xfffe, 0xfffe, 0xfffe, 0xfffe + [STAT_ATK - 1] = -2, + [STAT_DEF - 1] = -2, + [STAT_SPEED - 1] = -2, + [STAT_SPATK - 1] = -2, + [STAT_SPDEF - 1] = -2, + [STAT_ACC - 1] = -2, + [STAT_EVASION - 1] = -2 }; static const u16 *const sPointsArray[] = { - sUnknown_0860A4E0, - sUnknown_0860A68C, - sUnknown_0860A692, - sUnknown_0860A6A0, - sUnknown_0860A728, - sUnknown_0860A770, - sUnknown_0860A77C, - sUnknown_0860A788, - sUnknown_0860A7B0, - sUnknown_0860A7BE, - sUnknown_0860A7C8, - sUnknown_0860A7CA, - sUnknown_0860A7CC, - sUnknown_0860A7CE, - sUnknown_0860A7D0, - sUnknown_0860A7D2, - sUnknown_0860A7D4, - sUnknown_0860A7D6, - sUnknown_0860A7D8, - sUnknown_0860A7DA, - sUnknown_0860A7DA, - sUnknown_0860A7DC, - sUnknown_0860A7DE, - sUnknown_0860A7EC, - sUnknown_0860A7FA, - sUnknown_0860A808, - sUnknown_0860A816, - sUnknown_0860A824 + [PTS_MOVE_EFFECT] = sPoints_MoveEffect, + [PTS_EFFECTIVENESS] = sPoints_Effectiveness, + [PTS_SET_UP] = sPoints_SetUp, + [PTS_RAIN] = sPoints_RainMoves, + [PTS_SUN] = sPoints_SunMoves, + [PTS_SANDSTORM] = sPoints_SandstormMoves, + [PTS_HAIL] = sPoints_HailMoves, + [PTS_ELECTRIC] = sPoints_ElectricMoves, + [PTS_STATUS_DMG] = sPoints_StatusDmg, + [PTS_STATUS] = sPoints_Status, + [PTS_SPIKES] = sPoints_Spikes, + [PTS_WATER_SPORT] = sPoints_WaterSport, + [PTS_MUD_SPORT] = sPoints_MudSport, + [PTS_REFLECT] = sPoints_Reflect, + [PTS_LIGHT_SCREEN] = sPoints_LightScreen, + [PTS_SAFEGUARD] = sPoints_Safeguard, + [PTS_MIST] = sPoints_Mist, + [PTS_BREAK_WALL] = sPoints_BreakWall, + [PTS_CRITICAL_HIT] = sPoints_CriticalHit, + [PTS_FAINT] = sPoints_Faint, + [PTS_FAINT_SET_UP] = sPoints_Faint, + [PTS_FLINCHED] = sPoints_Flinched, + [PTS_STAT_INCREASE_1] = sPoints_StatIncrease1, + [PTS_STAT_INCREASE_2] = sPoints_StatIncrease2, + [PTS_STAT_DECREASE_SELF] = sPoints_StatDecreaseSelf, + [PTS_STAT_DECREASE_1] = sPoints_StatDecrease1, + [PTS_STAT_DECREASE_2] = sPoints_StatDecrease2, + [PTS_STAT_INCREASE_NOT_SELF] = sPoints_StatIncreaseNotSelf }; -static const u16 sUnknown_0860A8A4[] = +// Points will always be calculated for these messages +// even if current pokemon does not have corresponding move +static const u16 sSpecialBattleStrings[] = { STRINGID_PKMNPERISHCOUNTFELL, STRINGID_PKMNWISHCAMETRUE, STRINGID_PKMNLOSTPPGRUDGE, STRINGID_PKMNTOOKFOE, STRINGID_PKMNABSORBEDNUTRIENTS, STRINGID_PKMNANCHOREDITSELF, STRINGID_PKMNAFFLICTEDBYCURSE, STRINGID_PKMNSAPPEDBYLEECHSEED, STRINGID_PKMNLOCKEDINNIGHTMARE, STRINGID_PKMNHURTBY, STRINGID_PKMNHURTBYBURN, STRINGID_PKMNHURTBYPOISON, STRINGID_PKMNHURTBYSPIKES, STRINGID_ATTACKERFAINTED, STRINGID_TARGETFAINTED, - STRINGID_PKMNHITWITHRECOIL, STRINGID_PKMNCRASHED, 0xFFFF + STRINGID_PKMNHITWITHRECOIL, STRINGID_PKMNCRASHED, TABLE_END }; // code @@ -235,9 +570,9 @@ void BattleTv_SetDataBasedOnString(u16 stringId) moveSlot = GetBattlerMoveSlotId(gBattlerAttacker, gBattleMsgDataPtr->currentMove); - if (moveSlot >= 4 && sub_817E0B8(stringId) && stringId > BATTLESTRINGS_ID_ADDER) + if (moveSlot >= MAX_MON_MOVES && IsNotSpecialBattleString(stringId) && stringId > BATTLESTRINGS_ID_ADDER) { - tvPtr->side[atkSide].faintCause = 15; + tvPtr->side[atkSide].faintCause = FNT_OTHER; return; } @@ -252,17 +587,17 @@ void BattleTv_SetDataBasedOnString(u16 stringId) switch (stringId) { case STRINGID_ITDOESNTAFFECT: - AddMovePoints(1, moveSlot, 2, 0); + AddMovePoints(PTS_EFFECTIVENESS, moveSlot, 2, 0); if (!(gBattleTypeFlags & BATTLE_TYPE_LINK)) TrySetBattleSeminarShow(); break; case STRINGID_NOTVERYEFFECTIVE: - AddMovePoints(1, moveSlot, 1, 0); + AddMovePoints(PTS_EFFECTIVENESS, moveSlot, 1, 0); if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) && GetMonData(defMon, MON_DATA_HP, NULL) != 0) TrySetBattleSeminarShow(); break; case STRINGID_SUPEREFFECTIVE: - AddMovePoints(1, moveSlot, 0, 0); + AddMovePoints(PTS_EFFECTIVENESS, moveSlot, 0, 0); break; case STRINGID_PKMNFORESAWATTACK: tvPtr->side[atkSide].futureSightMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1; @@ -279,12 +614,12 @@ void BattleTv_SetDataBasedOnString(u16 stringId) break; case STRINGID_PKMNPERISHCOUNTFELL: if (*perishCount == 0) - tvPtr->side[atkSide].faintCause = 10; + tvPtr->side[atkSide].faintCause = FNT_PERISH_SONG; break; case STRINGID_PKMNWISHCAMETRUE: if (tvPtr->side[defSide].wishMonId != 0) { - AddMovePoints(2, 3, defSide, + AddMovePoints(PTS_SET_UP, 3, defSide, (tvPtr->side[defSide].wishMonId - 1) * 4 + tvPtr->side[defSide].wishMoveSlot); } break; @@ -295,7 +630,7 @@ void BattleTv_SetDataBasedOnString(u16 stringId) case STRINGID_PKMNLOSTPPGRUDGE: if (tvPtr->side[defSide].grudgeMonId != 0) { - AddMovePoints(2, 4, defSide, + AddMovePoints(PTS_SET_UP, 4, defSide, (tvPtr->side[defSide].grudgeMonId - 1) * 4 + tvPtr->side[defSide].grudgeMoveSlot); } break; @@ -305,7 +640,7 @@ void BattleTv_SetDataBasedOnString(u16 stringId) break; case STRINGID_PKMNTOOKFOE: if (tvPtr->side[defSide].destinyBondMonId != 0) - tvPtr->side[atkSide].faintCause = 11; + tvPtr->side[atkSide].faintCause = FNT_DESTINY_BOND; break; case STRINGID_PKMNPLANTEDROOTS: tvPtr->pos[atkSide][atkFlank].ingrainMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1; @@ -314,14 +649,14 @@ void BattleTv_SetDataBasedOnString(u16 stringId) case STRINGID_PKMNABSORBEDNUTRIENTS: if (tvPtr->pos[atkSide][atkFlank].ingrainMonId != 0) { - AddMovePoints(2, 6, atkSide, + AddMovePoints(PTS_SET_UP, 6, atkSide, (tvPtr->pos[atkSide][atkFlank].ingrainMonId - 1) * 4 + tvPtr->pos[atkSide][atkFlank].ingrainMoveSlot); } break; case STRINGID_PKMNANCHOREDITSELF: if (tvPtr->pos[defSide][defFlank].ingrainMonId != 0) { - AddMovePoints(2, 6, defSide, + AddMovePoints(PTS_SET_UP, 6, defSide, (tvPtr->pos[defSide][defFlank].ingrainMonId - 1) * 4 + tvPtr->pos[defSide][defFlank].ingrainMoveSlot); } break; @@ -329,15 +664,15 @@ void BattleTv_SetDataBasedOnString(u16 stringId) gBattleStruct->anyMonHasTransformed = TRUE; break; case STRINGID_CRITICALHIT: - AddMovePoints(0x12, moveSlot, 0, 0); + AddMovePoints(PTS_CRITICAL_HIT, moveSlot, 0, 0); break; case STRINGID_PKMNSSTATCHANGED: if (gBattleTextBuff1[2] != 0) { if (*statStringId == STRINGID_STATSHARPLY) - AddMovePoints(0x17, moveSlot, gBattleTextBuff1[2] - 1, 0); + AddMovePoints(PTS_STAT_INCREASE_2, moveSlot, gBattleTextBuff1[2] - 1, 0); else - AddMovePoints(0x16, moveSlot, gBattleTextBuff1[2] - 1, 0); + AddMovePoints(PTS_STAT_INCREASE_1, moveSlot, gBattleTextBuff1[2] - 1, 0); } break; case STRINGID_PKMNSSTATCHANGED2: @@ -346,27 +681,27 @@ void BattleTv_SetDataBasedOnString(u16 stringId) if (gBattlerAttacker == gBattlerTarget) { if (*statStringId == STRINGID_STATSHARPLY) - AddMovePoints(0x17, moveSlot, gBattleTextBuff1[2] - 1, 0); + AddMovePoints(PTS_STAT_INCREASE_2, moveSlot, gBattleTextBuff1[2] - 1, 0); else - AddMovePoints(0x16, moveSlot, gBattleTextBuff1[2] - 1, 0); + AddMovePoints(PTS_STAT_INCREASE_1, moveSlot, gBattleTextBuff1[2] - 1, 0); } else { - AddMovePoints(0x1B, moveSlot, gBattleTextBuff1[2] - 1, 0); + AddMovePoints(PTS_STAT_INCREASE_NOT_SELF, moveSlot, gBattleTextBuff1[2] - 1, 0); } } break; case STRINGID_PKMNSSTATCHANGED3: if (gBattleTextBuff1[2] != 0) - AddMovePoints(0x18, moveSlot, gBattleTextBuff1[2] - 1, 0); + AddMovePoints(PTS_STAT_DECREASE_SELF, moveSlot, gBattleTextBuff1[2] - 1, 0); break; case STRINGID_PKMNSSTATCHANGED4: if (gBattleTextBuff1[2] != 0) { if (*statStringId == STRINGID_STATHARSHLY) - AddMovePoints(0x1A, moveSlot, gBattleTextBuff1[2] - 1, 0); + AddMovePoints(PTS_STAT_DECREASE_2, moveSlot, gBattleTextBuff1[2] - 1, 0); else - AddMovePoints(0x19, moveSlot, gBattleTextBuff1[2] - 1, 0); + AddMovePoints(PTS_STAT_DECREASE_1, moveSlot, gBattleTextBuff1[2] - 1, 0); } break; case STRINGID_PKMNLAIDCURSE: @@ -377,8 +712,8 @@ void BattleTv_SetDataBasedOnString(u16 stringId) if (GetMonData(atkMon, MON_DATA_HP, NULL) && tvPtr->pos[atkSide][atkFlank].curseMonId != 0) { - AddMovePoints(8, 0, tvPtr->pos[atkSide][atkFlank].curseMonId - 1, tvPtr->pos[atkSide][atkFlank].curseMoveSlot); - tvPtr->side[atkSide].faintCause = 1; + AddMovePoints(PTS_STATUS_DMG, 0, tvPtr->pos[atkSide][atkFlank].curseMonId - 1, tvPtr->pos[atkSide][atkFlank].curseMoveSlot); + tvPtr->side[atkSide].faintCause = FNT_CURSE; tvPtr->side[atkSide].faintCauseMonId = atkFlank; } break; @@ -389,8 +724,8 @@ void BattleTv_SetDataBasedOnString(u16 stringId) case STRINGID_PKMNSAPPEDBYLEECHSEED: if (tvPtr->pos[atkSide][atkFlank].leechSeedMonId != 0) { - AddMovePoints(8, 1, tvPtr->pos[atkSide][atkFlank].leechSeedMonId - 1, tvPtr->pos[atkSide][atkFlank].leechSeedMoveSlot); - tvPtr->side[atkSide].faintCause = 2; + AddMovePoints(PTS_STATUS_DMG, 1, tvPtr->pos[atkSide][atkFlank].leechSeedMonId - 1, tvPtr->pos[atkSide][atkFlank].leechSeedMoveSlot); + tvPtr->side[atkSide].faintCause = FNT_LEECH_SEED; tvPtr->side[atkSide].faintCauseMonId = atkFlank; } break; @@ -402,8 +737,8 @@ void BattleTv_SetDataBasedOnString(u16 stringId) if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0 && tvPtr->pos[atkSide][atkFlank].nightmareMonId != 0) { - AddMovePoints(8, 5, tvPtr->pos[atkSide][atkFlank].nightmareMonId - 1, tvPtr->pos[atkSide][atkFlank].nightmareMoveSlot); - tvPtr->side[atkSide].faintCause = 5; + AddMovePoints(PTS_STATUS_DMG, 5, tvPtr->pos[atkSide][atkFlank].nightmareMonId - 1, tvPtr->pos[atkSide][atkFlank].nightmareMoveSlot); + tvPtr->side[atkSide].faintCause = FNT_NIGHTMARE; tvPtr->side[atkSide].faintCauseMonId = atkFlank; } break; @@ -419,8 +754,8 @@ void BattleTv_SetDataBasedOnString(u16 stringId) if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0 && tvPtr->pos[atkSide][atkFlank].wrapMonId != 0) { - AddMovePoints(8, 6, tvPtr->pos[atkSide][atkFlank].wrapMonId - 1, tvPtr->pos[atkSide][atkFlank].wrapMoveSlot); - tvPtr->side[atkSide].faintCause = 6; + AddMovePoints(PTS_STATUS_DMG, 6, tvPtr->pos[atkSide][atkFlank].wrapMonId - 1, tvPtr->pos[atkSide][atkFlank].wrapMoveSlot); + tvPtr->side[atkSide].faintCause = FNT_WRAP; tvPtr->side[atkSide].faintCauseMonId = atkFlank; } break; @@ -432,8 +767,8 @@ void BattleTv_SetDataBasedOnString(u16 stringId) if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0) { if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMonId != 0) - AddMovePoints(8, 4, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMoveSlot); - tvPtr->side[atkSide].faintCause = 4; + AddMovePoints(PTS_STATUS_DMG, 4, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMoveSlot); + tvPtr->side[atkSide].faintCause = FNT_BURN; tvPtr->side[atkSide].faintCauseMonId = gBattlerPartyIndexes[gBattlerAttacker]; } break; @@ -449,10 +784,10 @@ void BattleTv_SetDataBasedOnString(u16 stringId) if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0) { if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMonId != 0) - AddMovePoints(8, 2, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMoveSlot); + AddMovePoints(PTS_STATUS_DMG, 2, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMoveSlot); if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].badPsnMonId != 0) - AddMovePoints(8, 3, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].badPsnMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].badPsnMoveSlot); - tvPtr->side[atkSide].faintCause = 3; + AddMovePoints(PTS_STATUS_DMG, 3, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].badPsnMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].badPsnMoveSlot); + tvPtr->side[atkSide].faintCause = FNT_POISON; tvPtr->side[atkSide].faintCauseMonId = gBattlerPartyIndexes[gBattlerAttacker]; } break; @@ -462,7 +797,7 @@ void BattleTv_SetDataBasedOnString(u16 stringId) break; case STRINGID_PKMNIMMOBILIZEDBYLOVE: if (tvPtr->pos[atkSide][atkFlank].attractMonId != 0) - AddMovePoints(9, 0, tvPtr->pos[atkSide][atkFlank].attractMonId - 1, tvPtr->pos[atkSide][atkFlank].attractMoveSlot); + AddMovePoints(PTS_STATUS, 0, tvPtr->pos[atkSide][atkFlank].attractMonId - 1, tvPtr->pos[atkSide][atkFlank].attractMoveSlot); break; case STRINGID_PKMNWASPARALYZED: tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].prlzMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1; @@ -470,7 +805,7 @@ void BattleTv_SetDataBasedOnString(u16 stringId) break; case STRINGID_PKMNISPARALYZED: if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].prlzMonId != 0) - AddMovePoints(9, 2, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].prlzMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].prlzMoveSlot); + AddMovePoints(PTS_STATUS, 2, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].prlzMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].prlzMoveSlot); break; case STRINGID_PKMNFELLASLEEP: tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].slpMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1; @@ -480,7 +815,7 @@ void BattleTv_SetDataBasedOnString(u16 stringId) if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].slpMonId != 0 && gBattleMsgDataPtr->currentMove != MOVE_SNORE && gBattleMsgDataPtr->currentMove != MOVE_SLEEP_TALK) - AddMovePoints(9, 3, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].slpMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].slpMoveSlot); + AddMovePoints(PTS_STATUS, 3, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].slpMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].slpMoveSlot); break; case STRINGID_PKMNWASFROZEN: tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].frzMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1; @@ -488,7 +823,7 @@ void BattleTv_SetDataBasedOnString(u16 stringId) break; case STRINGID_PKMNISFROZEN: if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].frzMonId != 0) - AddMovePoints(9, 4, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].frzMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].frzMoveSlot); + AddMovePoints(PTS_STATUS, 4, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].frzMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].frzMoveSlot); break; case STRINGID_PKMNWASCONFUSED: tvPtr->pos[effSide][effFlank].confusionMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1; @@ -496,8 +831,8 @@ void BattleTv_SetDataBasedOnString(u16 stringId) break; case STRINGID_ITHURTCONFUSION: if (tvPtr->pos[atkSide][atkFlank].confusionMonId != 0) - AddMovePoints(9, 1, tvPtr->pos[atkSide][atkFlank].confusionMonId - 1, tvPtr->pos[atkSide][atkFlank].confusionMoveSlot); - tvPtr->side[atkSide].faintCause = 12; + AddMovePoints(PTS_STATUS, 1, tvPtr->pos[atkSide][atkFlank].confusionMonId - 1, tvPtr->pos[atkSide][atkFlank].confusionMoveSlot); + tvPtr->side[atkSide].faintCause = FNT_CONFUSION; break; case STRINGID_SPIKESSCATTERED: tvPtr->side[defSide].spikesMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1; @@ -506,8 +841,8 @@ void BattleTv_SetDataBasedOnString(u16 stringId) case STRINGID_PKMNHURTBYSPIKES: if (tvPtr->side[scriptingSide].spikesMonId != 0) { - AddMovePoints(10, scriptingSide ^ BIT_SIDE, tvPtr->side[scriptingSide].spikesMonId - 1, tvPtr->side[scriptingSide].spikesMoveSlot); - tvPtr->side[scriptingSide].faintCause = 7; + AddMovePoints(PTS_SPIKES, scriptingSide ^ BIT_SIDE, tvPtr->side[scriptingSide].spikesMonId - 1, tvPtr->side[scriptingSide].spikesMoveSlot); + tvPtr->side[scriptingSide].faintCause = FNT_SPIKES; } break; case STRINGID_PKMNBLEWAWAYSPIKES: @@ -582,7 +917,7 @@ void BattleTv_SetDataBasedOnString(u16 stringId) break; case STRINGID_PKMNUSEDSAFEGUARD: if (tvPtr->side[defSide].safeguardMonId != 0) - AddMovePoints(15, 0, tvPtr->side[defSide].safeguardMonId - 1, tvPtr->side[defSide].safeguardMoveSlot); + AddMovePoints(PTS_SAFEGUARD, 0, tvPtr->side[defSide].safeguardMonId - 1, tvPtr->side[defSide].safeguardMoveSlot); break; case STRINGID_PKMNSAFEGUARDEXPIRED: tvPtr->side[atkSide].safeguardMonId = 0; @@ -594,40 +929,40 @@ void BattleTv_SetDataBasedOnString(u16 stringId) break; case STRINGID_PKMNPROTECTEDBYMIST: if (tvPtr->side[defSide].mistMonId != 0) - AddMovePoints(16, 0, tvPtr->side[defSide].mistMonId - 1, tvPtr->side[defSide].mistMoveSlot); + AddMovePoints(PTS_MIST, 0, tvPtr->side[defSide].mistMonId - 1, tvPtr->side[defSide].mistMoveSlot); break; case STRINGID_THEWALLSHATTERED: tvPtr->side[defSide].reflectMonId = 0; tvPtr->side[defSide].reflectMoveSlot = 0; tvPtr->side[defSide].lightScreenMonId = 0; tvPtr->side[defSide].lightScreenMoveSlot = 0; - AddMovePoints(17, 0, gBattlerPartyIndexes[gBattlerAttacker], moveSlot); + AddMovePoints(PTS_BREAK_WALL, 0, gBattlerPartyIndexes[gBattlerAttacker], moveSlot); break; case STRINGID_PKMNFLINCHED: if (tvPtr->pos[atkSide][0].attackedByMonId != 0) - AddMovePoints(21, 0, tvPtr->pos[atkSide][0].attackedByMonId - 1, tvPtr->pos[atkSide][0].attackedByMoveSlot); + AddMovePoints(PTS_FLINCHED, 0, tvPtr->pos[atkSide][0].attackedByMonId - 1, tvPtr->pos[atkSide][0].attackedByMoveSlot); if (tvPtr->pos[atkSide][1].attackedByMonId != 0) - AddMovePoints(21, 0, tvPtr->pos[atkSide][1].attackedByMonId - 1, tvPtr->pos[atkSide][1].attackedByMoveSlot); + AddMovePoints(PTS_FLINCHED, 0, tvPtr->pos[atkSide][1].attackedByMonId - 1, tvPtr->pos[atkSide][1].attackedByMoveSlot); break; case STRINGID_PKMNCRASHED: case STRINGID_PKMNHITWITHRECOIL: - tvPtr->side[atkSide].faintCause = 14; + tvPtr->side[atkSide].faintCause = FNT_RECOIL; break; } } -static bool8 sub_817E0B8(u16 stringId) +static bool8 IsNotSpecialBattleString(u16 stringId) { s32 i = 0; do { - if (sUnknown_0860A8A4[i] == stringId) + if (sSpecialBattleStrings[i] == stringId) break; i++; - } while (sUnknown_0860A8A4[i] != 0xFFFF); + } while (sSpecialBattleStrings[i] != TABLE_END); - if (sUnknown_0860A8A4[i] == 0xFFFF) + if (sSpecialBattleStrings[i] == TABLE_END) return TRUE; else return FALSE; @@ -648,19 +983,19 @@ void BattleTv_SetDataBasedOnMove(u16 move, u16 weatherFlags, struct DisableStruc defSide = GetBattlerSide(gBattlerTarget); moveSlot = GetBattlerMoveSlotId(gBattlerAttacker, move); - if (moveSlot >= 4) + if (moveSlot >= MAX_MON_MOVES) { - tvPtr->side[atkSide].faintCause = 15; + tvPtr->side[atkSide].faintCause = FNT_OTHER; return; } tvPtr->pos[defSide][GetBattlerPosition(gBattlerAttacker) / 2].attackedByMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1; tvPtr->pos[defSide][GetBattlerPosition(gBattlerAttacker) / 2].attackedByMoveSlot = moveSlot; tvPtr->side[atkSide].usedMoveSlot = moveSlot; - AddMovePoints(0, moveSlot, gBattleMoves[move].effect, 0); + AddMovePoints(PTS_MOVE_EFFECT, moveSlot, gBattleMoves[move].effect, 0); AddPointsBasedOnWeather(weatherFlags, move, moveSlot); if (disableStructPtr->chargeTimer != 0) - AddMovePoints(7, move, moveSlot, 0); + AddMovePoints(PTS_ELECTRIC, move, moveSlot, 0); if (move == MOVE_WISH) { @@ -671,14 +1006,14 @@ void BattleTv_SetDataBasedOnMove(u16 move, u16 weatherFlags, struct DisableStruc { tvPtr->side[atkSide ^ BIT_SIDE].explosionMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1; tvPtr->side[atkSide ^ BIT_SIDE].explosionMoveSlot = moveSlot; - tvPtr->side[atkSide ^ BIT_SIDE].faintCause = 13; - tvPtr->side[atkSide ^ BIT_SIDE].explosion = 1; + tvPtr->side[atkSide ^ BIT_SIDE].faintCause = FNT_EXPLOSION; + tvPtr->side[atkSide ^ BIT_SIDE].explosion = TRUE; } - AddMovePoints(13, gBattleMoves[move].type, gBattleMoves[move].power, 0); - AddMovePoints(14, gBattleMoves[move].type, gBattleMoves[move].power, 0); - AddMovePoints(11, gBattleMoves[move].type, 0, 0); - AddMovePoints(12, gBattleMoves[move].type, 0, 0); + AddMovePoints(PTS_REFLECT, gBattleMoves[move].type, gBattleMoves[move].power, 0); + AddMovePoints(PTS_LIGHT_SCREEN, gBattleMoves[move].type, gBattleMoves[move].power, 0); + AddMovePoints(PTS_WATER_SPORT, gBattleMoves[move].type, 0, 0); + AddMovePoints(PTS_MUD_SPORT, gBattleMoves[move].type, 0, 0); } void BattleTv_SetDataBasedOnAnimation(u8 animationId) @@ -696,17 +1031,17 @@ void BattleTv_SetDataBasedOnAnimation(u8 animationId) case B_ANIM_FUTURE_SIGHT_HIT: if (tvPtr->side[atkSide].futureSightMonId != 0) { - AddMovePoints(2, 0, atkSide, + AddMovePoints(PTS_SET_UP, 0, atkSide, (tvPtr->side[atkSide].futureSightMonId - 1) * 4 + tvPtr->side[atkSide].futureSightMoveSlot); - tvPtr->side[atkSide].faintCause = 8; + tvPtr->side[atkSide].faintCause = FNT_FUTURE_SIGHT; } break; case B_ANIM_DOOM_DESIRE_HIT: if (tvPtr->side[atkSide].doomDesireMonId != 0) { - AddMovePoints(2, 1, atkSide, + AddMovePoints(PTS_SET_UP, 1, atkSide, (tvPtr->side[atkSide].doomDesireMonId - 1) * 4 + tvPtr->side[atkSide].doomDesireMoveSlot); - tvPtr->side[atkSide].faintCause = 9; + tvPtr->side[atkSide].faintCause = FNT_DOOM_DESIRE; } break; } @@ -819,49 +1154,67 @@ static void AddMovePoints(u8 caseId, u16 arg1, u8 arg2, u8 arg3) switch (caseId) { - case 0: - case 1: - case 18: - case 22 ... 27: + case PTS_MOVE_EFFECT: + case PTS_EFFECTIVENESS: + case PTS_CRITICAL_HIT: + case PTS_STAT_INCREASE_1: + case PTS_STAT_INCREASE_2: + case PTS_STAT_DECREASE_SELF: + case PTS_STAT_DECREASE_1: + case PTS_STAT_DECREASE_2: + case PTS_STAT_INCREASE_NOT_SELF: movePoints->points[atkSide][gBattlerPartyIndexes[gBattlerAttacker] * 4 + arg1] += sPointsArray[caseId][arg2]; break; - case 3 ... 7: + +#define move arg1 + case PTS_RAIN: + case PTS_SUN: + case PTS_SANDSTORM: + case PTS_HAIL: + case PTS_ELECTRIC: i = 0; ptr = sPointsArray[caseId]; do { - if (arg1 == ptr[i]) + if (move == ptr[i]) { movePoints->points[atkSide][gBattlerPartyIndexes[gBattlerAttacker] * 4 + arg2] += ptr[i+1]; break; } i += 2; - } while (ptr[i] != 0xFFFF); + } while (ptr[i] != TABLE_END); break; - case 19: - tvPtr->side[arg2 ^ 1].faintCause = 0; +#undef move + + case PTS_FAINT: + tvPtr->side[arg2 ^ 1].faintCause = FNT_NONE; movePoints->points[arg2][0 * 4 + arg3] += sPointsArray[caseId][arg1]; break; - case 20: - tvPtr->side[arg2].faintCause = 0; - case 2: + case PTS_FAINT_SET_UP: + tvPtr->side[arg2].faintCause = FNT_NONE; + // fallthrough + case PTS_SET_UP: movePoints->points[arg2][0 * 4 + arg3] += sPointsArray[caseId][arg1]; break; - case 17: + case PTS_BREAK_WALL: movePoints->points[atkSide][arg2 * 4 + arg3] += sPointsArray[caseId][arg1]; break; - case 8: - case 9: - case 15: - case 16: - case 21: + case PTS_STATUS_DMG: + case PTS_STATUS: + case PTS_SAFEGUARD: + case PTS_MIST: + case PTS_FLINCHED: movePoints->points[atkSide ^ BIT_SIDE][arg2 * 4 + arg3] += sPointsArray[caseId][arg1]; break; - case 10: + case PTS_SPIKES: movePoints->points[arg1][arg2 * 4 + arg3] += sPointsArray[caseId][0]; break; - case 11: - if (tvPtr->pos[defSide][0].waterSportMonId != -(tvPtr->pos[defSide][1].waterSportMonId) && arg1 == 10) + +#define type arg1 +#define power arg2 + case PTS_WATER_SPORT: + // If used fire move during Water Sport + if (tvPtr->pos[defSide][0].waterSportMonId != -(tvPtr->pos[defSide][1].waterSportMonId) && type == TYPE_FIRE) { if (tvPtr->pos[defSide][0].waterSportMonId != 0) { @@ -875,8 +1228,9 @@ static void AddMovePoints(u8 caseId, u16 arg1, u8 arg2, u8 arg3) } } break; - case 12: - if (tvPtr->pos[defSide][0].mudSportMonId != -(tvPtr->pos[defSide][1].mudSportMonId) && arg1 == 13) + case PTS_MUD_SPORT: + // If used Electric move during Mud Sport + if (tvPtr->pos[defSide][0].mudSportMonId != -(tvPtr->pos[defSide][1].mudSportMonId) && type == TYPE_ELECTRIC) { if (tvPtr->pos[defSide][0].mudSportMonId != 0) { @@ -890,20 +1244,24 @@ static void AddMovePoints(u8 caseId, u16 arg1, u8 arg2, u8 arg3) } } break; - case 13: - if (arg1 <= 8 && arg2 != 0 && tvPtr->side[defSide].reflectMonId != 0) + case PTS_REFLECT: + // If hit Reflect with damaging physical move + if (type < TYPE_MYSTERY && power != 0 && tvPtr->side[defSide].reflectMonId != 0) { u32 id = (tvPtr->side[defSide].reflectMonId - 1) * 4; movePoints->points[defSide][id + tvPtr->side[defSide].reflectMoveSlot] += sPointsArray[caseId][0]; } break; - case 14: - if (arg1 > 8 && arg2 != 0 && tvPtr->side[defSide].lightScreenMonId != 0) + case PTS_LIGHT_SCREEN: + // If hit Light Screen with damaging special move + if (type >= TYPE_MYSTERY && power != 0 && tvPtr->side[defSide].lightScreenMonId != 0) { u32 id = (tvPtr->side[defSide].lightScreenMonId - 1) * 4; movePoints->points[defSide][id + tvPtr->side[defSide].lightScreenMoveSlot] += sPointsArray[caseId][0]; } break; +#undef type +#undef power } } @@ -915,144 +1273,144 @@ static void AddPointsOnFainting(bool8 targetFainted) u32 atkArrId = tvPtr->side[atkSide].faintCauseMonId; s32 i; - if (tvPtr->side[atkSide].faintCause != 0) + if (tvPtr->side[atkSide].faintCause != FNT_NONE) { switch (tvPtr->side[atkSide].faintCause) { - case 1: + case FNT_CURSE: if (tvPtr->pos[atkSide][atkArrId].curseMonId != 0) { - AddMovePoints(19, 0, atkSide ^ BIT_SIDE, + AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE, (tvPtr->pos[atkSide][atkArrId].curseMonId - 1) * 4 + tvPtr->pos[atkSide][atkArrId].curseMoveSlot); } break; - case 2: + case FNT_LEECH_SEED: if (tvPtr->pos[atkSide][atkArrId].leechSeedMonId != 0) { - AddMovePoints(19, 0, atkSide ^ BIT_SIDE, + AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE, (tvPtr->pos[atkSide][atkArrId].leechSeedMonId - 1) * 4 + tvPtr->pos[atkSide][atkArrId].leechSeedMoveSlot); } break; - case 3: + case FNT_POISON: if (tvPtr->mon[atkSide][atkArrId].psnMonId != 0) { - AddMovePoints(19, 0, atkSide ^ BIT_SIDE, + AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE, (tvPtr->mon[atkSide][atkArrId].psnMonId - 1) * 4 + tvPtr->mon[atkSide][atkArrId].psnMoveSlot); } if (tvPtr->mon[atkSide][atkArrId].badPsnMonId != 0) { - AddMovePoints(19, 0, atkSide ^ BIT_SIDE, + AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE, (tvPtr->mon[atkSide][atkArrId].badPsnMonId - 1) * 4 + tvPtr->mon[atkSide][atkArrId].badPsnMoveSlot); } break; - case 4: + case FNT_BURN: if (tvPtr->mon[atkSide][atkArrId].brnMonId != 0) { - AddMovePoints(19, 0, atkSide ^ BIT_SIDE, + AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE, (tvPtr->mon[atkSide][atkArrId].brnMonId - 1) * 4 + tvPtr->mon[atkSide][atkArrId].brnMoveSlot); } break; - case 5: + case FNT_NIGHTMARE: if (tvPtr->pos[atkSide][atkArrId].nightmareMonId != 0) { - AddMovePoints(19, 0, atkSide ^ BIT_SIDE, + AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE, (tvPtr->pos[atkSide][atkArrId].nightmareMonId - 1) * 4 + tvPtr->pos[atkSide][atkArrId].nightmareMoveSlot); } break; - case 6: + case FNT_WRAP: if (tvPtr->pos[atkSide][atkArrId].wrapMonId != 0) { - AddMovePoints(19, 0, atkSide ^ BIT_SIDE, + AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE, (tvPtr->pos[atkSide][atkArrId].wrapMonId - 1) * 4 + tvPtr->pos[atkSide][atkArrId].wrapMoveSlot); } break; - case 7: + case FNT_SPIKES: if (tvPtr->side[atkSide].spikesMonId != 0) { - AddMovePoints(19, 0, atkSide ^ BIT_SIDE, + AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE, (tvPtr->side[atkSide].spikesMonId - 1) * 4 + tvPtr->side[atkSide].spikesMoveSlot); } break; - case 8: + case FNT_FUTURE_SIGHT: if (tvPtr->side[atkSide].futureSightMonId != 0) { - AddMovePoints(20, 0, atkSide, + AddMovePoints(PTS_FAINT_SET_UP, 0, atkSide, (tvPtr->side[atkSide].futureSightMonId - 1) * 4 + tvPtr->side[atkSide].futureSightMoveSlot); } break; - case 9: + case FNT_DOOM_DESIRE: if (tvPtr->side[atkSide].doomDesireMonId != 0) { - AddMovePoints(20, 0, atkSide, + AddMovePoints(PTS_FAINT_SET_UP, 0, atkSide, (tvPtr->side[atkSide].doomDesireMonId - 1) * 4 + tvPtr->side[atkSide].doomDesireMoveSlot); } break; - case 10: + case FNT_PERISH_SONG: if (tvPtr->side[atkSide].perishSong && tvPtr->side[atkSide].perishSongMonId - 1 != gBattlerPartyIndexes[gBattlerAttacker]) { - AddMovePoints(19, 0, atkSide, + AddMovePoints(PTS_FAINT, 0, atkSide, (tvPtr->side[atkSide].perishSongMonId - 1) * 4 + tvPtr->side[atkSide].perishSongMoveSlot); } if (tvPtr->side[atkSide ^ BIT_SIDE].perishSong) { - AddMovePoints(19, 0, atkSide ^ BIT_SIDE, + AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE, (tvPtr->side[atkSide ^ BIT_SIDE].perishSongMonId - 1) * 4 + tvPtr->side[atkSide ^ BIT_SIDE].perishSongMoveSlot); } break; - case 11: + case FNT_DESTINY_BOND: if (tvPtr->side[atkSide ^ BIT_SIDE].destinyBondMonId != 0) { - AddMovePoints(19, 0, atkSide ^ BIT_SIDE, + AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE, (tvPtr->side[atkSide ^ BIT_SIDE].destinyBondMonId - 1) * 4 + tvPtr->side[atkSide ^ BIT_SIDE].destinyBondMoveSlot); } break; - case 12: + case FNT_CONFUSION: for (i = 0; i < 2; i++) { if (tvPtr->pos[atkSide][i].confusionMonId != 0) { - AddMovePoints(19, 0, atkSide ^ BIT_SIDE, + AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE, (tvPtr->pos[atkSide][i].confusionMonId - 1) * 4 + tvPtr->pos[atkSide][i].confusionMoveSlot); } } break; - case 13: + case FNT_EXPLOSION: if (tvPtr->side[atkSide].explosion) { - AddMovePoints(19, 0, atkSide, + AddMovePoints(PTS_FAINT, 0, atkSide, (tvPtr->side[atkSide].explosionMonId - 1) * 4 + tvPtr->side[atkSide].explosionMoveSlot); } if (tvPtr->side[atkSide ^ BIT_SIDE].explosion) { - AddMovePoints(19, 0, atkSide ^ BIT_SIDE, + AddMovePoints(PTS_FAINT, 0, atkSide ^ BIT_SIDE, (tvPtr->side[atkSide ^ BIT_SIDE].explosionMonId - 1) * 4 + tvPtr->side[atkSide ^ BIT_SIDE].explosionMoveSlot); } break; - case 14: + case FNT_RECOIL: if (targetFainted == TRUE) { - AddMovePoints(20, 0, atkSide, + AddMovePoints(PTS_FAINT_SET_UP, 0, atkSide, (gBattlerPartyIndexes[gBattlerAttacker]) * 4 + tvPtr->side[atkSide].usedMoveSlot); } break; - case 15: + case FNT_OTHER: break; } } else { - if (tvPtr->side[defSide].faintCause == 7) + if (tvPtr->side[defSide].faintCause == FNT_SPIKES) { if (tvPtr->side[defSide].spikesMonId != 0) { - AddMovePoints(19, 0, defSide ^ BIT_SIDE, + AddMovePoints(PTS_FAINT, 0, defSide ^ BIT_SIDE, (tvPtr->side[defSide].spikesMonId - 1) * 4 + tvPtr->side[defSide].spikesMoveSlot); } } else { - AddMovePoints(20, 0, atkSide, + AddMovePoints(PTS_FAINT_SET_UP, 0, atkSide, (gBattlerPartyIndexes[gBattlerAttacker]) * 4 + tvPtr->side[atkSide].usedMoveSlot); } } @@ -1061,7 +1419,7 @@ static void AddPointsOnFainting(bool8 targetFainted) static void TrySetBattleSeminarShow(void) { s32 i; - s32 dmgByMove[4]; + s32 dmgByMove[MAX_MON_MOVES]; u16 powerOverride; u16 currMoveSaved; @@ -1087,9 +1445,9 @@ static void TrySetBattleSeminarShow(void) if (currMoveSaved == sVariableDmgMoves[i]) break; i++; - } while (sVariableDmgMoves[i] != 0xFFFF); + } while (sVariableDmgMoves[i] != TABLE_END); - if (sVariableDmgMoves[i] != 0xFFFF) + if (sVariableDmgMoves[i] != TABLE_END) return; dmgByMove[gMoveSelectionCursor[gBattlerAttacker]] = gBattleMoveDamage; @@ -1138,7 +1496,7 @@ static void TrySetBattleSeminarShow(void) opponentSpecies = GetMonData(&gEnemyParty [gBattlerPartyIndexes[gBattlerTarget]], MON_DATA_SPECIES, NULL); playerSpecies = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]], MON_DATA_SPECIES, NULL); - sub_80EE35C(opponentSpecies, playerSpecies, gMoveSelectionCursor[gBattlerAttacker], gBattleMons[gBattlerAttacker].moves, gBattleMons[gBattlerAttacker].moves[bestMoveId]); + TryPutBattleSeminarOnAir(opponentSpecies, playerSpecies, gMoveSelectionCursor[gBattlerAttacker], gBattleMons[gBattlerAttacker].moves, gBattleMons[gBattlerAttacker].moves[bestMoveId]); break; } } @@ -1162,9 +1520,9 @@ static bool8 ShouldCalculateDamage(u16 moveId, s32 *dmg, u16 *powerOverride) if (moveId == sVariableDmgMoves[i]) break; i++; - } while (sVariableDmgMoves[i] != 0xFFFF); + } while (sVariableDmgMoves[i] != TABLE_END); - if (sVariableDmgMoves[i] != 0xFFFF) + if (sVariableDmgMoves[i] != TABLE_END) { *dmg = 0; return FALSE; @@ -1193,8 +1551,8 @@ void BattleTv_ClearExplosionFaintCause(void) { struct BattleTv *tvPtr = &gBattleStruct->tv; - tvPtr->side[B_SIDE_PLAYER].faintCause = 0; - tvPtr->side[B_SIDE_OPPONENT].faintCause = 0; + tvPtr->side[B_SIDE_PLAYER].faintCause = FNT_NONE; + tvPtr->side[B_SIDE_OPPONENT].faintCause = FNT_NONE; tvPtr->side[B_SIDE_PLAYER].faintCauseMonId = 0; tvPtr->side[B_SIDE_OPPONENT].faintCauseMonId = 0; @@ -1205,8 +1563,8 @@ void BattleTv_ClearExplosionFaintCause(void) tvPtr->side[B_SIDE_PLAYER].explosionMoveSlot = 0; tvPtr->side[B_SIDE_OPPONENT].explosionMoveSlot = 0; - tvPtr->side[B_SIDE_PLAYER].explosion = 0; - tvPtr->side[B_SIDE_OPPONENT].explosion = 0; + tvPtr->side[B_SIDE_PLAYER].explosion = FALSE; + tvPtr->side[B_SIDE_OPPONENT].explosion = FALSE; } } @@ -1236,11 +1594,11 @@ u8 GetBattlerMoveSlotId(u8 battlerId, u16 moveId) static void AddPointsBasedOnWeather(u16 weatherFlags, u16 moveId, u8 moveSlot) { if (weatherFlags & WEATHER_RAIN_ANY) - AddMovePoints(3, moveId, moveSlot, 0); + AddMovePoints(PTS_RAIN, moveId, moveSlot, 0); else if (weatherFlags & WEATHER_SUN_ANY) - AddMovePoints(4, moveId, moveSlot, 0); + AddMovePoints(PTS_SUN, moveId, moveSlot, 0); else if (weatherFlags & WEATHER_SANDSTORM_ANY) - AddMovePoints(5, moveId, moveSlot, 0); + AddMovePoints(PTS_SANDSTORM, moveId, moveSlot, 0); else if (weatherFlags & WEATHER_HAIL_ANY) - AddMovePoints(6, moveId, moveSlot, 0); + AddMovePoints(PTS_HAIL, moveId, moveSlot, 0); } diff --git a/src/berry_blender.c b/src/berry_blender.c index 573affbd5..08a25c58a 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -2390,7 +2390,7 @@ static s16 Debug_GetGameTimeStage(void) static void CalculatePokeblock(struct BlenderBerry *berries, struct Pokeblock *pokeblock, u8 numPlayers, u8 *flavors, u16 maxRPM) { s32 i, j; - s32 multiuseVar, var2; + s32 multiuseVar; u8 numNegatives; for (i = 0; i < FLAVOR_COUNT + 1; i++) diff --git a/src/berry_crush.c b/src/berry_crush.c index 90bc7150d..84e2e2eba 100755 --- a/src/berry_crush.c +++ b/src/berry_crush.c @@ -877,7 +877,7 @@ void StartBerryCrush(MainCallback callback) static void GetBerryFromBag(void) { if (gSpecialVar_ItemId < FIRST_BERRY_INDEX || gSpecialVar_ItemId > LAST_BERRY_INDEX + 1) - gSpecialVar_ItemId = ITEM_CHERI_BERRY; + gSpecialVar_ItemId = FIRST_BERRY_INDEX; else RemoveBagItem(gSpecialVar_ItemId, 1); @@ -1573,7 +1573,6 @@ static void Task_ShowBerryCrushRankings(u8 taskId) u8 i = 0, j, xPos, yPos; u32 score = 0; s16 *data = gTasks[taskId].data; - u8 *str; switch (data[0]) { @@ -1714,8 +1713,7 @@ void sub_8022588(struct BerryCrushGame *r5) void sub_8022600(struct BerryCrushGame *r6) { - u8 r7, r2; - u8 *r4; + u8 r7; for (r7 = 0; r7 < r6->unk9; ++r7) { diff --git a/src/cable_club.c b/src/cable_club.c index 64bc9187a..cd0baefcd 100644 --- a/src/cable_club.c +++ b/src/cable_club.c @@ -128,8 +128,6 @@ static void UpdateLinkPlayerCountDisplay(u8 taskId, u8 numPlayers) static u32 ExchangeDataAndGetLinkupStatus(u8 minPlayers, u8 maxPlayers) { - int playerCount; - switch (GetLinkPlayerDataExchangeStatusTimed(minPlayers, maxPlayers)) { case EXCHANGE_COMPLETE: @@ -511,7 +509,6 @@ static void FinishLinkup(u16 *linkupStatus, u32 taskId) static void Task_LinkupAwaitTrainerCardData(u8 taskId) { u8 index; - struct TrainerCard *trainerCards; if (CheckLinkErrored(taskId) == TRUE) return; diff --git a/src/contest.c b/src/contest.c index 40a0eac66..e7c420448 100644 --- a/src/contest.c +++ b/src/contest.c @@ -4422,7 +4422,6 @@ static void CalculateAppealMoveImpact(u8 contestant) u16 move; u8 effect; u8 rnd; - bool8 canUseTurn; s32 i; eContestantStatus[contestant].appeal = 0; diff --git a/src/credits.c b/src/credits.c index 41d1c1686..a9beb319c 100644 --- a/src/credits.c +++ b/src/credits.c @@ -1158,7 +1158,7 @@ static void CB2_RunCreditsSequence(void) static void sub_8175548(void) { ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, sBackgroundTemplates, 1); + InitBgsFromTemplates(0, sBackgroundTemplates, ARRAY_COUNT(sBackgroundTemplates)); SetBgTilemapBuffer(0, AllocZeroed(BG_SCREEN_SIZE)); LoadPalette(gUnknown_085E56F0, 0x80, 0x40); InitWindows(sWindowTemplates); @@ -1305,8 +1305,6 @@ static void sub_8175808(u8 taskIdA) static void c2_080C9BFC(u8 taskIdA) { - u16 backup; - SetVBlankCallback(NULL); if (sub_8176AB0(gTasks[taskIdA].data[TDA_7], taskIdA)) diff --git a/src/data/items.h b/src/data/items.h index 30beb5352..443c45f1a 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -7,9 +7,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, // Pokeballs @@ -21,10 +20,10 @@ const struct Item gItems[] = .price = 0, .description = sMasterBallDesc, .pocket = POCKET_POKE_BALLS, - .type = 0, - .battleUsage = 2, + .type = ITEM_MASTER_BALL - FIRST_BALL, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = 0, + .secondaryId = ITEM_MASTER_BALL - FIRST_BALL, }, [ITEM_ULTRA_BALL] = @@ -34,10 +33,10 @@ const struct Item gItems[] = .price = 1200, .description = sUltraBallDesc, .pocket = POCKET_POKE_BALLS, - .type = 1, - .battleUsage = 2, + .type = ITEM_ULTRA_BALL - FIRST_BALL, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = 1, + .secondaryId = ITEM_ULTRA_BALL - FIRST_BALL, }, [ITEM_GREAT_BALL] = @@ -47,10 +46,10 @@ const struct Item gItems[] = .price = 600, .description = sGreatBallDesc, .pocket = POCKET_POKE_BALLS, - .type = 2, - .battleUsage = 2, + .type = ITEM_GREAT_BALL - FIRST_BALL, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = 2, + .secondaryId = ITEM_GREAT_BALL - FIRST_BALL, }, [ITEM_POKE_BALL] = @@ -60,10 +59,10 @@ const struct Item gItems[] = .price = 200, .description = sPokeBallDesc, .pocket = POCKET_POKE_BALLS, - .type = 3, - .battleUsage = 2, + .type = ITEM_POKE_BALL - FIRST_BALL, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = 3, + .secondaryId = ITEM_POKE_BALL - FIRST_BALL, }, [ITEM_SAFARI_BALL] = @@ -73,10 +72,10 @@ const struct Item gItems[] = .price = 0, .description = sSafariBallDesc, .pocket = POCKET_POKE_BALLS, - .type = 4, - .battleUsage = 2, + .type = ITEM_SAFARI_BALL - FIRST_BALL, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = 4, + .secondaryId = ITEM_SAFARI_BALL - FIRST_BALL, }, [ITEM_NET_BALL] = @@ -86,10 +85,10 @@ const struct Item gItems[] = .price = 1000, .description = sNetBallDesc, .pocket = POCKET_POKE_BALLS, - .type = 5, - .battleUsage = 2, + .type = ITEM_NET_BALL - FIRST_BALL, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = 5, + .secondaryId = ITEM_NET_BALL - FIRST_BALL, }, [ITEM_DIVE_BALL] = @@ -99,10 +98,10 @@ const struct Item gItems[] = .price = 1000, .description = sDiveBallDesc, .pocket = POCKET_POKE_BALLS, - .type = 6, - .battleUsage = 2, + .type = ITEM_DIVE_BALL - FIRST_BALL, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = 6, + .secondaryId = ITEM_DIVE_BALL - FIRST_BALL, }, [ITEM_NEST_BALL] = @@ -112,10 +111,10 @@ const struct Item gItems[] = .price = 1000, .description = sNestBallDesc, .pocket = POCKET_POKE_BALLS, - .type = 7, - .battleUsage = 2, + .type = ITEM_NEST_BALL - FIRST_BALL, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = 7, + .secondaryId = ITEM_NEST_BALL - FIRST_BALL, }, [ITEM_REPEAT_BALL] = @@ -125,10 +124,10 @@ const struct Item gItems[] = .price = 1000, .description = sRepeatBallDesc, .pocket = POCKET_POKE_BALLS, - .type = 8, - .battleUsage = 2, + .type = ITEM_REPEAT_BALL - FIRST_BALL, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = 8, + .secondaryId = ITEM_REPEAT_BALL - FIRST_BALL, }, [ITEM_TIMER_BALL] = @@ -138,10 +137,10 @@ const struct Item gItems[] = .price = 1000, .description = sTimerBallDesc, .pocket = POCKET_POKE_BALLS, - .type = 9, - .battleUsage = 2, + .type = ITEM_TIMER_BALL - FIRST_BALL, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = 9, + .secondaryId = ITEM_TIMER_BALL - FIRST_BALL, }, [ITEM_LUXURY_BALL] = @@ -151,10 +150,10 @@ const struct Item gItems[] = .price = 1000, .description = sLuxuryBallDesc, .pocket = POCKET_POKE_BALLS, - .type = 10, - .battleUsage = 2, + .type = ITEM_LUXURY_BALL - FIRST_BALL, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = 10, + .secondaryId = ITEM_LUXURY_BALL - FIRST_BALL, }, [ITEM_PREMIER_BALL] = @@ -164,10 +163,10 @@ const struct Item gItems[] = .price = 200, .description = sPremierBallDesc, .pocket = POCKET_POKE_BALLS, - .type = 11, - .battleUsage = 2, + .type = ITEM_PREMIER_BALL - FIRST_BALL, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_PokeBall, - .secondaryId = 11, + .secondaryId = ITEM_PREMIER_BALL - FIRST_BALL, }, // Medicine @@ -180,11 +179,10 @@ const struct Item gItems[] = .holdEffectParam = 20, .description = sPotionDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_ANTIDOTE] = @@ -194,11 +192,10 @@ const struct Item gItems[] = .price = 100, .description = sAntidoteDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_BURN_HEAL] = @@ -208,11 +205,10 @@ const struct Item gItems[] = .price = 250, .description = sBurnHealDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_ICE_HEAL] = @@ -222,11 +218,10 @@ const struct Item gItems[] = .price = 250, .description = sIceHealDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_AWAKENING] = @@ -236,11 +231,10 @@ const struct Item gItems[] = .price = 250, .description = sAwakeningDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_PARALYZE_HEAL] = @@ -250,11 +244,10 @@ const struct Item gItems[] = .price = 200, .description = sParalyzeHealDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_FULL_RESTORE] = @@ -265,11 +258,10 @@ const struct Item gItems[] = .holdEffectParam = 255, .description = sFullRestoreDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_MAX_POTION] = @@ -280,11 +272,10 @@ const struct Item gItems[] = .holdEffectParam = 255, .description = sMaxPotionDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_HYPER_POTION] = @@ -295,11 +286,10 @@ const struct Item gItems[] = .holdEffectParam = 200, .description = sHyperPotionDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_SUPER_POTION] = @@ -310,11 +300,10 @@ const struct Item gItems[] = .holdEffectParam = 50, .description = sSuperPotionDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_FULL_HEAL] = @@ -324,11 +313,10 @@ const struct Item gItems[] = .price = 600, .description = sFullHealDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_REVIVE] = @@ -338,11 +326,10 @@ const struct Item gItems[] = .price = 1500, .description = sReviveDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_MAX_REVIVE] = @@ -352,11 +339,10 @@ const struct Item gItems[] = .price = 4000, .description = sMaxReviveDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_FRESH_WATER] = @@ -367,11 +353,10 @@ const struct Item gItems[] = .holdEffectParam = 50, .description = sFreshWaterDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_SODA_POP] = @@ -382,11 +367,10 @@ const struct Item gItems[] = .holdEffectParam = 60, .description = sSodaPopDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_LEMONADE] = @@ -397,11 +381,10 @@ const struct Item gItems[] = .holdEffectParam = 80, .description = sLemonadeDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_MOOMOO_MILK] = @@ -412,11 +395,10 @@ const struct Item gItems[] = .holdEffectParam = 100, .description = sMoomooMilkDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_ENERGY_POWDER] = @@ -426,11 +408,10 @@ const struct Item gItems[] = .price = 500, .description = sEnergyPowderDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_ENERGY_ROOT] = @@ -440,11 +421,10 @@ const struct Item gItems[] = .price = 800, .description = sEnergyRootDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_HEAL_POWDER] = @@ -454,11 +434,10 @@ const struct Item gItems[] = .price = 450, .description = sHealPowderDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_REVIVAL_HERB] = @@ -468,11 +447,10 @@ const struct Item gItems[] = .price = 2800, .description = sRevivalHerbDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_ETHER] = @@ -483,11 +461,10 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sEtherDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_PPRecovery, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_PPRecovery, - .secondaryId = 0, }, [ITEM_MAX_ETHER] = @@ -498,11 +475,10 @@ const struct Item gItems[] = .holdEffectParam = 255, .description = sMaxEtherDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_PPRecovery, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_PPRecovery, - .secondaryId = 0, }, [ITEM_ELIXIR] = @@ -513,11 +489,10 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sElixirDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_PPRecovery, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_PPRecovery, - .secondaryId = 0, }, [ITEM_MAX_ELIXIR] = @@ -528,11 +503,10 @@ const struct Item gItems[] = .holdEffectParam = 255, .description = sMaxElixirDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_PPRecovery, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_PPRecovery, - .secondaryId = 0, }, [ITEM_LAVA_COOKIE] = @@ -542,11 +516,10 @@ const struct Item gItems[] = .price = 200, .description = sLavaCookieDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_BLUE_FLUTE] = @@ -556,11 +529,10 @@ const struct Item gItems[] = .price = 100, .description = sBlueFluteDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_YELLOW_FLUTE] = @@ -570,11 +542,10 @@ const struct Item gItems[] = .price = 200, .description = sYellowFluteDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_RED_FLUTE] = @@ -584,11 +555,10 @@ const struct Item gItems[] = .price = 300, .description = sRedFluteDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_BLACK_FLUTE] = @@ -599,9 +569,8 @@ const struct Item gItems[] = .holdEffectParam = 50, .description = sBlackFluteDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_BlackWhiteFlute, - .secondaryId = 0, }, [ITEM_WHITE_FLUTE] = @@ -612,9 +581,8 @@ const struct Item gItems[] = .holdEffectParam = 150, .description = sWhiteFluteDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_BlackWhiteFlute, - .secondaryId = 0, }, [ITEM_BERRY_JUICE] = @@ -626,11 +594,10 @@ const struct Item gItems[] = .holdEffectParam = 20, .description = sBerryJuiceDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_SACRED_ASH] = @@ -640,9 +607,8 @@ const struct Item gItems[] = .price = 200, .description = sSacredAshDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_SacredAsh, - .secondaryId = 0, }, // Collectibles @@ -654,9 +620,8 @@ const struct Item gItems[] = .price = 20, .description = sShoalSaltDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SHOAL_SHELL] = @@ -666,9 +631,8 @@ const struct Item gItems[] = .price = 20, .description = sShoalShellDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_RED_SHARD] = @@ -678,9 +642,8 @@ const struct Item gItems[] = .price = 200, .description = sRedShardDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_BLUE_SHARD] = @@ -690,9 +653,8 @@ const struct Item gItems[] = .price = 200, .description = sBlueShardDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_YELLOW_SHARD] = @@ -702,9 +664,8 @@ const struct Item gItems[] = .price = 200, .description = sYellowShardDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_GREEN_SHARD] = @@ -714,9 +675,8 @@ const struct Item gItems[] = .price = 200, .description = sGreenShardDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_034] = @@ -726,9 +686,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_035] = @@ -738,9 +697,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_036] = @@ -750,9 +708,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_037] = @@ -762,9 +719,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_038] = @@ -774,9 +730,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_039] = @@ -786,9 +741,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_03A] = @@ -798,9 +752,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_03B] = @@ -810,9 +763,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_03C] = @@ -822,9 +774,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_03D] = @@ -834,9 +785,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_03E] = @@ -846,9 +796,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, // Vitamins @@ -860,9 +809,8 @@ const struct Item gItems[] = .price = 9800, .description = sHPUpDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .secondaryId = 0, }, [ITEM_PROTEIN] = @@ -872,9 +820,8 @@ const struct Item gItems[] = .price = 9800, .description = sProteinDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .secondaryId = 0, }, [ITEM_IRON] = @@ -884,9 +831,8 @@ const struct Item gItems[] = .price = 9800, .description = sIronDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .secondaryId = 0, }, [ITEM_CARBOS] = @@ -896,9 +842,8 @@ const struct Item gItems[] = .price = 9800, .description = sCarbosDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .secondaryId = 0, }, [ITEM_CALCIUM] = @@ -908,9 +853,8 @@ const struct Item gItems[] = .price = 9800, .description = sCalciumDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .secondaryId = 0, }, [ITEM_RARE_CANDY] = @@ -920,9 +864,8 @@ const struct Item gItems[] = .price = 4800, .description = sRareCandyDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_RareCandy, - .secondaryId = 0, }, [ITEM_PP_UP] = @@ -932,9 +875,8 @@ const struct Item gItems[] = .price = 9800, .description = sPPUpDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_PPUp, - .secondaryId = 0, }, [ITEM_ZINC] = @@ -944,9 +886,8 @@ const struct Item gItems[] = .price = 9800, .description = sZincDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .secondaryId = 0, }, [ITEM_PP_MAX] = @@ -956,9 +897,8 @@ const struct Item gItems[] = .price = 9800, .description = sPPMaxDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_PPUp, - .secondaryId = 0, }, [ITEM_048] = @@ -968,9 +908,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, // Battle items @@ -982,11 +921,10 @@ const struct Item gItems[] = .price = 700, .description = sGuardSpecDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .battleUsage = 2, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_StatIncrease, - .secondaryId = 0, }, [ITEM_DIRE_HIT] = @@ -996,11 +934,10 @@ const struct Item gItems[] = .price = 650, .description = sDireHitDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .battleUsage = 2, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_StatIncrease, - .secondaryId = 0, }, [ITEM_X_ATTACK] = @@ -1010,11 +947,10 @@ const struct Item gItems[] = .price = 500, .description = sXAttackDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .battleUsage = 2, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_StatIncrease, - .secondaryId = 0, }, [ITEM_X_DEFEND] = @@ -1024,11 +960,10 @@ const struct Item gItems[] = .price = 550, .description = sXDefendDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .battleUsage = 2, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_StatIncrease, - .secondaryId = 0, }, [ITEM_X_SPEED] = @@ -1038,11 +973,10 @@ const struct Item gItems[] = .price = 350, .description = sXSpeedDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .battleUsage = 2, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_StatIncrease, - .secondaryId = 0, }, [ITEM_X_ACCURACY] = @@ -1052,11 +986,10 @@ const struct Item gItems[] = .price = 950, .description = sXAccuracyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .battleUsage = 2, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_StatIncrease, - .secondaryId = 0, }, [ITEM_X_SPECIAL] = @@ -1066,11 +999,10 @@ const struct Item gItems[] = .price = 350, .description = sXSpecialDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .battleUsage = 2, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_StatIncrease, - .secondaryId = 0, }, [ITEM_POKE_DOLL] = @@ -1080,11 +1012,10 @@ const struct Item gItems[] = .price = 1000, .description = sPokeDollDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .battleUsage = 2, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_Escape, - .secondaryId = 0, }, [ITEM_FLUFFY_TAIL] = @@ -1094,11 +1025,10 @@ const struct Item gItems[] = .price = 1000, .description = sFluffyTailDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .battleUsage = 2, + .battleUsage = ITEM_B_USE_OTHER, .battleUseFunc = ItemUseInBattle_Escape, - .secondaryId = 0, }, [ITEM_052] = @@ -1108,9 +1038,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, // Field items @@ -1123,9 +1052,8 @@ const struct Item gItems[] = .holdEffectParam = 200, .description = sSuperRepelDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_Repel, - .secondaryId = 0, }, [ITEM_MAX_REPEL] = @@ -1136,9 +1064,8 @@ const struct Item gItems[] = .holdEffectParam = 250, .description = sMaxRepelDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_Repel, - .secondaryId = 0, }, [ITEM_ESCAPE_ROPE] = @@ -1148,9 +1075,8 @@ const struct Item gItems[] = .price = 550, .description = sEscapeRopeDesc, .pocket = POCKET_ITEMS, - .type = 2, + .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_EscapeRope, - .secondaryId = 0, }, [ITEM_REPEL] = @@ -1161,9 +1087,8 @@ const struct Item gItems[] = .holdEffectParam = 100, .description = sRepelDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_Repel, - .secondaryId = 0, }, [ITEM_057] = @@ -1173,9 +1098,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_058] = @@ -1185,9 +1109,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_059] = @@ -1197,9 +1120,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_05A] = @@ -1209,9 +1131,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_05B] = @@ -1221,9 +1142,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_05C] = @@ -1233,9 +1153,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, // Evolution stones @@ -1247,9 +1166,8 @@ const struct Item gItems[] = .price = 2100, .description = sSunStoneDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, - .secondaryId = 0, }, [ITEM_MOON_STONE] = @@ -1259,9 +1177,8 @@ const struct Item gItems[] = .price = 0, .description = sMoonStoneDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, - .secondaryId = 0, }, [ITEM_FIRE_STONE] = @@ -1271,9 +1188,8 @@ const struct Item gItems[] = .price = 2100, .description = sFireStoneDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, - .secondaryId = 0, }, [ITEM_THUNDER_STONE] = @@ -1283,9 +1199,8 @@ const struct Item gItems[] = .price = 2100, .description = sThunderStoneDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, - .secondaryId = 0, }, [ITEM_WATER_STONE] = @@ -1295,9 +1210,8 @@ const struct Item gItems[] = .price = 2100, .description = sWaterStoneDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, - .secondaryId = 0, }, [ITEM_LEAF_STONE] = @@ -1307,9 +1221,8 @@ const struct Item gItems[] = .price = 2100, .description = sLeafStoneDesc, .pocket = POCKET_ITEMS, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, - .secondaryId = 0, }, [ITEM_063] = @@ -1319,9 +1232,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_064] = @@ -1331,9 +1243,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_065] = @@ -1343,9 +1254,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_066] = @@ -1355,9 +1265,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, // Valuable items @@ -1369,9 +1278,8 @@ const struct Item gItems[] = .price = 500, .description = sTinyMushroomDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_BIG_MUSHROOM] = @@ -1381,9 +1289,8 @@ const struct Item gItems[] = .price = 5000, .description = sBigMushroomDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_069] = @@ -1393,9 +1300,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_PEARL] = @@ -1405,9 +1311,8 @@ const struct Item gItems[] = .price = 1400, .description = sPearlDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_BIG_PEARL] = @@ -1417,9 +1322,8 @@ const struct Item gItems[] = .price = 7500, .description = sBigPearlDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_STARDUST] = @@ -1429,9 +1333,8 @@ const struct Item gItems[] = .price = 2000, .description = sStardustDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_STAR_PIECE] = @@ -1441,9 +1344,8 @@ const struct Item gItems[] = .price = 9800, .description = sStarPieceDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_NUGGET] = @@ -1453,9 +1355,8 @@ const struct Item gItems[] = .price = 10000, .description = sNuggetDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_HEART_SCALE] = @@ -1465,9 +1366,8 @@ const struct Item gItems[] = .price = 100, .description = sHeartScaleDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_070] = @@ -1477,9 +1377,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_071] = @@ -1489,9 +1388,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_072] = @@ -1501,9 +1399,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_073] = @@ -1513,9 +1410,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_074] = @@ -1525,9 +1421,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_075] = @@ -1537,9 +1432,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_076] = @@ -1549,9 +1443,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_077] = @@ -1561,9 +1454,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_078] = @@ -1573,9 +1465,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, // Mail @@ -1586,9 +1477,9 @@ const struct Item gItems[] = .price = 50, .description = sOrangeMailDesc, .pocket = POCKET_ITEMS, - .type = 0, + .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = 0, + .secondaryId = ITEM_ORANGE_MAIL - FIRST_MAIL_INDEX, }, [ITEM_HARBOR_MAIL] = @@ -1598,9 +1489,9 @@ const struct Item gItems[] = .price = 50, .description = sHarborMailDesc, .pocket = POCKET_ITEMS, - .type = 0, + .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = 1, + .secondaryId = ITEM_HARBOR_MAIL - FIRST_MAIL_INDEX, }, [ITEM_GLITTER_MAIL] = @@ -1610,9 +1501,9 @@ const struct Item gItems[] = .price = 50, .description = sGlitterMailDesc, .pocket = POCKET_ITEMS, - .type = 0, + .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = 2, + .secondaryId = ITEM_GLITTER_MAIL - FIRST_MAIL_INDEX, }, [ITEM_MECH_MAIL] = @@ -1622,9 +1513,9 @@ const struct Item gItems[] = .price = 50, .description = sMechMailDesc, .pocket = POCKET_ITEMS, - .type = 0, + .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = 3, + .secondaryId = ITEM_MECH_MAIL - FIRST_MAIL_INDEX, }, [ITEM_WOOD_MAIL] = @@ -1634,9 +1525,9 @@ const struct Item gItems[] = .price = 50, .description = sWoodMailDesc, .pocket = POCKET_ITEMS, - .type = 0, + .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = 4, + .secondaryId = ITEM_WOOD_MAIL - FIRST_MAIL_INDEX, }, [ITEM_WAVE_MAIL] = @@ -1646,9 +1537,9 @@ const struct Item gItems[] = .price = 50, .description = sWaveMailDesc, .pocket = POCKET_ITEMS, - .type = 0, + .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = 5, + .secondaryId = ITEM_WAVE_MAIL - FIRST_MAIL_INDEX, }, [ITEM_BEAD_MAIL] = @@ -1658,9 +1549,9 @@ const struct Item gItems[] = .price = 50, .description = sBeadMailDesc, .pocket = POCKET_ITEMS, - .type = 0, + .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = 6, + .secondaryId = ITEM_BEAD_MAIL - FIRST_MAIL_INDEX, }, [ITEM_SHADOW_MAIL] = @@ -1670,9 +1561,9 @@ const struct Item gItems[] = .price = 50, .description = sShadowMailDesc, .pocket = POCKET_ITEMS, - .type = 0, + .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = 7, + .secondaryId = ITEM_SHADOW_MAIL - FIRST_MAIL_INDEX, }, [ITEM_TROPIC_MAIL] = @@ -1682,9 +1573,9 @@ const struct Item gItems[] = .price = 50, .description = sTropicMailDesc, .pocket = POCKET_ITEMS, - .type = 0, + .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = 8, + .secondaryId = ITEM_TROPIC_MAIL - FIRST_MAIL_INDEX, }, [ITEM_DREAM_MAIL] = @@ -1694,9 +1585,9 @@ const struct Item gItems[] = .price = 50, .description = sDreamMailDesc, .pocket = POCKET_ITEMS, - .type = 0, + .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = 9, + .secondaryId = ITEM_DREAM_MAIL - FIRST_MAIL_INDEX, }, [ITEM_FAB_MAIL] = @@ -1706,9 +1597,9 @@ const struct Item gItems[] = .price = 50, .description = sFabMailDesc, .pocket = POCKET_ITEMS, - .type = 0, + .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = 10, + .secondaryId = ITEM_FAB_MAIL - FIRST_MAIL_INDEX, }, [ITEM_RETRO_MAIL] = @@ -1718,9 +1609,9 @@ const struct Item gItems[] = .price = 0, .description = sRetroMailDesc, .pocket = POCKET_ITEMS, - .type = 0, + .type = ITEM_USE_MAIL, .fieldUseFunc = ItemUseOutOfBattle_Mail, - .secondaryId = 11, + .secondaryId = ITEM_RETRO_MAIL - FIRST_MAIL_INDEX, }, // Berries @@ -1733,11 +1624,10 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_CURE_PAR, .description = sCheriBerryDesc, .pocket = POCKET_BERRIES, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_CHESTO_BERRY] = @@ -1748,11 +1638,10 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_CURE_SLP, .description = sChestoBerryDesc, .pocket = POCKET_BERRIES, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_PECHA_BERRY] = @@ -1763,11 +1652,10 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_CURE_PSN, .description = sPechaBerryDesc, .pocket = POCKET_BERRIES, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_RAWST_BERRY] = @@ -1778,11 +1666,10 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_CURE_BRN, .description = sRawstBerryDesc, .pocket = POCKET_BERRIES, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_ASPEAR_BERRY] = @@ -1793,11 +1680,10 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_CURE_FRZ, .description = sAspearBerryDesc, .pocket = POCKET_BERRIES, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_LEPPA_BERRY] = @@ -1809,11 +1695,10 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sLeppaBerryDesc, .pocket = POCKET_BERRIES, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_PPRecovery, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_PPRecovery, - .secondaryId = 0, }, [ITEM_ORAN_BERRY] = @@ -1825,11 +1710,10 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sOranBerryDesc, .pocket = POCKET_BERRIES, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_PERSIM_BERRY] = @@ -1840,11 +1724,10 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_CURE_CONFUSION, .description = sPersimBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_LUM_BERRY] = @@ -1855,11 +1738,10 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_CURE_STATUS, .description = sLumBerryDesc, .pocket = POCKET_BERRIES, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_SITRUS_BERRY] = @@ -1871,11 +1753,10 @@ const struct Item gItems[] = .holdEffectParam = 30, .description = sSitrusBerryDesc, .pocket = POCKET_BERRIES, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_Medicine, - .secondaryId = 0, }, [ITEM_FIGY_BERRY] = @@ -1887,9 +1768,8 @@ const struct Item gItems[] = .holdEffectParam = 8, .description = sFigyBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_WIKI_BERRY] = @@ -1901,9 +1781,8 @@ const struct Item gItems[] = .holdEffectParam = 8, .description = sWikiBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_MAGO_BERRY] = @@ -1915,9 +1794,8 @@ const struct Item gItems[] = .holdEffectParam = 8, .description = sMagoBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_AGUAV_BERRY] = @@ -1929,9 +1807,8 @@ const struct Item gItems[] = .holdEffectParam = 8, .description = sAguavBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_IAPAPA_BERRY] = @@ -1943,9 +1820,8 @@ const struct Item gItems[] = .holdEffectParam = 8, .description = sIapapaBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_RAZZ_BERRY] = @@ -1955,9 +1831,8 @@ const struct Item gItems[] = .price = 20, .description = sRazzBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_BLUK_BERRY] = @@ -1967,9 +1842,8 @@ const struct Item gItems[] = .price = 20, .description = sBlukBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_NANAB_BERRY] = @@ -1979,9 +1853,8 @@ const struct Item gItems[] = .price = 20, .description = sNanabBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_WEPEAR_BERRY] = @@ -1991,9 +1864,8 @@ const struct Item gItems[] = .price = 20, .description = sWepearBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_PINAP_BERRY] = @@ -2003,9 +1875,8 @@ const struct Item gItems[] = .price = 20, .description = sPinapBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_POMEG_BERRY] = @@ -2015,9 +1886,8 @@ const struct Item gItems[] = .price = 20, .description = sPomegBerryDesc, .pocket = POCKET_BERRIES, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_ReduceEV, - .secondaryId = 0, }, [ITEM_KELPSY_BERRY] = @@ -2027,9 +1897,8 @@ const struct Item gItems[] = .price = 20, .description = sKelpsyBerryDesc, .pocket = POCKET_BERRIES, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_ReduceEV, - .secondaryId = 0, }, [ITEM_QUALOT_BERRY] = @@ -2039,9 +1908,8 @@ const struct Item gItems[] = .price = 20, .description = sQualotBerryDesc, .pocket = POCKET_BERRIES, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_ReduceEV, - .secondaryId = 0, }, [ITEM_HONDEW_BERRY] = @@ -2051,9 +1919,8 @@ const struct Item gItems[] = .price = 20, .description = sHondewBerryDesc, .pocket = POCKET_BERRIES, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_ReduceEV, - .secondaryId = 0, }, [ITEM_GREPA_BERRY] = @@ -2063,9 +1930,8 @@ const struct Item gItems[] = .price = 20, .description = sGrepaBerryDesc, .pocket = POCKET_BERRIES, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_ReduceEV, - .secondaryId = 0, }, [ITEM_TAMATO_BERRY] = @@ -2075,9 +1941,8 @@ const struct Item gItems[] = .price = 20, .description = sTamatoBerryDesc, .pocket = POCKET_BERRIES, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_ReduceEV, - .secondaryId = 0, }, [ITEM_CORNN_BERRY] = @@ -2087,9 +1952,8 @@ const struct Item gItems[] = .price = 20, .description = sCornnBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_MAGOST_BERRY] = @@ -2099,9 +1963,8 @@ const struct Item gItems[] = .price = 20, .description = sMagostBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_RABUTA_BERRY] = @@ -2111,9 +1974,8 @@ const struct Item gItems[] = .price = 20, .description = sRabutaBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_NOMEL_BERRY] = @@ -2123,9 +1985,8 @@ const struct Item gItems[] = .price = 20, .description = sNomelBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SPELON_BERRY] = @@ -2135,9 +1996,8 @@ const struct Item gItems[] = .price = 20, .description = sSpelonBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_PAMTRE_BERRY] = @@ -2147,9 +2007,8 @@ const struct Item gItems[] = .price = 20, .description = sPamtreBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_WATMEL_BERRY] = @@ -2159,9 +2018,8 @@ const struct Item gItems[] = .price = 20, .description = sWatmelBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_DURIN_BERRY] = @@ -2171,9 +2029,8 @@ const struct Item gItems[] = .price = 20, .description = sDurinBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_BELUE_BERRY] = @@ -2183,9 +2040,8 @@ const struct Item gItems[] = .price = 20, .description = sBelueBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_LIECHI_BERRY] = @@ -2197,9 +2053,8 @@ const struct Item gItems[] = .holdEffectParam = 4, .description = sLiechiBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_GANLON_BERRY] = @@ -2211,9 +2066,8 @@ const struct Item gItems[] = .holdEffectParam = 4, .description = sGanlonBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SALAC_BERRY] = @@ -2225,9 +2079,8 @@ const struct Item gItems[] = .holdEffectParam = 4, .description = sSalacBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_PETAYA_BERRY] = @@ -2239,9 +2092,8 @@ const struct Item gItems[] = .holdEffectParam = 4, .description = sPetayaBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_APICOT_BERRY] = @@ -2253,9 +2105,8 @@ const struct Item gItems[] = .holdEffectParam = 4, .description = sApicotBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_LANSAT_BERRY] = @@ -2267,9 +2118,8 @@ const struct Item gItems[] = .holdEffectParam = 4, .description = sLansatBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_STARF_BERRY] = @@ -2281,9 +2131,8 @@ const struct Item gItems[] = .holdEffectParam = 4, .description = sStarfBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_ENIGMA_BERRY] = @@ -2293,11 +2142,10 @@ const struct Item gItems[] = .price = 20, .description = sEnigmaBerryDesc, .pocket = POCKET_BERRIES, - .type = 4, + .type = ITEM_USE_BAG_MENU, // Type handled by ItemUseOutOfBattle_EnigmaBerry .fieldUseFunc = ItemUseOutOfBattle_EnigmaBerry, - .battleUsage = 1, + .battleUsage = ITEM_B_USE_MEDICINE, .battleUseFunc = ItemUseInBattle_EnigmaBerry, - .secondaryId = 0, }, [ITEM_0B0] = @@ -2307,9 +2155,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0B1] = @@ -2319,9 +2166,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0B2] = @@ -2331,9 +2177,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, // Hold items @@ -2347,9 +2192,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sBrightPowderDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_WHITE_HERB] = @@ -2360,9 +2204,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_RESTORE_STATS, .description = sWhiteHerbDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_MACHO_BRACE] = @@ -2373,9 +2216,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_MACHO_BRACE, .description = sMachoBraceDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_EXP_SHARE] = @@ -2386,9 +2228,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_EXP_SHARE, .description = sExpShareDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_QUICK_CLAW] = @@ -2400,9 +2241,8 @@ const struct Item gItems[] = .holdEffectParam = 20, .description = sQuickClawDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SOOTHE_BELL] = @@ -2413,9 +2253,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_HAPPINESS_UP, .description = sSootheBellDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_MENTAL_HERB] = @@ -2426,9 +2265,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_CURE_ATTRACT, .description = sMentalHerbDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_CHOICE_BAND] = @@ -2439,9 +2277,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_CHOICE_BAND, .description = sChoiceBandDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_KINGS_ROCK] = @@ -2453,9 +2290,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sKingsRockDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SILVER_POWDER] = @@ -2467,9 +2303,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sSilverPowderDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_AMULET_COIN] = @@ -2481,9 +2316,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sAmuletCoinDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_CLEANSE_TAG] = @@ -2494,9 +2328,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_REPEL, .description = sCleanseTagDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SOUL_DEW] = @@ -2507,9 +2340,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_SOUL_DEW, .description = sSoulDewDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_DEEP_SEA_TOOTH] = @@ -2520,9 +2352,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_DEEP_SEA_TOOTH, .description = sDeepSeaToothDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_DEEP_SEA_SCALE] = @@ -2533,9 +2364,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_DEEP_SEA_SCALE, .description = sDeepSeaScaleDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SMOKE_BALL] = @@ -2546,9 +2376,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_CAN_ALWAYS_RUN, .description = sSmokeBallDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_EVERSTONE] = @@ -2559,9 +2388,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_PREVENT_EVOLVE, .description = sEverstoneDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_FOCUS_BAND] = @@ -2573,9 +2401,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sFocusBandDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_LUCKY_EGG] = @@ -2586,9 +2413,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_LUCKY_EGG, .description = sLuckyEggDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SCOPE_LENS] = @@ -2599,9 +2425,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_SCOPE_LENS, .description = sScopeLensDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_METAL_COAT] = @@ -2613,9 +2438,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sMetalCoatDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_LEFTOVERS] = @@ -2627,9 +2451,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sLeftoversDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_DRAGON_SCALE] = @@ -2641,9 +2464,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sDragonScaleDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_LIGHT_BALL] = @@ -2654,9 +2476,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_LIGHT_BALL, .description = sLightBallDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SOFT_SAND] = @@ -2668,9 +2489,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sSoftSandDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_HARD_STONE] = @@ -2682,9 +2502,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sHardStoneDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_MIRACLE_SEED] = @@ -2696,9 +2515,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sMiracleSeedDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_BLACK_GLASSES] = @@ -2710,9 +2528,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sBlackGlassesDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_BLACK_BELT] = @@ -2724,9 +2541,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sBlackBeltDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_MAGNET] = @@ -2738,9 +2554,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sMagnetDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_MYSTIC_WATER] = @@ -2752,9 +2567,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sMysticWaterDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SHARP_BEAK] = @@ -2766,9 +2580,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sSharpBeakDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_POISON_BARB] = @@ -2780,9 +2593,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sPoisonBarbDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_NEVER_MELT_ICE] = @@ -2794,9 +2606,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sNeverMeltIceDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SPELL_TAG] = @@ -2808,9 +2619,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sSpellTagDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_TWISTED_SPOON] = @@ -2822,9 +2632,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sTwistedSpoonDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_CHARCOAL] = @@ -2836,9 +2645,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sCharcoalDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_DRAGON_FANG] = @@ -2850,9 +2658,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sDragonFangDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SILK_SCARF] = @@ -2864,9 +2671,8 @@ const struct Item gItems[] = .holdEffectParam = 10, .description = sSilkScarfDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_UP_GRADE] = @@ -2877,9 +2683,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_UP_GRADE, .description = sUpGradeDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SHELL_BELL] = @@ -2891,9 +2696,8 @@ const struct Item gItems[] = .holdEffectParam = 8, .description = sShellBellDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SEA_INCENSE] = @@ -2905,9 +2709,8 @@ const struct Item gItems[] = .holdEffectParam = 5, .description = sSeaIncenseDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_LAX_INCENSE] = @@ -2919,9 +2722,8 @@ const struct Item gItems[] = .holdEffectParam = 5, .description = sLaxIncenseDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_LUCKY_PUNCH] = @@ -2932,9 +2734,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_LUCKY_PUNCH, .description = sLuckyPunchDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_METAL_POWDER] = @@ -2945,9 +2746,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_METAL_POWDER, .description = sMetalPowderDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_THICK_CLUB] = @@ -2958,9 +2758,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_THICK_CLUB, .description = sThickClubDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_STICK] = @@ -2971,9 +2770,8 @@ const struct Item gItems[] = .holdEffect = HOLD_EFFECT_STICK, .description = sStickDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0E2] = @@ -2983,9 +2781,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0E3] = @@ -2995,9 +2792,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0E4] = @@ -3007,9 +2803,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0E5] = @@ -3019,9 +2814,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0E6] = @@ -3031,9 +2825,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0E7] = @@ -3043,9 +2836,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0E8] = @@ -3055,9 +2847,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0E9] = @@ -3067,9 +2858,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0EA] = @@ -3079,9 +2869,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0EB] = @@ -3091,9 +2880,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0EC] = @@ -3103,9 +2891,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0ED] = @@ -3115,9 +2902,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0EE] = @@ -3127,9 +2913,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0EF] = @@ -3139,9 +2924,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0F0] = @@ -3151,9 +2935,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0F1] = @@ -3163,9 +2946,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0F2] = @@ -3175,9 +2957,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0F3] = @@ -3187,9 +2968,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0F4] = @@ -3199,9 +2979,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0F5] = @@ -3211,9 +2990,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0F6] = @@ -3223,9 +3001,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0F7] = @@ -3235,9 +3012,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0F8] = @@ -3247,9 +3023,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0F9] = @@ -3259,9 +3034,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0FA] = @@ -3271,9 +3045,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0FB] = @@ -3283,9 +3056,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0FC] = @@ -3295,9 +3067,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_0FD] = @@ -3307,9 +3078,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_RED_SCARF] = @@ -3319,9 +3089,8 @@ const struct Item gItems[] = .price = 100, .description = sRedScarfDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_BLUE_SCARF] = @@ -3331,9 +3100,8 @@ const struct Item gItems[] = .price = 100, .description = sBlueScarfDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_PINK_SCARF] = @@ -3343,9 +3111,8 @@ const struct Item gItems[] = .price = 100, .description = sPinkScarfDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_GREEN_SCARF] = @@ -3355,9 +3122,8 @@ const struct Item gItems[] = .price = 100, .description = sGreenScarfDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_YELLOW_SCARF] = @@ -3367,9 +3133,8 @@ const struct Item gItems[] = .price = 100, .description = sYellowScarfDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, // Key items @@ -3383,9 +3148,9 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 2, + .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_Bike, - .secondaryId = 0, + .secondaryId = MACH_BIKE, }, [ITEM_COIN_CASE] = @@ -3396,9 +3161,8 @@ const struct Item gItems[] = .description = sCoinCaseDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CoinCase, - .secondaryId = 0, }, [ITEM_ITEMFINDER] = @@ -3410,9 +3174,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 2, + .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_Itemfinder, - .secondaryId = 0, }, [ITEM_OLD_ROD] = @@ -3424,7 +3187,7 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 2, + .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_Rod, .secondaryId = OLD_ROD, }, @@ -3438,7 +3201,7 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 2, + .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_Rod, .secondaryId = GOOD_ROD, }, @@ -3452,7 +3215,7 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 2, + .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_Rod, .secondaryId = SUPER_ROD, }, @@ -3465,9 +3228,8 @@ const struct Item gItems[] = .description = sSSTicketDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_CONTEST_PASS] = @@ -3478,9 +3240,8 @@ const struct Item gItems[] = .description = sContestPassDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_10B] = @@ -3490,9 +3251,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_WAILMER_PAIL] = @@ -3503,9 +3263,8 @@ const struct Item gItems[] = .description = sWailmerPailDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 2, + .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_WailmerPail, - .secondaryId = 0, }, [ITEM_DEVON_GOODS] = @@ -3516,9 +3275,8 @@ const struct Item gItems[] = .description = sDevonGoodsDesc, .importance = 2, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SOOT_SACK] = @@ -3529,9 +3287,8 @@ const struct Item gItems[] = .description = sSootSackDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_BASEMENT_KEY] = @@ -3542,9 +3299,8 @@ const struct Item gItems[] = .description = sBasementKeyDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_ACRO_BIKE] = @@ -3556,9 +3312,9 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 2, + .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_Bike, - .secondaryId = 1, + .secondaryId = ACRO_BIKE, }, [ITEM_POKEBLOCK_CASE] = @@ -3570,9 +3326,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 3, + .type = ITEM_USE_PBLOCK_CASE, .fieldUseFunc = ItemUseOutOfBattle_PokeblockCase, - .secondaryId = 0, }, [ITEM_LETTER] = @@ -3583,9 +3338,8 @@ const struct Item gItems[] = .description = sLetterDesc, .importance = 2, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_EON_TICKET] = @@ -3596,7 +3350,7 @@ const struct Item gItems[] = .description = sEonTicketDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .secondaryId = 1, }, @@ -3609,9 +3363,8 @@ const struct Item gItems[] = .description = sRedOrbDesc, .importance = 2, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_BLUE_ORB] = @@ -3622,9 +3375,8 @@ const struct Item gItems[] = .description = sBlueOrbDesc, .importance = 2, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SCANNER] = @@ -3635,9 +3387,8 @@ const struct Item gItems[] = .description = sScannerDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_GO_GOGGLES] = @@ -3648,9 +3399,8 @@ const struct Item gItems[] = .description = sGoGogglesDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_METEORITE] = @@ -3661,9 +3411,8 @@ const struct Item gItems[] = .description = sMeteoriteDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_ROOM_1_KEY] = @@ -3674,9 +3423,8 @@ const struct Item gItems[] = .description = sRoom1KeyDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_ROOM_2_KEY] = @@ -3687,9 +3435,8 @@ const struct Item gItems[] = .description = sRoom2KeyDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_ROOM_4_KEY] = @@ -3700,9 +3447,8 @@ const struct Item gItems[] = .description = sRoom4KeyDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_ROOM_6_KEY] = @@ -3713,9 +3459,8 @@ const struct Item gItems[] = .description = sRoom6KeyDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_STORAGE_KEY] = @@ -3726,9 +3471,8 @@ const struct Item gItems[] = .description = sStorageKeyDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_ROOT_FOSSIL] = @@ -3739,9 +3483,8 @@ const struct Item gItems[] = .description = sRootFossilDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_CLAW_FOSSIL] = @@ -3752,9 +3495,8 @@ const struct Item gItems[] = .description = sClawFossilDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_DEVON_SCOPE] = @@ -3765,9 +3507,8 @@ const struct Item gItems[] = .description = sDevonScopeDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, // TMs/HMs @@ -3779,9 +3520,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM01Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM02_DRAGON_CLAW] = @@ -3791,9 +3531,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM02Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM03_WATER_PULSE] = @@ -3803,9 +3542,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM03Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM04_CALM_MIND] = @@ -3815,9 +3553,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM04Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM05_ROAR] = @@ -3827,9 +3564,8 @@ const struct Item gItems[] = .price = 1000, .description = sTM05Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM06_TOXIC] = @@ -3839,9 +3575,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM06Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM07_HAIL] = @@ -3851,9 +3586,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM07Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM08_BULK_UP] = @@ -3863,9 +3597,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM08Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM09_BULLET_SEED] = @@ -3875,9 +3608,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM09Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM10_HIDDEN_POWER] = @@ -3887,9 +3619,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM10Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM11_SUNNY_DAY] = @@ -3899,9 +3630,8 @@ const struct Item gItems[] = .price = 2000, .description = sTM11Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM12_TAUNT] = @@ -3911,9 +3641,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM12Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM13_ICE_BEAM] = @@ -3923,9 +3652,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM13Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM14_BLIZZARD] = @@ -3935,9 +3663,8 @@ const struct Item gItems[] = .price = 5500, .description = sTM14Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM15_HYPER_BEAM] = @@ -3947,9 +3674,8 @@ const struct Item gItems[] = .price = 7500, .description = sTM15Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM16_LIGHT_SCREEN] = @@ -3959,9 +3685,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM16Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM17_PROTECT] = @@ -3971,9 +3696,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM17Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM18_RAIN_DANCE] = @@ -3983,9 +3707,8 @@ const struct Item gItems[] = .price = 2000, .description = sTM18Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM19_GIGA_DRAIN] = @@ -3995,9 +3718,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM19Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM20_SAFEGUARD] = @@ -4007,9 +3729,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM20Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM21_FRUSTRATION] = @@ -4019,9 +3740,8 @@ const struct Item gItems[] = .price = 1000, .description = sTM21Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM22_SOLARBEAM] = @@ -4031,9 +3751,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM22Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM23_IRON_TAIL] = @@ -4043,9 +3762,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM23Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM24_THUNDERBOLT] = @@ -4055,9 +3773,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM24Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM25_THUNDER] = @@ -4067,9 +3784,8 @@ const struct Item gItems[] = .price = 5500, .description = sTM25Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM26_EARTHQUAKE] = @@ -4079,9 +3795,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM26Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM27_RETURN] = @@ -4091,9 +3806,8 @@ const struct Item gItems[] = .price = 1000, .description = sTM27Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM28_DIG] = @@ -4103,9 +3817,8 @@ const struct Item gItems[] = .price = 2000, .description = sTM28Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM29_PSYCHIC] = @@ -4115,9 +3828,8 @@ const struct Item gItems[] = .price = 2000, .description = sTM29Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM30_SHADOW_BALL] = @@ -4127,9 +3839,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM30Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM31_BRICK_BREAK] = @@ -4139,9 +3850,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM31Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM32_DOUBLE_TEAM] = @@ -4151,9 +3861,8 @@ const struct Item gItems[] = .price = 2000, .description = sTM32Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM33_REFLECT] = @@ -4163,9 +3872,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM33Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM34_SHOCK_WAVE] = @@ -4175,9 +3883,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM34Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM35_FLAMETHROWER] = @@ -4187,9 +3894,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM35Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM36_SLUDGE_BOMB] = @@ -4199,9 +3905,8 @@ const struct Item gItems[] = .price = 1000, .description = sTM36Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM37_SANDSTORM] = @@ -4211,9 +3916,8 @@ const struct Item gItems[] = .price = 2000, .description = sTM37Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM38_FIRE_BLAST] = @@ -4223,9 +3927,8 @@ const struct Item gItems[] = .price = 5500, .description = sTM38Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM39_ROCK_TOMB] = @@ -4235,9 +3938,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM39Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM40_AERIAL_ACE] = @@ -4247,9 +3949,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM40Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM41_TORMENT] = @@ -4259,9 +3960,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM41Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM42_FACADE] = @@ -4271,9 +3971,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM42Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM43_SECRET_POWER] = @@ -4283,9 +3982,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM43Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM44_REST] = @@ -4295,9 +3993,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM44Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM45_ATTRACT] = @@ -4307,9 +4004,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM45Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM46_THIEF] = @@ -4319,9 +4015,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM46Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM47_STEEL_WING] = @@ -4331,9 +4026,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM47Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM48_SKILL_SWAP] = @@ -4343,9 +4037,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM48Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM49_SNATCH] = @@ -4355,9 +4048,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM49Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_TM50_OVERHEAT] = @@ -4367,9 +4059,8 @@ const struct Item gItems[] = .price = 3000, .description = sTM50Desc, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_HM01_CUT] = @@ -4380,9 +4071,8 @@ const struct Item gItems[] = .description = sHM01Desc, .importance = 1, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_HM02_FLY] = @@ -4393,9 +4083,8 @@ const struct Item gItems[] = .description = sHM02Desc, .importance = 1, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_HM03_SURF] = @@ -4406,9 +4095,8 @@ const struct Item gItems[] = .description = sHM03Desc, .importance = 1, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_HM04_STRENGTH] = @@ -4419,9 +4107,8 @@ const struct Item gItems[] = .description = sHM04Desc, .importance = 1, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_HM05_FLASH] = @@ -4432,9 +4119,8 @@ const struct Item gItems[] = .description = sHM05Desc, .importance = 1, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_HM06_ROCK_SMASH] = @@ -4445,9 +4131,8 @@ const struct Item gItems[] = .description = sHM06Desc, .importance = 1, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_HM07_WATERFALL] = @@ -4458,9 +4143,8 @@ const struct Item gItems[] = .description = sHM07Desc, .importance = 1, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_HM08_DIVE] = @@ -4471,9 +4155,8 @@ const struct Item gItems[] = .description = sHM08Desc, .importance = 1, .pocket = POCKET_TM_HM, - .type = 1, + .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_TMHM, - .secondaryId = 0, }, [ITEM_15B] = @@ -4483,9 +4166,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_15C] = @@ -4495,9 +4177,8 @@ const struct Item gItems[] = .price = 0, .description = sDummyDesc, .pocket = POCKET_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, // FireRed/LeafGreen key items @@ -4510,9 +4191,8 @@ const struct Item gItems[] = .description = sOaksParcelDesc, .importance = 2, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_POKE_FLUTE] = @@ -4523,9 +4203,8 @@ const struct Item gItems[] = .description = sPokeFluteDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SECRET_KEY] = @@ -4536,9 +4215,8 @@ const struct Item gItems[] = .description = sSecretKeyDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_BIKE_VOUCHER] = @@ -4549,9 +4227,8 @@ const struct Item gItems[] = .description = sBikeVoucherDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_GOLD_TEETH] = @@ -4562,9 +4239,8 @@ const struct Item gItems[] = .description = sGoldTeethDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_OLD_AMBER] = @@ -4575,9 +4251,8 @@ const struct Item gItems[] = .description = sOldAmberDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_CARD_KEY] = @@ -4588,9 +4263,8 @@ const struct Item gItems[] = .description = sCardKeyDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_LIFT_KEY] = @@ -4601,9 +4275,8 @@ const struct Item gItems[] = .description = sLiftKeyDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_HELIX_FOSSIL] = @@ -4614,9 +4287,8 @@ const struct Item gItems[] = .description = sHelixFossilDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_DOME_FOSSIL] = @@ -4627,9 +4299,8 @@ const struct Item gItems[] = .description = sDomeFossilDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SILPH_SCOPE] = @@ -4640,9 +4311,8 @@ const struct Item gItems[] = .description = sSilphScopeDesc, .importance = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_BICYCLE] = @@ -4654,9 +4324,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 2, + .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_TOWN_MAP] = @@ -4668,9 +4337,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_VS_SEEKER] = @@ -4682,9 +4350,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 2, + .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_FAME_CHECKER] = @@ -4696,9 +4363,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_TM_CASE] = @@ -4710,9 +4376,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_BERRY_POUCH] = @@ -4724,9 +4389,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_TEACHY_TV] = @@ -4738,9 +4402,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 2, + .type = ITEM_USE_FIELD, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_TRI_PASS] = @@ -4752,9 +4415,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_RAINBOW_PASS] = @@ -4766,9 +4428,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_TEA] = @@ -4780,9 +4441,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_MYSTIC_TICKET] = @@ -4794,9 +4454,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_AURORA_TICKET] = @@ -4808,9 +4467,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_POWDER_JAR] = @@ -4822,9 +4480,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_PowderJar, - .secondaryId = 0, }, [ITEM_RUBY] = @@ -4836,9 +4493,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_SAPPHIRE] = @@ -4850,9 +4506,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, // Emerald-specific key items @@ -4866,9 +4521,8 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, [ITEM_OLD_SEA_MAP] = @@ -4880,8 +4534,7 @@ const struct Item gItems[] = .importance = 1, .unk19 = 1, .pocket = POCKET_KEY_ITEMS, - .type = 4, + .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, - .secondaryId = 0, }, }; diff --git a/src/decompress.c b/src/decompress.c index 007753303..335699449 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -86,7 +86,7 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32 { if (species == SPECIES_UNOWN) { - u16 i = (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 3)) % 0x1C; + u16 i = GET_UNOWN_LETTER(personality); // The other Unowns are separate from Unown A. if (i == 0) @@ -308,7 +308,7 @@ void LoadSpecialPokePic_2(const struct CompressedSpriteSheet *src, void *dest, s { if (species == SPECIES_UNOWN) { - u16 i = (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 3)) % 0x1C; + u16 i = GET_UNOWN_LETTER(personality); // The other Unowns are separate from Unown A. if (i == 0) @@ -366,7 +366,7 @@ void LoadSpecialPokePic_DontHandleDeoxys(const struct CompressedSpriteSheet *src { if (species == SPECIES_UNOWN) { - u16 i = (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 3)) % 0x1C; + u16 i = GET_UNOWN_LETTER(personality); // The other Unowns are separate from Unown A. if (i == 0) diff --git a/src/decoration.c b/src/decoration.c index b97ab4321..484398aba 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -113,7 +113,7 @@ EWRAM_DATA static u16 sDecorationsCursorPos = 0; EWRAM_DATA static u16 sDecorationsScrollOffset = 0; EWRAM_DATA u8 gCurDecorationIndex = 0; EWRAM_DATA static u8 sCurDecorationCategory = DECORCAT_DESK; -EWRAM_DATA static u32 filler_0203a174[2] = {}; +EWRAM_DATA static u32 sFiller[2] = {}; EWRAM_DATA static struct DecorationPCContext sDecorationContext = {}; EWRAM_DATA static u8 sDecorMenuWindowIds[WINDOW_COUNT] = {}; EWRAM_DATA static struct DecorationItemsMenu *sDecorationItemsMenu = NULL; diff --git a/src/diploma.c b/src/diploma.c index f243d09f9..8f04bb9ad 100644 --- a/src/diploma.c +++ b/src/diploma.c @@ -168,7 +168,7 @@ static const struct BgTemplate sDiplomaBgTemplates[2] = static void InitDiplomaBg(void) { ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, sDiplomaBgTemplates, 2); + InitBgsFromTemplates(0, sDiplomaBgTemplates, ARRAY_COUNT(sDiplomaBgTemplates)); SetBgTilemapBuffer(1, sDiplomaTilemapPtr); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); ShowBg(0); diff --git a/src/easy_chat.c b/src/easy_chat.c index 2590eea1a..6bb77bc84 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -4073,7 +4073,6 @@ static void sub_811D864(u8 arg0, u8 arg1) { int i, j; u16 easyChatWord; - u8 *str; int y; int var0; diff --git a/src/ereader_screen.c b/src/ereader_screen.c index 3f2cf3217..d27605c1d 100755 --- a/src/ereader_screen.c +++ b/src/ereader_screen.c @@ -211,7 +211,6 @@ static u32 sub_81D4EE4(u8 *arg0, u16 *arg1) void task_add_00_ereader(void) { - int value; struct Unk81D5014 *data; u8 taskId = CreateTask(sub_81D5084, 0); data = (struct Unk81D5014 *)gTasks[taskId].data; diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 12ef4acdc..d9c06eb10 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -87,7 +87,7 @@ static void GetGroundEffectFlags_Puddle(struct ObjectEvent*, u32*); static void GetGroundEffectFlags_Ripple(struct ObjectEvent*, u32*); static void GetGroundEffectFlags_Seaweed(struct ObjectEvent*, u32*); static void GetGroundEffectFlags_JumpLanding(struct ObjectEvent*, u32*); -static u8 ObjectEventCheckForReflectiveSurface(struct ObjectEvent*); +static u8 ObjectEventGetNearbyReflectionType(struct ObjectEvent*); static u8 GetReflectionTypeByMetatileBehavior(u32); static void InitObjectPriorityByZCoord(struct Sprite *sprite, u8 z); static void ObjectEventUpdateSubpriority(struct ObjectEvent*, struct Sprite*); @@ -130,7 +130,6 @@ static struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8 localId, static void ClearObjectEventMovement(struct ObjectEvent *, struct Sprite *); static void ObjectEventSetSingleMovement(struct ObjectEvent *, struct Sprite *, u8); static void oamt_npc_ministep_reset(struct Sprite *, u8, u8); -static void UpdateObjectEventSpriteSubpriorityAndVisibility(struct Sprite *); static void InitSpriteForFigure8Anim(struct Sprite *sprite); static bool8 AnimateSpriteInFigure8(struct Sprite *sprite); static void UpdateObjectEventSprite(struct Sprite *); @@ -7514,21 +7513,23 @@ static void ObjectEventUpdateMetatileBehaviors(struct ObjectEvent *objEvent) static void GetGroundEffectFlags_Reflection(struct ObjectEvent *objEvent, u32 *flags) { - u32 reflectionFlags[2] = { GROUND_EFFECT_FLAG_REFLECTION, GROUND_EFFECT_FLAG_ICE_REFLECTION }; - u8 type = ObjectEventCheckForReflectiveSurface(objEvent); + u32 reflectionFlags[NUM_REFLECTION_TYPES - 1] = { + [REFL_TYPE_ICE - 1] = GROUND_EFFECT_FLAG_ICE_REFLECTION, + [REFL_TYPE_WATER - 1] = GROUND_EFFECT_FLAG_WATER_REFLECTION + }; + u8 reflType = ObjectEventGetNearbyReflectionType(objEvent); - if (type) + if (reflType) { - if (!objEvent->hasReflection) + if (objEvent->hasReflection == 0) { - objEvent->hasReflection = 0; - objEvent->hasReflection = 1; - *flags |= reflectionFlags[type - 1]; + objEvent->hasReflection++; + *flags |= reflectionFlags[reflType - 1]; } } else { - objEvent->hasReflection = 0; + objEvent->hasReflection = FALSE; } } @@ -7701,26 +7702,24 @@ static void GetGroundEffectFlags_JumpLanding(struct ObjectEvent *objEvent, u32 * } } -static u8 ObjectEventCheckForReflectiveSurface(struct ObjectEvent *objEvent) +#define RETURN_REFLECTION_TYPE_AT(x, y) \ + b = MapGridGetMetatileBehaviorAt(x, y); \ + result = GetReflectionTypeByMetatileBehavior(b); \ + if (result != REFL_TYPE_NONE) \ + return result; + +static u8 ObjectEventGetNearbyReflectionType(struct ObjectEvent *objEvent) { const struct ObjectEventGraphicsInfo *info = GetObjectEventGraphicsInfo(objEvent->graphicsId); // ceil div by tile width? s16 width = (info->width + 8) >> 4; s16 height = (info->height + 8) >> 4; - s16 i; - s16 j; - u8 result; - u8 b; - s16 one; - -#define RETURN_REFLECTION_TYPE_AT(x, y) \ - b = MapGridGetMetatileBehaviorAt(x, y); \ - result = GetReflectionTypeByMetatileBehavior(b); \ - if (result != 0) \ - return result; + s16 i, j; + u8 result, b; // used by RETURN_REFLECTION_TYPE_AT + s16 one = 1; - for (i = 0, one = 1; i < height; i++) + for (i = 0; i < height; i++) { RETURN_REFLECTION_TYPE_AT(objEvent->currentCoords.x, objEvent->currentCoords.y + one + i) RETURN_REFLECTION_TYPE_AT(objEvent->previousCoords.x, objEvent->previousCoords.y + one + i) @@ -7732,19 +7731,20 @@ static u8 ObjectEventCheckForReflectiveSurface(struct ObjectEvent *objEvent) RETURN_REFLECTION_TYPE_AT(objEvent->previousCoords.x - j, objEvent->previousCoords.y + one + i) } } - return 0; + + return REFL_TYPE_NONE; +} #undef RETURN_REFLECTION_TYPE_AT -} static u8 GetReflectionTypeByMetatileBehavior(u32 behavior) { if (MetatileBehavior_IsIce(behavior)) - return 1; + return REFL_TYPE_ICE; else if (MetatileBehavior_IsReflective(behavior)) - return 2; + return REFL_TYPE_WATER; else - return 0; + return REFL_TYPE_NONE; } u8 GetLedgeJumpDirection(s16 x, s16 y, u8 z) @@ -7945,12 +7945,12 @@ void GroundEffect_StepOnLongGrass(struct ObjectEvent *objEvent, struct Sprite *s void GroundEffect_WaterReflection(struct ObjectEvent *objEvent, struct Sprite *sprite) { - SetUpReflection(objEvent, sprite, 0); + SetUpReflection(objEvent, sprite, FALSE); } void GroundEffect_IceReflection(struct ObjectEvent *objEvent, struct Sprite *sprite) { - SetUpReflection(objEvent, sprite, 1); + SetUpReflection(objEvent, sprite, TRUE); } void GroundEffect_FlowingWater(struct ObjectEvent *objEvent, struct Sprite *sprite) @@ -8117,8 +8117,8 @@ static void (*const sGroundEffectFuncs[])(struct ObjectEvent *objEvent, struct S GroundEffect_StepOnTallGrass, // GROUND_EFFECT_FLAG_TALL_GRASS_ON_MOVE GroundEffect_SpawnOnLongGrass, // GROUND_EFFECT_FLAG_LONG_GRASS_ON_SPAWN GroundEffect_StepOnLongGrass, // GROUND_EFFECT_FLAG_LONG_GRASS_ON_MOVE - GroundEffect_WaterReflection, // GROUND_EFFECT_FLAG_ICE_REFLECTION - GroundEffect_IceReflection, // GROUND_EFFECT_FLAG_REFLECTION + GroundEffect_WaterReflection, // GROUND_EFFECT_FLAG_WATER_REFLECTION + GroundEffect_IceReflection, // GROUND_EFFECT_FLAG_ICE_REFLECTION GroundEffect_FlowingWater, // GROUND_EFFECT_FLAG_SHALLOW_FLOWING_WATER GroundEffect_SandTracks, // GROUND_EFFECT_FLAG_SAND GroundEffect_DeepSandTracks, // GROUND_EFFECT_FLAG_DEEP_SAND @@ -8649,14 +8649,14 @@ static void DestroyObjectEventSprites(void) } } -static int GetObjectEventSpriteId(u8 var) // this should return a u8, because all that call this shifts to u8, but it wont match because it doesnt shift u8 at the end. +static int GetObjectEventSpriteId(u8 objectEventId) // this should return a u8, because all that call this shifts to u8, but it wont match because it doesnt shift u8 at the end. { int i; for (i = 0; i < MAX_SPRITES; i++) { struct Sprite *sprite = &gSprites[i]; - if(sprite->inUse && sprite->callback == UpdateObjectEventSprite && (u8)sprite->data[0] == var) + if (sprite->inUse && sprite->callback == UpdateObjectEventSprite && (u8)sprite->data[0] == objectEventId) return i; } return MAX_SPRITES; @@ -8788,9 +8788,9 @@ static void UpdateObjectEventSpritePosition(struct Sprite *sprite) } } -bool32 IsObjectEventSpriteAnimating(u8 var) +bool32 IsObjectEventSpriteAnimating(u8 objectEventId) { - u8 spriteId = GetObjectEventSpriteId(var); + u8 spriteId = GetObjectEventSpriteId(objectEventId); if (spriteId == MAX_SPRITES) return FALSE; diff --git a/src/evolution_scene.c b/src/evolution_scene.c index d41bc5970..a8de8a555 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -60,7 +60,6 @@ static void CB2_TradeEvolutionSceneUpdate(void); static void EvoDummyFunc(void); static void VBlankCB_EvolutionScene(void); static void VBlankCB_TradeEvolutionScene(void); -static void sub_81150D8(void); static void sub_8140134(void); static void EvoScene_DoMonAnimation(u8 monSpriteId, u16 speciesId); static bool32 EvoScene_IsMonAnimFinished(u8 monSpriteId); diff --git a/src/faraway_island.c b/src/faraway_island.c index e3d8444c9..bc0814652 100755 --- a/src/faraway_island.c +++ b/src/faraway_island.c @@ -372,7 +372,6 @@ void SetMewAboveGrass(void) { s16 x; s16 y; - u8 spriteId; struct ObjectEvent *mew = &gObjectEvents[GetMewObjectEventId()]; mew->invisible = FALSE; diff --git a/src/field_effect.c b/src/field_effect.c index 5a18557eb..b1837c514 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -934,43 +934,43 @@ void FreeResourcesAndDestroySprite(struct Sprite *sprite, u8 spriteId) // r, g, b are between 0 and 16 void MultiplyInvertedPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b) { - int curRed; - int curGreen; - int curBlue; - u16 outPal; - - outPal = gPlttBufferUnfaded[i]; - curRed = outPal & 0x1f; - curGreen = (outPal & (0x1f << 5)) >> 5; - curBlue = (outPal & (0x1f << 10)) >> 10; - curRed += (((0x1f - curRed) * r) >> 4); - curGreen += (((0x1f - curGreen) * g) >> 4); - curBlue += (((0x1f - curBlue) * b) >> 4); - outPal = curRed; - outPal |= curGreen << 5; - outPal |= curBlue << 10; - gPlttBufferFaded[i] = outPal; + int curRed, curGreen, curBlue; + u16 color = gPlttBufferUnfaded[i]; + + curRed = (color & RGB_RED); + curGreen = (color & RGB_GREEN) >> 5; + curBlue = (color & RGB_BLUE) >> 10; + + curRed += (((0x1F - curRed) * r) >> 4); + curGreen += (((0x1F - curGreen) * g) >> 4); + curBlue += (((0x1F - curBlue) * b) >> 4); + + color = curRed; + color |= (curGreen << 5); + color |= (curBlue << 10); + + gPlttBufferFaded[i] = color; } // r, g, b are between 0 and 16 void MultiplyPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b) { - int curRed; - int curGreen; - int curBlue; - u16 outPal; - - outPal = gPlttBufferUnfaded[i]; - curRed = outPal & 0x1f; - curGreen = (outPal & (0x1f << 5)) >> 5; - curBlue = (outPal & (0x1f << 10)) >> 10; - curRed -= ((curRed * r) >> 4); + int curRed, curGreen, curBlue; + u16 color = gPlttBufferUnfaded[i]; + + curRed = (color & RGB_RED); + curGreen = (color & RGB_GREEN) >> 5; + curBlue = (color & RGB_BLUE) >> 10; + + curRed -= ((curRed * r) >> 4); curGreen -= ((curGreen * g) >> 4); - curBlue -= ((curBlue * b) >> 4); - outPal = curRed; - outPal |= curGreen << 5; - outPal |= curBlue << 10; - gPlttBufferFaded[i] = outPal; + curBlue -= ((curBlue * b) >> 4); + + color = curRed; + color |= curGreen << 5; + color |= curBlue << 10; + + gPlttBufferFaded[i] = color; } // Task data for Task_PokecenterHeal and Task_HallOfFameRecord diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index 2322232b8..67102a83b 100755 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -32,6 +32,11 @@ static void CreateBobbingEffect(struct ObjectEvent *, struct Sprite *, struct Sp static void sub_8155850(struct Sprite *); static u32 ShowDisguiseFieldEffect(u8, u8, u8); +#define sReflectionObjEventId data[0] +#define sReflectionObjEventLocalId data[1] +#define sReflectionVerticalOffset data[2] +#define sIsStillReflection data[7] + void SetUpReflection(struct ObjectEvent *objectEvent, struct Sprite *sprite, bool8 stillReflection) { struct Sprite *reflectionSprite; @@ -46,9 +51,9 @@ void SetUpReflection(struct ObjectEvent *objectEvent, struct Sprite *sprite, boo reflectionSprite->affineAnims = gDummySpriteAffineAnimTable; reflectionSprite->affineAnimBeginning = TRUE; reflectionSprite->subspriteMode = SUBSPRITES_OFF; - reflectionSprite->data[0] = sprite->data[0]; - reflectionSprite->data[1] = objectEvent->localId; - reflectionSprite->data[7] = stillReflection; + reflectionSprite->sReflectionObjEventId = sprite->data[0]; + reflectionSprite->sReflectionObjEventLocalId = objectEvent->localId; + reflectionSprite->sIsStillReflection = stillReflection; LoadObjectReflectionPalette(objectEvent, reflectionSprite); if (!stillReflection) @@ -60,19 +65,19 @@ static s16 GetReflectionVerticalOffset(struct ObjectEvent *objectEvent) return GetObjectEventGraphicsInfo(objectEvent->graphicsId)->height - 2; } -static void LoadObjectReflectionPalette(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static void LoadObjectReflectionPalette(struct ObjectEvent *objectEvent, struct Sprite *reflectionSprite) { u8 bridgeType; u16 bridgeReflectionVerticalOffsets[] = { 12, 28, 44 }; - sprite->data[2] = 0; + reflectionSprite->sReflectionVerticalOffset = 0; if (!GetObjectEventGraphicsInfo(objectEvent->graphicsId)->disableReflectionPaletteLoad && ((bridgeType = MetatileBehavior_GetBridgeType(objectEvent->previousMetatileBehavior)) || (bridgeType = MetatileBehavior_GetBridgeType(objectEvent->currentMetatileBehavior)))) { - sprite->data[2] = bridgeReflectionVerticalOffsets[bridgeType - 1]; - LoadObjectHighBridgeReflectionPalette(objectEvent, sprite->oam.paletteNum); + reflectionSprite->sReflectionVerticalOffset = bridgeReflectionVerticalOffsets[bridgeType - 1]; + LoadObjectHighBridgeReflectionPalette(objectEvent, reflectionSprite->oam.paletteNum); } else { - LoadObjectRegularReflectionPalette(objectEvent, sprite->oam.paletteNum); + LoadObjectRegularReflectionPalette(objectEvent, reflectionSprite->oam.paletteNum); } } @@ -118,9 +123,9 @@ static void UpdateObjectReflectionSprite(struct Sprite *reflectionSprite) struct ObjectEvent *objectEvent; struct Sprite *mainSprite; - objectEvent = &gObjectEvents[reflectionSprite->data[0]]; + objectEvent = &gObjectEvents[reflectionSprite->sReflectionObjEventId]; mainSprite = &gSprites[objectEvent->spriteId]; - if (!objectEvent->active || !objectEvent->hasReflection || objectEvent->localId != reflectionSprite->data[1]) + if (!objectEvent->active || !objectEvent->hasReflection || objectEvent->localId != reflectionSprite->sReflectionObjEventLocalId) { reflectionSprite->inUse = FALSE; } @@ -135,8 +140,7 @@ static void UpdateObjectReflectionSprite(struct Sprite *reflectionSprite) reflectionSprite->subspriteTableNum = mainSprite->subspriteTableNum; reflectionSprite->invisible = mainSprite->invisible; reflectionSprite->pos1.x = mainSprite->pos1.x; - // reflectionSprite->data[2] holds an additional vertical offset, used by the high bridges on Route 120 - reflectionSprite->pos1.y = mainSprite->pos1.y + GetReflectionVerticalOffset(objectEvent) + reflectionSprite->data[2]; + reflectionSprite->pos1.y = mainSprite->pos1.y + GetReflectionVerticalOffset(objectEvent) + reflectionSprite->sReflectionVerticalOffset; reflectionSprite->centerToCornerVecX = mainSprite->centerToCornerVecX; reflectionSprite->centerToCornerVecY = mainSprite->centerToCornerVecY; reflectionSprite->pos2.x = mainSprite->pos2.x; @@ -146,8 +150,7 @@ static void UpdateObjectReflectionSprite(struct Sprite *reflectionSprite) if (objectEvent->hideReflection == TRUE) reflectionSprite->invisible = TRUE; - // Check if the reflection is not still. - if (reflectionSprite->data[7] == FALSE) + if (reflectionSprite->sIsStillReflection == FALSE) { // Sets the reflection sprite's rot/scale matrix to the appropriate // matrix based on whether or not the main sprite is horizontally flipped. @@ -159,6 +162,11 @@ static void UpdateObjectReflectionSprite(struct Sprite *reflectionSprite) } } +#undef sReflectionObjEventId +#undef sReflectionObjEventLocalId +#undef sReflectionVerticalOffset +#undef sIsStillReflection + extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[]; u8 CreateWarpArrowSprite(void) diff --git a/src/fieldmap.c b/src/fieldmap.c index 296c4edf2..2961d2f49 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -28,7 +28,7 @@ EWRAM_DATA static u16 gBackupMapData[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 u32 sFiller_02037344 = 0; // without this, the next file won't align properly +EWRAM_DATA static u32 sFiller = 0; // without this, the next file won't align properly struct BackupMapLayout gBackupMapLayout; diff --git a/src/fldeff_cut.c b/src/fldeff_cut.c index 0458f7621..446633a53 100644 --- a/src/fldeff_cut.c +++ b/src/fldeff_cut.c @@ -62,7 +62,6 @@ static void HandleLongGrassOnHyper(u8, s16, s16); static u8 sCutSquareSide; static u8 sTileCountFromPlayer_X; static u8 sTileCountFromPlayer_Y; -static u32 sUnused; static bool8 sHyperCutTiles[CUT_HYPER_AREA]; // EWRAM variables diff --git a/src/fldeff_escalator.c b/src/fldeff_escalator.c index 7a96eaa82..733dca722 100644 --- a/src/fldeff_escalator.c +++ b/src/fldeff_escalator.c @@ -10,8 +10,6 @@ static EWRAM_DATA u8 sEscalatorAnim_TaskId = 0; static void SetEscalatorMetatile(u8 taskId, const s16 *metatileIds, u16 metatileMasks); static void Task_DrawEscalator(u8 taskId); -static void Task_DrawTeleporterHousing(u8 taskId); -static void Task_DrawTeleporterCable(u8 taskId); #define ESCALATOR_STAGES 3 #define LAST_ESCALATOR_STAGE (ESCALATOR_STAGES - 1) diff --git a/src/frontier_util.c b/src/frontier_util.c index db5f86aef..095c750a6 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -1513,9 +1513,9 @@ static void ShowLinkContestResultsWindow(void) AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Smart, x, 89, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Tough, x, 105, TEXT_SPEED_FF, NULL); - for (i = 0; i < 5; i++) + for (i = 0; i < CONTEST_CATEGORIES_COUNT; i++) { - for (j = 0; j < 4; j++) + for (j = 0; j < CONTESTANT_COUNT; j++) { ConvertIntToDecimalStringN(gStringVar4, gSaveBlock2Ptr->contestLinkResults[i][j], STR_CONV_MODE_RIGHT_ALIGN, 4); AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, (j * 38) + 64, (i * 16) + 41, TEXT_SPEED_FF, NULL); diff --git a/src/image_processing_effects.c b/src/image_processing_effects.c index cbd8b9b37..224de6fe1 100644 --- a/src/image_processing_effects.c +++ b/src/image_processing_effects.c @@ -129,11 +129,11 @@ static void ApplyImageEffect_RedChannelGrayscale(u8 delta) u16 *pixel = &pixelRow[gCanvasColumnStart]; for (i = 0; i < gCanvasColumnEnd; i++, pixel++) { - if (!(0x8000 & *pixel)) + if (!IS_ALPHA(*pixel)) { // Gets the grayscale value, based on the pixel's red channel. // Also adds a delta to skew lighter or darker. - u8 grayValue = (31 & *pixel); + u8 grayValue = (*pixel & RGB_RED); grayValue += delta; if (grayValue > 31) grayValue = 31; @@ -154,9 +154,9 @@ static void ApplyImageEffect_RedChannelGrayscaleHighlight(u8 highlight) u16 *pixel = &pixelRow[gCanvasColumnStart]; for (i = 0; i < gCanvasColumnEnd; i++, pixel++) { - if (!(0x8000 & *pixel)) + if (!IS_ALPHA(*pixel)) { - u8 grayValue = (31 & *pixel); + u8 grayValue = (*pixel & RGB_RED); if (grayValue > 31 - highlight) grayValue = 31 - (highlight >> 1); @@ -183,7 +183,7 @@ static void ApplyImageEffect_Grayscale(void) u16 *pixel = &pixelRow[gCanvasColumnStart]; for (i = 0; i < gCanvasColumnEnd; i++, pixel++) { - if (!(0x8000 & *pixel)) + if (!IS_ALPHA(*pixel)) *pixel = ConvertColorToGrayscale(pixel); } } @@ -203,7 +203,7 @@ static void ApplyImageEffect_Blur(void) pixel += gCanvasWidth; while (j < gCanvasRowEnd - 1) { - if (!(0x8000 & *pixel)) + if (!IS_ALPHA(*pixel)) { *pixel = QuantizePixel_Blur(&prevPixel, pixel, pixel + gCanvasWidth); prevPixel = *pixel; @@ -225,7 +225,7 @@ static void ApplyImageEffect_PersonalityColor(u8 personality) u16 *pixel = &pixelRow[gCanvasColumnStart]; for (i = 0; i < gCanvasColumnEnd; i++, pixel++) { - if (!(0x8000 & *pixel)) + if (!IS_ALPHA(*pixel)) *pixel = QuantizePixel_PersonalityColor(pixel, personality); } } @@ -241,7 +241,7 @@ static void ApplyImageEffect_BlackAndWhite(void) u16 *pixel = &pixelRow[gCanvasColumnStart]; for (i = 0; i < gCanvasColumnEnd; i++, pixel++) { - if (!(0x8000 & *pixel)) + if (!IS_ALPHA(*pixel)) *pixel = QuantizePixel_BlackAndWhite(pixel); } } @@ -293,7 +293,7 @@ static void ApplyImageEffect_Invert(void) u16 *pixel = &pixelRow[gCanvasColumnStart]; for (i = 0; i < gCanvasColumnEnd; i++, pixel++) { - if (!(0x8000 & *pixel)) + if (!IS_ALPHA(*pixel)) *pixel = QuantizePixel_Invert(pixel); } } @@ -311,7 +311,7 @@ static void ApplyImageEffect_Shimmer(void) { for (j = 0; j < 64; j++, pixel++) { - if (!(0x8000 & *pixel)) + if (!IS_ALPHA(*pixel)) *pixel = QuantizePixel_Invert(pixel); } } @@ -321,30 +321,30 @@ static void ApplyImageEffect_Shimmer(void) { pixel = &gCanvasPixels[j]; prevPixel = *pixel; - *pixel = 0x8000; + *pixel = RGB_ALPHA; for (i = 1, pixel += 64; i < 63; i++, pixel += 64) { - if (!(0x8000 & *pixel)) + if (!IS_ALPHA(*pixel)) { *pixel = QuantizePixel_BlurHard(&prevPixel, pixel, pixel + 64); prevPixel = *pixel; } } - *pixel = 0x8000; + *pixel = RGB_ALPHA; pixel = &gCanvasPixels[j]; prevPixel = *pixel; - *pixel = 0x8000; + *pixel = RGB_ALPHA; for (i = 1, pixel += 64; i < 63; i++, pixel += 64) { - if (!(0x8000 & *pixel)) + if (!IS_ALPHA(*pixel)) { *pixel = QuantizePixel_BlurHard(&prevPixel, pixel, pixel + 64); prevPixel = *pixel; } } - *pixel = 0x8000; + *pixel = RGB_ALPHA; } // Finally, invert colors back to the original color space. @@ -355,7 +355,7 @@ static void ApplyImageEffect_Shimmer(void) { for (j = 0; j < 64; j++, pixel++) { - if (!(0x8000 & *pixel)) + if (!IS_ALPHA(*pixel)) *pixel = QuantizePixel_Invert(pixel); } } @@ -372,7 +372,7 @@ static void ApplyImageEffect_BlurRight(void) u16 prevPixel = *pixel; for (i = 1, pixel++; i < gCanvasColumnEnd - 1; i++, pixel++) { - if (!(0x8000 & *pixel)) + if (!IS_ALPHA(*pixel)) { *pixel = QuantizePixel_MotionBlur(&prevPixel, pixel); prevPixel = *pixel; @@ -392,7 +392,7 @@ static void ApplyImageEffect_BlurDown(void) u16 prevPixel = *pixel; for (j = 1, pixel += gCanvasWidth; j < gCanvasRowEnd - 1; j++, pixel += gCanvasWidth) { - if (!(0x8000 & *pixel)) + if (!IS_ALPHA(*pixel)) { *pixel = QuantizePixel_MotionBlur(&prevPixel, pixel); prevPixel = *pixel; @@ -447,11 +447,11 @@ static void AddPointillismPoints(u16 arg0) { u16 *pixel = &gCanvasPixels[points[i].row * 64] + points[i].column; - if (!(0x8000 & *pixel)) + if (!IS_ALPHA(*pixel)) { - u16 red = (*pixel) & 0x1F; - u16 green = (*pixel >> 5) & 0x1F; - u16 blue = (*pixel >> 10) & 0x1F; + u16 red = GET_R(*pixel); + u16 green = GET_G(*pixel); + u16 blue = GET_B(*pixel); switch (colorType) { @@ -501,9 +501,9 @@ static void AddPointillismPoints(u16 arg0) static u16 ConvertColorToGrayscale(u16 *color) { s32 clr = *color; - s32 r = clr & 0x1F; - s32 g = (clr >> 5) & 0x1F; - s32 b = (clr >> 10) & 0x1F; + s32 r = GET_R(clr); + s32 g = GET_G(clr); + s32 b = GET_B(clr); s32 gray = (r * Q_8_8(0.3) + g * Q_8_8(0.59) + b * Q_8_8(0.1133)) >> 8; return RGB2(gray, gray, gray); } @@ -512,9 +512,9 @@ static u16 ConvertColorToGrayscale(u16 *color) // Everything else is white. static u16 QuantizePixel_PersonalityColor(u16 *color, u8 personality) { - u16 red = *color & 0x1F; - u16 green = (*color >> 5) & 0x1F; - u16 blue = (*color >> 10) & 0x1F; + u16 red = GET_R(*color); + u16 green = GET_G(*color); + u16 blue = GET_B(*color); if (red < 17 && green < 17 && blue < 17) return GetColorFromPersonality(personality); @@ -526,9 +526,9 @@ static u16 QuantizePixel_PersonalityColor(u16 *color, u8 personality) // the mon's personality value, return a color. static u16 GetColorFromPersonality(u8 personality) { - u16 red = 0; + u16 red = 0; u16 green = 0; - u16 blue = 0; + u16 blue = 0; u8 strength = (personality / 6) % 3; u8 colorType = personality % 6; @@ -577,9 +577,9 @@ static u16 GetColorFromPersonality(u8 personality) static u16 QuantizePixel_BlackAndWhite(u16 *color) { - u16 red = *color & 0x1F; - u16 green = (*color >> 5) & 0x1F; - u16 blue = (*color >> 10) & 0x1F; + u16 red = GET_R(*color); + u16 green = GET_G(*color); + u16 blue = GET_B(*color); if (red < 17 && green < 17 && blue < 17) return RGB_BLACK; @@ -591,9 +591,9 @@ static u16 QuantizePixel_BlackOutline(u16 *pixelA, u16 *pixelB) { if (*pixelA != RGB_BLACK) { - if (*pixelA & 0x8000) - return 0x8000; - if (*pixelB & 0x8000) + if (IS_ALPHA(*pixelA)) + return RGB_ALPHA; + if (IS_ALPHA(*pixelB)) return RGB_BLACK; return *pixelA; @@ -604,13 +604,13 @@ static u16 QuantizePixel_BlackOutline(u16 *pixelA, u16 *pixelB) static u16 QuantizePixel_Invert(u16 *color) { - u16 red = *color & 0x1F; - u16 green = (*color >> 5) & 0x1F; - u16 blue = (*color >> 10) & 0x1F; + u16 red = GET_R(*color); + u16 green = GET_G(*color); + u16 blue = GET_B(*color); - red = 31 - red; + red = 31 - red; green = 31 - green; - blue = 31 - blue; + blue = 31 - blue; return RGB2(red, green, blue); } @@ -626,12 +626,12 @@ static u16 QuantizePixel_MotionBlur(u16 *prevPixel, u16 *curPixel) if (*prevPixel == *curPixel) return *curPixel; - pixelChannels[0][0] = (*prevPixel >> 0) & 0x1F; - pixelChannels[0][1] = (*prevPixel >> 5) & 0x1F; - pixelChannels[0][2] = (*prevPixel >> 10) & 0x1F; - pixelChannels[1][0] = (*curPixel >> 0) & 0x1F; - pixelChannels[1][1] = (*curPixel >> 5) & 0x1F; - pixelChannels[1][2] = (*curPixel >> 10) & 0x1F; + pixelChannels[0][0] = GET_R(*prevPixel); + pixelChannels[0][1] = GET_G(*prevPixel); + pixelChannels[0][2] = GET_B(*prevPixel); + pixelChannels[1][0] = GET_R(*curPixel); + pixelChannels[1][1] = GET_G(*curPixel); + pixelChannels[1][2] = GET_B(*curPixel); // Don't blur light colors. if (pixelChannels[0][0] > 25 && pixelChannels[0][1] > 25 && pixelChannels[0][2] > 25) @@ -667,9 +667,9 @@ static u16 QuantizePixel_MotionBlur(u16 *prevPixel, u16 *curPixel) largestDiff = diffs[0]; } - red = (pixelChannels[1][0] * (31 - largestDiff / 2)) / 31; + red = (pixelChannels[1][0] * (31 - largestDiff / 2)) / 31; green = (pixelChannels[1][1] * (31 - largestDiff / 2)) / 31; - blue = (pixelChannels[1][2] * (31 - largestDiff / 2)) / 31; + blue = (pixelChannels[1][2] * (31 - largestDiff / 2)) / 31; return RGB2(red, green, blue); } @@ -684,13 +684,13 @@ static u16 QuantizePixel_Blur(u16 *prevPixel, u16 *curPixel, u16 *nextPixel) if (*prevPixel == *curPixel && *nextPixel == *curPixel) return *curPixel; - red = (*curPixel >> 0) & 0x1F; - green = (*curPixel >> 5) & 0x1F; - blue = (*curPixel >> 10) & 0x1F; + red = GET_R(*curPixel); + green = GET_G(*curPixel); + blue = GET_B(*curPixel); - prevAvg = (((*prevPixel >> 0) & 0x1F) + ((*prevPixel >> 5) & 0x1F) + ((*prevPixel >> 10) & 0x1F)) / 3; - curAvg = (((*curPixel >> 0) & 0x1F) + ((*curPixel >> 5) & 0x1F) + ((*curPixel >> 10) & 0x1F)) / 3; - nextAvg = (((*nextPixel >> 0) & 0x1F) + ((*nextPixel >> 5) & 0x1F) + ((*nextPixel >> 10) & 0x1F)) / 3; + prevAvg = (GET_R(*prevPixel) + GET_G(*prevPixel) + GET_B(*prevPixel)) / 3; + curAvg = (GET_R(*curPixel) + GET_G(*curPixel) + GET_B(*curPixel)) / 3; + nextAvg = (GET_R(*nextPixel) + GET_G(*nextPixel) + GET_B(*nextPixel)) / 3; if (prevAvg == curAvg && nextAvg == curAvg) return *curPixel; @@ -728,14 +728,14 @@ static u16 QuantizePixel_BlurHard(u16 *prevPixel, u16 *curPixel, u16 *nextPixel) if (*prevPixel == *curPixel && *nextPixel == *curPixel) return *curPixel; - red = (*curPixel >> 0) & 0x1F; - green = (*curPixel >> 5) & 0x1F; - blue = (*curPixel >> 10) & 0x1F; - - prevAvg = (((*prevPixel >> 0) & 0x1F) + ((*prevPixel >> 5) & 0x1F) + ((*prevPixel >> 10) & 0x1F)) / 3; - curAvg = (((*curPixel >> 0) & 0x1F) + ((*curPixel >> 5) & 0x1F) + ((*curPixel >> 10) & 0x1F)) / 3; - nextAvg = (((*nextPixel >> 0) & 0x1F) + ((*nextPixel >> 5) & 0x1F) + ((*nextPixel >> 10) & 0x1F)) / 3; - + red = GET_R(*curPixel); + green = GET_G(*curPixel); + blue = GET_B(*curPixel); + + prevAvg = (GET_R(*prevPixel) + GET_G(*prevPixel) + GET_B(*prevPixel)) / 3; + curAvg = (GET_R(*curPixel) + GET_G(*curPixel) + GET_B(*curPixel)) / 3; + nextAvg = (GET_R(*nextPixel) + GET_G(*nextPixel) + GET_B(*nextPixel)) / 3; + if (prevAvg == curAvg && nextAvg == curAvg) return *curPixel; @@ -851,37 +851,37 @@ void ApplyImageProcessingQuantization(struct ImageProcessingContext *context) static void SetPresetPalette_PrimaryColors(void) { - gCanvasPalette[0] = RGB2(0, 0, 0); - gCanvasPalette[1] = RGB2(6, 6, 6); - gCanvasPalette[2] = RGB2(29, 29, 29); - gCanvasPalette[3] = RGB2(11, 11, 11); - gCanvasPalette[4] = RGB2(29, 6, 6); - gCanvasPalette[5] = RGB2(6, 29, 6); - gCanvasPalette[6] = RGB2(6, 6, 29); - gCanvasPalette[7] = RGB2(29, 29, 6); - gCanvasPalette[8] = RGB2(29, 6, 29); - gCanvasPalette[9] = RGB2(6, 29, 29); - gCanvasPalette[10] = RGB2(29, 11, 6); - gCanvasPalette[11] = RGB2(11, 29, 6); - gCanvasPalette[12] = RGB2(6, 11, 29); - gCanvasPalette[13] = RGB2(29, 6, 11); - gCanvasPalette[14] = RGB2(6, 29, 11); - gCanvasPalette[15] = RGB2(11, 6, 29); + gCanvasPalette[0] = RGB_BLACK; + gCanvasPalette[1] = RGB(6, 6, 6); + gCanvasPalette[2] = RGB(29, 29, 29); + gCanvasPalette[3] = RGB(11, 11, 11); + gCanvasPalette[4] = RGB(29, 6, 6); + gCanvasPalette[5] = RGB(6, 29, 6); + gCanvasPalette[6] = RGB(6, 6, 29); + gCanvasPalette[7] = RGB(29, 29, 6); + gCanvasPalette[8] = RGB(29, 6, 29); + gCanvasPalette[9] = RGB(6, 29, 29); + gCanvasPalette[10] = RGB(29, 11, 6); + gCanvasPalette[11] = RGB(11, 29, 6); + gCanvasPalette[12] = RGB(6, 11, 29); + gCanvasPalette[13] = RGB(29, 6, 11); + gCanvasPalette[14] = RGB(6, 29, 11); + gCanvasPalette[15] = RGB(11, 6, 29); } static void SetPresetPalette_BlackAndWhite(void) { - gCanvasPalette[0] = RGB2(0, 0, 0); - gCanvasPalette[1] = RGB2(0, 0, 0); - gCanvasPalette[2] = RGB2(31, 31, 31); + gCanvasPalette[0] = RGB_BLACK; + gCanvasPalette[1] = RGB_BLACK; + gCanvasPalette[2] = RGB_WHITE; } static void SetPresetPalette_GrayscaleSmall(void) { u8 i; - gCanvasPalette[0] = RGB2(0, 0, 0); - gCanvasPalette[1] = RGB2(0, 0, 0); + gCanvasPalette[0] = RGB_BLACK; + gCanvasPalette[1] = RGB_BLACK; for (i = 0; i < 14; i++) gCanvasPalette[i + 2] = RGB2(2 * (i + 2), 2 * (i + 2), 2 * (i + 2)); } @@ -890,7 +890,7 @@ static void SetPresetPalette_Grayscale(void) { u8 i; - gCanvasPalette[0] = RGB2(0, 0, 0); + gCanvasPalette[0] = RGB_BLACK; for (i = 0; i < 32; i++) gCanvasPalette[i + 1] = RGB2(i, i, i); } @@ -914,7 +914,7 @@ static void QuantizePalette_Standard(bool8 useLimitedPalette) u16 *pixel = &pixelRow[gCanvasColumnStart]; for (i = 0; i < gCanvasColumnEnd; i++, pixel++) { - if (*pixel & 0x8000) + if (IS_ALPHA(*pixel)) { *pixel = gCanvasPaletteStart; } @@ -982,7 +982,7 @@ static void QuantizePalette_BlackAndWhite(void) u16 *pixel = &pixelRow[gCanvasColumnStart]; for (i = 0; i < gCanvasColumnEnd; i++, pixel++) { - if (*pixel & 0x8000) + if (IS_ALPHA(*pixel)) { *pixel = gCanvasPaletteStart; } @@ -1013,7 +1013,7 @@ static void QuantizePalette_GrayscaleSmall(void) u16 *pixel = &pixelRow[gCanvasColumnStart]; for (i = 0; i < gCanvasColumnEnd; i++, pixel++) { - if (*pixel & 0x8000) + if (IS_ALPHA(*pixel)) *pixel = gCanvasPaletteStart; else *pixel = QuantizePixel_GrayscaleSmall(pixel) + gCanvasPaletteStart; @@ -1031,7 +1031,7 @@ static void QuantizePalette_Grayscale(void) u16 *pixel = &pixelRow[gCanvasColumnStart]; for (i = 0; i < gCanvasColumnEnd; i++, pixel++) { - if (*pixel & 0x8000) + if (IS_ALPHA(*pixel)) *pixel = gCanvasPaletteStart; else *pixel = QuantizePixel_Grayscale(pixel) + gCanvasPaletteStart; @@ -1049,7 +1049,7 @@ static void QuantizePalette_PrimaryColors(void) u16 *pixel = &pixelRow[gCanvasColumnStart]; for (i = 0; i < gCanvasColumnEnd; i++, pixel++) { - if (*pixel & 0x8000) + if (IS_ALPHA(*pixel)) *pixel = gCanvasPaletteStart; else *pixel = QuantizePixel_PrimaryColors(pixel) + gCanvasPaletteStart; @@ -1060,9 +1060,9 @@ static void QuantizePalette_PrimaryColors(void) // Quantizes the pixel's color channels to nearest multiple of 4, and clamps to [6, 30]. static u16 QuantizePixel_Standard(u16 *pixel) { - u16 red = *pixel & 0x1F; - u16 green = (*pixel >> 5) & 0x1F; - u16 blue = (*pixel >> 10) & 0x1F; + u16 red = GET_R(*pixel); + u16 green = GET_G(*pixel); + u16 blue = GET_B(*pixel); // Quantize color channels to muliples of 4, rounding up. if (red & 3) @@ -1091,10 +1091,10 @@ static u16 QuantizePixel_Standard(u16 *pixel) static u16 QuantizePixel_PrimaryColors(u16* color) { - u16 red = *color & 0x1F; - u16 green = (*color >> 5) & 0x1F; - u16 blue = (*color >> 10) & 0x1F; - + u16 red = GET_R(*color); + u16 green = GET_G(*color); + u16 blue = GET_B(*color); + if (red < 12 && green < 11 && blue < 11) return 1; @@ -1206,9 +1206,9 @@ static u16 QuantizePixel_PrimaryColors(u16* color) static u16 QuantizePixel_GrayscaleSmall(u16 *color) { - u16 red = *color & 0x1F; - u16 green = (*color >> 5) & 0x1F; - u16 blue = (*color >> 10) & 0x1F; + u16 red = GET_R(*color); + u16 green = GET_G(*color); + u16 blue = GET_B(*color); u16 average = ((red + green + blue) / 3) & 0x1E; if (average == 0) return 1; @@ -1218,9 +1218,9 @@ static u16 QuantizePixel_GrayscaleSmall(u16 *color) static u16 QuantizePixel_Grayscale(u16 *color) { - u16 red = *color & 0x1F; - u16 green = (*color >> 5) & 0x1F; - u16 blue = (*color >> 10) & 0x1F; + u16 red = GET_R(*color); + u16 green = GET_G(*color); + u16 blue = GET_B(*color); u16 average = (red + green + blue) / 3; return average + 1; } diff --git a/src/intro.c b/src/intro.c index 7dab2ad46..7c92913b6 100644 --- a/src/intro.c +++ b/src/intro.c @@ -986,8 +986,6 @@ static void SerialCB_CopyrightScreen(void) static u8 SetUpCopyrightScreen(void) { - u16 ime; - switch (gMain.state) { case 0: @@ -1302,7 +1300,6 @@ static void Task_IntroStartBikeRide(u8 taskId) static void Task_IntroHandleBikeAndFlygonMovement(u8 taskId) { - s16 a; u16 offset; if (gIntroFrameCounter == 1856) diff --git a/src/item.c b/src/item.c index 0b6366048..91d2f1a0a 100644 --- a/src/item.c +++ b/src/item.c @@ -102,8 +102,8 @@ void CopyItemNameHandlePlural(u16 itemId, u8 *dst, u32 quantity) } else { - if (itemId >= ITEM_CHERI_BERRY && itemId <= ITEM_ENIGMA_BERRY) - GetBerryCountString(dst, gBerries[itemId - ITEM_CHERI_BERRY].name, quantity); + if (itemId >= FIRST_BERRY_INDEX && itemId <= LAST_BERRY_INDEX) + GetBerryCountString(dst, gBerries[itemId - FIRST_BERRY_INDEX].name, quantity); else StringCopy(dst, ItemId_GetName(itemId)); } diff --git a/src/item_menu.c b/src/item_menu.c index 931cba2bf..6d30038d0 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -627,7 +627,6 @@ void CB2_Bag(void) bool8 SetupBagMenu(void) { - u32 index; u8 taskId; switch (gMain.state) @@ -742,7 +741,7 @@ void BagMenu_InitBGs(void) ResetVramOamAndBgCntRegs(); memset(gBagMenu->tilemapBuffer, 0, 0x800); ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, sBgTemplates_ItemMenu, 3); + InitBgsFromTemplates(0, sBgTemplates_ItemMenu, ARRAY_COUNT(sBgTemplates_ItemMenu)); SetBgTilemapBuffer(2, gBagMenu->tilemapBuffer); ResetAllBgsCoordinates(); ScheduleBgCopyTilemapToVram(2); @@ -865,7 +864,7 @@ void GetItemName(s8 *dest, u16 itemId) } break; case BERRIES_POCKET: - ConvertIntToDecimalStringN(gStringVar1, itemId - ITEM_CHERI_BERRY + 1, STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar1, itemId - FIRST_BERRY_INDEX + 1, STR_CONV_MODE_LEADING_ZEROS, 2); CopyItemName(itemId, gStringVar2); StringExpandPlaceholders(dest, gText_NumberVar1Clear7Var2); break; @@ -1721,7 +1720,7 @@ void ItemMenu_UseOutOfBattle(u8 taskId) if (ItemId_GetFieldFunc(gSpecialVar_ItemId)) { BagMenu_RemoveSomeWindow(); - if (CalculatePlayerPartyCount() == 0 && ItemId_GetType(gSpecialVar_ItemId) == 1) + if (CalculatePlayerPartyCount() == 0 && ItemId_GetType(gSpecialVar_ItemId) == ITEM_USE_PARTY_MENU) BagMenu_PrintThereIsNoPokemon(taskId); else { diff --git a/src/item_use.c b/src/item_use.c index df6a35bc9..af0ca9ee5 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -77,13 +77,13 @@ EWRAM_DATA static void(*sItemUseOnFieldCB)(u8 taskId) = NULL; // Below is set TRUE by UseRegisteredKeyItemOnField #define tUsingRegisteredKeyItem data[3] -// .rodata - +// UB here if an item with type ITEM_USE_MAIL or ITEM_USE_BAG_MENU uses SetUpItemUseCallback +// Never occurs in vanilla, but can occur with improperly created items static const MainCallback sItemUseCallbacks[] = { - CB2_ShowPartyMenuForItemUse, - CB2_ReturnToField, - NULL, + [ITEM_USE_PARTY_MENU - 1] = CB2_ShowPartyMenuForItemUse, + [ITEM_USE_FIELD - 1] = CB2_ReturnToField, + [ITEM_USE_PBLOCK_CASE - 1] = NULL, }; static const u8 sClockwiseDirections[] = {DIR_NORTH, DIR_EAST, DIR_SOUTH, DIR_WEST}; @@ -94,13 +94,12 @@ static const struct YesNoFuncTable sUseTMHMYesNoFuncTable = .noFunc = BagMenu_InitListsMenu, }; -// .text - +#define tEnigmaBerryType data[4] static void SetUpItemUseCallback(u8 taskId) { u8 type; if (gSpecialVar_ItemId == ITEM_ENIGMA_BERRY) - type = gTasks[taskId].data[4] - 1; + type = gTasks[taskId].tEnigmaBerryType - 1; else type = ItemId_GetType(gSpecialVar_ItemId) - 1; if (!InBattlePyramid()) @@ -218,9 +217,9 @@ void ItemUseOutOfBattle_Bike(u8 taskId) static void ItemUseOnFieldCB_Bike(u8 taskId) { - if (!ItemId_GetSecondaryId(gSpecialVar_ItemId)) + if (ItemId_GetSecondaryId(gSpecialVar_ItemId) == MACH_BIKE) GetOnOffBike(PLAYER_AVATAR_FLAG_MACH_BIKE); - else + else // ACRO_BIKE GetOnOffBike(PLAYER_AVATAR_FLAG_ACRO_BIKE); ScriptUnfreezeObjectEvents(); ScriptContext2_Disable(); @@ -1065,28 +1064,28 @@ void ItemUseOutOfBattle_EnigmaBerry(u8 taskId) case ITEM_EFFECT_SPDEF_EV: case ITEM_EFFECT_SPEED_EV: case ITEM_EFFECT_DEF_EV: - gTasks[taskId].data[4] = 1; + gTasks[taskId].tEnigmaBerryType = ITEM_USE_PARTY_MENU; ItemUseOutOfBattle_Medicine(taskId); break; case ITEM_EFFECT_SACRED_ASH: - gTasks[taskId].data[4] = 1; + gTasks[taskId].tEnigmaBerryType = ITEM_USE_PARTY_MENU; ItemUseOutOfBattle_SacredAsh(taskId); break; case ITEM_EFFECT_RAISE_LEVEL: - gTasks[taskId].data[4] = 1; + gTasks[taskId].tEnigmaBerryType = ITEM_USE_PARTY_MENU; ItemUseOutOfBattle_RareCandy(taskId); break; case ITEM_EFFECT_PP_UP: case ITEM_EFFECT_PP_MAX: - gTasks[taskId].data[4] = 1; + gTasks[taskId].tEnigmaBerryType = ITEM_USE_PARTY_MENU; ItemUseOutOfBattle_PPUp(taskId); break; case ITEM_EFFECT_HEAL_PP: - gTasks[taskId].data[4] = 1; + gTasks[taskId].tEnigmaBerryType = ITEM_USE_PARTY_MENU; ItemUseOutOfBattle_PPRecovery(taskId); break; default: - gTasks[taskId].data[4] = 4; + gTasks[taskId].tEnigmaBerryType = ITEM_USE_BAG_MENU; ItemUseOutOfBattle_CannotUse(taskId); break; } diff --git a/src/librfu_rfu.c b/src/librfu_rfu.c index fe1d10834..7cb9b1bd6 100644 --- a/src/librfu_rfu.c +++ b/src/librfu_rfu.c @@ -1724,7 +1724,6 @@ static void rfu_constructSendLLFrame(void) u32 pakcketSize, currSize; u8 i; u8 *llf_p; - struct RfuSlotStatusNI *slotStatusNI; if (gRfuLinkStatus->parentChild != MODE_NEUTRAL && gRfuLinkStatus->sendSlotNIFlag | gRfuLinkStatus->recvSlotNIFlag | gRfuLinkStatus->sendSlotUNIFlag) diff --git a/src/mail.c b/src/mail.c index 04464f06b..71e98b42a 100644 --- a/src/mail.c +++ b/src/mail.c @@ -125,7 +125,7 @@ static void CB2_ExitMailReadFreeVars(void); // .rodata -static const struct BgTemplate sUnknown_0859F290[] = { +static const struct BgTemplate sBgTemplates[] = { { .bg = 0, .charBaseIndex = 2, @@ -254,7 +254,7 @@ void ReadMail(struct MailStruct *mail, void (*callback)(void), bool8 flag) sMailRead->parserMultiple = ConvertEasyChatWordsToString; if (IS_ITEM_MAIL(mail->itemId)) { - sMailRead->mailType = mail->itemId - ITEM_ORANGE_MAIL; + sMailRead->mailType = mail->itemId - FIRST_MAIL_INDEX; } else { @@ -279,10 +279,10 @@ void ReadMail(struct MailStruct *mail, void (*callback)(void), bool8 flag) default: sMailRead->animsActive = 0; break; - case ITEM_BEAD_MAIL - ITEM_ORANGE_MAIL: + case ITEM_BEAD_MAIL - FIRST_MAIL_INDEX: sMailRead->animsActive = 1; break; - case ITEM_DREAM_MAIL - ITEM_ORANGE_MAIL: + case ITEM_DREAM_MAIL - FIRST_MAIL_INDEX: sMailRead->animsActive = 2; break; } @@ -336,7 +336,7 @@ static bool8 MailReadBuildGraphics(void) break; case 6: ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, sUnknown_0859F290, 3); + InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates)); SetBgTilemapBuffer(1, sMailRead->bg1TilemapBuffer); SetBgTilemapBuffer(2, sMailRead->bg2TilemapBuffer); break; diff --git a/src/main_menu.c b/src/main_menu.c index 2c27b673a..74af96da8 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -1799,7 +1799,7 @@ static void CB2_NewGameBirchSpeech_ReturnFromNamingScreen(void) ResetBgsAndClearDma3BusyFlags(0); SetGpuReg(REG_OFFSET_DISPCNT, 0); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); - InitBgsFromTemplates(0, sMainMenuBgTemplates, 2); + InitBgsFromTemplates(0, sMainMenuBgTemplates, ARRAY_COUNT(sMainMenuBgTemplates)); InitBgFromTemplate(&sBirchBgTemplate); SetVBlankCallback(NULL); SetGpuReg(REG_OFFSET_BG2CNT, 0); @@ -2097,7 +2097,7 @@ static void NewGameBirchSpeech_ShowGenderMenu(void) { DrawMainMenuWindowBorder(&gNewGameBirchSpeechTextWindows[1], 0xF3); FillWindowPixelBuffer(1, PIXEL_FILL(1)); - PrintMenuTable(1, 2, sMenuActions_Gender); + PrintMenuTable(1, ARRAY_COUNT(sMenuActions_Gender), sMenuActions_Gender); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(1, 2, 0); PutWindowTilemap(1); CopyWindowToVram(1, 3); diff --git a/src/match_call.c b/src/match_call.c index 723562ade..7e8d0c38a 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -1494,7 +1494,6 @@ static const struct MatchCallText *GetGeneralMatchCallText(int matchCallId, u8 * int count; u32 topic, id; u16 rand; - u16 var3; rand = Random(); if (!(rand & 1)) diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index af68c6116..c97ee94f3 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -1324,7 +1324,6 @@ static void PrintStoryList(void) { s32 i; s32 width = GetStringWidth(1, gText_Exit, 0); - u8 tileWidth; for (i = 0; i < NUM_STORYTELLER_TALES; i++) { s32 curWidth; diff --git a/src/mevent_server.c b/src/mevent_server.c index 0d3afea30..2e7b3d89a 100644 --- a/src/mevent_server.c +++ b/src/mevent_server.c @@ -288,8 +288,8 @@ static u32 (*const func_tbl[])(struct mevent_srv_common *) = { static u32 mevent_srv_exec_common(struct mevent_srv_common * svr) { u32 response; - AGB_ASSERT(svr->mainseqno < NELEMS(func_tbl)); + AGB_ASSERT(svr->mainseqno < ARRAY_COUNT(func_tbl)); response = func_tbl[svr->mainseqno](svr); - AGB_ASSERT(svr->mainseqno < NELEMS(func_tbl)); + AGB_ASSERT(svr->mainseqno < ARRAY_COUNT(func_tbl)); return response; } diff --git a/src/minigame_countdown.c b/src/minigame_countdown.c index cd5710d44..d2f7d3ea8 100644 --- a/src/minigame_countdown.c +++ b/src/minigame_countdown.c @@ -14,7 +14,6 @@ static void sub_802E83C(u8 taskId); static void sub_802E8C8(u8 taskId); static void sub_802EA50(u8 taskId); static void sub_802EAB0(u8 taskId); -static void sub_802EB98(u8 taskId); static void Task_MinigameCountdown(u8 taskId); static bool32 RunMinigameCountdownDigitsAnim(u8 spriteId); static bool32 IsStartGraphicAnimRunning(u8 spriteId); diff --git a/src/overworld.c b/src/overworld.c index 72aa17929..cbfc70898 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -174,7 +174,6 @@ static u8 sPlayerTradingStates[MAX_LINK_PLAYERS]; static u16 (*sPlayerKeyInterceptCallback)(u32); static bool8 sUnknown_03000E18; static u8 sRfuKeepAliveTimer; -static u32 sUnusedVar; // IWRAM common u16 *gBGTilemapBuffers1; diff --git a/src/palette.c b/src/palette.c index 320e11ecc..ece753d21 100644 --- a/src/palette.c +++ b/src/palette.c @@ -60,7 +60,7 @@ 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[0x10] = {0}; EWRAM_DATA struct PaletteFadeControl gPaletteFade = {0}; -static EWRAM_DATA u32 gFiller_2037FE0 = 0; +static EWRAM_DATA u32 sFiller = 0; static EWRAM_DATA u32 sPlttBufferTransferPending = 0; EWRAM_DATA u8 gPaletteDecompressionBuffer[PLTT_DECOMP_BUFFER_SIZE] = {0}; @@ -624,7 +624,7 @@ static u8 UpdateFastPaletteFade(void) if (b < b0) b = b0; - gPlttBufferFaded[i] = r | (g << 5) | (b << 10); + gPlttBufferFaded[i] = RGB(r, g, b); } break; case FAST_FADE_OUT_TO_WHITE: @@ -642,7 +642,7 @@ static u8 UpdateFastPaletteFade(void) if (b > 31) b = 31; - gPlttBufferFaded[i] = r | (g << 5) | (b << 10); + gPlttBufferFaded[i] = RGB(r, g, b); } break; case FAST_FADE_IN_FROM_BLACK: @@ -668,7 +668,7 @@ static u8 UpdateFastPaletteFade(void) if (b > b0) b = b0; - gPlttBufferFaded[i] = r | (g << 5) | (b << 10); + gPlttBufferFaded[i] = RGB(r, g, b); } break; case FAST_FADE_OUT_TO_BLACK: @@ -686,7 +686,7 @@ static u8 UpdateFastPaletteFade(void) if (b < 0) b = 0; - gPlttBufferFaded[i] = r | (g << 5) | (b << 10); + gPlttBufferFaded[i] = RGB(r, g, b); } } @@ -856,13 +856,13 @@ void TintPalette_GrayScale(u16 *palette, u16 count) for (i = 0; i < count; i++) { - r = (*palette >> 0) & 0x1F; - g = (*palette >> 5) & 0x1F; - b = (*palette >> 10) & 0x1F; + r = GET_R(*palette); + g = GET_G(*palette); + b = GET_B(*palette); gray = (r * Q_8_8(0.3) + g * Q_8_8(0.59) + b * Q_8_8(0.1133)) >> 8; - *palette++ = (gray << 10) | (gray << 5) | (gray << 0); + *palette++ = RGB2(gray, gray, gray); } } @@ -873,18 +873,18 @@ void TintPalette_GrayScale2(u16 *palette, u16 count) for (i = 0; i < count; i++) { - r = (*palette >> 0) & 0x1F; - g = (*palette >> 5) & 0x1F; - b = (*palette >> 10) & 0x1F; + r = GET_R(*palette); + g = GET_G(*palette); + b = GET_B(*palette); gray = (r * Q_8_8(0.3) + g * Q_8_8(0.59) + b * Q_8_8(0.1133)) >> 8; - if (gray > 0x1F) - gray = 0x1F; + if (gray > 31) + gray = 31; gray = sRoundedDownGrayscaleMap[gray]; - *palette++ = (gray << 10) | (gray << 5) | (gray << 0); + *palette++ = RGB2(gray, gray, gray); } } @@ -895,9 +895,9 @@ void TintPalette_SepiaTone(u16 *palette, u16 count) for (i = 0; i < count; i++) { - r = (*palette >> 0) & 0x1F; - g = (*palette >> 5) & 0x1F; - b = (*palette >> 10) & 0x1F; + r = GET_R(*palette); + g = GET_G(*palette); + b = GET_B(*palette); gray = (r * Q_8_8(0.3) + g * Q_8_8(0.59) + b * Q_8_8(0.1133)) >> 8; @@ -908,7 +908,7 @@ void TintPalette_SepiaTone(u16 *palette, u16 count) if (r > 31) r = 31; - *palette++ = (b << 10) | (g << 5) | (r << 0); + *palette++ = RGB2(r, g, b); } } @@ -919,9 +919,9 @@ void TintPalette_CustomTone(u16 *palette, u16 count, u16 rTone, u16 gTone, u16 b for (i = 0; i < count; i++) { - r = (*palette >> 0) & 0x1F; - g = (*palette >> 5) & 0x1F; - b = (*palette >> 10) & 0x1F; + r = GET_R(*palette); + g = GET_G(*palette); + b = GET_B(*palette); gray = (r * Q_8_8(0.3) + g * Q_8_8(0.59) + b * Q_8_8(0.1133)) >> 8; @@ -936,7 +936,7 @@ void TintPalette_CustomTone(u16 *palette, u16 count, u16 rTone, u16 gTone, u16 b if (b > 31) b = 31; - *palette++ = (b << 10) | (g << 5) | (r << 0); + *palette++ = RGB2(r, g, b); } } diff --git a/src/party_menu.c b/src/party_menu.c index 8aca27f47..256558985 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -151,7 +151,7 @@ static EWRAM_DATA u16 *sSlot1TilemapBuffer = 0; // for switching party slots static EWRAM_DATA u16 *sSlot2TilemapBuffer = 0; // EWRAM_DATA u8 gSelectedOrderFromParty[MAX_FRONTIER_PARTY_SIZE] = {0}; static EWRAM_DATA u16 sPartyMenuItemId = 0; -static EWRAM_DATA u16 sUnused_0203CEFE = 0; +static EWRAM_DATA u16 sUnused = 0; EWRAM_DATA u8 gBattlePartyCurrentOrder[PARTY_SIZE / 2] = {0}; // bits 0-3 are the current pos of Slot 1, 4-7 are Slot 2, and so on // IWRAM common diff --git a/src/player_pc.c b/src/player_pc.c index 928aac706..1f293a195 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -443,7 +443,7 @@ static void InitItemStorageMenu(u8 taskId, u8 var) windowTemplate.width = GetMaxWidthInMenuTable(gPCText_ItemPCOptionsText, 4); data[4] = AddWindow(&windowTemplate); SetStandardWindowBorderStyle(data[4], 0); - PrintMenuTable(data[4], 4, gPCText_ItemPCOptionsText); + PrintMenuTable(data[4], ARRAY_COUNT(gPCText_ItemPCOptionsText), gPCText_ItemPCOptionsText); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[4], 4, var); ScheduleBgCopyTilemapToVram(0); ItemStorageMenuPrint(gPCText_OptionDescList[var]); @@ -686,7 +686,7 @@ static void Mailbox_ReturnToPlayerPC(u8 taskId) static void Mailbox_PrintMailOptions(u8 taskId) { u8 r4 = sub_81D1C84(2); - PrintMenuTable(r4, 4, gMailboxMailOptions); + PrintMenuTable(r4, ARRAY_COUNT(gMailboxMailOptions), gMailboxMailOptions); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(r4, 4, 0); ScheduleBgCopyTilemapToVram(0); gTasks[taskId].func = Mailbox_MailOptionsProcessInput; @@ -1058,7 +1058,6 @@ static void ItemStorage_ProcessWithdrawTossInput(u8 taskId) s16 *data; bool32 toss; u32 i, x; - u8 windowId; const u8* text; data = gTasks[taskId].data; diff --git a/src/pokeblock_feed.c b/src/pokeblock_feed.c index 32db6c717..a930523ce 100644 --- a/src/pokeblock_feed.c +++ b/src/pokeblock_feed.c @@ -61,7 +61,6 @@ static void HandleInitWindows(void); static void LaunchPokeblockFeedTask(void); static void SetPokeblockSpritePal(u8 pokeblockCaseId); static void sub_817A5CC(void); -static void sub_8148108(u8 spriteId, bool8 a1); static void DoPokeblockCaseThrowEffect(u8 spriteId, bool8 arg1); static void PrepareMonToMoveToPokeblock(u8 spriteId); static void Task_HandleMonAtePokeblock(u8 taskId); diff --git a/src/pokedex.c b/src/pokedex.c index 6aa347994..c0236020e 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1373,7 +1373,7 @@ static const struct SearchOptionText sDexSearchColorOptions[] = {}, }; -static const struct SearchOptionText sDexSearchTypeOptions[] = +static const struct SearchOptionText sDexSearchTypeOptions[NUMBER_OF_MON_TYPES + 1] = // + 2 for "None" and terminator, - 1 for Mystery { {gText_DexEmptyString, gText_DexSearchTypeNone}, {gText_DexEmptyString, gTypeNames[TYPE_NORMAL]}, @@ -1407,7 +1407,7 @@ static const u8 sOrderOptions[] = ORDER_SMALLEST, }; -static const u8 sDexSearchTypeIds[] = +static const u8 sDexSearchTypeIds[NUMBER_OF_MON_TYPES] = { TYPE_NONE, TYPE_NORMAL, @@ -1587,9 +1587,6 @@ static void ResetPokedexView(struct PokedexView *pokedexView) void CB2_OpenPokedex(void) { - u8 *addr; - u32 size; - switch (gMain.state) { case 0: diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c index 7a3b38dc2..b63b00290 100755 --- a/src/pokedex_area_screen.c +++ b/src/pokedex_area_screen.c @@ -489,7 +489,6 @@ static bool8 MonListHasMon(const struct WildPokemonInfo *info, u16 species, u16 static void BuildAreaGlowTilemap(void) { u16 i, y, x, j; - u16 val; for (i = 0; i < ARRAY_COUNT(sPokedexAreaScreen->areaGlowTilemap); i++) sPokedexAreaScreen->areaGlowTilemap[i] = 0; diff --git a/src/pokemon.c b/src/pokemon.c index 5829bbd0a..3a2e88aae 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2304,14 +2304,14 @@ void CreateMonWithGenderNatureLetter(struct Pokemon *mon, u16 species, u8 level, { u32 personality; - if ((u8)(unownLetter - 1) < 28) + if ((u8)(unownLetter - 1) < NUM_UNOWN_FORMS) { u16 actualLetter; do { personality = Random32(); - actualLetter = ((((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 0x3)) % 28); + actualLetter = GET_UNOWN_LETTER(personality); } while (nature != GetNatureFromPersonality(personality) || gender != GetGenderFromSpeciesAndPersonality(species, personality) @@ -4658,7 +4658,6 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov u32 var_28 = 0; u16 heldItem; u8 r10; - u32 r4; u32 r5; s8 r2; u16 evCount; diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index b85a29151..065b8e22e 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -1099,7 +1099,7 @@ u16 GetUnownLetterByPersonality(u32 personality) if (!personality) return 0; else - return (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 0x3)) % 0x1C; + return GET_UNOWN_LETTER(personality); } u16 sub_80D2E84(u16 species) diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 4be1cf729..50fc04372 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -8389,7 +8389,7 @@ static u8 sub_80D0894(void) static void sub_80D08CC(void) { - s32 i, j, r8, r9; + s32 i, j; s32 rowCount, columnCount; u8 boxId; u8 monArrayId; diff --git a/src/pokenav_conditions_3.c b/src/pokenav_conditions_3.c index d02d844d0..2a1dda1fa 100644 --- a/src/pokenav_conditions_3.c +++ b/src/pokenav_conditions_3.c @@ -419,7 +419,7 @@ static u32 LoopedTask_OpenConditionSearchResults(s32 state) switch (state) { case 0: - InitBgTemplates(sConditionSearchResultBgTemplates, NELEMS(sConditionSearchResultBgTemplates)); + InitBgTemplates(sConditionSearchResultBgTemplates, ARRAY_COUNT(sConditionSearchResultBgTemplates)); DecompressAndCopyTileDataToVram(1, sConditionSearchResultTiles, 0, 0, 0); SetBgTilemapBuffer(1, searchList->buff); CopyToBgTilemapBuffer(1, sConditionSearchResultTilemap, 0, 0); diff --git a/src/pokenav_main_menu.c b/src/pokenav_main_menu.c index 009cf783f..21bddf1cd 100644 --- a/src/pokenav_main_menu.c +++ b/src/pokenav_main_menu.c @@ -496,7 +496,7 @@ void PokenavCopyPalette(const u16 *src, const u16 *dest, int size, int a3, int a g1 = ((((GET_G(*dest) << 8) - (g << 8)) / a3) * a4) >> 8; b1 = ((((GET_B(*dest) << 8) - (b << 8)) / a3) * a4) >> 8; - r = (r + r1) & 0x1F; //_RGB(r + r1, g + g1, b + b1); doesn't match; I have to assign the value of ((r + r1) & 0x1F) to r1 + r = (r + r1) & 0x1F; //_RGB(r + r1, g + g1, b + b1); doesn't match; I have to assign the value of ((r + r1) & 0x1F) to r g = (g + g1) & 0x1F; //See above b = (b + b1) & 0x1F; //See above diff --git a/src/pokenav_menu_handler_2.c b/src/pokenav_menu_handler_2.c index 3fcd41dc9..eea8131a9 100644 --- a/src/pokenav_menu_handler_2.c +++ b/src/pokenav_menu_handler_2.c @@ -750,7 +750,7 @@ static void LoadPokenavOptionPalettes(void) { s32 i; - for (i = 0; i < NELEMS(sPokenavOptionsSpriteSheets); i++) + for (i = 0; i < ARRAY_COUNT(sPokenavOptionsSpriteSheets); i++) LoadCompressedSpriteSheet(&sPokenavOptionsSpriteSheets[i]); Pokenav_AllocAndLoadPalettes(sPokenavOptionsSpritePalettes); } diff --git a/src/pokenav_ribbons_1.c b/src/pokenav_ribbons_1.c index 9c171dd45..397e1e749 100644 --- a/src/pokenav_ribbons_1.c +++ b/src/pokenav_ribbons_1.c @@ -427,7 +427,7 @@ static u32 LoopedTask_OpenRibbonsMonList(s32 state) switch (state) { case 0: - InitBgTemplates(sMonRibbonListBgTemplates, NELEMS(sMonRibbonListBgTemplates)); + InitBgTemplates(sMonRibbonListBgTemplates, ARRAY_COUNT(sMonRibbonListBgTemplates)); DecompressAndCopyTileDataToVram(1, sMonRibbonListFrameTiles, 0, 0, 0); SetBgTilemapBuffer(1, monMenu->buff); CopyToBgTilemapBuffer(1, sMonRibbonListFrameTilemap, 0, 0); diff --git a/src/record_mixing.c b/src/record_mixing.c index 898459c0a..2028cc647 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -94,7 +94,6 @@ static void *sApprenticesSave; static void *sBattleTowerSave_Duplicate; static u32 sRecordStructSize; static u8 gUnknown_03001160; -static u32 filler_03001164; static struct PlayerHallRecords *gUnknown_03001168[3]; static EWRAM_DATA struct RecordMixingDayCareMail gUnknown_02039F9C = {0}; diff --git a/src/region_map.c b/src/region_map.c index c2a5b4e9c..22b925a6f 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -1677,7 +1677,7 @@ void CB2_OpenFlyMap(void) break; case 1: ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(1, sFlyMapBgTemplates, 3); + InitBgsFromTemplates(1, sFlyMapBgTemplates, ARRAY_COUNT(sFlyMapBgTemplates)); gMain.state++; break; case 2: diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c index 9bf0e7ed4..50ceeb74e 100644 --- a/src/save_failed_screen.c +++ b/src/save_failed_screen.c @@ -62,7 +62,7 @@ static const struct OamData sClockOamData = .affineParam = 0 }; -static const struct BgTemplate gUnknown_085EFD88[3] = +static const struct BgTemplate sBgTemplates[3] = { { .bg = 0, @@ -212,7 +212,7 @@ static void CB2_SaveFailedScreen(void) LZ77UnCompVram(gBirchGrassTilemap, (void *)(BG_SCREEN_ADDR(15))); LZ77UnCompVram(sSaveFailedClockGfx, (void *)(VRAM + 0x10020)); ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, gUnknown_085EFD88, 3); + InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates)); SetBgTilemapBuffer(0, (void *)&gDecompressionBuffer[0x2000]); CpuFill32(0, &gDecompressionBuffer[0x2000], 0x800); LoadBgTiles(0, gTextWindowFrame1_Gfx, 0x120, 0x214); diff --git a/src/script.c b/src/script.c index 9ba1a7429..e6557aa75 100644 --- a/src/script.c +++ b/src/script.c @@ -11,9 +11,7 @@ extern const u8* gUnknown_020375C0; // ewram bss static u8 sScriptContext1Status; -static u32 sUnusedVariable1; static struct ScriptContext sScriptContext1; -static u32 sUnusedVariable2; static struct ScriptContext sScriptContext2; static bool8 sScriptContext2Enabled; diff --git a/src/secret_base.c b/src/secret_base.c index 8e0929593..d49eef277 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -996,7 +996,7 @@ static void ShowRegistryMenuActions(u8 taskId) template.width = GetMaxWidthInMenuTable(sRegistryMenuActions, 2); data[7] = AddWindow(&template); SetStandardWindowBorderStyle(data[7], 0); - PrintMenuTable(data[7], 2, sRegistryMenuActions); + PrintMenuTable(data[7], ARRAY_COUNT(sRegistryMenuActions), sRegistryMenuActions); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[7], 2, 0); ScheduleBgCopyTilemapToVram(0); gTasks[taskId].func = HandleRegistryMenuActionsInput; diff --git a/src/shop.c b/src/shop.c index 44ab0885c..a447982fc 100755 --- a/src/shop.c +++ b/src/shop.c @@ -489,7 +489,6 @@ static void BuyMenuFreeMemory(void) static void BuyMenuBuildListMenuTemplate(void) { u16 i; - u16 itemCount; gUnknown_02039F74 = Alloc((gMartInfo.itemCount + 1) * sizeof(*gUnknown_02039F74)); gUnknown_02039F78 = Alloc((gMartInfo.itemCount + 1) * sizeof(*gUnknown_02039F78)); diff --git a/src/starter_choose.c b/src/starter_choose.c index 771db961e..f7ffcfc2c 100644 --- a/src/starter_choose.c +++ b/src/starter_choose.c @@ -378,7 +378,6 @@ static void VblankCB_StarterChoose(void) void CB2_ChooseStarter(void) { - u16 savedIme; u8 taskId; u8 spriteId; @@ -2085,7 +2085,6 @@ static void sub_80EDE98(TVShow *show) u16 k; u8 n; u8 deco; - u8 x; for (i = 0; i < DECOR_MAX_SECRET_BASE; i ++) { @@ -2307,7 +2306,7 @@ void TryPutLotteryWinnerReportOnAir(void) } } -void sub_80EE35C(u16 foeSpecies, u16 species, u8 moveIdx, const u16 *movePtr, u16 betterMove) +void TryPutBattleSeminarOnAir(u16 foeSpecies, u16 species, u8 moveIdx, const u16 *movePtr, u16 betterMove) { TVShow *show; u8 i; @@ -4095,7 +4094,6 @@ static void sub_80F0E58(PokeNews *dest[16], PokeNews *src[16]) static bool8 sub_80F0E84(PokeNews *dest, PokeNews *src, s8 slot) { u8 i; - u8 kind; if (src->kind == POKENEWS_NONE) { @@ -6602,7 +6600,6 @@ static void DoTVShowSpotTheCuties(void) { TVShow *show; u8 state; - u32 playerId; show = &gSaveBlock1Ptr->tvShows[gSpecialVar_0x8004]; gSpecialVar_Result = FALSE; @@ -6707,7 +6704,6 @@ static void DoTVShowPokemonNewsBattleFrontier(void) { TVShow *show; u8 state; - u32 playerId; show = &gSaveBlock1Ptr->tvShows[gSpecialVar_0x8004]; gSpecialVar_Result = FALSE; @@ -6856,7 +6852,6 @@ static void DoTVShowWhatsNo1InHoennToday(void) { TVShow *show; u8 state; - u32 playerId; show = &gSaveBlock1Ptr->tvShows[gSpecialVar_0x8004]; gSpecialVar_Result = FALSE; |