diff --git a/data/scripts/debug.inc b/data/scripts/debug.inc index 7165ef921..095f1fb07 100644 --- a/data/scripts/debug.inc +++ b/data/scripts/debug.inc @@ -374,7 +374,29 @@ Debug_EventScript_SetHiddenNature:: dynmultistack 0, 0, TRUE, 7, FALSE, 0, NULL switch VAR_RESULT case MULTI_B_PRESSED, Debug_EventScript_InflictStatus1_Close - special SetHiddenNature + special SetHiddenNature + releaseall + end + +Debug_EventScript_SetAbility:: + special ChoosePartyMon + waitstate + callnative DebugNative_GetAbilityNames + dynmultipush gStringVar1, 0 + dynmultipush gStringVar2, 1 + dynmultipush gStringVar3, 2 + dynmultistack 0, 0, FALSE, 3 FALSE, 0, NULL + switch VAR_RESULT + case MULTI_B_PRESSED, Debug_EventScript_SetAbilityClose + special SetAbility +Debug_EventScript_SetAbilityClose: + releaseall + end + +Debug_EventScript_SetFriendship:: + special ChoosePartyMon + waitstate + callnative DebugNative_Party_SetFriendship releaseall end diff --git a/data/specials.inc b/data/specials.inc index 3f2e7c9ad..18698c9df 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -465,4 +465,5 @@ gSpecials:: def_special TrySkyBattle def_special TryPrepareSecondApproachingTrainer def_special SetHiddenNature + def_special SetAbility gSpecialsEnd:: diff --git a/include/field_fadetransition.h b/include/field_fadetransition.h index 7bfdbb6e8..08ae805c1 100644 --- a/include/field_fadetransition.h +++ b/include/field_fadetransition.h @@ -4,13 +4,6 @@ #include "global.h" void FieldCB_RushInjuredPokemonToCenter(void); -void DoWarp(void); -void DoDiveWarp(void); -void DoDoorWarp(void); - -void DoFallWarp(void); -void DoTeleportWarp(void); -void DoTeleport2Warp(void); void FieldCB_DefaultWarpExit(void); void WarpFadeOutScreen(void); void FieldCB_ContinueScriptHandleMusic(void); @@ -22,12 +15,6 @@ void FieldCB_ContinueScriptUnionRoom(void); bool32 FieldFadeTransitionBackgroundEffectIsFinished(void); void palette_bg_faded_fill_black(void); -void DoStairWarp(u16 metatileBehavior, u16 delay); -void DoEscalatorWarp(u8 a0); -void DoLavaridgeGymB1FWarp(void); -void DoLavaridgeGym1FWarp(void); -void DoTeleportWarp(void); -void DoUnionRoomWarp(void); void FieldCB_ReturnToFieldWirelessLink(void); void FieldCB_ReturnToFieldCableLink(void); bool8 FieldCB_ReturnToFieldOpenStartMenu(void); diff --git a/include/field_screen_effect.h b/include/field_screen_effect.h index e6736298a..cf0c84b1a 100644 --- a/include/field_screen_effect.h +++ b/include/field_screen_effect.h @@ -9,6 +9,18 @@ void DoOutwardBarnDoorWipe(void); void Task_BarnDoorWipe(u8 taskId); void FieldCB_RushInjuredPokemonToCenter(void); void WriteFlashScanlineEffectBuffer(u8 flashLevel); +void DoWarp(void); +void DoDiveWarp(void); +void DoDoorWarp(void); +void DoFallWarp(void); +void DoTeleportWarp(void); +void DoTeleport2Warp(void); +void DoStairWarp(u16 metatileBehavior, u16 delay); +void DoEscalatorWarp(u8 a0); +void DoLavaridgeGymB1FWarp(void); +void DoLavaridgeGym1FWarp(void); +void DoTeleportWarp(void); +void DoUnionRoomWarp(void); extern const s32 gMaxFlashLevel; diff --git a/include/item.h b/include/item.h index 085459b32..eab33b67e 100644 --- a/include/item.h +++ b/include/item.h @@ -245,14 +245,14 @@ void RemovePCItem(u16 itemId, u16 quantity); void CompactItemsInBagPocket(enum Pocket pocketId); void SortBerriesOrTMHMs(enum Pocket pocketId); u8 CountItemsInPC(void); -bool8 HasAtLeastOneBerry(void); -bool8 HasAtLeastOnePokeBall(void); +bool32 HasAtLeastOneBerry(void); +bool32 HasAtLeastOnePokeBall(void); -bool8 IsItemTM(u16 itemId); -bool8 IsItemHM(u16 itemId); -bool8 IsItemTMHM(u16 itemId); +bool32 IsItemTM(u16 itemId); +bool32 IsItemHM(u16 itemId); +bool32 IsItemTMHM(u16 itemId); -bool8 IsItemBall(u16 itemId); +bool32 IsItemBall(u16 itemId); const u8 *GetItemEffect(u32 itemId); u32 GetItemStatus1Mask(u16 itemId); diff --git a/include/pokeball.h b/include/pokeball.h index b78f87180..ff56a622e 100644 --- a/include/pokeball.h +++ b/include/pokeball.h @@ -45,6 +45,7 @@ enum { extern const struct CompressedSpriteSheet gBallSpriteSheets[POKEBALL_COUNT]; extern const struct SpritePalette gBallSpritePalettes[POKEBALL_COUNT]; extern const struct SpriteTemplate gBallSpriteTemplates[]; +extern const u16 gBallItemIds[]; #define POKEBALL_PLAYER_SENDOUT 0xFF #define POKEBALL_OPPONENT_SENDOUT 0xFE diff --git a/include/strings.h b/include/strings.h index e9d21475a..1a8e704f7 100644 --- a/include/strings.h +++ b/include/strings.h @@ -226,6 +226,7 @@ extern const u8 gText_LinkStandby[]; extern const u8 gText_BattleMenu[]; extern const u8 gText_WhatWillPkmnDo[]; extern const u8 gText_NewLine[]; +extern const u8 gText_Space2[]; // battle_controller_pokedude extern const u8 Pokedude_Text_SpeedierBattlerGoesFirst[]; diff --git a/src/debug.c b/src/debug.c index cd3934fae..cb29f71d9 100644 --- a/src/debug.c +++ b/src/debug.c @@ -22,14 +22,15 @@ #include "event_data.h" #include "event_object_movement.h" #include "event_scripts.h" -#include "field_fadetransition.h" #include "field_message_box.h" -// #include "field_screen_effect.h" +#include "field_screen_effect.h" +#include "field_specials.h" #include "field_weather.h" #include "follower_npc.h" #include "international_string_util.h" #include "item.h" #include "item_icon.h" +#include "item_use.h" #include "list_menu.h" #include "m4a.h" #include "main.h" @@ -56,6 +57,7 @@ #include "strings.h" #include "string_util.h" #include "task.h" +// #include "tv.h" #include "pokemon_summary_screen.h" #include "wild_encounter.h" #include "constants/abilities.h" @@ -237,6 +239,8 @@ static void Debug_DestroyMenu(u8 taskId); static void DebugAction_Cancel(u8 taskId); static void DebugAction_DestroyExtraWindow(u8 taskId); static void Debug_RefreshListMenu(u8 taskId); +static u8 DebugNativeStep_CreateDebugWindow(void); +static void DebugNativeStep_CloseDebugWindow(u8 taskId); static void DebugAction_OpenSubMenu(u8 taskId, const struct DebugMenuOption *items); static void DebugAction_OpenSubMenuFlagsVars(u8 taskId, const struct DebugMenuOption *items); @@ -349,6 +353,8 @@ extern const u8 Debug_EventScript_CheckEVs[]; extern const u8 Debug_EventScript_CheckIVs[]; extern const u8 Debug_EventScript_InflictStatus1[]; extern const u8 Debug_EventScript_SetHiddenNature[]; +extern const u8 Debug_EventScript_SetAbility[]; +extern const u8 Debug_EventScript_SetFriendship[]; extern const u8 Debug_EventScript_Script_1[]; extern const u8 Debug_EventScript_Script_2[]; extern const u8 Debug_EventScript_Script_3[]; @@ -572,11 +578,13 @@ static const struct DebugMenuOption sDebugMenu_Actions_PCBag[] = static const struct DebugMenuOption sDebugMenu_Actions_Party[] = { - { COMPOUND_STRING("Move Reminder"), DebugAction_ExecuteScript, TwoIsland_House_EventScript_ChooseMonToTutor }, + { COMPOUND_STRING("Move Relearner"), DebugAction_ExecuteScript, TwoIsland_House_EventScript_ChooseMonToTutor }, { COMPOUND_STRING("Hatch an Egg"), DebugAction_ExecuteScript, Debug_HatchAnEgg }, { COMPOUND_STRING("Heal party"), DebugAction_Party_HealParty }, { COMPOUND_STRING("Inflict Status1"), DebugAction_ExecuteScript, Debug_EventScript_InflictStatus1 }, { COMPOUND_STRING("Set Hidden Nature"), DebugAction_ExecuteScript, Debug_EventScript_SetHiddenNature }, + { COMPOUND_STRING("Set Friendship"), DebugAction_ExecuteScript, Debug_EventScript_SetFriendship }, + { COMPOUND_STRING("Set Ability"), DebugAction_ExecuteScript, Debug_EventScript_SetAbility }, { COMPOUND_STRING("Check EVs"), DebugAction_ExecuteScript, Debug_EventScript_CheckEVs }, { COMPOUND_STRING("Check IVs"), DebugAction_ExecuteScript, Debug_EventScript_CheckIVs }, { COMPOUND_STRING("Clear Party"), DebugAction_Party_ClearParty }, @@ -657,7 +665,7 @@ static const struct DebugMenuOption sDebugMenu_Actions_Flags[] = { NULL } }; -static const u8 *sDebugMenu_Actions_BagUse_Options[] = +static const u8 *const sDebugMenu_Actions_BagUse_Options[] = { COMPOUND_STRING("No Bag: {STR_VAR_1}Inactive"), COMPOUND_STRING("No Bag: {STR_VAR_1}VS Trainers"), @@ -940,6 +948,30 @@ static void DebugAction_DestroyExtraWindow(u8 taskId) UnfreezeObjectEvents(); } +static u8 DebugNativeStep_CreateDebugWindow(void) +{ + u8 windowId; + + LockPlayerFieldControls(); + FreezeObjectEvents(); + HideMapNamePopUpWindow(); + LoadMessageBoxAndBorderGfx(); + windowId = AddWindow(&sDebugMenuWindowTemplateExtra); + DrawStdWindowFrame(windowId, FALSE); + CopyWindowToVram(windowId, COPYWIN_FULL); + + return windowId; +} + +static void DebugNativeStep_CloseDebugWindow(u8 taskId) +{ + ClearStdWindowAndFrame(gTasks[taskId].tSubWindowId, TRUE); + RemoveWindow(gTasks[taskId].tSubWindowId); + DestroyTask(taskId); + UnfreezeObjectEvents(); + UnlockPlayerFieldControls(); +} + static const u16 sLocationFlags[] = { FLAG_WORLD_MAP_PALLET_TOWN, @@ -966,7 +998,7 @@ static const u16 sLocationFlags[] = static u8 Debug_CheckToggleFlags(u8 id) { - u8 result = FALSE; + bool32 result = FALSE; switch (id) { @@ -2048,6 +2080,17 @@ static void Debug_Display_ItemInfo(u32 itemId, u32 digit, u8 windowId) { StringCopy(gStringVar2, gText_DigitIndicator[digit]); u8* end = CopyItemName(itemId, gStringVar1); + u16 moveId = ItemIdToBattleMoveId(itemId); + if (moveId != MOVE_NONE) + { + end = StringCopy(end, gText_Space2); + end = StringCopy(end, GetMoveName(moveId)); + } + else if (CheckIfItemIsTMHMOrEvolutionStone(itemId) == 1) + { + end = StringCopy(end, COMPOUND_STRING(" None")); + } + WrapFontIdToFit(gStringVar1, end, DEBUG_MENU_FONT, WindowWidthPx(windowId)); StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15); ConvertIntToDecimalStringN(gStringVar3, itemId, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS); @@ -2585,11 +2628,11 @@ static void DebugAction_Give_Pokemon_SelectDynamaxLevel(u8 taskId) } } -static void Debug_Display_StatInfo(const u8* text, u32 stat, u32 value, u32 digit, u8 windowId) +static void Debug_Display_StatInfo(const u8* text, u32 stat, u32 value, u32 digit, u8 windowId, u32 maxValue) { StringCopy(gStringVar1, gStatNamesTable[stat]); StringCopy(gStringVar2, gText_DigitIndicator[digit]); - ConvertIntToDecimalStringN(gStringVar3, value, STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar3, value, STR_CONV_MODE_LEADING_ZEROS, CountDigits(maxValue)); StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15); StringExpandPlaceholders(gStringVar4, text); AddTextPrinterParameterized(windowId, DEBUG_MENU_FONT, gStringVar4, 0, 0, 0, NULL); @@ -2609,7 +2652,7 @@ static void DebugAction_Give_Pokemon_SelectGigantamaxFactor(u8 taskId) sDebugMonData->gmaxFactor = gTasks[taskId].tInput; gTasks[taskId].tInput = 0; gTasks[taskId].tDigit = 0; - Debug_Display_StatInfo(sDebugText_IVs, gTasks[taskId].tIterator, gTasks[taskId].tInput, gTasks[taskId].tDigit, gTasks[taskId].tSubWindowId); + Debug_Display_StatInfo(sDebugText_IVs, gTasks[taskId].tIterator, gTasks[taskId].tInput, gTasks[taskId].tDigit, gTasks[taskId].tSubWindowId, MAX_PER_STAT_IVS); gTasks[taskId].func = DebugAction_Give_Pokemon_SelectIVs; } else if (JOY_NEW(B_BUTTON)) @@ -2626,7 +2669,7 @@ static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId) { PlaySE(SE_SELECT); Debug_HandleInput_Numeric(taskId, 0, MAX_PER_STAT_IVS, 3); - Debug_Display_StatInfo(sDebugText_IVs, gTasks[taskId].tIterator, gTasks[taskId].tInput, gTasks[taskId].tDigit, gTasks[taskId].tSubWindowId); + Debug_Display_StatInfo(sDebugText_IVs, gTasks[taskId].tIterator, gTasks[taskId].tInput, gTasks[taskId].tDigit, gTasks[taskId].tSubWindowId, MAX_PER_STAT_IVS); } //If A or B button @@ -2642,7 +2685,7 @@ static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId) gTasks[taskId].tInput = 0; gTasks[taskId].tDigit = 0; - Debug_Display_StatInfo(sDebugText_IVs, gTasks[taskId].tIterator, gTasks[taskId].tInput, gTasks[taskId].tDigit, gTasks[taskId].tSubWindowId); + Debug_Display_StatInfo(sDebugText_IVs, gTasks[taskId].tIterator, gTasks[taskId].tInput, gTasks[taskId].tDigit, gTasks[taskId].tSubWindowId, MAX_PER_STAT_IVS); gTasks[taskId].func = DebugAction_Give_Pokemon_SelectIVs; } else @@ -2651,7 +2694,7 @@ static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId) gTasks[taskId].tDigit = 0; gTasks[taskId].tIterator = 0; - Debug_Display_StatInfo(sDebugText_EVs, gTasks[taskId].tIterator, gTasks[taskId].tInput, gTasks[taskId].tDigit, gTasks[taskId].tSubWindowId); + Debug_Display_StatInfo(sDebugText_EVs, gTasks[taskId].tIterator, gTasks[taskId].tInput, gTasks[taskId].tDigit, gTasks[taskId].tSubWindowId, MAX_PER_STAT_EVS); gTasks[taskId].func = DebugAction_Give_Pokemon_SelectEVs; } } @@ -2699,7 +2742,7 @@ static void DebugAction_Give_Pokemon_SelectEVs(u8 taskId) { PlaySE(SE_SELECT); Debug_HandleInput_Numeric(taskId, 0, MAX_PER_STAT_EVS, 4); - Debug_Display_StatInfo(sDebugText_EVs, gTasks[taskId].tIterator, gTasks[taskId].tInput, gTasks[taskId].tDigit, gTasks[taskId].tSubWindowId); + Debug_Display_StatInfo(sDebugText_EVs, gTasks[taskId].tIterator, gTasks[taskId].tInput, gTasks[taskId].tDigit, gTasks[taskId].tSubWindowId, MAX_PER_STAT_EVS); } //If A or B button @@ -2714,7 +2757,7 @@ static void DebugAction_Give_Pokemon_SelectEVs(u8 taskId) gTasks[taskId].tIterator++; gTasks[taskId].tInput = 0; gTasks[taskId].tDigit = 0; - Debug_Display_StatInfo(sDebugText_EVs, gTasks[taskId].tIterator, gTasks[taskId].tInput, gTasks[taskId].tDigit, gTasks[taskId].tSubWindowId); + Debug_Display_StatInfo(sDebugText_EVs, gTasks[taskId].tIterator, gTasks[taskId].tInput, gTasks[taskId].tDigit, gTasks[taskId].tSubWindowId, MAX_PER_STAT_EVS); gTasks[taskId].func = DebugAction_Give_Pokemon_SelectEVs; } else @@ -2731,7 +2774,7 @@ static void DebugAction_Give_Pokemon_SelectEVs(u8 taskId) } PlaySE(SE_FAILURE); - Debug_Display_StatInfo(sDebugText_EVs, gTasks[taskId].tIterator, gTasks[taskId].tInput, gTasks[taskId].tDigit, gTasks[taskId].tSubWindowId); + Debug_Display_StatInfo(sDebugText_EVs, gTasks[taskId].tIterator, gTasks[taskId].tInput, gTasks[taskId].tDigit, gTasks[taskId].tSubWindowId, MAX_PER_STAT_EVS); gTasks[taskId].func = DebugAction_Give_Pokemon_SelectEVs; } else @@ -2862,6 +2905,10 @@ static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://githu //Moves for (i = 0; i < MAX_MON_MOVES; i++) { + // Non-default moveset chosen. Reset moves before setting the chosen moves. + if (moves[0] != MOVE_NONE) + SetMonMoveSlot(&mon, MOVE_NONE, i); + if (moves[i] == MOVE_NONE || moves[i] >= MOVES_COUNT) continue; @@ -2939,7 +2986,7 @@ static void UNUSED Debug_Display_DecorationInfo(u32 itemId, u32 digit, u8 window // AddTextPrinterParameterized(windowId, DEBUG_MENU_FONT, gStringVar4, 0, 0, 0, NULL); } -static void DebugAction_Give_Decoration(u8 taskId) +static void UNUSED DebugAction_Give_Decoration(u8 taskId) { // u8 windowId; @@ -3009,6 +3056,9 @@ static void DebugAction_Give_MaxMoney(u8 taskId) static void DebugAction_Give_MaxCoins(u8 taskId) { SetCoins(MAX_COINS); + + if (!CheckBagHasItem(ITEM_COIN_CASE, 1)) + AddBagItem(ITEM_COIN_CASE, 1); } static void DebugAction_Give_MaxBattlePoints(u8 taskId) @@ -3160,12 +3210,10 @@ static void DebugAction_PCBag_Fill_PocketItems(u8 taskId) static void DebugAction_PCBag_Fill_PocketPokeBalls(u8 taskId) { - u16 ballId; - - for (ballId = BALL_STRANGE; ballId < POKEBALL_COUNT; ballId++) + for (enum PokeBall ballId = BALL_STRANGE; ballId < POKEBALL_COUNT; ballId++) { if (CheckBagHasSpace(ballId, MAX_BAG_ITEM_CAPACITY)) - AddBagItem(ballId, MAX_BAG_ITEM_CAPACITY); + AddBagItem(gBallItemIds[ballId], MAX_BAG_ITEM_CAPACITY); } } @@ -3393,11 +3441,6 @@ static void DebugAction_DestroyFollowerNPC(u8 taskId) #undef tCurrentSong -#undef tMenuTaskId -#undef tWindowId -#undef tSubWindowId -#undef tInput -#undef tDigit #define SOUND_LIST_BGM \ X(MUS_HEAL) \ @@ -3889,6 +3932,81 @@ static void DebugAction_Party_HealParty(u8 taskId) Debug_DestroyMenu_Full(taskId); } +void DebugNative_GetAbilityNames(void) +{ + u32 species = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES); + StringCopy(gStringVar1, gAbilitiesInfo[GetAbilityBySpecies(species, 0)].name); + StringCopy(gStringVar2, gAbilitiesInfo[GetAbilityBySpecies(species, 1)].name); + StringCopy(gStringVar3, gAbilitiesInfo[GetAbilityBySpecies(species, 2)].name); +} + +#define tPartyId data[5] +#define tFriendship data[6] + +static void Debug_Display_FriendshipInfo(s32 oldFriendship, s32 newFriendship, u32 digit, u8 windowId) +{ + ConvertIntToDecimalStringN(gStringVar1, oldFriendship, STR_CONV_MODE_LEADING_ZEROS, 3); + ConvertIntToDecimalStringN(gStringVar2, newFriendship, STR_CONV_MODE_LEADING_ZEROS, 3); + StringCopy(gStringVar3, gText_DigitIndicator[digit]); + StringExpandPlaceholders(gStringVar4, COMPOUND_STRING("Friendship:\n{STR_VAR_1} {RIGHT_ARROW} {STR_VAR_2}\n\n{STR_VAR_3}")); + AddTextPrinterParameterized(windowId, DEBUG_MENU_FONT, gStringVar4, 0, 0, 0, NULL); +} + +static void DebugNativeStep_Party_SetFriendshipSelect(u8 taskId) +{ + if (JOY_NEW(A_BUTTON)) + { + PlaySE(SE_SELECT); + gTasks[taskId].tFriendship = gTasks[taskId].tInput; + SetMonData(&gPlayerParty[gTasks[taskId].tPartyId], MON_DATA_FRIENDSHIP, &gTasks[taskId].tInput); + } + else if (JOY_NEW(B_BUTTON)) + { + PlaySE(SE_SELECT); + DebugNativeStep_CloseDebugWindow(taskId); + return; + } + + Debug_HandleInput_Numeric(taskId, 0, 255, 3); + + if (JOY_NEW(DPAD_ANY) || JOY_NEW(A_BUTTON)) + Debug_Display_FriendshipInfo(gTasks[taskId].tFriendship, gTasks[taskId].tInput, gTasks[taskId].tDigit, gTasks[taskId].tSubWindowId); +} + +static void DebugNativeStep_Party_SetFriendshipMain(u8 taskId) +{ + u8 windowId = DebugNativeStep_CreateDebugWindow(); + u32 friendship = GetMonData(&gPlayerParty[gTasks[taskId].tPartyId], MON_DATA_FRIENDSHIP); + + // Display initial flag + Debug_Display_FriendshipInfo(friendship, friendship, 0, windowId); + + gTasks[taskId].func = DebugNativeStep_Party_SetFriendshipSelect; + gTasks[taskId].tSubWindowId = windowId; + gTasks[taskId].tFriendship = friendship; + gTasks[taskId].tInput = friendship; + gTasks[taskId].tDigit = 0; + gTasks[taskId].tPartyId = 0; +} + +void DebugNative_Party_SetFriendship(void) +{ + if (gSpecialVar_0x8004 < PARTY_SIZE) + { + u32 taskId = CreateTask(DebugNativeStep_Party_SetFriendshipMain, 1); + gTasks[taskId].tPartyId = gSpecialVar_0x8004; + } +} + +#undef tPartyId +#undef tFriendship + +#undef tMenuTaskId +#undef tWindowId +#undef tSubWindowId +#undef tInput +#undef tDigit + static void DebugAction_Party_ClearParty(u8 taskId) { ZeroPlayerPartyMons(); diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index ac3c2c9bb..f8c636d75 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -10,7 +10,7 @@ #include "event_scripts.h" #include "fieldmap.h" #include "field_control_avatar.h" -#include "field_fadetransition.h" +#include "field_screen_effect.h" #include "field_player_avatar.h" #include "field_poison.h" #include "field_specials.h" diff --git a/src/field_specials.c b/src/field_specials.c index b2dcf7bcc..c3fb7cbcb 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -2150,6 +2150,12 @@ void SetHiddenNature(void) CalculateMonStats(&gPlayerParty[gSpecialVar_0x8004]); } +void SetAbility(void) +{ + u32 ability = gSpecialVar_Result; + SetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_ABILITY_NUM, &ability); +} + void DaisyMassageServices(void) { AdjustFriendship(&gPlayerParty[gSpecialVar_0x8004], FRIENDSHIP_EVENT_MASSAGE); diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index adbabe2a0..97e82a26e 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -16,7 +16,7 @@ #include "overworld.h" #include "trainer_pokemon_sprites.h" #include "text_window.h" -#include "field_fadetransition.h" +#include "field_screen_effect.h" #include "menu.h" #include "string_util.h" #include "trig.h" diff --git a/src/item.c b/src/item.c index a5710932f..a86d6c521 100644 --- a/src/item.c +++ b/src/item.c @@ -267,7 +267,7 @@ bool8 CheckBagHasItem(u16 itemId, u16 count) return FALSE; } -bool8 HasAtLeastOneBerry(void) +bool32 HasAtLeastOneBerry(void) { u16 itemId; bool8 exists; @@ -292,13 +292,11 @@ bool8 HasAtLeastOneBerry(void) return FALSE; } -bool8 HasAtLeastOnePokeBall(void) +bool32 HasAtLeastOnePokeBall(void) { - u16 ballId; - - for (ballId = BALL_STRANGE; ballId < POKEBALL_COUNT; ballId++) + for (enum PokeBall ballId = BALL_STRANGE; ballId < POKEBALL_COUNT; ballId++) { - if (CheckBagHasItem(ballId, 1) == TRUE) + if (CheckBagHasItem(gBallItemIds[ballId], 1) == TRUE) return TRUE; } return FALSE; @@ -920,24 +918,24 @@ bool32 IsHoldEffectChoice(enum HoldEffect holdEffect) || holdEffect == HOLD_EFFECT_CHOICE_SPECS; } -bool8 IsItemTM(u16 itemId) +bool32 IsItemTM(u16 itemId) { itemId = SanitizeItemId(itemId); return ITEM_TM01 <= itemId && itemId <= ITEM_TM100; } -bool8 IsItemHM(u16 itemId) +bool32 IsItemHM(u16 itemId) { itemId = SanitizeItemId(itemId); return ITEM_HM01 <= itemId && itemId <= ITEM_HM08; } -bool8 IsItemTMHM(u16 itemId) +bool32 IsItemTMHM(u16 itemId) { return IsItemTM(itemId) || IsItemHM(itemId); } -bool8 IsItemBall(u16 itemId) +bool32 IsItemBall(u16 itemId) { return GetPocketByItemId(itemId) == POCKET_POKE_BALLS; } diff --git a/src/pokeball.c b/src/pokeball.c index 068ebd4b2..114ad88ad 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -538,6 +538,38 @@ const struct SpriteTemplate gBallSpriteTemplates[POKEBALL_COUNT] = }, }; +const u16 gBallItemIds[POKEBALL_COUNT] = +{ + [BALL_STRANGE] = ITEM_STRANGE_BALL, + [BALL_POKE] = ITEM_POKE_BALL, + [BALL_GREAT] = ITEM_GREAT_BALL, + [BALL_ULTRA] = ITEM_ULTRA_BALL, + [BALL_MASTER] = ITEM_MASTER_BALL, + [BALL_PREMIER] = ITEM_PREMIER_BALL, + [BALL_HEAL] = ITEM_HEAL_BALL, + [BALL_NET] = ITEM_NET_BALL, + [BALL_NEST] = ITEM_NEST_BALL, + [BALL_DIVE] = ITEM_DIVE_BALL, + [BALL_DUSK] = ITEM_DUSK_BALL, + [BALL_TIMER] = ITEM_TIMER_BALL, + [BALL_QUICK] = ITEM_QUICK_BALL, + [BALL_REPEAT] = ITEM_REPEAT_BALL, + [BALL_LUXURY] = ITEM_LUXURY_BALL, + [BALL_LEVEL] = ITEM_LEVEL_BALL, + [BALL_LURE] = ITEM_LURE_BALL, + [BALL_MOON] = ITEM_MOON_BALL, + [BALL_FRIEND] = ITEM_FRIEND_BALL, + [BALL_LOVE] = ITEM_LOVE_BALL, + [BALL_FAST] = ITEM_FAST_BALL, + [BALL_HEAVY] = ITEM_HEAVY_BALL, + [BALL_DREAM] = ITEM_DREAM_BALL, + [BALL_SAFARI] = ITEM_SAFARI_BALL, + [BALL_SPORT] = ITEM_SPORT_BALL, + [BALL_PARK] = ITEM_PARK_BALL, + [BALL_BEAST] = ITEM_BEAST_BALL, + [BALL_CHERISH] = ITEM_CHERISH_BALL, +}; + #define tFrames data[0] #define tPan data[1] #define tThrowId data[2] diff --git a/src/script_pokemon_util.c b/src/script_pokemon_util.c index 1c0f9c9b7..7a7ba0e02 100644 --- a/src/script_pokemon_util.c +++ b/src/script_pokemon_util.c @@ -300,7 +300,7 @@ u32 ScriptGiveMon(u16 species, u8 level, u16 item) MAX_PER_STAT_IVS + 1, MAX_PER_STAT_IVS + 1, MAX_PER_STAT_IVS + 1}; // ScriptGiveMonParameterized won't touch the stats' IV. u16 moves[MAX_MON_MOVES] = {MOVE_NONE, MOVE_NONE, MOVE_NONE, MOVE_NONE}; - return ScriptGiveMonParameterized(0, PARTY_SIZE, species, level, item, ITEM_POKE_BALL, NUM_NATURES, NUM_ABILITY_PERSONALITY, MON_GENDERLESS, evs, ivs, moves, FALSE, FALSE, NUMBER_OF_MON_TYPES, 0); + return ScriptGiveMonParameterized(0, PARTY_SIZE, species, level, item, ITEM_POKE_BALL, NUM_NATURES, NUM_ABILITY_PERSONALITY, MON_GENDERLESS, evs, ivs, moves, SHINY_MODE_RANDOM, FALSE, NUMBER_OF_MON_TYPES, 0); } #define PARSE_FLAG(n, default_) (flags & (1 << (n))) ? VarGet(ScriptReadHalfword(ctx)) : (default_)