Mirror pokeemerald PR#1329 & PR#1335 to pokefirered

The `giftRibbons` field in `SaveBlock1` has been split out into proper subfields. The new ExternalEvent structs deal with interconnectivity between external games/peripherals and FRLG. US & JP Colosseum Bonus Discs', Colosseum and XD's, Pokémon Channel's, and PokémonBox: Ruby & Sapphire's interactions with these fields has been documented.

The `giftRibbon#` fields in `PokemonSubstruct3` have also been renamed to their appropriate ribbons, and commented with distribution info if applicable. The previous `fatefulEncounter` field was actually filler, and relabeled as such, while the `obedient` bit was renamed `eventLegal`. All relevant constants and functions dealing with the Pokémon data structure were renamed with these changes in mind.

I still maintain that `eventLegal` is a misnomer and it should be called `fatefulEncounter` in all three repos.
This commit is contained in:
Deokishisu
2021-02-16 16:56:31 -05:00
parent bc4f88d72c
commit 57e3f5e0f8
20 changed files with 178 additions and 129 deletions
+5 -4
View File
@@ -1394,14 +1394,15 @@
.4byte \value
.endm
@ Makes the Pokemon in the specified slot of the player's party obedient. It will not randomly disobey orders in battle.
.macro setmonobedient slot:req
@ Sets the Pokemon in the specified slot of the player party's eventLegal bit.
.macro setmoneventlegal slot:req
.byte 0xcd
.2byte \slot
.endm
@ Checks if the Pokemon in the specified slot of the player's party is obedient. If the Pokemon is disobedient, VAR_RESULT is TRUE. If the Pokemon is obedient (or if the specified slot is empty or invalid), VAR_RESULT is FALSE.
.macro checkmonobedience slot:req
@ Checks if the Pokemon in the specified slot of the player's party has its eventLegal bit set. If it isn't set,
@ VAR_RESULT is TRUE. If the bit is set (or if the specified slot is empty or invalid), VAR_RESULT is FALSE.
.macro checkmoneventlegal slot:req
.byte 0xce
.2byte \slot
.endm
+1 -1
View File
@@ -87,7 +87,7 @@ BirthIsland_Exterior_EventScript_Deoxys:: @ 81652C0
setvar VAR_0x8004, SPECIES_DEOXYS
setvar VAR_0x8005, 30 @ Level
setvar VAR_0x8006, ITEM_NONE
special CreateObedientEnemyMon
special CreateEventLegalEnemyMon
setflag FLAG_SYS_SPECIAL_WILD_BATTLE
special StartLegendaryBattle
waitstate
+1 -1
View File
@@ -59,7 +59,7 @@ NavelRock_Base_EventScript_Lugia:: @ 8165134
setvar VAR_0x8004, SPECIES_LUGIA
setvar VAR_0x8005, 70 @ Level
setvar VAR_0x8006, ITEM_NONE
special CreateObedientEnemyMon
special CreateEventLegalEnemyMon
setflag FLAG_SYS_SPECIAL_WILD_BATTLE
special StartLegendaryBattle
waitstate
+1 -1
View File
@@ -63,7 +63,7 @@ NavelRock_Summit_EventScript_HoOh:: @ 8164FFB
setvar VAR_0x8004, SPECIES_HO_OH
setvar VAR_0x8005, 70 @ Level
setvar VAR_0x8006, ITEM_NONE
special CreateObedientEnemyMon
special CreateEventLegalEnemyMon
setflag FLAG_SYS_SPECIAL_WILD_BATTLE
special StartLegendaryBattle
waitstate
+1 -1
View File
@@ -68,7 +68,7 @@ SurfPichu_FullParty: @ 8488EEB
SurfPichu_GiveEgg: @ 8488EF6
giveegg SPECIES_PICHU
setmonobedient VAR_EVENT_PICHU_SLOT
setmoneventlegal VAR_EVENT_PICHU_SLOT
setmonmetlocation VAR_EVENT_PICHU_SLOT, 0xff
compare VAR_EVENT_PICHU_SLOT, 1
vgoto_if_eq SurfPichu_Slot1
+2 -2
View File
@@ -206,8 +206,8 @@ gScriptCmdTable:: @ 815F9B4
.4byte ScrCmd_signmsg
.4byte ScrCmd_normalmsg
.4byte ScrCmd_comparestattoword
.4byte ScrCmd_setmonobedient
.4byte ScrCmd_checkmonobedience
.4byte ScrCmd_setmoneventlegal
.4byte ScrCmd_checkmoneventlegal
.4byte ScrCmd_execram
.4byte ScrCmd_setworldmapflag
.4byte ScrCmd_warpteleport2
+1 -1
View File
@@ -451,5 +451,5 @@ gSpecials:: @ 815FD60
def_special InitElevatorFloorSelectMenuPos
def_special UpdateLoreleiDollCollection
def_special LoopWingFlapSound
def_special CreateObedientEnemyMon
def_special CreateEventLegalEnemyMon
gSpecialsEnd::
+9 -9
View File
@@ -74,15 +74,15 @@
#define MON_DATA_VICTORY_RIBBON 69
#define MON_DATA_ARTIST_RIBBON 70
#define MON_DATA_EFFORT_RIBBON 71
#define MON_DATA_GIFT_RIBBON_1 72
#define MON_DATA_GIFT_RIBBON_2 73
#define MON_DATA_GIFT_RIBBON_3 74
#define MON_DATA_GIFT_RIBBON_4 75
#define MON_DATA_GIFT_RIBBON_5 76
#define MON_DATA_GIFT_RIBBON_6 77
#define MON_DATA_GIFT_RIBBON_7 78
#define MON_DATA_FATEFUL_ENCOUNTER 79
#define MON_DATA_OBEDIENCE 80
#define MON_DATA_MARINE_RIBBON 72
#define MON_DATA_LAND_RIBBON 73
#define MON_DATA_SKY_RIBBON 74
#define MON_DATA_COUNTRY_RIBBON 75
#define MON_DATA_NATIONAL_RIBBON 76
#define MON_DATA_EARTH_RIBBON 77
#define MON_DATA_WORLD_RIBBON 78
#define MON_DATA_FILLER 79
#define MON_DATA_EVENT_LEGAL 80
#define MON_DATA_KNOWN_MOVES 81
#define MON_DATA_RIBBON_COUNT 82
#define MON_DATA_RIBBONS 83
+49 -1
View File
@@ -715,6 +715,52 @@ struct TrainerNameRecord
u8 trainerName[PLAYER_NAME_LENGTH + 1];
};
// For external event data storage. The majority of these may have never been used.
// In FRLG, the only known used fields are the PokeCoupon and BoxRS ones, but hacking the distribution discs allows FRLG to receive events and set the others
struct ExternalEventData
{
u8 unknownExternalDataFields1[7]; // if actually used, may be broken up into different fields.
u32 unknownExternalDataFields2:8;
u32 currentPokeCoupons:24; // PokéCoupons stored by Pokémon Colosseum and XD from Mt. Battle runs. Earned PokéCoupons are also added to totalEarnedPokeCoupons. Colosseum/XD caps this at 9,999,999, but will read up to 16,777,215.
u32 gotGoldPokeCouponTitleReward:1; // Master Ball from Jp Colosseum Bonus Disc; for reaching 30,000 totalEarnedPokeCoupons
u32 gotSilverPokeCouponTitleReward:1; // Light Ball Pikachu from JP Colosseum Bonus Disc; for reaching 5000 totalEarnedPokeCoupons
u32 gotBronzePokeCouponTitleReward:1; // PP Max from JP Colosseum Bonus Disc; for reaching 2500 totalEarnedPokeCoupons
u32 receivedAgetoCelebi:1; // from JP Colosseum Bonus Disc
u32 unknownExternalDataFields3:4;
u32 totalEarnedPokeCoupons:24; // Used by the JP Colosseum bonus disc. Determines PokéCoupon rank to distribute rewards. Unread in International games. Colosseum/XD caps this at 9,999,999.
u8 unknownExternalDataFields4[5]; // if actually used, may be broken up into different fields.
} __attribute__((packed)); /*size = 0x14*/
// For external event flags. The majority of these may have never been used.
// In FRLG, Jirachi cannot normally be received, but hacking the distribution discs allows FRLG to receive Jirachi and set the flag
struct ExternalEventFlags
{
u8 usedBoxRS:1; // Set by Pokémon Box: Ruby & Sapphire; denotes whether this save has connected to it and triggered the free False Swipe Swablu Egg giveaway.
u8 boxRSEggsUnlocked:2; // Set by Pokémon Box: Ruby & Sapphire; denotes the number of Eggs unlocked from deposits; 1 for ExtremeSpeed Zigzagoon (at 100 deposited), 2 for Pay Day Skitty (at 500 deposited), 3 for Surf Pichu (at 1500 deposited)
u8 padding:5;
u8 unknownFlag1;
u8 receivedGCNJirachi; // Both the US Colosseum Bonus Disc and PAL/AUS Pokémon Channel use this field. One cannot receive a WISHMKR Jirachi and CHANNEL Jirachi with the same savefile.
u8 unknownFlag3;
u8 unknownFlag4;
u8 unknownFlag5;
u8 unknownFlag6;
u8 unknownFlag7;
u8 unknownFlag8;
u8 unknownFlag9;
u8 unknownFlag10;
u8 unknownFlag11;
u8 unknownFlag12;
u8 unknownFlag13;
u8 unknownFlag14;
u8 unknownFlag15;
u8 unknownFlag16;
u8 unknownFlag17;
u8 unknownFlag18;
u8 unknownFlag19;
u8 unknownFlag20;
} __attribute__((packed));/*size = 0x15*/
#define UNION_ROOM_KB_ROW_COUNT 10
struct SaveBlock1
@@ -761,7 +807,9 @@ struct SaveBlock1
/*0x2F18*/ OldMan oldMan; // unused
/*0x2F54*/ struct EasyChatPair easyChatPairs[5]; // unused
/*0x2F80*/ struct DayCare daycare;
/*0x309C*/ u8 giftRibbons[52];
/*0x309C*/ u8 giftRibbons[11];
/*0x30A7*/ struct ExternalEventData externalEventData;
/*0x30BB*/ struct ExternalEventFlags externalEventFlags;
/*0x30D0*/ struct Roamer roamer;
/*0x30EC*/ struct EnigmaBerry enigmaBerry;
/*0x3120*/ struct MEventBuffers mysteryEventBuffers;
+10 -10
View File
@@ -65,15 +65,15 @@ struct PokemonSubstruct3
/* 0x0A */ u32 victoryRibbon:1;
/* 0x0A */ u32 artistRibbon:1;
/* 0x0A */ u32 effortRibbon:1;
/* 0x0A */ u32 giftRibbon1:1;
/* 0x0A */ u32 giftRibbon2:1;
/* 0x0A */ u32 giftRibbon3:1;
/* 0x0A */ u32 giftRibbon4:1;
/* 0x0B */ u32 giftRibbon5:1;
/* 0x0B */ u32 giftRibbon6:1;
/* 0x0B */ u32 giftRibbon7:1;
/* 0x0B */ u32 fatefulEncounter:4;
/* 0x0B */ u32 obedient:1;
/* 0x0A */ u32 marineRibbon:1; // never distributed
/* 0x0A */ u32 landRibbon:1; // never distributed
/* 0x0A */ u32 skyRibbon:1; // never distributed
/* 0x0A */ u32 countryRibbon:1; // distributed during Pokémon Festa '04 and '05 to tournament winners
/* 0x0B */ u32 nationalRibbon:1;
/* 0x0B */ u32 earthRibbon:1;
/* 0x0B */ u32 worldRibbon:1; // distributed during Pokémon Festa '04 and '05 to tournament winners
/* 0x0B */ u32 filler:4;
/* 0x0B */ u32 eventLegal:1; // controls Mew & Deoxys obedience; if set, Pokémon is a fateful encounter in FRLG & Gen 4+ summary screens; set for in-game event island legendaries, some distributed events, and Pokémon from XD: Gale of Darkness.
};
union PokemonSubstruct
@@ -449,7 +449,7 @@ bool8 sub_804455C(u8 caseId, u8 battlerId);
void SetDeoxysStats(void);
u16 sub_80447AC(void);
u16 sub_80447F0(void);
void CreateObedientEnemyMon(void);
void CreateEventLegalEnemyMon(void);
void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality);
bool8 CheckBattleTypeGhost(struct Pokemon *mon, u8 bank);
struct OakSpeechNidoranFStruct *OakSpeechNidoranFSetup(u8 battlePosition, bool8 enable);
+2 -2
View File
@@ -15,8 +15,8 @@ extern const u8 gText_GenderlessSymbol[];
extern const u16 gUnknown_826601C[];
void CB2_ReturnFromLinkTrade(void);
s32 Trade_CalcLinkPlayerCompatibilityParam(void);
s32 CanRegisterMonForTradingBoard(struct GFtgtGnameSub rfuPlayer, u16 species2, u16 species, u8 isObedientBitSet);
s32 GetUnionRoomTradeMessageId(struct GFtgtGnameSub rfuPlayer, struct GFtgtGnameSub rfuPartner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, u8 isObedientBitSet);
s32 CanRegisterMonForTradingBoard(struct GFtgtGnameSub rfuPlayer, u16 species2, u16 species, u8 isEventLegal);
s32 GetUnionRoomTradeMessageId(struct GFtgtGnameSub rfuPlayer, struct GFtgtGnameSub rfuPartner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, u8 isEventLegal);
void CB2_ReturnToTradeMenuFromSummary(void);
#endif //GUARD_TRADE_H
+3 -3
View File
@@ -3095,13 +3095,13 @@ u8 GetMoveTarget(u16 move, u8 setTarget)
return targetBattler;
}
static bool32 HasObedientBitSet(u8 battlerId)
static bool32 IsNotEventLegalMewOrDeoxys(u8 battlerId)
{
if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT
|| (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS
&& GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_MEW))
return TRUE;
return GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_OBEDIENCE, NULL);
return GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_EVENT_LEGAL, NULL);
}
u8 IsMonDisobedient(void)
@@ -3112,7 +3112,7 @@ u8 IsMonDisobedient(void)
if ((gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_POKEDUDE)) || GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT)
return 0;
if (HasObedientBitSet(gBattlerAttacker)) // only if species is Mew or Deoxys
if (IsNotEventLegalMewOrDeoxys(gBattlerAttacker)) // only if species is Mew or Deoxys
{
if (!IsOtherTrainer(gBattleMons[gBattlerAttacker].otId, gBattleMons[gBattlerAttacker].otName) || FlagGet(FLAG_BADGE08_GET))
return 0;
+3 -3
View File
@@ -1591,7 +1591,7 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
{
u16 species;
u32 personality, pokerus;
u8 i, friendship, language, gameMet, markings, obedience;
u8 i, friendship, language, gameMet, markings, isEventLegal;
u16 moves[4];
u32 ivs[NUM_STATS];
@@ -1614,7 +1614,7 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
gameMet = GetMonData(egg, MON_DATA_MET_GAME);
markings = GetMonData(egg, MON_DATA_MARKINGS);
pokerus = GetMonData(egg, MON_DATA_POKERUS);
obedience = GetMonData(egg, MON_DATA_OBEDIENCE);
isEventLegal = GetMonData(egg, MON_DATA_EVENT_LEGAL);
CreateMon(temp, species, EGG_HATCH_LEVEL, 32, TRUE, personality, 0, 0);
@@ -1636,7 +1636,7 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
friendship = 120;
SetMonData(temp, MON_DATA_FRIENDSHIP, &friendship);
SetMonData(temp, MON_DATA_POKERUS, &pokerus);
SetMonData(temp, MON_DATA_OBEDIENCE, &obedience);
SetMonData(temp, MON_DATA_EVENT_LEGAL, &isEventLegal);
*egg = *temp;
}
+1 -1
View File
@@ -557,7 +557,7 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon)
for (i = MON_DATA_COOL_RIBBON; i < MON_DATA_COOL_RIBBON + 5; i++)
SetMonData(&gPlayerParty[gPlayerPartyCount], i, (&data));
for (i = MON_DATA_CHAMPION_RIBBON; i <= MON_DATA_FATEFUL_ENCOUNTER; i++)
for (i = MON_DATA_CHAMPION_RIBBON; i <= MON_DATA_FILLER; i++)
SetMonData(&gPlayerParty[gPlayerPartyCount], i, (&data));
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_STATUS, (&data));
+4 -4
View File
@@ -3867,9 +3867,9 @@ static void CursorCB_Register(u8 taskId)
{
u16 species2 = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2);
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES);
u8 obedience = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_OBEDIENCE);
u8 isEventLegal = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_EVENT_LEGAL);
switch (CanRegisterMonForTradingBoard(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), species2, species, obedience))
switch (CanRegisterMonForTradingBoard(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), species2, species, isEventLegal))
{
case CANT_REGISTER_MON:
StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow);
@@ -3894,8 +3894,8 @@ static void CursorCB_Trade1(u8 taskId)
{
u16 species2 = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2);
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES);
u8 obedience = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_OBEDIENCE);
u32 stringId = GetUnionRoomTradeMessageId(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), gPartnerTgtGnameSub, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, obedience);
u8 isEventLegal = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_EVENT_LEGAL);
u32 stringId = GetUnionRoomTradeMessageId(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), gPartnerTgtGnameSub, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, isEventLegal);
if (stringId != UR_TRADE_MSG_NONE)
{
+64 -64
View File
@@ -1978,12 +1978,12 @@ void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src)
CalculateMonStats(mon);
}
static void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId)
static void CreateEventLegalMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId)
{
bool32 obedient = TRUE;
bool32 isEventLegal = TRUE;
CreateMon(mon, species, level, fixedIV, hasFixedPersonality, fixedPersonality, otIdType, fixedOtId);
SetMonData(mon, MON_DATA_OBEDIENCE, &obedient);
SetMonData(mon, MON_DATA_EVENT_LEGAL, &isEventLegal);
}
void sub_803E23C(struct Pokemon *mon, struct BattleTowerPokemon *dest)
@@ -3153,32 +3153,32 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
case MON_DATA_EFFORT_RIBBON:
retVal = substruct3->effortRibbon;
break;
case MON_DATA_GIFT_RIBBON_1:
retVal = substruct3->giftRibbon1;
case MON_DATA_MARINE_RIBBON:
retVal = substruct3->marineRibbon;
break;
case MON_DATA_GIFT_RIBBON_2:
retVal = substruct3->giftRibbon2;
case MON_DATA_LAND_RIBBON:
retVal = substruct3->landRibbon;
break;
case MON_DATA_GIFT_RIBBON_3:
retVal = substruct3->giftRibbon3;
case MON_DATA_SKY_RIBBON:
retVal = substruct3->skyRibbon;
break;
case MON_DATA_GIFT_RIBBON_4:
retVal = substruct3->giftRibbon4;
case MON_DATA_COUNTRY_RIBBON:
retVal = substruct3->countryRibbon;
break;
case MON_DATA_GIFT_RIBBON_5:
retVal = substruct3->giftRibbon5;
case MON_DATA_NATIONAL_RIBBON:
retVal = substruct3->nationalRibbon;
break;
case MON_DATA_GIFT_RIBBON_6:
retVal = substruct3->giftRibbon6;
case MON_DATA_EARTH_RIBBON:
retVal = substruct3->earthRibbon;
break;
case MON_DATA_GIFT_RIBBON_7:
retVal = substruct3->giftRibbon7;
case MON_DATA_WORLD_RIBBON:
retVal = substruct3->worldRibbon;
break;
case MON_DATA_FATEFUL_ENCOUNTER:
retVal = substruct3->fatefulEncounter;
case MON_DATA_FILLER:
retVal = substruct3->filler;
break;
case MON_DATA_OBEDIENCE:
retVal = substruct3->obedient;
case MON_DATA_EVENT_LEGAL:
retVal = substruct3->eventLegal;
break;
case MON_DATA_SPECIES2:
retVal = substruct0->species;
@@ -3220,13 +3220,13 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
retVal += substruct3->victoryRibbon;
retVal += substruct3->artistRibbon;
retVal += substruct3->effortRibbon;
retVal += substruct3->giftRibbon1;
retVal += substruct3->giftRibbon2;
retVal += substruct3->giftRibbon3;
retVal += substruct3->giftRibbon4;
retVal += substruct3->giftRibbon5;
retVal += substruct3->giftRibbon6;
retVal += substruct3->giftRibbon7;
retVal += substruct3->marineRibbon;
retVal += substruct3->landRibbon;
retVal += substruct3->skyRibbon;
retVal += substruct3->countryRibbon;
retVal += substruct3->nationalRibbon;
retVal += substruct3->earthRibbon;
retVal += substruct3->worldRibbon;
}
break;
case MON_DATA_RIBBONS:
@@ -3243,13 +3243,13 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
| (substruct3->victoryRibbon << 17)
| (substruct3->artistRibbon << 18)
| (substruct3->effortRibbon << 19)
| (substruct3->giftRibbon1 << 20)
| (substruct3->giftRibbon2 << 21)
| (substruct3->giftRibbon3 << 22)
| (substruct3->giftRibbon4 << 23)
| (substruct3->giftRibbon5 << 24)
| (substruct3->giftRibbon6 << 25)
| (substruct3->giftRibbon7 << 26);
| (substruct3->marineRibbon << 20)
| (substruct3->landRibbon << 21)
| (substruct3->skyRibbon << 22)
| (substruct3->countryRibbon << 23)
| (substruct3->nationalRibbon << 24)
| (substruct3->earthRibbon << 25)
| (substruct3->worldRibbon << 26);
}
break;
default:
@@ -3316,15 +3316,15 @@ void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg)
case MON_DATA_VICTORY_RIBBON:
case MON_DATA_ARTIST_RIBBON:
case MON_DATA_EFFORT_RIBBON:
case MON_DATA_GIFT_RIBBON_1:
case MON_DATA_GIFT_RIBBON_2:
case MON_DATA_GIFT_RIBBON_3:
case MON_DATA_GIFT_RIBBON_4:
case MON_DATA_GIFT_RIBBON_5:
case MON_DATA_GIFT_RIBBON_6:
case MON_DATA_GIFT_RIBBON_7:
case MON_DATA_FATEFUL_ENCOUNTER:
case MON_DATA_OBEDIENCE:
case MON_DATA_MARINE_RIBBON:
case MON_DATA_LAND_RIBBON:
case MON_DATA_SKY_RIBBON:
case MON_DATA_COUNTRY_RIBBON:
case MON_DATA_NATIONAL_RIBBON:
case MON_DATA_EARTH_RIBBON:
case MON_DATA_WORLD_RIBBON:
case MON_DATA_FILLER:
case MON_DATA_EVENT_LEGAL:
case MON_DATA_KNOWN_MOVES:
case MON_DATA_RIBBON_COUNT:
case MON_DATA_RIBBONS:
@@ -3556,32 +3556,32 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg)
case MON_DATA_EFFORT_RIBBON:
SET8(substruct3->effortRibbon);
break;
case MON_DATA_GIFT_RIBBON_1:
SET8(substruct3->giftRibbon1);
case MON_DATA_MARINE_RIBBON:
SET8(substruct3->marineRibbon);
break;
case MON_DATA_GIFT_RIBBON_2:
SET8(substruct3->giftRibbon2);
case MON_DATA_LAND_RIBBON:
SET8(substruct3->landRibbon);
break;
case MON_DATA_GIFT_RIBBON_3:
SET8(substruct3->giftRibbon3);
case MON_DATA_SKY_RIBBON:
SET8(substruct3->skyRibbon);
break;
case MON_DATA_GIFT_RIBBON_4:
SET8(substruct3->giftRibbon4);
case MON_DATA_COUNTRY_RIBBON:
SET8(substruct3->countryRibbon);
break;
case MON_DATA_GIFT_RIBBON_5:
SET8(substruct3->giftRibbon5);
case MON_DATA_NATIONAL_RIBBON:
SET8(substruct3->nationalRibbon);
break;
case MON_DATA_GIFT_RIBBON_6:
SET8(substruct3->giftRibbon6);
case MON_DATA_EARTH_RIBBON:
SET8(substruct3->earthRibbon);
break;
case MON_DATA_GIFT_RIBBON_7:
SET8(substruct3->giftRibbon7);
case MON_DATA_WORLD_RIBBON:
SET8(substruct3->worldRibbon);
break;
case MON_DATA_FATEFUL_ENCOUNTER:
SET8(substruct3->fatefulEncounter);
case MON_DATA_FILLER:
SET8(substruct3->filler);
break;
case MON_DATA_OBEDIENCE:
SET8(substruct3->obedient);
case MON_DATA_EVENT_LEGAL:
SET8(substruct3->eventLegal);
break;
case MON_DATA_IVS:
{
@@ -6027,14 +6027,14 @@ u16 sub_80447F0(void)
return gFacilityClassToTrainerClass[gLinkPlayerFacilityClasses[arrId]];
}
void CreateObedientEnemyMon(void)
void CreateEventLegalEnemyMon(void)
{
s32 species = gSpecialVar_0x8004;
s32 level = gSpecialVar_0x8005;
s32 itemId = gSpecialVar_0x8006;
ZeroEnemyPartyMons();
CreateObedientMon(&gEnemyParty[0], species, level, 32, 0, 0, 0, 0);
CreateEventLegalMon(&gEnemyParty[0], species, level, 32, 0, 0, 0, 0);
if (itemId)
{
u8 heldItem[2];
+3 -3
View File
@@ -37,9 +37,9 @@ static const struct UnknownStruct sBigMonSizeTable[] =
static const u8 sGiftRibbonsMonDataIds[] =
{
MON_DATA_GIFT_RIBBON_1, MON_DATA_GIFT_RIBBON_2, MON_DATA_GIFT_RIBBON_3,
MON_DATA_GIFT_RIBBON_4, MON_DATA_GIFT_RIBBON_5, MON_DATA_GIFT_RIBBON_6,
MON_DATA_GIFT_RIBBON_7
MON_DATA_MARINE_RIBBON, MON_DATA_LAND_RIBBON, MON_DATA_SKY_RIBBON,
MON_DATA_COUNTRY_RIBBON, MON_DATA_NATIONAL_RIBBON, MON_DATA_EARTH_RIBBON,
MON_DATA_WORLD_RIBBON
};
#define CM_PER_INCH 2.54
+4 -4
View File
@@ -2623,7 +2623,7 @@ static void sub_8137578(void)
if (GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_MET_LEVEL) == 0)
{
if (GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_OBEDIENCE) == 1)
if (GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_EVENT_LEGAL) == 1)
{
if (sub_813B7E0(nature))
DynamicPlaceholderTextUtil_ExpandPlaceholders(natureMetOrHatchedAtLevelStr, gUnknown_841996D);
@@ -2718,7 +2718,7 @@ static void sub_8137724(void)
if (GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_MET_LEVEL) == 0)
{
if (GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_OBEDIENCE) == 1)
if (GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_EVENT_LEGAL) == 1)
{
if (sub_813B7E0(nature))
DynamicPlaceholderTextUtil_ExpandPlaceholders(natureMetOrHatchedAtLevelStr, gUnknown_84199F4);
@@ -2772,7 +2772,7 @@ static void sub_8137970(void)
if (sMonSummaryScreen->monList.mons != gEnemyParty)
{
if (metLocation == METLOC_FATEFUL_ENCOUNTER || GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_OBEDIENCE) == 1)
if (metLocation == METLOC_FATEFUL_ENCOUNTER || GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_EVENT_LEGAL) == 1)
chosenStrIndex = 4;
else
{
@@ -2790,7 +2790,7 @@ static void sub_8137970(void)
}
else
{
if (metLocation == METLOC_FATEFUL_ENCOUNTER || GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_OBEDIENCE) == 1)
if (metLocation == METLOC_FATEFUL_ENCOUNTER || GetMonData(&sMonSummaryScreen->currentMon, MON_DATA_EVENT_LEGAL) == 1)
chosenStrIndex = 4;
else
{
+6 -6
View File
@@ -2230,21 +2230,21 @@ bool8 ScrCmd_normalmsg(struct ScriptContext * ctx)
return FALSE;
}
// This command will force the Pokémon to be obedient, you don't get to make it disobedient.
bool8 ScrCmd_setmonobedient(struct ScriptContext * ctx)
// This command will set a Pokémon's eventLegal bit; there is no similar command to clear it.
bool8 ScrCmd_setmoneventlegal(struct ScriptContext * ctx)
{
bool8 obedient = TRUE;
bool8 isEventLegal = TRUE;
u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
SetMonData(&gPlayerParty[partyIndex], MON_DATA_OBEDIENCE, &obedient);
SetMonData(&gPlayerParty[partyIndex], MON_DATA_EVENT_LEGAL, &isEventLegal);
return FALSE;
}
bool8 ScrCmd_checkmonobedience(struct ScriptContext * ctx)
bool8 ScrCmd_checkmoneventlegal(struct ScriptContext * ctx)
{
u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
gSpecialVar_Result = GetMonData(&gPlayerParty[partyIndex], MON_DATA_OBEDIENCE, NULL);
gSpecialVar_Result = GetMonData(&gPlayerParty[partyIndex], MON_DATA_EVENT_LEGAL, NULL);
return FALSE;
}
+8 -8
View File
@@ -1845,7 +1845,7 @@ static u8 PlayerHasEnoughPokemonToTrade_HandleMewDeoxys(u8 *flags, u8 partyCount
count += flags[i];
}
species = GetMonData(&gEnemyParty[sTradeMenuResourcesPtr->otherPlayerCursorPosition % 6], MON_DATA_SPECIES);
if ((species == SPECIES_DEOXYS || species == SPECIES_MEW) && !GetMonData(&gEnemyParty[sTradeMenuResourcesPtr->otherPlayerCursorPosition % 6], MON_DATA_OBEDIENCE))
if ((species == SPECIES_DEOXYS || species == SPECIES_MEW) && !GetMonData(&gEnemyParty[sTradeMenuResourcesPtr->otherPlayerCursorPosition % 6], MON_DATA_EVENT_LEGAL))
return 2;
if (count != 0)
count = 1;
@@ -2649,7 +2649,7 @@ static u32 TestWhetherSelectedMonCanBeTraded(struct Pokemon * party, int partyCo
if (species[cursorPos] == SPECIES_DEOXYS || species[cursorPos] == SPECIES_MEW)
{
if (!GetMonData(&party[cursorPos], MON_DATA_OBEDIENCE))
if (!GetMonData(&party[cursorPos], MON_DATA_EVENT_LEGAL))
{
return 4;
}
@@ -2730,17 +2730,17 @@ s32 Trade_CalcLinkPlayerCompatibilityParam(void)
return 0;
}
static bool32 IsDeoxysOrMewUntradable(u16 species, bool8 isObedientBitSet)
static bool32 IsDeoxysOrMewUntradable(u16 species, bool8 isEventLegal)
{
if (species == SPECIES_DEOXYS || species == SPECIES_MEW)
{
if (!isObedientBitSet)
if (!isEventLegal)
return TRUE;
}
return FALSE;
}
int GetUnionRoomTradeMessageId(struct GFtgtGnameSub playerSub, struct GFtgtGnameSub partnerSub, u16 species1, u16 species2, u8 type, u16 species3, u8 isObedientBitSet)
int GetUnionRoomTradeMessageId(struct GFtgtGnameSub playerSub, struct GFtgtGnameSub partnerSub, u16 species1, u16 species2, u8 type, u16 species3, u8 isEventLegal)
{
u8 playerHasNationalDex = playerSub.hasNationalDex;
u8 playerIsChampion = playerSub.isChampion;
@@ -2769,7 +2769,7 @@ int GetUnionRoomTradeMessageId(struct GFtgtGnameSub playerSub, struct GFtgtGname
}
}
if (IsDeoxysOrMewUntradable(species3, isObedientBitSet))
if (IsDeoxysOrMewUntradable(species3, isEventLegal))
{
return 4;
}
@@ -2820,11 +2820,11 @@ int GetUnionRoomTradeMessageId(struct GFtgtGnameSub playerSub, struct GFtgtGname
return 0;
}
int CanRegisterMonForTradingBoard(struct GFtgtGnameSub playerSub, u16 species2, u16 species, u8 obedience)
int CanRegisterMonForTradingBoard(struct GFtgtGnameSub playerSub, u16 species2, u16 species, u8 isEventLegal)
{
u8 canTradeEggAndNational = playerSub.hasNationalDex;
if (IsDeoxysOrMewUntradable(species, obedience))
if (IsDeoxysOrMewUntradable(species, isEventLegal))
{
return 1;
}