mirror of
https://github.com/pret/pokefirered.git
synced 2026-05-19 11:36:51 -05:00
adjust tmhm functions to new system
This commit is contained in:
parent
c6442ee353
commit
843da75781
10
src/item.c
10
src/item.c
|
|
@ -920,19 +920,19 @@ bool32 IsHoldEffectChoice(enum HoldEffect holdEffect)
|
|||
|
||||
bool32 IsItemTM(u16 itemId)
|
||||
{
|
||||
itemId = SanitizeItemId(itemId);
|
||||
return ITEM_TM01 <= itemId && itemId <= ITEM_TM100;
|
||||
enum TMHMIndex index = GetItemTMHMIndex(SanitizeItemId(itemId));
|
||||
return index > 0 && index <= NUM_TECHNICAL_MACHINES;
|
||||
}
|
||||
|
||||
bool32 IsItemHM(u16 itemId)
|
||||
{
|
||||
itemId = SanitizeItemId(itemId);
|
||||
return ITEM_HM01 <= itemId && itemId <= ITEM_HM08;
|
||||
return GetItemTMHMIndex(SanitizeItemId(itemId)) > NUM_TECHNICAL_MACHINES;
|
||||
}
|
||||
|
||||
bool32 IsItemTMHM(u16 itemId)
|
||||
{
|
||||
return IsItemTM(itemId) || IsItemHM(itemId);
|
||||
enum TMHMIndex index = GetItemTMHMIndex(SanitizeItemId(itemId));
|
||||
return index > 0 && index <= NUM_ALL_MACHINES;
|
||||
}
|
||||
|
||||
bool32 IsItemBall(u16 itemId)
|
||||
|
|
|
|||
|
|
@ -110,10 +110,10 @@ const void *GetItemIconPic(u16 itemId)
|
|||
return gItemIcon_ReturnToFieldArrow; // Use last icon, the "return to field" arrow
|
||||
if (itemId >= ITEMS_COUNT)
|
||||
return gItemsInfo[0].iconPic;
|
||||
if (itemId >= ITEM_TM01 && itemId < ITEM_HM01 + NUM_HIDDEN_MACHINES)
|
||||
if (gItemsInfo[itemId].pocket == POCKET_TM_HM)
|
||||
{
|
||||
if (itemId < ITEM_TM01 + NUM_TECHNICAL_MACHINES)
|
||||
return gItemIcon_TM;
|
||||
if (GetItemTMHMIndex(itemId) > NUM_TECHNICAL_MACHINES)
|
||||
return gItemIcon_HM;
|
||||
return gItemIcon_HM;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1016,7 +1016,7 @@ static bool8 DisplayPartyPokemonDataForMoveTutorOrEvolutionItem(u8 slot)
|
|||
|
||||
if (gPartyMenu.action == PARTY_ACTION_MOVE_TUTOR)
|
||||
{
|
||||
gSpecialVar_Result = FALSE;
|
||||
gSpecialVar_Result = FALSE;
|
||||
DisplayPartyPokemonDataToTeachMove(slot, gSpecialVar_0x8005);
|
||||
}
|
||||
else
|
||||
|
|
@ -2763,7 +2763,7 @@ static u8 DisplaySelectionWindow(u8 windowType)
|
|||
text = gMovesInfo[gFieldMovesInfo[sPartyMenuInternal->actions[i] - CURSOR_OPTION_FIELD_MOVES].moveId].name;
|
||||
else
|
||||
text = sCursorOptions[sPartyMenuInternal->actions[i]].text;
|
||||
|
||||
|
||||
AddTextPrinterParameterized4(sPartyMenuInternal->windowId[0], FONT_NORMAL, cursorDimension, (i * 16) + 2, fontAttribute, 0, sFontColorTable[fontColorsId], 0, text);
|
||||
}
|
||||
InitMenuInUpperLeftCorner(sPartyMenuInternal->windowId[0], sPartyMenuInternal->numActions, 0, TRUE);
|
||||
|
|
@ -3701,7 +3701,7 @@ static void Task_HandleSwitchItemsYesNoInput(u8 taskId)
|
|||
{
|
||||
case 0: // Yes, switch items
|
||||
RemoveBagItem(gSpecialVar_ItemId, 1);
|
||||
|
||||
|
||||
// No room to return held item to bag
|
||||
if (AddBagItem(sPartyMenuItemId, 1) == FALSE)
|
||||
{
|
||||
|
|
@ -3972,7 +3972,7 @@ static void CursorCB_Enter(u8 taskId)
|
|||
u8 maxBattlers;
|
||||
u8 i;
|
||||
const u8 *str;
|
||||
|
||||
|
||||
if (gPartyMenu.chooseMonsBattleType == CHOOSE_MONS_FOR_UNION_ROOM_BATTLE)
|
||||
{
|
||||
maxBattlers = 2;
|
||||
|
|
@ -4270,7 +4270,7 @@ static void FieldCallback_Surf(void)
|
|||
bool32 FieldMove_SetUpSurf(void)
|
||||
{
|
||||
s16 x, y;
|
||||
|
||||
|
||||
GetXYCoordsOneStepInFrontOfPlayer(&x, &y);
|
||||
if (MetatileBehavior_IsFastWater(MapGridGetMetatileBehaviorAt(x, y)) != TRUE
|
||||
&& !TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)
|
||||
|
|
@ -4286,7 +4286,7 @@ bool32 FieldMove_SetUpSurf(void)
|
|||
static void DisplayCantUseSurfMessage(void)
|
||||
{
|
||||
s16 x, y;
|
||||
|
||||
|
||||
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
|
||||
{
|
||||
DisplayPartyMenuStdMessage(PARTY_MSG_ALREADY_SURFING);
|
||||
|
|
@ -4509,7 +4509,7 @@ static void CB2_UseTMHMAfterForgettingMove(void)
|
|||
struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
|
||||
u8 moveIdx = GetMoveSlotToReplace();
|
||||
u16 move = GetMonData(mon, moveIdx + MON_DATA_MOVE1);
|
||||
|
||||
|
||||
RemoveMonPPBonus(mon, moveIdx);
|
||||
SetMonMoveSlot(mon, ItemIdToBattleMoveId(gSpecialVar_ItemId), moveIdx);
|
||||
AdjustFriendship(mon, FRIENDSHIP_EVENT_LEARN_TMHM);
|
||||
|
|
@ -4640,7 +4640,7 @@ void ItemUseCB_ApplyAbilityCapsule(u8 taskId, TaskFunc task)
|
|||
s16 *data = gTasks[taskId].data;
|
||||
switch (tState)
|
||||
{
|
||||
case 0:
|
||||
case 0:
|
||||
tMonId = gPartyMenu.slotId;
|
||||
tSpecies = GetMonData(&gPlayerParty[tMonId], MON_DATA_SPECIES, NULL);
|
||||
tAbilityNum = GetMonData(&gPlayerParty[tMonId], MON_DATA_ABILITY_NUM, NULL) ^ 1;
|
||||
|
|
@ -5329,7 +5329,7 @@ static void TryUseItemOnMove(u8 taskId) {
|
|||
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
|
||||
ScheduleBgCopyTilemapToVram(2);
|
||||
gTasks[taskId].func = Task_ClosePartyMenuAfterText;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Task_DoUseItemAnim(taskId);
|
||||
|
|
@ -5763,7 +5763,7 @@ static void ItemUseCB_RareCandyStep(u8 taskId, TaskFunc func)
|
|||
ConvertIntToDecimalStringN(gStringVar2, sFinalLevel, STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnElevatedToLvVar2);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
ConvertIntToDecimalStringN(gStringVar2, sExpCandyExperienceTable[holdEffectParam - 1], STR_CONV_MODE_LEFT_ALIGN, 6);
|
||||
ConvertIntToDecimalStringN(gStringVar3, sFinalLevel, STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
|
|
@ -5877,7 +5877,7 @@ static void Task_TryLearnNewMoves(u8 taskId)
|
|||
static void Task_TryLearningNextMove(u8 taskId)
|
||||
{
|
||||
u16 result;
|
||||
|
||||
|
||||
for (; sInitialLevel <= sFinalLevel; sInitialLevel++)
|
||||
{
|
||||
SetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_LEVEL, &sInitialLevel);
|
||||
|
|
@ -6416,7 +6416,7 @@ static void RemoveItemToGiveFromBag(u16 item)
|
|||
// but there always should be, and the return is ignored in all uses
|
||||
static bool8 ReturnGiveItemToBagOrPC(u16 item)
|
||||
{
|
||||
if (gPartyMenu.action == PARTY_ACTION_GIVE_ITEM)
|
||||
if (gPartyMenu.action == PARTY_ACTION_GIVE_ITEM)
|
||||
return AddBagItem(item, 1);
|
||||
else
|
||||
return AddPCItem(item, 1);
|
||||
|
|
@ -6506,7 +6506,7 @@ static u8 CheckBattleEntriesAndGetMessage(void)
|
|||
u8 i, j;
|
||||
struct Pokemon *party = gPlayerParty;
|
||||
u8 *order = gSelectedOrderFromParty;
|
||||
|
||||
|
||||
switch (gPartyMenu.chooseMonsBattleType)
|
||||
{
|
||||
case CHOOSE_MONS_FOR_BATTLE_TOWER:
|
||||
|
|
@ -7865,7 +7865,7 @@ static void ShiftMoveSlot(struct Pokemon *mon, u8 slotTo, u8 slotFrom)
|
|||
u32 Party_FirstMonWithMove(u16 moveId)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE)
|
||||
|
|
|
|||
|
|
@ -670,20 +670,20 @@ static void InitTMCaseListMenuItems(void)
|
|||
gMultiuseListMenuTemplate.scrollMultiple = 0;
|
||||
}
|
||||
|
||||
static void GetTMNumberAndMoveString(u8 * dest, u16 itemId)
|
||||
static void GetTMNumberAndMoveString(u8 *dest, u16 itemId)
|
||||
{
|
||||
StringCopy(gStringVar4, gText_FontSmall);
|
||||
if (IsItemHM(itemId))
|
||||
{
|
||||
StringAppend(gStringVar4, sText_ClearTo18);
|
||||
StringAppend(gStringVar4, gText_NumberClear01);
|
||||
ConvertIntToDecimalStringN(gStringVar1, itemId - ITEM_HM01 + 1, STR_CONV_MODE_LEADING_ZEROS, 1);
|
||||
ConvertIntToDecimalStringN(gStringVar1, GetItemTMHMIndex(itemId) - NUM_TECHNICAL_MACHINES, STR_CONV_MODE_LEADING_ZEROS, NUM_HIDDEN_MACHINES >= 10 ? 2 : 1);
|
||||
StringAppend(gStringVar4, gStringVar1);
|
||||
}
|
||||
else
|
||||
{
|
||||
StringAppend(gStringVar4, gText_NumberClear01);
|
||||
ConvertIntToDecimalStringN(gStringVar1, itemId - ITEM_TM01 + 1, STR_CONV_MODE_LEADING_ZEROS, 2);
|
||||
ConvertIntToDecimalStringN(gStringVar1, GetItemTMHMIndex(itemId), STR_CONV_MODE_LEADING_ZEROS, NUM_TECHNICAL_MACHINES >= 100 ? 3 : 2);
|
||||
StringAppend(gStringVar4, gStringVar1);
|
||||
}
|
||||
StringAppend(gStringVar4, sText_SingleSpace);
|
||||
|
|
@ -945,7 +945,7 @@ static void ReturnToList(u8 taskId)
|
|||
static void Task_SelectedTMHM_Field(u8 taskId)
|
||||
{
|
||||
u8 * strbuf;
|
||||
|
||||
|
||||
// Create context window
|
||||
TMCase_SetWindowBorder2(WIN_SELECTED_MSG);
|
||||
if (!MenuHelpers_IsLinkActive() && InUnionRoom() != TRUE)
|
||||
|
|
@ -975,7 +975,7 @@ static void Task_SelectedTMHM_Field(u8 taskId)
|
|||
sTMCaseDynamicResources->menuActionIndices);
|
||||
|
||||
InitMenuNormal(sTMCaseDynamicResources->contextMenuWindowId, FONT_NORMAL, 0, 2, GetFontAttribute(FONT_NORMAL, FONTATTR_MAX_LETTER_HEIGHT) + 2, sTMCaseDynamicResources->numMenuActions, 0);
|
||||
|
||||
|
||||
// Print label text next to the context window
|
||||
strbuf = Alloc(256);
|
||||
GetTMNumberAndMoveString(strbuf, gSpecialVar_ItemId);
|
||||
|
|
@ -1180,7 +1180,7 @@ static void Task_SelectedTMHM_Sell(u8 taskId)
|
|||
|
||||
if (tQuantity > MAX_BAG_ITEM_CAPACITY)
|
||||
tQuantity = MAX_BAG_ITEM_CAPACITY;
|
||||
|
||||
|
||||
if (tQuantity > maxQuantity)
|
||||
tQuantity = maxQuantity;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user