diff --git a/src/dexnav.c b/src/dexnav.c index 9008650431..e821ac8542 100644 --- a/src/dexnav.c +++ b/src/dexnav.c @@ -141,7 +141,7 @@ static u8 DexNavGetAbilityNum(u16 species, u8 searchLevel); static u8 DexNavGeneratePotential(u8 searchLevel); static u8 DexNavTryGenerateMonLevel(u16 species, u8 environment); static u8 GetEncounterLevelFromMapData(u16 species, u8 environment); -static void CreateDexNavWildMon(u16 species, u8 potential, u8 level, u8 abilityNum, u16* moves); +static void CreateDexNavWildMon(u16 species, u8 potential, u8 level, u8 abilityNum, u16 item, u16* moves); static u8 GetPlayerDistance(s16 x, s16 y); static u8 DexNavPickTile(u8 environment, u8 xSize, u8 ySize, bool8 smallScan); static void DexNavProximityUpdate(void); @@ -490,19 +490,19 @@ static void AddSearchWindowText(u16 species, u8 proximity, u8 searchLevel, bool8 if (hidden) { StringCopy(gStringVar4, sText_ThreeQmarks); - AddTextPrinterParameterized3(sDexNavSearchDataPtr->windowId, 0, WINDOW_COL_0, 0, sSearchFontColor, TEXT_SPEED_FF, gStringVar4); + AddTextPrinterParameterized3(sDexNavSearchDataPtr->windowId, 0, WINDOW_COL_0, 0, sSearchFontColor, TEXT_SKIP_DRAW, gStringVar4); return; } else { StringCopy(gStringVar1, gSpeciesNames[species]); - AddTextPrinterParameterized3(sDexNavSearchDataPtr->windowId, 0, WINDOW_COL_0, 0, sSearchFontColor, TEXT_SPEED_FF, gStringVar1); + AddTextPrinterParameterized3(sDexNavSearchDataPtr->windowId, 0, WINDOW_COL_0, 0, sSearchFontColor, TEXT_SKIP_DRAW, gStringVar1); } //level - always present ConvertIntToDecimalStringN(gStringVar1, sDexNavSearchDataPtr->monLevel, STR_CONV_MODE_LEFT_ALIGN, 3); StringExpandPlaceholders(gStringVar4, sText_MonLevel); - AddTextPrinterParameterized3(sDexNavSearchDataPtr->windowId, 0, WINDOW_COL_1, 0, sSearchFontColor, TEXT_SPEED_FF, gStringVar4); + AddTextPrinterParameterized3(sDexNavSearchDataPtr->windowId, 0, WINDOW_COL_1, 0, sSearchFontColor, TEXT_SKIP_DRAW, gStringVar4); if (proximity <= SNEAKING_PROXIMITY) { @@ -512,21 +512,21 @@ static void AddSearchWindowText(u16 species, u8 proximity, u8 searchLevel, bool8 { StringCopy(gStringVar1, gMoveNames[sDexNavSearchDataPtr->moves[0]]); StringExpandPlaceholders(gStringVar4, sText_EggMove); - AddTextPrinterParameterized3(windowId, 0, WINDOW_MOVE_NAME_X, 0, sSearchFontColor, TEXT_SPEED_FF, gStringVar4); + AddTextPrinterParameterized3(windowId, 0, WINDOW_MOVE_NAME_X, 0, sSearchFontColor, TEXT_SKIP_DRAW, gStringVar4); } if (searchLevel > 2) { // ability name StringCopy(gStringVar1, gAbilityNames[GetAbilityBySpecies(species, sDexNavSearchDataPtr->abilityNum)]); - AddTextPrinterParameterized3(windowId, 0, WINDOW_COL_1 + 16, 12, sSearchFontColor, TEXT_SPEED_FF, gStringVar1); + AddTextPrinterParameterized3(windowId, 0, WINDOW_COL_1 + 16, 12, sSearchFontColor, TEXT_SKIP_DRAW, gStringVar1); // item name if (sDexNavSearchDataPtr->heldItem) { CopyItemName(sDexNavSearchDataPtr->heldItem, gStringVar1); StringExpandPlaceholders(gStringVar4, sText_HeldItem); - AddTextPrinterParameterized3(windowId, 0, WINDOW_COL_0, 12, sSearchFontColor, TEXT_SPEED_FF, gStringVar4); + AddTextPrinterParameterized3(windowId, 0, WINDOW_COL_0, 12, sSearchFontColor, TEXT_SKIP_DRAW, gStringVar4); } } } @@ -537,7 +537,7 @@ static void AddSearchWindowText(u16 species, u8 proximity, u8 searchLevel, bool8 StringExpandPlaceholders(gStringVar4, sText_DexNavChainLong); else StringExpandPlaceholders(gStringVar4, sText_DexNavChain); - AddTextPrinterParameterized3(windowId, 0, SEARCH_ARROW_X - 16, 12, sSearchFontColor, TEXT_SPEED_FF, gStringVar4); + AddTextPrinterParameterized3(windowId, 0, SEARCH_ARROW_X - 16, 12, sSearchFontColor, TEXT_SKIP_DRAW, gStringVar4); CopyWindowToVram(sDexNavSearchDataPtr->windowId, 2); } @@ -937,7 +937,7 @@ static void DexNavUpdateDirectionArrow(void) str = sText_ArrowDown; //player above } - AddTextPrinterParameterized3(windowId, 1, SEARCH_ARROW_X, SEARCH_ARROW_Y, sSearchFontColor, TEXT_SPEED_FF, str); + AddTextPrinterParameterized3(windowId, 1, SEARCH_ARROW_X, SEARCH_ARROW_Y, sSearchFontColor, TEXT_SKIP_DRAW, str); CopyWindowToVram(windowId, 2); } @@ -1100,7 +1100,7 @@ static void Task_DexNavSearch(u8 taskId) if (sDexNavSearchDataPtr->proximity < 1) { CreateDexNavWildMon(sDexNavSearchDataPtr->species, sDexNavSearchDataPtr->potential, sDexNavSearchDataPtr->monLevel, - sDexNavSearchDataPtr->abilityNum, sDexNavSearchDataPtr->moves); + sDexNavSearchDataPtr->abilityNum, sDexNavSearchDataPtr->heldItem, sDexNavSearchDataPtr->moves); FlagClear(FLAG_SYS_DEXNAV_SEARCH); gDexnavBattle = TRUE; @@ -1209,7 +1209,7 @@ static void DexNavUpdateSearchWindow(u8 proximity, u8 searchLevel) ////////////////////////////// //// DEXNAV MON GENERATOR //// ////////////////////////////// -static void CreateDexNavWildMon(u16 species, u8 potential, u8 level, u8 abilityNum, u16* moves) +static void CreateDexNavWildMon(u16 species, u8 potential, u8 level, u8 abilityNum, u16 item, u16* moves) { struct Pokemon* mon = &gEnemyParty[0]; u8 iv[3]; @@ -1237,6 +1237,10 @@ static void CreateDexNavWildMon(u16 species, u8 potential, u8 level, u8 abilityN //Set ability SetMonData(mon, MON_DATA_ABILITY_NUM, &abilityNum); + + // Set Held Item + if (item) + SetMonData(mon, MON_DATA_HELD_ITEM, &item); //Set moves for (i = 0; i < MAX_MON_MOVES; i++) @@ -2205,13 +2209,13 @@ static void PrintSearchableSpecies(u16 species) PutWindowTilemap(WINDOW_REGISTERED); if (species == SPECIES_NONE) { - AddTextPrinterParameterized3(WINDOW_REGISTERED, 1, 0, 0, sFontColor_White, TEXT_SPEED_FF, sText_DexNav_PressRToRegister); + AddTextPrinterParameterized3(WINDOW_REGISTERED, 1, 0, 0, sFontColor_White, TEXT_SKIP_DRAW, sText_DexNav_PressRToRegister); } else { StringCopy(gStringVar1, gSpeciesNames[species]); StringExpandPlaceholders(gStringVar4, sText_DexNav_SearchForRegisteredSpecies); - AddTextPrinterParameterized3(WINDOW_REGISTERED, 1, 0, 0, sFontColor_White, TEXT_SPEED_FF, gStringVar4); + AddTextPrinterParameterized3(WINDOW_REGISTERED, 1, 0, 0, sFontColor_White, TEXT_SKIP_DRAW, gStringVar4); } PrintMapName(); @@ -2645,11 +2649,11 @@ static void DrawSearchIcon(void) static void DrawHiddenSearchWindow(u8 width) { AddSearchWindow(width); - AddTextPrinterParameterized3(sDexNavSearchDataPtr->windowId, 0, SPECIES_ICON_X + 4, 0, sSearchFontColor, TEXT_SPEED_FF, sText_ThreeQmarks); + AddTextPrinterParameterized3(sDexNavSearchDataPtr->windowId, 0, SPECIES_ICON_X + 4, 0, sSearchFontColor, TEXT_SKIP_DRAW, sText_ThreeQmarks); ConvertIntToDecimalStringN(gStringVar1, sDexNavSearchDataPtr->searchLevel, STR_CONV_MODE_LEFT_ALIGN, 2); StringExpandPlaceholders(gStringVar4, sText_SearchLevel); - AddTextPrinterParameterized3(sDexNavSearchDataPtr->windowId, 0, SPECIES_ICON_X + 4, 12, sSearchFontColor, TEXT_SPEED_FF, gStringVar4); + AddTextPrinterParameterized3(sDexNavSearchDataPtr->windowId, 0, SPECIES_ICON_X + 4, 12, sSearchFontColor, TEXT_SKIP_DRAW, gStringVar4); CopyWindowToVram(sDexNavSearchDataPtr->windowId, 2); } diff --git a/src/pokemon.c b/src/pokemon.c index b5d9ea8759..c2f47190cd 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6565,7 +6565,8 @@ static s32 GetWildMonTableIdInAlteringCave(u16 species) void SetWildMonHeldItem(void) { - if (!(gBattleTypeFlags & (BATTLE_TYPE_LEGENDARY | BATTLE_TYPE_TRAINER | BATTLE_TYPE_PYRAMID | BATTLE_TYPE_PIKE))) + if (!(gBattleTypeFlags & (BATTLE_TYPE_LEGENDARY | BATTLE_TYPE_TRAINER | BATTLE_TYPE_PYRAMID | BATTLE_TYPE_PIKE)) + && !gDexnavBattle) { u16 rnd = Random() % 100; u16 species = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, 0);