Move union room data, more trade doc

This commit is contained in:
GriffinR
2019-10-04 17:24:03 -04:00
parent 2b0c944286
commit 6b556900f8
11 changed files with 1134 additions and 1117 deletions
+2
View File
@@ -346,6 +346,7 @@ static void sub_80B2918(u8 taskId)
HideFieldMessageBox();
gTasks[taskId].func = sub_80B2CB0;
}
// EXCHANGE_STAT_4 or EXCHANGE_STAT_5 in sub_80B2478
else if (gSpecialVar_Result == 7 || gSpecialVar_Result == 9)
{
CloseLink();
@@ -393,6 +394,7 @@ static void sub_80B2A08(u8 taskId)
HideFieldMessageBox();
gTasks[taskId].func = sub_80B2CB0;
}
// EXCHANGE_STAT_4 or EXCHANGE_STAT_5 in sub_80B2478
else if (gSpecialVar_Result == 7 || gSpecialVar_Result == 9)
{
CloseLink();
+1 -1
View File
@@ -353,7 +353,7 @@ static const struct MenuAction sSelectTradeMonActions[] =
[MENU_ACTION_TRADE] = {sText_Trade2, sub_807A024}
};
static const u8 *const sTradeMessageTexts[] =
static const u8 *const sTradeMessages[] =
{
[TRADE_MSG_STANDBY] = sText_CommunicationStandby,
[TRADE_MSG_CANCELED] = sText_TheTradeHasBeenCanceled,
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -2165,9 +2165,9 @@ void sub_800DD94(struct UnkLinkRfuStruct_02022B14 *data, u8 r9, bool32 r2, s32 r
data->unk_00.unk_00_4 = 0;
data->unk_00.unk_00_5 = 0;
data->unk_00.unk_00_6 = 0;
data->unk_00.unk_00_7 = FlagGet(FLAG_IS_CHAMPION);
data->unk_00.unk_01_0 = IsNationalPokedexEnabled();
data->unk_00.unk_01_1 = FlagGet(FLAG_SYS_GAME_CLEAR);
data->unk_00.isChampion = FlagGet(FLAG_IS_CHAMPION);
data->unk_00.hasNationalDex = IsNationalPokedexEnabled();
data->unk_00.gameClear = FlagGet(FLAG_SYS_GAME_CLEAR);
}
bool8 sub_800DE7C(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx)
@@ -4259,7 +4259,7 @@ void sub_8010FCC(u32 a0, u32 a1, u32 a2)
{
gUnknown_02022B14.type = a0;
gUnknown_02022B14.species = a1;
gUnknown_02022B14.unk_0b_1 = a2;
gUnknown_02022B14.level = a2;
}
u8 sub_801100C(s32 a0)
@@ -4979,7 +4979,7 @@ bool32 sub_801200C(s16 a1, struct UnkLinkRfuStruct_02022B14 *structPtr)
return TRUE;
}
else if (structPtr->species != structPtr2->species
|| structPtr->unk_0b_1 != structPtr2->unk_0b_1
|| structPtr->level != structPtr2->level
|| structPtr->type != structPtr2->type)
{
return TRUE;
+13 -13
View File
@@ -1196,17 +1196,17 @@ struct
[FIELD_MOVE_SWEET_SCENT] = {SetUpFieldMove_SweetScent, 0x0d},
};
static const u8 *const gUnknown_08615E0C[] =
static const u8 *const sUnionRoomTradeMessages[] =
{
gText_NotPkmnOtherTrainerWants,
gText_ThatIsntAnEgg,
gText_PkmnCantBeTradedNow,
gText_PkmnCantBeTradedNow,
gText_OtherTrainersPkmnCantBeTraded,
gText_EggCantBeTradedNow,
gText_OtherTrainerCantAcceptPkmn,
gText_CantTradeWithTrainer,
gText_CantTradeWithTrainer,
[UR_TRADE_MSG_NOT_MON_PARTNER_WANTS - 1] = gText_NotPkmnOtherTrainerWants,
[UR_TRADE_MSG_NOT_EGG - 1] = gText_ThatIsntAnEgg,
[UR_TRADE_MSG_MON_CANT_BE_TRADED_1 - 1] = gText_PkmnCantBeTradedNow,
[UR_TRADE_MSG_MON_CANT_BE_TRADED_2 - 1] = gText_PkmnCantBeTradedNow,
[UR_TRADE_MSG_PARTNERS_MON_CANT_BE_TRADED - 1] = gText_OtherTrainersPkmnCantBeTraded,
[UR_TRADE_MSG_EGG_CANT_BE_TRADED -1] = gText_EggCantBeTradedNow,
[UR_TRADE_MSG_PARTNER_CANT_ACCEPT_MON - 1] = gText_OtherTrainerCantAcceptPkmn,
[UR_TRADE_MSG_CANT_TRADE_WITH_PARTNER_1 - 1] = gText_CantTradeWithTrainer,
[UR_TRADE_MSG_CANT_TRADE_WITH_PARTNER_2 - 1] = gText_CantTradeWithTrainer,
};
static const u32 sHeldItemGfx[] = INCBIN_U32("graphics/interface/hold_icons.4bpp");
@@ -4661,11 +4661,11 @@ static void CursorCb_Trade1(u8 taskId)
u16 species2 = GetMonData(&gPlayerParty[gUnknown_0203CEC8.slotId], MON_DATA_SPECIES2);
u16 species = GetMonData(&gPlayerParty[gUnknown_0203CEC8.slotId], MON_DATA_SPECIES);
u8 obedience = GetMonData(&gPlayerParty[gUnknown_0203CEC8.slotId], MON_DATA_OBEDIENCE);
u32 stringId = sub_807A7E0(*(struct UnkLinkRfuStruct_02022B14Substruct *)sub_800F7DC(), gUnknown_02022C38, species2, gUnknown_02022C3C, gUnknown_02022C3E, species, obedience);
u32 stringId = GetUnionRoomTradeMessageId(*(struct UnkLinkRfuStruct_02022B14Substruct *)sub_800F7DC(), gUnknown_02022C38, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, obedience);
if (stringId != 0)
if (stringId != UR_TRADE_MSG_NONE)
{
StringExpandPlaceholders(gStringVar4, gUnknown_08615E0C[stringId - 1]);
StringExpandPlaceholders(gStringVar4, sUnionRoomTradeMessages[stringId - 1]);
PlaySE(SE_HAZURE);
sub_81B302C(&gUnknown_0203CEC4->windowId[0]);
sub_81B302C(&gUnknown_0203CEC4->windowId[1]);
+35 -31
View File
@@ -2193,7 +2193,7 @@ static void sub_807A0C4(void)
static void PrintTradeMessage(u8 messageId)
{
FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized(0, 1, sTradeMessageTexts[messageId], 0, 1, TEXT_SPEED_FF, NULL);
AddTextPrinterParameterized(0, 1, sTradeMessages[messageId], 0, 1, TEXT_SPEED_FF, NULL);
DrawTextBorderOuter(0, 20, 12);
PutWindowTilemap(0);
CopyWindowToVram(0, 3);
@@ -2428,6 +2428,10 @@ static u32 sub_807A5F4(struct Pokemon *playerParty, int partyCount, int monIdx)
}
}
// Return values are used to determine exchange status in GetLinkPlayerDataExchangeStatusTimed
// 0: EXCHANGE_COMPLETE
// 1: EXCHANGE_STAT_4
// 2: EXCHANGE_STAT_5
s32 sub_807A728(void)
{
s32 val;
@@ -2452,7 +2456,7 @@ s32 sub_807A728(void)
{
if (gLinkPlayers[GetMultiplayerId()].name[10] & 0xF0)
{
if (val == 2)
if (val == 2) //unnecessary check, val always 2 here
{
if (gLinkPlayers[GetMultiplayerId() ^ 1].name[10] & 0xF0)
{
@@ -2483,80 +2487,80 @@ static bool32 IsDeoxysOrMewUntradable(u16 species, bool8 isObedientBitSet)
return FALSE;
}
int sub_807A7E0(struct UnkLinkRfuStruct_02022B14Substruct a0, struct UnkLinkRfuStruct_02022B14Substruct a1, u16 species1, u16 species2, u8 type, u16 species3, u8 isObedientBitSet)
int GetUnionRoomTradeMessageId(struct UnkLinkRfuStruct_02022B14Substruct a0, struct UnkLinkRfuStruct_02022B14Substruct a1, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, u8 isObedientBitSet)
{
u8 r9 = a0.unk_01_0;
u8 r2 = a0.unk_00_7;
u8 r10 = a1.unk_01_0;
u8 r0 = a1.unk_00_7;
bool8 playerHasNationalDex = a0.hasNationalDex;
bool8 playerIsChampion = a0.isChampion;
bool8 partnerHasNationalDex = a1.hasNationalDex;
bool8 partnerIsChampion = a1.isChampion;
u8 r1 = a1.unk_01_2;
if (r1 != 3)
{
if (!r2)
if (!playerIsChampion)
{
return 8;
return UR_TRADE_MSG_CANT_TRADE_WITH_PARTNER_1;
}
else if (!r0)
else if (!partnerIsChampion)
{
return 9;
return UR_TRADE_MSG_CANT_TRADE_WITH_PARTNER_2;
}
}
if (IsDeoxysOrMewUntradable(species3, isObedientBitSet))
if (IsDeoxysOrMewUntradable(playerSpecies, isObedientBitSet))
{
return 4;
return UR_TRADE_MSG_MON_CANT_BE_TRADED_2;
}
if (species2 == SPECIES_EGG)
if (partnerSpecies == SPECIES_EGG)
{
if (species1 != species2)
if (playerSpecies2 != partnerSpecies)
{
return 2;
return UR_TRADE_MSG_NOT_EGG;
}
}
else
{
if (gBaseStats[species1].type1 != type && gBaseStats[species1].type2 != type)
if (gBaseStats[playerSpecies2].type1 != requestedType && gBaseStats[playerSpecies2].type2 != requestedType)
{
return 1;
return UR_TRADE_MSG_NOT_MON_PARTNER_WANTS;
}
}
if (species1 == SPECIES_EGG && species1 != species2)
if (playerSpecies2 == SPECIES_EGG && playerSpecies2 != partnerSpecies)
{
return 3;
return UR_TRADE_MSG_MON_CANT_BE_TRADED_1;
}
if (!r9)
if (!playerHasNationalDex)
{
if (species1 == SPECIES_EGG)
if (playerSpecies2 == SPECIES_EGG)
{
return 6;
return UR_TRADE_MSG_EGG_CANT_BE_TRADED;
}
if (!IsSpeciesInHoennDex(species1))
if (!IsSpeciesInHoennDex(playerSpecies2))
{
return 4;
return UR_TRADE_MSG_MON_CANT_BE_TRADED_2;
}
if (!IsSpeciesInHoennDex(species2))
if (!IsSpeciesInHoennDex(partnerSpecies))
{
return 5;
return UR_TRADE_MSG_PARTNERS_MON_CANT_BE_TRADED;
}
}
if (!r10 && !IsSpeciesInHoennDex(species1))
if (!partnerHasNationalDex && !IsSpeciesInHoennDex(playerSpecies2))
{
return 7;
return UR_TRADE_MSG_PARTNER_CANT_ACCEPT_MON;
}
return 0;
return UR_TRADE_MSG_NONE;
}
int sub_807A8D0(struct UnkLinkRfuStruct_02022B14Substruct a0, u16 species2, u16 species, u8 isObedientBitSet)
{
u8 unk = a0.unk_01_0;
u8 unk = a0.hasNationalDex;
if (IsDeoxysOrMewUntradable(species, isObedientBitSet))
{
+18 -1056
View File
File diff suppressed because it is too large Load Diff