diff --git a/asm/include/main_02034974.inc b/asm/include/main_02034974.inc new file mode 100644 index 00000000..d222fdfa --- /dev/null +++ b/asm/include/main_02034974.inc @@ -0,0 +1,816 @@ +#pragma once +.public ADVENTURE_LOG_ENCOUNTERS_MONSTER_IDS +.public ADVENTURE_LOG_PTR +.public ARM9_UNKNOWN_DATA__NA_209E6BC +.public ARM9_UNKNOWN_PTR__NA_20A2C84 +.public ARM9_UNKNOWN_TABLE__NA_209E12C +.public ARM9_UNKNOWN_TABLE__NA_209E164 +.public ARM9_UNKNOWN_TABLE__NA_209E280 +.public ARM9_UNKNOWN_TABLE__NA_20A20B0 +.public AddItemToStorage +.public AddMoneyCarried +.public Arm9LoadUnkFieldNa0x2029EC8 +.public Arm9StoreUnkFieldNa0x2029ED8 +.public ArrayCopy32 +.public ArrayFill32 +.public BAG_CAPACITY_TABLE +.public BAG_CAPACITY_TABLE_SPECIAL_EPISODES +.public BAG_ITEMS_PTR_MIRROR +.public CLIENT_LEVEL_TABLE +.public CanMonsterUseMove +.public CardBackupError +.public CardPullOutWithStatus +.public CheckDebugMenuField0x1A4 +.public CheckOptionsMenuField0x1A4 +.public CheckParentMenuField0x1A0 +.public ClearWindow +.public CloseAdvancedMenu +.public CloseAdvancedTextBox +.public CloseAdvancedTextBox2 +.public CloseCollectionMenu +.public CloseDebugMenu +.public CloseDialogueBox +.public CloseOptionsMenu +.public CloseParentMenu +.public ClosePortraitBox +.public CloseScrollBox +.public CloseSimpleMenu +.public CloseTeamSelectionMenu +.public CloseTextBox +.public CloseTextBox2 +.public ConvertStorageItemAtIdxToItem +.public CopyNStringFromId +.public CountNbOfItemsInStorage +.public CountNbOfValidItemsInStorage +.public CountNbOfValidItemsInTimeDarknessInStorage +.public CreateAdvancedMenu +.public CreateAdvancedTextBox +.public CreateAdvancedTextBoxWithArg +.public CreateCollectionMenu +.public CreateDebugMenu +.public CreateDialogueBox +.public CreateOptionsMenu +.public CreateParentMenu +.public CreateParentMenuFromStringIds +.public CreatePortraitBox +.public CreateScrollBoxMulti +.public CreateScrollBoxSingle +.public CreateSimpleMenu +.public CreateSimpleMenuFromStringIds +.public CreateTeamSelectionMenu +.public CreateTextBox +.public CreateTextBoxWithArg +.public DEFAULT_HERO_ID +.public DUNGEON_DATA_LIST +.public DUNGEON_PTR +.public DUNGEON_RESTRICTIONS +.public Debug_FatalError +.public Debug_GetDebugFlag +.public Debug_GetLogFlag +.public Debug_Print +.public Debug_Print0 +.public Debug_SetDebugFlag +.public Debug_SetLogFlag +.public DecompressAtNormalVeneer +.public DexNumbersEqual +.public DirectoryFileMngr_OpenDirectoryFile +.public DisableIqSkill +.public DrawTextInWindow +.public DrawTileGrid +.public DungeonSwapIdToIdx +.public DungeonSwapIdxToId +.public DungeonToGroundMoveset +.public EnableAllLearnableIqSkills +.public FORBIDDEN_FORGOT_MOVE_LIST +.public FemaleToMaleForm +.public FileClose +.public FileRom_HandleOpen +.public FileRom_HandleRead +.public FileRom_HandleSeek +.public FileRom_InitDataTransfer +.public FileRom_StopDataTransfer +.public FileRom_Veneer_FileInit +.public FormatMoveStringMore +.public GAME_MODE +.public GLOBAL_PROGRESS_PTR +.public GUEST_MONSTER_DATA +.public GetActiveRosterIndex +.public GetActiveTeamMember +.public GetActualSellPrice +.public GetAdvancedMenuCurrentOption +.public GetAdvancedMenuResult +.public GetAdvancedTextBoxFlags2 +.public GetAtSize +.public GetCurrentBagCapacity +.public GetDungeonModeSpecial +.public GetDungeonResultString +.public GetEvolutionPossibilities +.public GetHeldButtons +.public GetHero +.public GetHeroMemberIdx +.public GetInfoGroundMoveset +.public GetInfoMoveGround +.public GetIqSkillStringId +.public GetItemAtIdx +.public GetItemCategory +.public GetItemCategoryVeneer +.public GetItemIdFromList +.public GetItemMoveId16 +.public GetKeyM2NSwitch +.public GetKeyN2MSwitch +.public GetLanguage +.public GetLanguageType +.public GetLearnableIqSkills +.public GetMainCharacter1MemberIdx +.public GetMainCharacter2MemberIdx +.public GetMainCharacter3MemberIdx +.public GetMaxPp +.public GetMoneyCarried +.public GetMoneyStored +.public GetMonsterName +.public GetMoveRangeId +.public GetMoveType +.public GetMovesetEggPtr +.public GetMovesetHmTmPtr +.public GetMovesetIdx__02013CAC +.public GetMovesetLevelUpPtr +.public GetNbItemsInBag +.public GetNbMoves +.public GetNextIqSkill +.public GetPartner +.public GetPartnerMemberIdx +.public GetPartyMembers +.public GetPpIncrease +.public GetPressedButtons +.public GetReleasedStylus +.public GetRngSeed +.public GetSimpleMenuResult +.public GetSosMailCount +.public GetStringFromFileVeneer +.public GetTeamMember +.public GetTime +.public GetWindow +.public GroundToDungeonMoveset +.public HIDDEN_POWER_BASE_POWER_TABLE +.public HandleSir0Translation +.public HidePortraitBox +.public InitMove +.public InitPreprocessorArgs +.public IqSkillFlagTest +.public Is2TurnsMove +.public IsAdvancedMenuActive2 +.public IsAdvancedTextBoxActive +.public IsCollectionMenuActive +.public IsCollectionMenuState3 +.public IsDebugMenuActive +.public IsDialogueBoxActive +.public IsExclusiveItemIdForMonster +.public IsExperienceLocked +.public IsGummi +.public IsItemInTimeDarkness +.public IsItemValidVeneer +.public IsMainCharacter +.public IsMovesetValidInTimeDarkness +.public IsNot2TurnsMoveOrSketch +.public IsOptionsMenuActive +.public IsParentMenuActive +.public IsRealMove +.public IsScrollBoxActive +.public IsShoppableItem +.public IsSimpleMenuActive +.public IsStorableItem +.public IsStorageFull +.public IsTeamSelectionMenuActive +.public IsTeamSelectionMenuState3 +.public IsThrownItem +.public IsTreasureBox +.public IsValidTeamMember +.public ItemZInit +.public KAOMADO_FILEPATH +.public KEYBOARD_STRING_IDS +.public LearnMoves +.public LoadFileFromRom +.public LoadOverlay +.public MISSION_FLOORS_FORBIDDEN +.public MISSION_FLOOR_RANKS_PTRS +.public MONSTER_SPRITE_DATA +.public MemAlloc +.public MemFree +.public MemZero +.public MemcpySimple +.public MemsetSimple +.public NOTIFY_NOTE +.public NormalizeTreasureBox +.public OS_GetLockID +.public OUTLAW_LEVEL_TABLE +.public OUTLAW_MINION_LEVEL_TABLE +.public OverlayIsLoaded +.public PARTNER_TALK_KIND_TABLE +.public PORTRAIT_LAYOUTS +.public PlayAdvancedTextBoxInputSound +.public PlayBgmByIdVeneer +.public PlaySeVolumeWrapper +.public PointsToZero +.public PreprocessString +.public PreprocessStringFromId +.public RANK_UP_TABLE +.public Rand16Bit +.public Rand32Bit +.public RandInt +.public RandIntSafe +.public ReadItemsFromSave +.public ReadMonsterInfoFromSave +.public ReadStringFromDialogueBox +.public RemoveActiveMembersFromAllTeams +.public RemoveActiveMembersFromRescueTeam +.public RemoveActiveMembersFromSpecialEpisodeTeam +.public RemoveEmptyItemsInBag +.public ResumeAdvancedMenu +.public SCRIPT_VARS +.public SCRIPT_VARS_LOCALS +.public SECONDARY_TERRAIN_TYPES +.public SPECIAL_EPISODE_MAIN_CHARACTERS +.public STATUSES_FULL_DESCRIPTION_STRING_IDS +.public SetActiveInventory +.public SetActiveKecleonShop +.public SetActiveTeam +.public SetAdvancedTextBoxField0x1C2 +.public SetAdvancedTextBoxPartialMenu +.public SetAdvancedTextBoxState5 +.public SetBothScreensWindowsColor +.public SetCollectionMenuField0x1BC +.public SetCollectionMenuVoidFn +.public SetCollectionMenuWidth +.public SetMoneyCarried +.public SetMoneyStored +.public SetRngSeed +.public SetSimpleMenuField0x1AC +.public SetTeamSetupHeroAndPartnerOnly +.public SetUnkAdvancedTextBoxFn +.public SetUnkAdvancedTextBoxWindowFn +.public ShowDialogueBox +.public ShowPortraitInPortraitBox +.public ShowStringIdInDialogueBox +.public ShowStringInDialogueBox +.public SortItemsInBag +.public SortItemsInStorage +.public StrcpyName +.public StrcpySimple +.public StringFromId +.public StrncmpSimple +.public StrncpyName +.public StrncpySimple +.public StrncpySimpleNoPad +.public StrncpySimpleNoPadSafe +.public TEAM_MEMBER_TABLE_PTR +.public TryPointCameraToMonster +.public UNOWN_SPECIES_ADDITIONAL_CHAR_PTR_TABLE +.public UnloadFile +.public UpdateWindow +.public VERSION_EXCLUSIVE_MONSTERS +.public WONDER_MAIL_BITS_MAP +.public WONDER_MAIL_BITS_SWAP +.public WONDER_MAIL_ENCRYPTION_TABLE +.public WriteItemsToSave +.public WriteMonsterInfoToSave +.public ZInit8 +.public _0209B08C +.public _0209B09C +.public _0209B0EC +.public _0209B0FC +.public _0209B10C +.public _0209B11C +.public _0209B134 +.public _0209B1B8 +.public _0209B1C8 +.public _0209B1D8 +.public _0209B1F0 +.public _0209B208 +.public _0209B218 +.public _0209B228 +.public _0209B244 +.public _0209B254 +.public _0209B264 +.public _0209B288 +.public _0209B28C +.public _0209B298 +.public _0209B2B8 +.public _0209B2C4 +.public _0209B2D0 +.public _0209B2DC +.public _0209B2E0 +.public _0209B2E1 +.public _0209B2E2 +.public _0209B2E3 +.public _0209B2EC +.public _0209B2FC +.public _0209B30C +.public _0209B31C +.public _0209B32C +.public _0209B32E +.public _0209B3B4 +.public _0209B3B6 +.public _0209B48C +.public _0209B4A4 +.public _0209B4AC +.public _0209B4B8 +.public _0209B4C0 +.public _0209B4C4 +.public _0209B4D4 +.public _0209B4E4 +.public _0209B4FC +.public _0209B50C +.public _0209C29C_JP +.public _0209C29D_JP +.public _0209C29E_JP +.public _0209C5C0 +.public _0209C5D0 +.public _0209C5E0 +.public _0209C604 +.public _0209C60C +.public _0209C618 +.public _0209C628 +.public _0209C638 +.public _0209C648 +.public _0209C658 +.public _0209C668 +.public _0209C678 +.public _0209C688 +.public _0209C6B8 +.public _0209C70C +.public _0209C764 +.public _0209C798 +.public _0209C7B8 +.public _0209C7CC +.public _0209C7D4 +.public _0209C7E4 +.public _0209C7F4 +.public _0209C820 +.public _0209C82C +.public _0209C83C +.public _0209C844 +.public _0209C846 +.public _0209C850 +.public _0209C85C +.public _0209C86C +.public _0209C884 +.public _0209C89C +.public _0209C8A8 +.public _0209C8B8 +.public _0209C8C8 +.public _0209C928 +.public _0209C92C +.public _0209C93C +.public _0209C94C +.public _0209C95C +.public _0209C96C +.public _0209C97C +.public _0209C98C +.public _0209C99C +.public _0209C9AC +.public _0209C9B0 +.public _0209C9CC +.public _0209C9D4 +.public _0209C9DC +.public _0209C9E4 +.public _0209C9F4 +.public _0209C9FC +.public _0209CA08 +.public _0209CA18 +.public _0209CA2C +.public _0209CA3C +.public _0209CA48 +.public _0209CA58 +.public _0209CA68 +.public _0209CA78 +.public _0209CA88 +.public _0209CA98 +.public _0209CAB4 +.public _0209CB0C +.public _0209CB3C +.public _0209CB4C +.public _0209CB6C +.public _0209CB78 +.public _0209CB88 +.public _0209CB98 +.public _0209CBA8 +.public _0209CBB0 +.public _0209CBB8 +.public _0209CBC0 +.public _0209CBC8 +.public _0209CBD0 +.public _0209CBD8 +.public _0209CBE0 +.public _0209CBE8 +.public _0209CC0C +.public _0209CC18 +.public _0209CC28 +.public _0209CC38 +.public _0209CC48 +.public _0209CC60 +.public _0209CC80 +.public _0209CC90 +.public _0209CCA0 +.public _0209CCB0 +.public _0209CCC0 +.public _0209CCD0 +.public _0209CCE0 +.public _0209CD4C +.public _0209CD6C +.public _0209CD84 +.public _0209CD94 +.public _0209CDA4 +.public _0209CDB8 +.public _0209CDD0 +.public _0209CDE0 +.public _0209CDF8 +.public _0209CE10 +.public _0209CE40 +.public _0209CE50 +.public _0209CE54 +.public _0209CE58 +.public _0209CE68 +.public _0209CE78 +.public _0209CE88 +.public _0209CE89 +.public _0209CEAC +.public _0209CF0C +.public _0209CF28 +.public _0209CF48 +.public _0209CF64 +.public _0209CF84 +.public _0209DF70 +.public _0209DFA0 +.public _0209DFC8 +.public _0209DFE8 +.public _0209E008 +.public _0209E010 +.public _0209E011 +.public _0209E264 +.public _0209E3A1 +.public _0209E3A2 +.public _0209E3A3 +.public _0209E6BD +.public _0209E912 +.public _020A0C68 +.public _020A0C69 +.public _020A0C6A +.public _020A0C6C +.public _020A0C6E +.public _020A1864 +.public _020A1880 +.public _020A1884 +.public _020A189C +.public _020A18C0 +.public _020A192C +.public _020A20B1 +.public _020A2808 +.public _020A281C +.public _020A2830 +.public _020A2844 +.public _020A2858 +.public _020A286C +.public _020A2880 +.public _020A2894 +.public _020A28A8 +.public _020A28E0 +.public _020A2904 +.public _020A2928 +.public _020A294C +.public _020A2970 +.public _020A2994 +.public _020A29B8 +.public _020A29DC +.public _020A2A00 +.public _020A2A24 +.public _020A2A48 +.public _020A2A6C +.public _020A2A90 +.public _020A2AB4 +.public _020A2AD8 +.public _020A2AFC +.public _020A2B20 +.public _020A2D09 +.public _020A31B8 +.public _020A31D4 +.public _020A31E4 +.public _020A31F4 +.public _020A31FC +.public _020A3200 +.public _020A3210 +.public _020A322C +.public _020A3248 +.public _020A3258 +.public _020A327C +.public _020A328C +.public _020A32D4 +.public _020A32F8 +.public _020A3330 +.public _020A45C8_JP +.public _020AFDB8 +.public _020AFDBC +.public _020AFDD0 +.public _020AFDD8 +.public _020AFDE0 +.public _020AFDE8 +.public _020AFDF0 +.public _020AFE40 +.public _020AFE58 +.public _020AFE5C +.public _020AFE70 +.public _020AFE74 +.public _020AFE78 +.public _020AFE7C +.public _020AFE8C +.public _020AFE90 +.public _020AFE98 +.public _020AFEA8 +.public _020AFEB4 +.public _020AFEC8 +.public _020AFECC +.public _020AFED0 +.public _020AFED4 +.public _020AFED8 +.public _020AFEDC +.public _020AFEE0 +.public _020AFEE4 +.public _020AFEE8 +.public _020AFEEC +.public _020AFEF4 +.public _020AFF00 +.public _020AFF14 +.public _020AFF38 +.public _020AFF40 +.public _020AFF4C +.public _020AFF54 +.public _020AFF5C +.public _020AFF64 +.public _020AFF68 +.public _020AFF6C +.public _020AFF7C +.public _020AFF80 +.public _020AFF88 +.public _020B09B0 +.public _020B09B4 +.public _020B09C0 +.public _020B09C8 +.public _020B09D0 +.public _020B12A0_JP +.public _020B12F4_EU +.public _020B1308_EU +.public _022AADF8 +.public _022AADFC +.public _022AAE00 +.public _022AAE2A +.public _022AAE2E +.public _022AAE4C +.public _022AAE58 +.public _022AAE64 +.public _022AAE68 +.public _022AAE70 +.public _022AAE74 +.public _022AAE78 +.public _022AAEA4 +.public _022AAEA8 +.public _022AAEAC +.public _022AB09C +.public _022AB0A0 +.public _022AB0A1 +.public _022AB0A2 +.public _022AB0A9 +.public _022AB0AC +.public _022AB4AC +.public _022AB4B0 +.public _022AB4F8 +.public _022AB4FC +.public _022AB510 +.public _022AB518 +.public _022AB5A8 +.public _022AB5AC +.public _022AB694 +.public _022AB69C +.public _022AB918 +.public _022AB924 +.public _022AB92C +.public _022AB930 +.public _022ABDE0 +.public _f2d +.public _fsub +.public _s32_div_f +.public memcpy +.public ov11_022E6E68 +.public ov11_023061CC +.public ov11_023061E4 +.public ov11_02306C64 +.public ov11_02306C9C +.public ov11_0230D000 +.public ov11_0230D220 +.public ov11_0230D71C +.public ov11_0230D92C +.public ov11_02310BDC +.public ov11_02310C18 +.public ov29_022E2A78 +.public ov29_022EA62C +.public ov29_023002F0 +.public ov29_02347100 +.public sprintf +.public strcat +.public strcpy +.public strlen +.public strncmp +.public strncpy +.public sub_01FF8F28 +.public sub_02001808 +.public sub_02002580 +.public sub_020027F8 +.public sub_0200302C +.public sub_020030FC +.public sub_02003B94 +.public sub_02003BC8 +.public sub_02004F80 +.public sub_020063F4 +.public sub_02006498 +.public sub_02006BFC +.public sub_02006C8C +.public sub_0200A124 +.public sub_0200A158 +.public sub_0200A184 +.public sub_0200A478 +.public sub_0200A4C4 +.public sub_0200A504 +.public sub_0200A510 +.public sub_0200A590 +.public sub_0200B2C4 +.public sub_0200B314 +.public sub_0200B330 +.public sub_0200B340 +.public sub_0200B3C0 +.public sub_0200B3D4 +.public sub_0200B3FC +.public sub_0200C4CC +.public sub_0200C5DC +.public sub_0200CABC +.public sub_0200CAD4 +.public sub_0200CAE4 +.public sub_0200D310 +.public sub_0200D65C +.public sub_0200D670 +.public sub_0200FD48 +.public sub_02010044 +.public sub_02010060 +.public sub_02010154 +.public sub_0201077C +.public sub_02010794 +.public sub_020107F4 +.public sub_02012AB8 +.public sub_02013190 +.public sub_020131F0 +.public sub_02013E54 +.public sub_02013F58 +.public sub_02015090 +.public sub_02017C50 +.public sub_02017C74 +.public sub_02017C80 +.public sub_0202059C +.public sub_020205C0 +.public sub_0202065C +.public sub_020236FC +.public sub_0202372C +.public sub_02024B94 +.public sub_02024D7C +.public sub_020251F0 +.public sub_02025304_JP +.public sub_02025888 +.public sub_02025C7C +.public sub_02025D50 +.public sub_02025E84 +.public sub_0202613C +.public sub_020261D4 +.public sub_02026204 +.public sub_02026268 +.public sub_020262E0 +.public sub_020264A4 +.public sub_020264F8 +.public sub_020265A8 +.public sub_02027180 +.public sub_02027B1C +.public sub_0202810C +.public sub_0202812C +.public sub_020282F4 +.public sub_02028324 +.public sub_02028354 +.public sub_0202836C +.public sub_020288DC +.public sub_020288FC +.public sub_02029F88 +.public sub_02029FBC +.public sub_0202A2A4 +.public sub_0202AAE8 +.public sub_0202AB80 +.public sub_0202ABB0 +.public sub_0202C1E4 +.public sub_0202C620 +.public sub_0202C654 +.public sub_0202C6D4 +.public sub_0202C748 +.public sub_0202C75C +.public sub_0202D068 +.public sub_0202D0EC +.public sub_0202D134 +.public sub_0202D16C +.public sub_0202D59C +.public sub_0202D5B0 +.public sub_0202D5E4 +.public sub_0202DF64 +.public sub_0202F16C +.public sub_0202F190 +.public sub_0202F2C4 +.public sub_0202F334 +.public sub_0202F3F8 +.public sub_0202F954 +.public sub_0202F9B8 +.public sub_020307EC +.public sub_020308E4 +.public sub_02030908 +.public sub_02030940 +.public sub_02030978 +.public sub_020309B8 +.public sub_02030A18 +.public sub_02030A50 +.public sub_02030A64 +.public sub_02030A74 +.public sub_02030A90 +.public sub_02030AAC +.public sub_02030EF0 +.public sub_0203111C +.public sub_0203115C +.public sub_0203117C +.public sub_020311D4 +.public sub_020311E8 +.public sub_02031220 +.public sub_02031888 +.public sub_0203189C +.public sub_020318D0 +.public sub_02031914 +.public sub_020347A0 +.public sub_020347F0 +.public sub_02034840 +.public sub_020348E4 +.public sub_02054F18 +.public sub_02054FB8 +.public sub_02054FEC +.public sub_02055020 +.public sub_020550DC +.public sub_020550E0 +.public sub_02055118 +.public sub_02055B78 +.public sub_02055D4C +.public sub_020560B8 +.public sub_02056228 +.public sub_0205633C +.public sub_02056360 +.public sub_02056410 +.public sub_02056460 +.public sub_020564B0 +.public sub_02056504 +.public sub_020568A4 +.public sub_02056B58 +.public sub_02056BD4 +.public sub_02056F60 +.public sub_02058460 +.public sub_020584F8 +.public sub_020584FC +.public sub_020597B0 +.public sub_02059A74 +.public sub_02059B08 +.public sub_0205A4B4 +.public sub_0205B028 +.public sub_0205B0A0 +.public sub_0205B0B8 +.public sub_0205B478 +.public sub_0205B77C +.public sub_0205BB7C +.public sub_0205BD14 +.public sub_0205BD9C +.public sub_0205BFB0 +.public sub_0205C2A4 +.public sub_0205C548 +.public sub_0205C75C +.public sub_0205EE40 +.public sub_0205F00C +.public sub_0205FAB0 +.public sub_0205FC20 +.public sub_0205FD88 +.public sub_0205FE80 +.public sub_02062B64 +.public sub_0206637C +.public sub_02079094 +.public sub_0207B9EC +.public sub_0208346C +.public sub_0208347C +.public sub_02083A18 +.public sub_02083B00 +.public sub_02083B14 +.public sub_02083B3C +.public sub_02084304 +.public vsprintf diff --git a/asm/include/overlay_31.inc b/asm/include/overlay_31_02382FBC.inc similarity index 71% rename from asm/include/overlay_31.inc rename to asm/include/overlay_31_02382FBC.inc index fe04cd82..f1470f51 100644 --- a/asm/include/overlay_31.inc +++ b/asm/include/overlay_31_02382FBC.inc @@ -1,5 +1,4 @@ #pragma once -.public _020A1870 .public AddDungeonSubMenuOption .public AdvanceFrame .public AiMovement @@ -11,7 +10,6 @@ .public BaseFormsEqual .public CanAiUseMove .public CanMonsterSpawn -.public CeilFixedPoint .public CheckTeamMemberIdxVeneer .public CheckVariousConditions .public CheckVariousStatuses2 @@ -33,19 +31,48 @@ .public CreateScrollBoxSingle .public CreateTextBox .public CreateTextBoxWithArg +.public DUNGEON_PTR +.public DUNGEON_SUBMENU_ITEMS_1 +.public DUNGEON_SUBMENU_ITEMS_5 +.public DUNGEON_SUBMENU_ITEMS_6 +.public DUNGEON_WINDOW_PARAMS_10 +.public DUNGEON_WINDOW_PARAMS_11 +.public DUNGEON_WINDOW_PARAMS_12 +.public DUNGEON_WINDOW_PARAMS_13 +.public DUNGEON_WINDOW_PARAMS_14 +.public DUNGEON_WINDOW_PARAMS_15 +.public DUNGEON_WINDOW_PARAMS_16 +.public DUNGEON_WINDOW_PARAMS_17 +.public DUNGEON_WINDOW_PARAMS_18 +.public DUNGEON_WINDOW_PARAMS_19 +.public DUNGEON_WINDOW_PARAMS_20 +.public DUNGEON_WINDOW_PARAMS_21 +.public DUNGEON_WINDOW_PARAMS_22 +.public DUNGEON_WINDOW_PARAMS_23 +.public DUNGEON_WINDOW_PARAMS_24 +.public DUNGEON_WINDOW_PARAMS_25 +.public DUNGEON_WINDOW_PARAMS_26 +.public DUNGEON_WINDOW_PARAMS_27 +.public DUNGEON_WINDOW_PARAMS_28 +.public DUNGEON_WINDOW_PARAMS_29 +.public DUNGEON_WINDOW_PARAMS_30 +.public DUNGEON_WINDOW_PARAMS_31 +.public DUNGEON_WINDOW_PARAMS_32 +.public DUNGEON_WINDOW_PARAMS_5 +.public DUNGEON_WINDOW_PARAMS_6 +.public DUNGEON_WINDOW_PARAMS_7 +.public DUNGEON_WINDOW_PARAMS_8 +.public DUNGEON_WINDOW_PARAMS_9 .public Debug_Print0 .public DisableDungeonSubMenuOption .public DisplayMessage .public DrawTextInWindow .public DrawTileGrid -.public DUNGEON_PTR .public FormatMoveString .public FormatMoveStringMore .public GetActiveTeamMember -.public GetApparentWeather .public GetCurrentBagCapacity .public GetDexNumber -.public GetFloorType .public GetItemAction .public GetItemCategoryVeneer .public GetItemInfo @@ -57,7 +84,6 @@ .public GetLeaderChangeFlag .public GetLeaderMonster .public GetMaxPp -.public GetMoneyCarried .public GetMonsterIdFromSpawnEntry .public GetMonsterName .public GetNbItemsInBag @@ -70,7 +96,6 @@ .public GetTile .public GetTrapInfo .public GetUnlockedTactics -.public GetWindow .public GetWindowRectangle .public HideTileGrid .public InitPreprocessorArgs @@ -91,12 +116,48 @@ .public JoinedAtRangeCheck2Veneer .public LogMessageByIdWithPopupCheckUser .public MemAlloc -.public memcpy .public MemFree -.public memset .public MemZero .public MonsterCanThrowItems .public MonsterHasEmbargoStatus +.public OVERLAY31_JP_STRING +.public OVERLAY31_UNKNOWN_POINTER__NA_238A268 +.public OVERLAY31_UNKNOWN_POINTER__NA_238A26C +.public OVERLAY31_UNKNOWN_POINTER__NA_238A270 +.public OVERLAY31_UNKNOWN_POINTER__NA_238A27C +.public OVERLAY31_UNKNOWN_POINTER__NA_238A280 +.public OVERLAY31_UNKNOWN_POINTER__NA_238A284 +.public OVERLAY31_UNKNOWN_POINTER__NA_238A288 +.public OVERLAY31_UNKNOWN_POINTER__NA_238A28C +.public OVERLAY31_UNKNOWN_STRING_IDS +.public OVERLAY31_UNKNOWN_STRUCT__NA_2389EF0 +.public OVERLAY31_UNKNOWN_STRUCT__NA_2389FE8 +.public OVERLAY31_UNKNOWN_STRUCT__NA_238A144 +.public OVERLAY31_UNKNOWN_STRUCT__NA_238A190 +.public PlaySeVolumeWrapper +.public PlayWindowInputSound +.public PopInventoryMenuField0x1A3 +.public PositionHasItem +.public PreprocessString +.public PreprocessStringFromId +.public PrintIqSkillsMenu +.public ResumeParentMenu +.public SetAdvancedTextBoxField0x1C2 +.public SetAdvancedTextBoxField0x1C4 +.public SetAdvancedTextBoxState5 +.public SetMonsterActionFields +.public ShowStringInDialogueBox +.public SortItemsInBag +.public SpecificRecruitCheck +.public StringFromId +.public TeamMemberHasEnabledIqSkill +.public TryPointCameraToMonster +.public UpdateMapSurveyorFlag +.public UpdateWindow +.public YesNoMenu +.public _020A1870 +.public memcpy +.public memset .public ov10_022BCC60 .public ov10_022BCC7C .public ov10_022BCCB0 @@ -107,9 +168,7 @@ .public ov10_022BCE44 .public ov10_022BD394 .public ov10_022BD474 -.public ov29_02056264 .public ov29_022E08F4 -.public ov29_022E0C2C .public ov29_022E1618 .public ov29_022E1620 .public ov29_022E2A78 @@ -156,39 +215,45 @@ .public ov29_0234F77C .public ov29_0234FB50 .public ov29_0234FB60 -.public ov29_0234FB6C .public ov29_0234FBD4 .public ov29_0235352C .public ov29_0237C91C .public ov29_0238280C -.public OVERLAY31_UNKNOWN_STRING_IDS -.public PlaySeVolumeWrapper -.public PlayWindowInputSound -.public PopInventoryMenuField0x1A3 -.public PositionHasItem -.public PositionIsOnHiddenStairs -.public PreprocessString -.public PreprocessStringFromId -.public PrintIqSkillsMenu -.public ResumeParentMenu -.public SetAdvancedTextBoxField0x1C2 -.public SetAdvancedTextBoxField0x1C4 -.public SetAdvancedTextBoxState5 -.public SetMonsterActionFields -.public ShouldMonsterRunAwayVariation -.public ShowStringInDialogueBox -.public SortItemsInBag -.public SpecificRecruitCheck +.public ov31_02382B54 +.public ov31_02382DAC +.public ov31_02382F68 +.public ov31_02389E22 +.public ov31_02389F5C +.public ov31_0238A044 +.public ov31_0238A04C +.public ov31_0238A054 +.public ov31_0238A05C +.public ov31_0238A064 +.public ov31_0238A06C +.public ov31_0238A074 +.public ov31_0238A07C +.public ov31_0238A084 +.public ov31_0238A0A8 +.public ov31_0238A0B0 +.public ov31_0238A0B8 +.public ov31_0238A0C0 +.public ov31_0238A0C8 +.public ov31_0238A0D0 +.public ov31_0238A0D8 +.public ov31_0238A0E0 +.public ov31_0238A0E8 +.public ov31_0238A154 +.public ov31_0238A228 +.public ov31_0238A23C +.public ov31_0238A2A0 +.public ov31_0238A2A8 .public strcpy -.public StringFromId .public sub_02001808 .public sub_0200B3D4 .public sub_0200D310 .public sub_0200D894 .public sub_02017C74 .public sub_02017C80 -.public sub_02025888 -.public sub_020265A8 .public sub_02027B1C .public sub_0202810C .public sub_0202812C @@ -216,7 +281,6 @@ .public sub_0203FD14 .public sub_0203FD38 .public sub_0203FD44 -.public sub_0203FE5C .public sub_0204018C .public sub_0204019C .public sub_020407C0 @@ -237,14 +301,8 @@ .public sub_020420F4 .public sub_0204AEA0 .public sub_0204F10C -.public sub_0204F9E0 .public sub_02053CA0 .public sub_02054F44 .public sub_02056228 .public sub_020585B4 -.public TeamMemberHasEnabledIqSkill -.public TryPointCameraToMonster -.public UpdateMapSurveyorFlag -.public UpdateWindow .public vsprintf -.public YesNoMenu diff --git a/asm/main_02034974.s b/asm/main_02034974.s new file mode 100644 index 00000000..77214bdc --- /dev/null +++ b/asm/main_02034974.s @@ -0,0 +1,41015 @@ + .include "asm/macros.inc" + .include "main_02034974.inc" + + .text + + arm_func_start sub_02034974 +sub_02034974: ; 0x02034974 + stmdb sp!, {r4, r5, r6, lr} + ldr r3, _02034A34 ; =_020AFDB8 + mov r5, r1 + ldr r1, [r3] + mov r6, r0 + add r1, r1, #0xc4 + mov r4, r2 + bl sub_020347A0 + cmp r0, #0 + bne _02034A2C + ldr r0, _02034A34 ; =_020AFDB8 + ldr r1, [r0] + ldrb r0, [r1, #0x10] + cmp r0, #0 + beq _020349C8 + mov r0, r6 + add r1, r1, #0x14 + bl sub_020347A0 + cmp r0, #0 + movne r0, #0 + ldmneia sp!, {r4, r5, r6, pc} +_020349C8: + ldr ip, _02034A34 ; =_020AFDB8 + mov r2, #1 + ldr r0, [ip] + mov r1, #0 + strb r2, [r0, #0x10] + ldr r0, [ip] + cmp r4, #0 + strb r1, [r0, #0xc0] + ldr lr, [ip] + ldmia r6, {r0, r1, r2, r3} + add r6, lr, #0x14 + stmia r6, {r0, r1, r2, r3} + str r5, [lr, #0x24] + beq _02034A24 + ldr r0, [ip] + mov r5, #9 + add r6, r0, #0x28 +_02034A0C: + ldmia r4!, {r0, r1, r2, r3} + stmia r6!, {r0, r1, r2, r3} + subs r5, r5, #1 + bne _02034A0C + ldmia r4, {r0, r1} + stmia r6, {r0, r1} +_02034A24: + mov r0, #1 + ldmia sp!, {r4, r5, r6, pc} +_02034A2C: + mov r0, #0 + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_02034A34: .word _020AFDB8 + arm_func_end sub_02034974 + + arm_func_start sub_02034A38 +sub_02034A38: ; 0x02034A38 + stmdb sp!, {r3, r4, r5, lr} + ldr r1, _02034A7C ; =_020AFDB8 + mov r5, r0 + ldr r4, [r1] + ldr r0, [r4, #0x24] + cmp r0, #0 + beq _02034A74 + add lr, r4, #0x28 + mov ip, #9 +_02034A5C: + ldmia lr!, {r0, r1, r2, r3} + stmia r5!, {r0, r1, r2, r3} + subs ip, ip, #1 + bne _02034A5C + ldmia lr, {r0, r1} + stmia r5, {r0, r1} +_02034A74: + ldr r0, [r4, #0x24] + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_02034A7C: .word _020AFDB8 + arm_func_end sub_02034A38 + + arm_func_start sub_02034A80 +sub_02034A80: ; 0x02034A80 + stmdb sp!, {r4, r5, r6, lr} + sub sp, sp, #0x10 + ldr r0, _02034C9C ; =_020AFDB8 + ldr ip, [r0] + ldr r0, [ip, #0xd4] + add r4, ip, #0xc4 + cmp r0, #1 + beq _02034AAC + cmp r0, #2 + beq _02034B6C + b _02034BE4 +_02034AAC: + ldrb r0, [ip, #0x10] + cmp r0, #0 + beq _02034AD8 + add r6, ip, #0x14 + ldmia r6, {r0, r1, r2, r3} + stmia r4, {r0, r1, r2, r3} + ldr r0, _02034CA0 ; =_0209B08C + mov r5, #0 + ldmia r0, {r0, r1, r2, r3} + stmia r6, {r0, r1, r2, r3} + strb r5, [ip, #0x10] +_02034AD8: + ldr ip, _02034C9C ; =_020AFDB8 + ldr r6, [ip] + ldrb r0, [r6, #0xc0] + cmp r0, #0 + beq _02034B0C + ldr r0, _02034CA0 ; =_0209B08C + mov r5, #0 + ldmia r0, {r0, r1, r2, r3} + stmia r4, {r0, r1, r2, r3} + strb r5, [r6, #0xc0] + ldr r0, [ip] + str r5, [r0, #0xd4] + b _02034C94 +_02034B0C: + ldr r0, [r4] + bl OverlayIsLoaded + cmp r0, #0 + bne _02034B34 + ldr r0, [r4] + bl LoadOverlay + ldr r0, _02034C9C ; =_020AFDB8 + mov r1, #1 + ldr r0, [r0] + strb r1, [r0, #0xd8] +_02034B34: + ldr r0, [r4, #4] + cmp r0, #0 + beq _02034B5C + blx r0 + cmp r0, #0 + ldreq r0, _02034C9C ; =_020AFDB8 + moveq r1, #3 + ldreq r0, [r0] + streq r1, [r0, #0xd4] + beq _02034C94 +_02034B5C: + ldr r0, _02034C9C ; =_020AFDB8 + mov r1, #2 + ldr r0, [r0] + str r1, [r0, #0xd4] +_02034B6C: + add r5, sp, #0 + ldmia r4, {r0, r1, r2, r3} + stmia r5, {r0, r1, r2, r3} + ldr r0, [r4, #0xc] + blx r0 + mov r5, r0 + sub r0, r5, #3 + cmp r0, #1 + bhi _02034BE4 + add r1, sp, #0 + mov r0, r4 + bl sub_020347A0 + cmp r0, #0 + beq _02034BE4 + ldr r0, _02034C9C ; =_020AFDB8 + mov r1, #3 + ldr r0, [r0] + cmp r5, #4 + str r1, [r0, #0xd4] + bne _02034BE4 + bl sub_020347F0 + ldr r0, _02034CA0 ; =_0209B08C + ldr ip, _02034C9C ; =_020AFDB8 + ldmia r0, {r0, r1, r2, r3} + stmia r4, {r0, r1, r2, r3} + ldr r0, [ip] + mov r1, #0 + strb r1, [r0, #0xc0] + ldr r0, [ip] + str r1, [r0, #0xd4] +_02034BE4: + ldr r0, _02034C9C ; =_020AFDB8 + ldr r1, [r0] + ldrb r0, [r1, #0x10] + cmp r0, #0 + beq _02034C4C + ldr r0, _02034CA0 ; =_0209B08C + mov r1, r4 + bl sub_020347A0 + cmp r0, #0 + bne _02034C10 + bl sub_020347F0 +_02034C10: + ldr ip, _02034C9C ; =_020AFDB8 + mov r5, #0 + ldr r6, [ip] + ldr lr, _02034CA0 ; =_0209B08C + add r0, r6, #0x14 + ldmia r0, {r0, r1, r2, r3} + stmia r4, {r0, r1, r2, r3} + strb r5, [r6, #0x10] + ldr ip, [ip] + ldmia lr, {r0, r1, r2, r3} + add r4, ip, #0x14 + stmia r4, {r0, r1, r2, r3} + mov r0, #1 + str r0, [ip, #0xd4] + b _02034C94 +_02034C4C: + ldrb r0, [r1, #0xc0] + cmp r0, #0 + beq _02034C94 + ldr r0, _02034CA0 ; =_0209B08C + mov r1, r4 + bl sub_020347A0 + cmp r0, #0 + bne _02034C70 + bl sub_020347F0 +_02034C70: + ldr r0, _02034CA0 ; =_0209B08C + ldr ip, _02034C9C ; =_020AFDB8 + ldmia r0, {r0, r1, r2, r3} + stmia r4, {r0, r1, r2, r3} + ldr r0, [ip] + mov r1, #0 + strb r1, [r0, #0xc0] + ldr r0, [ip] + str r1, [r0, #0xd4] +_02034C94: + add sp, sp, #0x10 + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_02034C9C: .word _020AFDB8 +_02034CA0: .word _0209B08C + arm_func_end sub_02034A80 + + arm_func_start sub_02034CA4 +sub_02034CA4: ; 0x02034CA4 + stmdb sp!, {r3, lr} + ldr r0, _02034D08 ; =_020AFDBC + ldr r1, [r0, #8] + cmp r1, #0 + beq _02034CE4 + ldr r1, [r0, #0xc] + ldrb r0, [r1, #0x480] + cmp r0, #0 + bne _02034D00 + ldr r0, [r1, #0x10] + cmp r0, #0 + moveq r0, #3 + streq r0, [r1, #0x10] + beq _02034D00 + mov r0, #0 + ldmia sp!, {r3, pc} +_02034CE4: + ldr r0, [r0, #0xc] + cmp r0, #0 + beq _02034D00 + bl MemFree + ldr r0, _02034D08 ; =_020AFDBC + mov r1, #0 + str r1, [r0, #0xc] +_02034D00: + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_02034D08: .word _020AFDBC + arm_func_end sub_02034CA4 + + arm_func_start sub_02034D0C +sub_02034D0C: ; 0x02034D0C + stmdb sp!, {r3, lr} + ldr r0, _02034D4C ; =_020AFDBC + ldr r1, [r0, #8] + ldr r0, [r0, #0xc] + cmp r1, #0 + movne r1, #1 + strneb r1, [r0, #0x480] + bne _02034D44 + cmp r0, #0 + beq _02034D44 + bl MemFree + ldr r0, _02034D4C ; =_020AFDBC + mov r1, #0 + str r1, [r0, #0xc] +_02034D44: + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_02034D4C: .word _020AFDBC + arm_func_end sub_02034D0C + + arm_func_start sub_02034D50 +sub_02034D50: ; 0x02034D50 + stmdb sp!, {r3, lr} + ldr r0, _02034DA0 ; =_020AFDBC + ldr r0, [r0, #0xc] + cmp r0, #0 + ldmneia sp!, {r3, pc} + ldr r0, _02034DA4 ; =0x00000484 + mov r1, #8 + bl MemAlloc + ldr r1, _02034DA0 ; =_020AFDBC + str r0, [r1, #0xc] + bl InitPortraitParams + ldr r0, _02034DA0 ; =_020AFDBC + mov r2, #0 + ldr r1, [r0, #0xc] + str r2, [r1, #0x10] + ldr r1, [r0, #0xc] + str r2, [r1, #0x468] + ldr r0, [r0, #0xc] + strb r2, [r0, #0x480] + ldmia sp!, {r3, pc} + .align 2, 0 +_02034DA0: .word _020AFDBC +_02034DA4: .word 0x00000484 + arm_func_end sub_02034D50 + + arm_func_start sub_02034DA8 +sub_02034DA8: ; 0x02034DA8 + stmdb sp!, {r3, lr} + ldr r0, _02034E20 ; =_020AFDBC + ldr r2, [r0, #8] + cmp r2, #0 + beq _02034DE4 + ldr r1, [r0, #0xc] + ldrb r0, [r1, #0x480] + cmp r0, #0 + movne r0, #1 + ldmneia sp!, {r3, pc} + ldr r0, [r1, #0x10] + cmp r0, #0 + movne r0, #1 + ldreqb r0, [r2, #8] + ldmia sp!, {r3, pc} +_02034DE4: + ldr r0, [r0, #0xc] + cmp r0, #0 + beq _02034E04 + ldr r0, [r0, #0x10] + cmp r0, #0 + beq _02034E18 + mov r0, #1 + ldmia sp!, {r3, pc} +_02034E04: + ldr r0, _02034E24 ; =_0209B09C + bl sub_02034840 + cmp r0, #0 + movne r0, #1 + ldmneia sp!, {r3, pc} +_02034E18: + mov r0, #0 + ldmia sp!, {r3, pc} + .align 2, 0 +_02034E20: .word _020AFDBC +_02034E24: .word _0209B09C + arm_func_end sub_02034DA8 + + arm_func_start sub_02034E28 +sub_02034E28: ; 0x02034E28 + stmdb sp!, {r4, lr} + mov r4, r0 + bl sub_02034D50 + cmp r4, #0 + ldrne ip, _02034E5C ; =_020AFDBC + ldmneia r4, {r0, r1, r2, r3} + ldrne ip, [ip, #0xc] + stmneia ip, {r0, r1, r2, r3} + ldmneia sp!, {r4, pc} + ldr r0, _02034E5C ; =_020AFDBC + ldr r0, [r0, #0xc] + bl InitPortraitParams + ldmia sp!, {r4, pc} + .align 2, 0 +_02034E5C: .word _020AFDBC + arm_func_end sub_02034E28 + + arm_func_start sub_02034E60 +sub_02034E60: ; 0x02034E60 + ldr r2, _02034E6C ; =_020AFDBC + stmia r2, {r0, r1} + bx lr + .align 2, 0 +_02034E6C: .word _020AFDBC + arm_func_end sub_02034E60 + + arm_func_start sub_02034E70 +sub_02034E70: ; 0x02034E70 + ldr r0, _02034EB0 ; =_020AFDBC + ldr r1, [r0, #0xc] + cmp r1, #0 + beq _02034EA8 + ldrb r0, [r1, #0x480] + cmp r0, #0 + bne _02034EA8 + ldr r0, [r1, #0x10] + cmp r0, #0 + moveq r0, #4 + streq r0, [r1, #0x10] + beq _02034EA8 + mov r0, #0 + bx lr +_02034EA8: + mov r0, #1 + bx lr + .align 2, 0 +_02034EB0: .word _020AFDBC + arm_func_end sub_02034E70 + + arm_func_start sub_02034EB4 +sub_02034EB4: ; 0x02034EB4 + stmdb sp!, {r4, r5, r6, lr} + mov r6, r0 + mov r5, r1 + mov r4, r2 + bl sub_02034D50 + ldr r0, _02034F18 ; =_020AFDBC + mov r1, r4 + ldr r2, [r0, #0xc] + strh r6, [r2, #0x14] + ldr r2, [r0, #0xc] + strh r5, [r2, #0x16] + ldr r0, [r0, #0xc] + add r0, r0, #0x18 + bl sub_020236FC + ldr r1, _02034F18 ; =_020AFDBC + ldr r0, _02034F1C ; =_0209B09C + ldr r1, [r1, #0xc] + mov r2, #1 + str r2, [r1, #0x10] + bl sub_02034840 + cmp r0, #0 + ldmneia sp!, {r4, r5, r6, pc} + ldr r0, _02034F1C ; =_0209B09C + bl sub_020348E4 + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_02034F18: .word _020AFDBC +_02034F1C: .word _0209B09C + arm_func_end sub_02034EB4 + + arm_func_start sub_02034F20 +sub_02034F20: ; 0x02034F20 + stmdb sp!, {r4, r5, r6, lr} + mov r6, r0 + mov r5, r1 + mov r4, r2 + bl sub_02034D50 + ldr r0, _02034F90 ; =_020AFDBC + mov r1, r5 + ldr r2, [r0, #0xc] + strh r6, [r2, #0x14] + ldr r0, [r0, #0xc] + add r0, r0, #0x68 + bl strcpy + ldr r0, _02034F90 ; =_020AFDBC + mov r1, r4 + ldr r0, [r0, #0xc] + add r0, r0, #0x18 + bl sub_020236FC + ldr r1, _02034F90 ; =_020AFDBC + ldr r0, _02034F94 ; =_0209B09C + ldr r1, [r1, #0xc] + mov r2, #2 + str r2, [r1, #0x10] + bl sub_02034840 + cmp r0, #0 + ldmneia sp!, {r4, r5, r6, pc} + ldr r0, _02034F94 ; =_0209B09C + bl sub_020348E4 + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_02034F90: .word _020AFDBC +_02034F94: .word _0209B09C + arm_func_end sub_02034F20 + + arm_func_start sub_02034F98 +sub_02034F98: ; 0x02034F98 + stmdb sp!, {r3, lr} + ldr r0, _0203501C ; =_020AFDBC + ldr r2, [r0, #8] + cmp r2, #0 + beq _02034FE8 + ldr r1, [r0, #0xc] + ldrb r0, [r1, #0x480] + cmp r0, #0 + movne r0, #1 + ldmneia sp!, {r3, pc} + ldr r0, [r1, #0x468] + cmp r0, #0 + movne r0, #1 + ldmneia sp!, {r3, pc} + ldrsb r1, [r2] + mvn r0, #1 + cmp r1, r0 + moveq r0, #0 + ldrneb r0, [r2, #9] + ldmia sp!, {r3, pc} +_02034FE8: + ldr r0, _02035020 ; =_0209B09C + bl sub_02034840 + cmp r0, #0 + movne r0, #1 + ldmneia sp!, {r3, pc} + ldr r0, _0203501C ; =_020AFDBC + ldr r0, [r0, #0xc] + cmp r0, #0 + ldrne r0, [r0, #0x468] + cmpne r0, #0 + movne r0, #1 + moveq r0, #0 + ldmia sp!, {r3, pc} + .align 2, 0 +_0203501C: .word _020AFDBC +_02035020: .word _0209B09C + arm_func_end sub_02034F98 + + arm_func_start sub_02035024 +sub_02035024: ; 0x02035024 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r7, r0 + mov r6, r1 + mov r5, r2 + mov r4, r3 + bl sub_02034D50 + ldr r1, _02035090 ; =_020AFDBC + mov r0, #0 + str r0, [r1, #0x10] + ldr r0, [r1, #0xc] + mov r3, #2 + str r7, [r0, #0x46c] + ldr r2, [r1, #0xc] + ldr r0, _02035094 ; =_0209B09C + str r6, [r2, #0x474] + ldr r2, [r1, #0xc] + str r5, [r2, #0x478] + ldr r2, [r1, #0xc] + str r3, [r2, #0x468] + ldr r1, [r1, #0xc] + str r4, [r1, #0x47c] + bl sub_02034840 + cmp r0, #0 + ldmneia sp!, {r3, r4, r5, r6, r7, pc} + ldr r0, _02035094 ; =_0209B09C + bl sub_020348E4 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_02035090: .word _020AFDBC +_02035094: .word _0209B09C + arm_func_end sub_02035024 + + arm_func_start sub_02035098 +sub_02035098: ; 0x02035098 + stmdb sp!, {r3, lr} + ldr r0, _020350D0 ; =_020AFDBC + ldr r0, [r0, #8] + cmp r0, #0 + ldrnesb r0, [r0] + mvnne r1, #1 + cmpne r0, r1 + beq _020350C4 + bl GetSimpleMenuResult + ldr r1, _020350D0 ; =_020AFDBC + str r0, [r1, #0x10] +_020350C4: + ldr r0, _020350D0 ; =_020AFDBC + ldr r0, [r0, #0x10] + ldmia sp!, {r3, pc} + .align 2, 0 +_020350D0: .word _020AFDBC + arm_func_end sub_02035098 + arm_func_start sub_020350D4 +sub_020350D4: ; 0x020350D4 + stmdb sp!, {r3, lr} + mov r0, #0xc + mov r1, #8 + bl MemAlloc + ldr r2, _02035150 ; =_020AFDBC + mov ip, #0 + str r0, [r2, #8] + str ip, [r0, #4] + ldr r1, [r2, #8] + mov r0, ip + strb ip, [r1, #8] + ldr r3, [r2, #8] + mov r1, #3 + strb ip, [r3, #9] + ldr r3, [r2, #8] + mov r2, #1 + strb ip, [r3, #0xa] + bl CreatePortraitBox + ldr r1, _02035150 ; =_020AFDBC + ldr r1, [r1, #8] + strb r0, [r1, #2] + mov r0, #0 + bl CreateDialogueBox + ldr r1, _02035150 ; =_020AFDBC + mvn r2, #1 + ldr r3, [r1, #8] + strb r0, [r3, #1] + ldr r1, [r1, #8] + mov r0, #1 + strb r2, [r1] + ldmia sp!, {r3, pc} + .align 2, 0 +_02035150: .word _020AFDBC + arm_func_end sub_020350D4 + + arm_func_start sub_02035154 +sub_02035154: ; 0x02035154 + stmdb sp!, {r3, lr} + ldr r0, _020351D8 ; =_020AFDBC + ldr r0, [r0, #8] + cmp r0, #0 + beq _020351B4 + ldrsb r0, [r0] + mvn r1, #1 + cmp r0, r1 + beq _0203517C + bl CloseSimpleMenu +_0203517C: + ldr r0, _020351D8 ; =_020AFDBC + ldr r0, [r0, #8] + ldrsb r0, [r0, #1] + bl CloseDialogueBox + ldr r0, _020351D8 ; =_020AFDBC + ldr r0, [r0, #8] + ldrsb r0, [r0, #2] + bl ClosePortraitBox + ldr r0, _020351D8 ; =_020AFDBC + ldr r0, [r0, #8] + bl MemFree + ldr r0, _020351D8 ; =_020AFDBC + mov r1, #0 + str r1, [r0, #8] +_020351B4: + ldr r0, _020351D8 ; =_020AFDBC + ldr r0, [r0, #0xc] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + bl MemFree + ldr r0, _020351D8 ; =_020AFDBC + mov r1, #0 + str r1, [r0, #0xc] + ldmia sp!, {r3, pc} + .align 2, 0 +_020351D8: .word _020AFDBC + arm_func_end sub_02035154 + + arm_func_start sub_020351DC +sub_020351DC: ; 0x020351DC + stmdb sp!, {r3, r4, lr} + sub sp, sp, #0x9c + ldr r0, _02035598 ; =_020AFDBC + ldr r2, [r0, #8] + ldr r1, [r2, #4] + cmp r1, #0 + beq _02035204 + cmp r1, #1 + beq _02035574 + b _0203558C +_02035204: + ldr r3, [r0, #0xc] + ldr r0, [r3, #0x10] + cmp r0, #0 + beq _020352E0 + cmp r0, #4 + addls pc, pc, r0, lsl #2 + b _02035290 +_02035220: ; jump table + b _02035290 ; case 0 + b _02035234 ; case 1 + b _0203525C ; case 2 + b _02035290 ; case 3 + b _02035284 ; case 4 +_02035234: + ldrsb r0, [r2, #1] + ldrh r1, [r3, #0x14] + ldrh r2, [r3, #0x16] + add r3, r3, #0x18 + bl ShowStringIdInDialogueBox + ldr r0, _02035598 ; =_020AFDBC + mov r1, #1 + ldr r0, [r0, #8] + strb r1, [r0, #0xa] + b _02035298 +_0203525C: + ldrsb r0, [r2, #1] + ldrh r1, [r3, #0x14] + add r2, r3, #0x68 + add r3, r3, #0x18 + bl ShowStringInDialogueBox + ldr r0, _02035598 ; =_020AFDBC + mov r1, #1 + ldr r0, [r0, #8] + strb r1, [r0, #0xa] + b _02035298 +_02035284: + ldrsb r0, [r2, #1] + bl sub_0202F3F8 + b _02035298 +_02035290: + ldrsb r0, [r2, #1] + bl sub_0202F2C4 +_02035298: + ldr r2, _02035598 ; =_020AFDBC + ldr r1, [r2, #8] + ldrb r0, [r1, #0xa] + cmp r0, #0 + beq _020352C8 + ldr r0, [r2, #0xc] + ldrh r0, [r0, #0x14] + tst r0, #0x20 + beq _020352C8 + ldrsb r0, [r1, #1] + ldmia r2, {r1, r2} + bl sub_0202F190 +_020352C8: + ldr r0, _02035598 ; =_020AFDBC + mov r1, #0 + ldr r0, [r0, #0xc] + mov r4, #1 + str r1, [r0, #0x10] + b _020352EC +_020352E0: + ldrsb r0, [r2, #1] + bl IsDialogueBoxActive + mov r4, r0 +_020352EC: + ldr r0, _02035598 ; =_020AFDBC + ldr r1, [r0, #8] + strb r4, [r1, #8] + ldr r2, [r0, #0xc] + ldr r1, [r2, #0x468] + cmp r1, #0 + beq _02035408 + ldr r1, [r2, #0x478] + str r1, [sp, #4] + ldr r1, [r2, #0x46c] + orr r1, r1, #0x20 + str r1, [r2, #0x46c] + ldr r1, [r0, #0xc] + ldr r0, [r1, #0x46c] + tst r0, #0x8000 + moveq r4, #8 + beq _02035350 + orr r0, r0, #0x1800 + orr r0, r0, #0x40000 + str r0, [r1, #0x46c] + mov r1, #0 + mov r0, #0x10 + strh r1, [sp, #0xc] + str r0, [sp, #0x10] + mov r4, #5 +_02035350: + ldr r0, _02035598 ; =_020AFDBC + mvn r1, #1 + ldr r0, [r0, #8] + ldrsb r0, [r0] + cmp r0, r1 + beq _0203536C + bl CloseSimpleMenu +_0203536C: + ldr r0, _02035598 ; =_020AFDBC + ldr r2, [r0, #0xc] + ldr r0, [r2, #0x468] + str r4, [sp] + cmp r0, #1 + mov r0, #0 + ldr r1, [r2, #0x46c] + bne _020353A0 + ldr r3, [r2, #0x470] + add r2, sp, #4 + bl CreateSimpleMenuFromStringIds + ldr r1, _02035598 ; =_020AFDBC + b _020353B0 +_020353A0: + ldr r3, [r2, #0x474] + add r2, sp, #4 + bl CreateSimpleMenu + ldr r1, _02035598 ; =_020AFDBC +_020353B0: + ldr r1, [r1, #8] + strb r0, [r1] + ldr r0, _02035598 ; =_020AFDBC + ldr r0, [r0, #8] + ldrsb r0, [r0, #1] + bl ShowDialogueBox + ldr r0, _02035598 ; =_020AFDBC + ldr r1, [r0, #0xc] + ldr r1, [r1, #0x47c] + cmp r1, #0 + ble _020353E8 + ldr r0, [r0, #8] + ldrsb r0, [r0] + bl SetSimpleMenuField0x1AC +_020353E8: + ldr r0, _02035598 ; =_020AFDBC + mov r2, #0 + ldr r1, [r0, #0xc] + mov r4, #1 + str r2, [r1, #0x468] + ldr r0, [r0, #8] + strb r4, [r0, #9] + b _02035468 +_02035408: + ldr r0, [r0, #8] + mvn r1, #1 + ldrsb r0, [r0] + cmp r0, r1 + beq _02035468 + bl GetSimpleMenuResult + ldr r1, _02035598 ; =_020AFDBC + mov r4, #1 + str r0, [r1, #0x10] + ldr r0, [r1, #8] + strb r4, [r0, #9] + ldr r0, [r1, #8] + ldrsb r0, [r0] + bl IsSimpleMenuActive + cmp r0, #0 + bne _02035468 + ldr r0, _02035598 ; =_020AFDBC + ldr r0, [r0, #8] + ldrsb r0, [r0] + bl CloseSimpleMenu + ldr r0, _02035598 ; =_020AFDBC + mvn r1, #1 + ldr r0, [r0, #8] + strb r1, [r0] +_02035468: + ldr r0, _02035598 ; =_020AFDBC + ldr r1, [r0, #0xc] + ldrb r1, [r1, #0x480] + cmp r1, #0 + beq _020354AC + ldr r0, [r0, #8] + ldrsb r0, [r0, #1] + bl sub_0202F334 + ldr r0, _02035598 ; =_020AFDBC + ldr r0, [r0, #8] + ldrsb r0, [r0, #2] + bl HidePortraitBox + ldr r0, _02035598 ; =_020AFDBC + mov r1, #1 + ldr r0, [r0, #8] + str r1, [r0, #4] + b _0203558C +_020354AC: + cmp r4, #0 + bne _020354F8 + ldr r0, [r0, #8] + ldrsb r0, [r0, #1] + bl sub_0202F16C + cmp r0, #0x10 + cmpne r0, #0 + bne _0203558C + ldr r0, _02035598 ; =_020AFDBC + ldr r0, [r0, #8] + ldrsb r0, [r0, #2] + bl HidePortraitBox + ldr r0, _02035598 ; =_020AFDBC + mov r2, #1 + ldr r1, [r0, #8] + str r2, [r1, #4] + ldr r0, [r0, #8] + strb r2, [r0, #8] + b _0203558C +_020354F8: + ldr r1, [r0, #8] + ldrb r0, [r1, #0xa] + cmp r0, #0 + beq _0203558C + ldrsb r0, [r1, #1] + bl sub_0202F16C + cmp r0, #0xc + beq _0203558C + ldr r0, _02035598 ; =_020AFDBC + ldr r0, [r0, #0xc] + bl IsValidPortrait + cmp r0, #0 + beq _02035544 + ldr r0, _02035598 ; =_020AFDBC + ldr r2, [r0, #8] + ldr r1, [r0, #0xc] + ldrsb r0, [r2, #2] + bl ShowPortraitInPortraitBox + b _02035554 +_02035544: + ldr r0, _02035598 ; =_020AFDBC + ldr r0, [r0, #8] + ldrsb r0, [r0, #2] + bl HidePortraitBox +_02035554: + ldr r0, _02035598 ; =_020AFDBC + mov r3, #1 + ldr r2, [r0, #8] + mov r1, #0 + strb r3, [r2, #8] + ldr r0, [r0, #8] + strb r1, [r0, #0xa] + b _0203558C +_02035574: + ldrsb r0, [r2, #1] + bl sub_020282F4 + mvn r1, #5 + cmp r0, r1 + moveq r0, #4 + beq _02035590 +_0203558C: + mov r0, #1 +_02035590: + add sp, sp, #0x9c + ldmia sp!, {r3, r4, pc} + .align 2, 0 +_02035598: .word _020AFDBC + arm_func_end sub_020351DC + + arm_func_start sub_0203559C +sub_0203559C: ; 0x0203559C + stmdb sp!, {r3, lr} + mov lr, r0 + mov r2, r1 + ldr r3, _020355D4 ; =_020AFDD0 + mov ip, #0 + ldr r0, _020355D8 ; =_0209B0FC + mov r1, lr + strb ip, [r3] + bl sub_02034974 + cmp r0, #0 + ldrne r0, _020355D4 ; =_020AFDD0 + movne r1, #0 + strneb r1, [r0, #1] + ldmia sp!, {r3, pc} + .align 2, 0 +_020355D4: .word _020AFDD0 +_020355D8: .word _0209B0FC + arm_func_end sub_0203559C + + arm_func_start sub_020355DC +sub_020355DC: ; 0x020355DC + stmdb sp!, {r3, r4, r5, lr} + ldr r3, _02035638 ; =_020AFDD0 + mov r5, r0 + mov lr, r1 + mov ip, #0 + mov r4, r2 + ldr r0, _0203563C ; =_0209B10C + mov r1, r5 + mov r2, lr + strb ip, [r3] + bl sub_02034974 + cmp r0, #0 + ldmeqia sp!, {r3, r4, r5, pc} + ldr r0, _02035638 ; =_020AFDD0 + mov r1, #1 + strb r1, [r0] + bl sub_02035640 + ldr r0, _02035638 ; =_020AFDD0 + mov r1, #0 + ldr r2, [r0, #4] + str r4, [r2, #0xf8] + strb r1, [r0, #1] + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_02035638: .word _020AFDD0 +_0203563C: .word _0209B10C + arm_func_end sub_020355DC + + arm_func_start sub_02035640 +sub_02035640: ; 0x02035640 + stmdb sp!, {r3, lr} + ldr r0, _02035764 ; =_020AFDD0 + ldrb r0, [r0] + cmp r0, #0 + movne r1, #0x300 + moveq r1, #8 + mov r0, #0xfc + bl MemAlloc + ldr r1, _02035764 ; =_020AFDD0 + str r0, [r1, #4] + add r0, r0, #0xc + bl sub_02034A38 + ldr r1, _02035764 ; =_020AFDD0 + ldr r1, [r1, #4] + str r0, [r1, #8] + mov r0, #0 + bl sub_02048078 + ldr r0, _02035764 ; =_020AFDD0 + ldr r0, [r0, #4] + add r0, r0, #0xa4 + bl sub_0204AB78 + ldr r1, _02035764 ; =_020AFDD0 + mov r0, #0 + ldr r3, [r1, #4] + ldrb r2, [r3, #0xa4] + str r2, [r3, #0xb0] + ldr r3, [r1, #4] + ldrb r2, [r3, #0xa6] + str r2, [r3, #0xb4] + ldr r3, [r1, #4] + ldrb r2, [r3, #0xa5] + str r2, [r3, #0xb8] + ldr r3, [r1, #4] + ldrb r2, [r3, #0xa7] + str r2, [r3, #0xbc] + ldr r3, [r1, #4] + ldrb r2, [r3, #0xa8] + str r2, [r3, #0xc0] + ldr r3, [r1, #4] + ldrb r2, [r3, #0xa9] + str r2, [r3, #0xc4] + ldr r3, [r1, #4] + ldrb r2, [r3, #0xaa] + str r2, [r3, #0xc8] + ldr r3, [r1, #4] + ldrb r2, [r3, #0xab] + str r2, [r3, #0xcc] + ldr r3, [r1, #4] + ldrb r2, [r3, #0xac] + str r2, [r3, #0xd0] +_02035708: + ldr r2, [r1, #4] + add r3, r2, r0, lsl #2 + ldr r2, [r3, #0xb0] + add r0, r0, #1 + str r2, [r3, #0xd4] + cmp r0, #9 + blt _02035708 + ldr r1, _02035764 ; =_020AFDD0 + mvn ip, #1 + ldr r0, [r1, #4] + mov r3, #0 + strb ip, [r0] + ldr r2, [r1, #4] + mov r0, #1 + strb ip, [r2, #1] + ldr r2, [r1, #4] + strb ip, [r2, #2] + ldr r2, [r1, #4] + str r3, [r2, #4] + ldr r2, [r1, #4] + str r3, [r2, #0xf8] + strb r3, [r1, #1] + ldmia sp!, {r3, pc} + .align 2, 0 +_02035764: .word _020AFDD0 + arm_func_end sub_02035640 + + arm_func_start sub_02035768 +sub_02035768: ; 0x02035768 + stmdb sp!, {r3, lr} + ldr r0, _020357EC ; =_020AFDD0 + ldr r0, [r0, #4] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0] + mvn r1, #1 + cmp r0, r1 + beq _02035790 + bl CloseOptionsMenu +_02035790: + ldr r0, _020357EC ; =_020AFDD0 + mvn r1, #1 + ldr r0, [r0, #4] + ldrsb r0, [r0, #1] + cmp r0, r1 + beq _020357AC + bl CloseDialogueBox +_020357AC: + ldr r0, _020357EC ; =_020AFDD0 + mvn r1, #1 + ldr r0, [r0, #4] + ldrsb r0, [r0, #2] + cmp r0, r1 + beq _020357C8 + bl CloseParentMenu +_020357C8: + mov r0, #1 + bl sub_02048078 + ldr r0, _020357EC ; =_020AFDD0 + ldr r0, [r0, #4] + bl MemFree + ldr r0, _020357EC ; =_020AFDD0 + mov r1, #0 + str r1, [r0, #4] + ldmia sp!, {r3, pc} + .align 2, 0 +_020357EC: .word _020AFDD0 + arm_func_end sub_02035768 + + arm_func_start sub_020357F0 +sub_020357F0: ; 0x020357F0 + stmdb sp!, {r4, lr} + sub sp, sp, #8 + ldr r2, _02035CCC ; =_020AFDD0 + ldr r3, [r2, #4] + ldr r0, [r3, #4] + cmp r0, #6 + addls pc, pc, r0, lsl #2 + b _02035CC0 +_02035810: ; jump table + b _0203582C ; case 0 + b _02035920 ; case 1 + b _020359BC ; case 2 + b _02035A80 ; case 3 + b _02035AE8 ; case 4 + b _02035BC0 ; case 5 + b _02035C94 ; case 6 +_0203582C: + ldrsb r0, [r3, #1] + mvn r1, #1 + cmp r0, r1 + beq _0203586C + bl IsDialogueBoxActive + cmp r0, #0 + bne _02035CC0 + ldr r0, _02035CCC ; =_020AFDD0 + ldr r0, [r0, #4] + ldrsb r0, [r0, #1] + bl CloseDialogueBox + ldr r0, _02035CCC ; =_020AFDD0 + mvn r1, #1 + ldr r0, [r0, #4] + strb r1, [r0, #1] + b _02035CC0 +_0203586C: + ldrsb r0, [r3, #2] + cmp r0, r1 + beq _020358A8 + bl IsParentMenuActive + cmp r0, #0 + bne _02035CC0 + ldr r0, _02035CCC ; =_020AFDD0 + ldr r0, [r0, #4] + ldrsb r0, [r0, #2] + bl CloseParentMenu + ldr r0, _02035CCC ; =_020AFDD0 + mvn r1, #1 + ldr r0, [r0, #4] + strb r1, [r0, #2] + b _02035CC0 +_020358A8: + ldrsb r0, [r3] + cmp r0, r1 + bne _02035910 + mov r0, #0 + str r0, [r3, #0xc] + ldr r0, [r2, #4] +#ifdef JAPAN + mov r1, #0x38c +#else + mov r1, #0x184 +#endif + strh r1, [r0, #0x14] + ldr r0, [r2, #4] + mov r1, #0x10 + str r1, [r0, #0x18] + ldr r2, [r2, #4] + mov r0, #9 + str r0, [sp] + add r0, r2, #0xb0 + str r0, [sp, #4] + ldr r1, [r2, #8] + ldr r0, _02035CD0 ; =_0209B0EC + orr r1, r1, #0x33 + ldr r3, _02035CD4 ; =_0209B134 + orr r1, r1, #0x1800 + add r2, r2, #0xc + bl CreateOptionsMenu + ldr r1, _02035CCC ; =_020AFDD0 + ldr r1, [r1, #4] + strb r0, [r1] +_02035910: + ldr r0, _02035CCC ; =_020AFDD0 + mov r1, #1 + ldr r0, [r0, #4] + str r1, [r0, #4] +_02035920: + ldr r0, _02035CCC ; =_020AFDD0 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl CheckOptionsMenuField0x1A4 + cmp r0, #0 + bne _02035CC0 + ldr r0, _02035CCC ; =_020AFDD0 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl sub_0202D5E4 + ldr r1, _02035CCC ; =_020AFDD0 + tst r0, #0xff + strb r0, [r1, #1] + beq _02035998 + mov r3, #0 + ldr ip, [r1, #4] + mov r4, r3 + mov r0, #1 +_02035968: + add r1, ip, r4, lsl #2 + ldr r2, [r1, #0xd4] + ldr r1, [r1, #0xb0] + add r4, r4, #1 + cmp r2, r1 + movne r3, r0 + cmp r4, #9 + blt _02035968 + cmp r3, #0 + ldreq r0, _02035CCC ; =_020AFDD0 + moveq r1, #0 + streqb r1, [r0, #1] +_02035998: + ldr r0, _02035CCC ; =_020AFDD0 + ldrb r1, [r0, #1] + ldr r0, [r0, #4] + cmp r1, #0 + moveq r1, #4 + streq r1, [r0, #4] + movne r1, #2 + strne r1, [r0, #4] + b _02035CC0 +_020359BC: + ldrsb r0, [r3] + mvn r1, #1 + cmp r0, r1 + beq _020359FC + bl IsOptionsMenuActive + cmp r0, #0 + bne _02035CC0 + ldr r0, _02035CCC ; =_020AFDD0 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl CloseOptionsMenu + ldr r0, _02035CCC ; =_020AFDD0 + mvn r1, #1 + ldr r0, [r0, #4] + strb r1, [r0] + b _02035CC0 +_020359FC: + ldrsb r0, [r3, #1] + cmp r0, r1 + bne _02035A34 + mov r0, #0 + bl CreateDialogueBox + ldr r3, _02035CCC ; =_020AFDD0 + ldr r1, _02035CD8 ; =0x00000408 + ldr r4, [r3, #4] +#ifdef JAPAN + sub r2, r1, #0x5b +#else + ldr r2, _02035CDC ; =0x000001A5 +#endif + strb r0, [r4, #1] + ldr r0, [r3, #4] + mov r3, #0 + ldrsb r0, [r0, #1] + bl ShowStringIdInDialogueBox +_02035A34: + ldr r1, _02035CCC ; =_020AFDD0 + mvn r0, #1 + ldr r1, [r1, #4] + ldrsb r1, [r1, #2] + cmp r1, r0 + bne _02035A6C + mov r0, #0 + ldr r3, _02035CE0 ; =_0209B11C + mov r2, r0 + mov r1, #0x13 + bl CreateParentMenuFromStringIds + ldr r1, _02035CCC ; =_020AFDD0 + ldr r1, [r1, #4] + strb r0, [r1, #2] +_02035A6C: + ldr r0, _02035CCC ; =_020AFDD0 + mov r1, #3 + ldr r0, [r0, #4] + str r1, [r0, #4] + b _02035CC0 +_02035A80: + ldrsb r0, [r3, #2] + bl CheckParentMenuField0x1A0 + cmp r0, #0 + bne _02035CC0 + ldr r0, _02035CCC ; =_020AFDD0 + ldr r0, [r0, #4] + ldrsb r0, [r0, #2] + bl sub_0202ABB0 + ldr r1, _02035CCC ; =_020AFDD0 + mov r4, r0 + ldr r0, [r1, #4] + ldrsb r0, [r0, #1] + bl sub_0202F334 + cmp r4, #1 + ldreq r0, _02035CCC ; =_020AFDD0 + moveq r1, #0 + ldreq r0, [r0, #4] + streq r1, [r0, #4] + beq _02035CC0 + mov r0, #1 + bl SetNotifyNote + ldr r0, _02035CCC ; =_020AFDD0 + mov r1, #4 + ldr r0, [r0, #4] + str r1, [r0, #4] + b _02035CC0 +_02035AE8: + ldrsb r0, [r3] + mvn r1, #1 + cmp r0, r1 + beq _02035B24 + bl IsOptionsMenuActive + cmp r0, #0 + bne _02035CC0 + ldr r0, _02035CCC ; =_020AFDD0 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl CloseOptionsMenu + ldr r0, _02035CCC ; =_020AFDD0 + mvn r1, #1 + ldr r0, [r0, #4] + strb r1, [r0] +_02035B24: + ldr r0, _02035CCC ; =_020AFDD0 + mvn r1, #1 + ldr r0, [r0, #4] + ldrsb r0, [r0, #1] + cmp r0, r1 + beq _02035B68 + bl IsDialogueBoxActive + cmp r0, #0 + bne _02035CC0 + ldr r0, _02035CCC ; =_020AFDD0 + ldr r0, [r0, #4] + ldrsb r0, [r0, #1] + bl CloseDialogueBox + ldr r0, _02035CCC ; =_020AFDD0 + mvn r1, #1 + ldr r0, [r0, #4] + strb r1, [r0, #1] +_02035B68: + ldr r0, _02035CCC ; =_020AFDD0 + mvn r1, #1 + ldr r0, [r0, #4] + ldrsb r0, [r0, #2] + cmp r0, r1 + beq _02035BAC + bl IsParentMenuActive + cmp r0, #0 + bne _02035CC0 + ldr r0, _02035CCC ; =_020AFDD0 + ldr r0, [r0, #4] + ldrsb r0, [r0, #2] + bl CloseParentMenu + ldr r0, _02035CCC ; =_020AFDD0 + mvn r1, #1 + ldr r0, [r0, #4] + strb r1, [r0, #2] +_02035BAC: + ldr r0, _02035CCC ; =_020AFDD0 + mov r1, #5 + ldr r0, [r0, #4] + str r1, [r0, #4] + b _02035CC0 +_02035BC0: + mov r0, #7 + str r0, [r3, #4] + ldrb r0, [r2, #1] + cmp r0, #0 + beq _02035C4C + ldr r1, [r2, #4] + ldr r0, [r1, #0xb0] + strb r0, [r1, #0xa4] + ldr r1, [r2, #4] + ldr r0, [r1, #0xb4] + strb r0, [r1, #0xa6] + ldr r1, [r2, #4] + ldr r0, [r1, #0xb8] + strb r0, [r1, #0xa5] + ldr r1, [r2, #4] + ldr r0, [r1, #0xbc] + strb r0, [r1, #0xa7] + ldr r1, [r2, #4] + ldr r0, [r1, #0xc0] + strb r0, [r1, #0xa8] + ldr r1, [r2, #4] + ldr r0, [r1, #0xc4] + strb r0, [r1, #0xa9] + ldr r1, [r2, #4] + ldr r0, [r1, #0xc8] + strb r0, [r1, #0xaa] + ldr r1, [r2, #4] + ldr r0, [r1, #0xcc] + strb r0, [r1, #0xab] + ldr r1, [r2, #4] + ldr r0, [r1, #0xd0] + strb r0, [r1, #0xac] + ldr r0, [r2, #4] + add r0, r0, #0xa4 + bl sub_0204AB98 +_02035C4C: + ldr r0, _02035CCC ; =_020AFDD0 + ldr r2, [r0, #4] + ldr r1, [r2, #8] + tst r1, #0x100 + beq _02035C70 + ldrb r1, [r0, #1] + ldr r0, [r2, #0x94] + ldr r2, [r2, #0x90] + blx r2 +_02035C70: + ldr r0, _02035CCC ; =_020AFDD0 + ldr r1, [r0, #4] + ldr r0, [r1, #0xf8] + cmp r0, #0 + movne r0, #6 + strne r0, [r1, #4] + bne _02035CC0 + mov r0, #4 + b _02035CC4 +_02035C94: + ldr r0, [r3, #0x94] + ldr r1, [r3, #0xf8] + blx r1 + cmp r0, #0 + beq _02035CC0 + ldr r0, _02035CCC ; =_020AFDD0 + mov r2, #7 + ldr r1, [r0, #4] + mov r0, #4 + str r2, [r1, #4] + b _02035CC4 +_02035CC0: + mov r0, #1 +_02035CC4: + add sp, sp, #8 + ldmia sp!, {r4, pc} + .align 2, 0 +_02035CCC: .word _020AFDD0 +_02035CD0: .word _0209B0EC +_02035CD4: .word _0209B134 +_02035CD8: .word 0x00000408 +#ifndef JAPAN +_02035CDC: .word 0x000001A5 +#endif +_02035CE0: .word _0209B11C + arm_func_end sub_020357F0 + + arm_func_start sub_02035CE4 +sub_02035CE4: ; 0x02035CE4 + stmdb sp!, {r4, lr} + mov r4, r0 + ldr r0, _02035DA8 ; =_0209B1B8 + bl sub_02034974 + cmp r0, #0 + ldmeqia sp!, {r4, pc} + ldr r2, _02035DAC ; =_020AFDD8 + mov r3, #0 + mov r0, #0xb8 + mov r1, #8 + strb r3, [r2] + bl MemAlloc + ldr r1, _02035DAC ; =_020AFDD8 + str r0, [r1, #4] + add r0, r0, #0xc + bl sub_02034A38 + ldr r1, _02035DAC ; =_020AFDD8 + ldr r1, [r1, #4] + str r0, [r1, #8] + mov r0, #0 + bl sub_02048078 + ldr r0, _02035DAC ; =_020AFDD8 + ldr r0, [r0, #4] + add r0, r0, #0xa4 + bl sub_0204AF98 + ldr r0, _02035DAC ; =_020AFDD8 + mvn r3, #1 + ldr ip, [r0, #4] + mov r2, #0 + ldrb r1, [ip, #0xa4] + str r1, [ip, #0xb0] + ldr ip, [r0, #4] + ldr r1, [ip, #0xb0] + str r1, [ip, #0xb4] + ldr ip, [r0, #4] + ldr r1, [ip, #0xb0] + str r1, [ip, #0xac] + ldr r1, [r0, #4] + strb r3, [r1] + ldr r1, [r0, #4] + strb r3, [r1, #1] + ldr r1, [r0, #4] + strb r3, [r1, #2] + ldr r1, [r0, #4] + str r2, [r1, #4] + ldr r1, [r0, #4] + str r4, [r1, #0xa8] + strb r2, [r0] + ldmia sp!, {r4, pc} + .align 2, 0 +_02035DA8: .word _0209B1B8 +_02035DAC: .word _020AFDD8 + arm_func_end sub_02035CE4 + + arm_func_start sub_02035DB0 +sub_02035DB0: ; 0x02035DB0 + stmdb sp!, {r3, lr} + ldr r0, _02035E34 ; =_020AFDD8 + ldr r0, [r0, #4] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0] + mvn r1, #1 + cmp r0, r1 + beq _02035DD8 + bl CloseOptionsMenu +_02035DD8: + ldr r0, _02035E34 ; =_020AFDD8 + mvn r1, #1 + ldr r0, [r0, #4] + ldrsb r0, [r0, #1] + cmp r0, r1 + beq _02035DF4 + bl CloseDialogueBox +_02035DF4: + ldr r0, _02035E34 ; =_020AFDD8 + mvn r1, #1 + ldr r0, [r0, #4] + ldrsb r0, [r0, #2] + cmp r0, r1 + beq _02035E10 + bl CloseParentMenu +_02035E10: + mov r0, #1 + bl sub_02048078 + ldr r0, _02035E34 ; =_020AFDD8 + ldr r0, [r0, #4] + bl MemFree + ldr r0, _02035E34 ; =_020AFDD8 + mov r1, #0 + str r1, [r0, #4] + ldmia sp!, {r3, pc} + .align 2, 0 +_02035E34: .word _020AFDD8 + arm_func_end sub_02035DB0 + + arm_func_start sub_02035E38 +sub_02035E38: ; 0x02035E38 + stmdb sp!, {r4, lr} + sub sp, sp, #8 + ldr r2, _0203630C ; =_020AFDD8 + ldr r3, [r2, #4] + ldr r0, [r3, #4] + cmp r0, #5 + addls pc, pc, r0, lsl #2 + b _02036300 +_02035E58: ; jump table + b _02035E70 ; case 0 + b _02035F64 ; case 1 + b _0203604C ; case 2 + b _02036110 ; case 3 + b _02036178 ; case 4 + b _02036250 ; case 5 +_02035E70: + ldrsb r0, [r3, #1] + mvn r1, #1 + cmp r0, r1 + beq _02035EB0 + bl IsDialogueBoxActive + cmp r0, #0 + bne _02036300 + ldr r0, _0203630C ; =_020AFDD8 + ldr r0, [r0, #4] + ldrsb r0, [r0, #1] + bl CloseDialogueBox + ldr r0, _0203630C ; =_020AFDD8 + mvn r1, #1 + ldr r0, [r0, #4] + strb r1, [r0, #1] + b _02036300 +_02035EB0: + ldrsb r0, [r3, #2] + cmp r0, r1 + beq _02035EEC + bl IsParentMenuActive + cmp r0, #0 + bne _02036300 + ldr r0, _0203630C ; =_020AFDD8 + ldr r0, [r0, #4] + ldrsb r0, [r0, #2] + bl CloseParentMenu + ldr r0, _0203630C ; =_020AFDD8 + mvn r1, #1 + ldr r0, [r0, #4] + strb r1, [r0, #2] + b _02036300 +_02035EEC: + ldrsb r0, [r3] + cmp r0, r1 + bne _02035F54 + mov r0, #0 + str r0, [r3, #0xc] + ldr r0, [r2, #4] +#ifdef JAPAN + mov r1, #0x3b0 +#else + mov r1, #0x1a8 +#endif + strh r1, [r0, #0x14] + ldr r0, [r2, #4] + mov r1, #0x10 + str r1, [r0, #0x18] + ldr r2, [r2, #4] + mov r0, #9 + str r0, [sp] + add r0, r2, #0xb0 + str r0, [sp, #4] + ldr r1, [r2, #8] + ldr r0, _02036310 ; =_0209B1C8 + orr r1, r1, #0x33 + ldr r3, _02036314 ; =_0209B1F0 + orr r1, r1, #0x1800 + add r2, r2, #0xc + bl CreateOptionsMenu + ldr r1, _0203630C ; =_020AFDD8 + ldr r1, [r1, #4] + strb r0, [r1] +_02035F54: + ldr r0, _0203630C ; =_020AFDD8 + mov r1, #1 + ldr r0, [r0, #4] + str r1, [r0, #4] +_02035F64: + ldr r0, _0203630C ; =_020AFDD8 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl CheckOptionsMenuField0x1A4 + cmp r0, #0 + bne _02035FE8 + ldr r0, _0203630C ; =_020AFDD8 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl sub_0202D5E4 + ldr r1, _0203630C ; =_020AFDD8 + tst r0, #0xff + strb r0, [r1] + beq _02035FC4 + ldr r0, [r1, #4] + mov r2, #0 + ldr r1, [r0, #0xb4] + ldr r0, [r0, #0xb0] + cmp r1, r0 + movne r2, #1 + cmp r2, #0 + ldreq r0, _0203630C ; =_020AFDD8 + moveq r1, #0 + streqb r1, [r0] +_02035FC4: + ldr r0, _0203630C ; =_020AFDD8 + ldrb r1, [r0] + ldr r0, [r0, #4] + cmp r1, #0 + moveq r1, #4 + streq r1, [r0, #4] + movne r1, #2 + strne r1, [r0, #4] + b _02036300 +_02035FE8: + ldr r0, _0203630C ; =_020AFDD8 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl sub_0202D59C + movs r4, r0 + bne _02036300 + ldr r0, _0203630C ; =_020AFDD8 + ldr r1, [r0, #4] + ldrsb r0, [r1], #0xb0 + bl sub_0202D5B0 + ldr r0, _0203630C ; =_020AFDD8 + ldr r0, [r0, #4] + add r0, r0, r4, lsl #2 + ldr r1, [r0, #0xb0] + ldr r0, [r0, #0xac] + cmp r1, r0 + beq _02036300 + and r0, r1, #0xff + bl sub_02027180 + ldr r0, _0203630C ; =_020AFDD8 + ldr r0, [r0, #4] + add r1, r0, r4, lsl #2 + ldr r0, [r1, #0xb0] + str r0, [r1, #0xac] + b _02036300 +_0203604C: + ldrsb r0, [r3] + mvn r1, #1 + cmp r0, r1 + beq _0203608C + bl IsOptionsMenuActive + cmp r0, #0 + bne _02036300 + ldr r0, _0203630C ; =_020AFDD8 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl CloseOptionsMenu + ldr r0, _0203630C ; =_020AFDD8 + mvn r1, #1 + ldr r0, [r0, #4] + strb r1, [r0] + b _02036300 +_0203608C: + ldrsb r0, [r3, #1] + cmp r0, r1 + bne _020360C4 + mov r0, #0 + bl CreateDialogueBox + ldr r3, _0203630C ; =_020AFDD8 + ldr r1, _02036318 ; =0x00000408 + ldr r4, [r3, #4] +#ifdef JAPAN + sub r2, r1, #0x5b +#else + ldr r2, _0203631C ; =0x000001A5 +#endif + strb r0, [r4, #1] + ldr r0, [r3, #4] + mov r3, #0 + ldrsb r0, [r0, #1] + bl ShowStringIdInDialogueBox +_020360C4: + ldr r1, _0203630C ; =_020AFDD8 + mvn r0, #1 + ldr r1, [r1, #4] + ldrsb r1, [r1, #2] + cmp r1, r0 + bne _020360FC + mov r0, #0 + ldr r3, _02036320 ; =_0209B1D8 + mov r2, r0 + mov r1, #0x13 + bl CreateParentMenuFromStringIds + ldr r1, _0203630C ; =_020AFDD8 + ldr r1, [r1, #4] + strb r0, [r1, #2] +_020360FC: + ldr r0, _0203630C ; =_020AFDD8 + mov r1, #3 + ldr r0, [r0, #4] + str r1, [r0, #4] + b _02036300 +_02036110: + ldrsb r0, [r3, #2] + bl CheckParentMenuField0x1A0 + cmp r0, #0 + bne _02036300 + ldr r0, _0203630C ; =_020AFDD8 + ldr r0, [r0, #4] + ldrsb r0, [r0, #2] + bl sub_0202ABB0 + ldr r1, _0203630C ; =_020AFDD8 + mov r4, r0 + ldr r0, [r1, #4] + ldrsb r0, [r0, #1] + bl sub_0202F334 + cmp r4, #1 + ldreq r0, _0203630C ; =_020AFDD8 + moveq r1, #0 + ldreq r0, [r0, #4] + streq r1, [r0, #4] + beq _02036300 + mov r0, #1 + bl SetNotifyNote + ldr r0, _0203630C ; =_020AFDD8 + mov r1, #4 + ldr r0, [r0, #4] + str r1, [r0, #4] + b _02036300 +_02036178: + ldrsb r0, [r3] + mvn r1, #1 + cmp r0, r1 + beq _020361B4 + bl IsOptionsMenuActive + cmp r0, #0 + bne _02036300 + ldr r0, _0203630C ; =_020AFDD8 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl CloseOptionsMenu + ldr r0, _0203630C ; =_020AFDD8 + mvn r1, #1 + ldr r0, [r0, #4] + strb r1, [r0] +_020361B4: + ldr r0, _0203630C ; =_020AFDD8 + mvn r1, #1 + ldr r0, [r0, #4] + ldrsb r0, [r0, #1] + cmp r0, r1 + beq _020361F8 + bl IsDialogueBoxActive + cmp r0, #0 + bne _02036300 + ldr r0, _0203630C ; =_020AFDD8 + ldr r0, [r0, #4] + ldrsb r0, [r0, #1] + bl CloseDialogueBox + ldr r0, _0203630C ; =_020AFDD8 + mvn r1, #1 + ldr r0, [r0, #4] + strb r1, [r0, #1] +_020361F8: + ldr r0, _0203630C ; =_020AFDD8 + mvn r1, #1 + ldr r0, [r0, #4] + ldrsb r0, [r0, #2] + cmp r0, r1 + beq _0203623C + bl IsParentMenuActive + cmp r0, #0 + bne _02036300 + ldr r0, _0203630C ; =_020AFDD8 + ldr r0, [r0, #4] + ldrsb r0, [r0, #2] + bl CloseParentMenu + ldr r0, _0203630C ; =_020AFDD8 + mvn r1, #1 + ldr r0, [r0, #4] + strb r1, [r0, #2] +_0203623C: + ldr r0, _0203630C ; =_020AFDD8 + mov r1, #5 + ldr r0, [r0, #4] + str r1, [r0, #4] + b _02036300 +_02036250: + mov r0, #6 + str r0, [r3, #4] + ldrb r0, [r2] + mov r4, #0 + ldr r1, [r2, #4] + cmp r0, #0 + beq _02036298 + ldr r0, [r1, #0xb0] + strb r0, [r1, #0xa4] + ldr r0, [r2, #4] + add r0, r0, #0xa4 + bl sub_0204AFAC + ldr r0, _0203630C ; =_020AFDD8 + ldr r0, [r0, #4] + ldr r0, [r0, #0xa8] + cmp r0, #1 + moveq r4, #1 + b _020362A0 +_02036298: + ldr r0, [r1, #0xb4] + strb r0, [r1, #0xa4] +_020362A0: + ldr r0, _0203630C ; =_020AFDD8 + ldr r0, [r0, #4] + ldrb r0, [r0, #0xa4] + bl sub_02027180 + cmp r4, #0 + beq _020362D4 + ldr r1, _0203630C ; =_020AFDD8 + mov r0, #2 + ldr r2, [r1, #4] + mov r1, #0x100 + add r2, r2, #0xc + bl sub_0204964C + b _020362F8 +_020362D4: + ldr r0, _0203630C ; =_020AFDD8 + ldr r2, [r0, #4] + ldr r1, [r2, #8] + tst r1, #0x100 + beq _020362F8 + ldrb r1, [r0] + ldr r0, [r2, #0x94] + ldr r2, [r2, #0x90] + blx r2 +_020362F8: + mov r0, #4 + b _02036304 +_02036300: + mov r0, #1 +_02036304: + add sp, sp, #8 + ldmia sp!, {r4, pc} + .align 2, 0 +_0203630C: .word _020AFDD8 +_02036310: .word _0209B1C8 +_02036314: .word _0209B1F0 +_02036318: .word 0x00000408 +#ifndef JAPAN +_0203631C: .word 0x000001A5 +#endif +_02036320: .word _0209B1D8 + arm_func_end sub_02035E38 + + arm_func_start sub_02036324 +sub_02036324: ; 0x02036324 + stmdb sp!, {r3, lr} + mov r3, r0 + mov r2, r1 + ldr r0, _02036350 ; =_0209B218 + mov r1, r3 + bl sub_02034974 + cmp r0, #0 + ldrne r0, _02036354 ; =_020AFDE0 + movne r1, #0 + strneb r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_02036350: .word _0209B218 +_02036354: .word _020AFDE0 + arm_func_end sub_02036324 + + arm_func_start sub_02036358 +sub_02036358: ; 0x02036358 + stmdb sp!, {r3, r4, r5, lr} + sub sp, sp, #8 + mov r0, #0xb0 + mov r1, #8 + bl MemAlloc + ldr r1, _0203642C ; =_020AFDE0 + str r0, [r1, #4] + add r0, r0, #0xc + bl sub_02034A38 + ldr r4, _0203642C ; =_020AFDE0 + mov r5, #0 + ldr r1, [r4, #4] + str r0, [r1, #8] +_0203638C: + and r0, r5, #0xff + bl Debug_GetDebugFlag + ldr r1, [r4, #4] + add r1, r1, r5 + add r5, r5, #1 + strb r0, [r1, #0xa4] + cmp r5, #0xc + blt _0203638C + ldr r0, _0203642C ; =_020AFDE0 + mov r3, #0 + ldr r1, [r0, #4] + ldr r2, _02036430 ; =0x00003C64 + str r3, [r1, #0xc] + ldr r1, [r0, #4] + mov r3, #0x10 + strh r2, [r1, #0x14] + ldr r2, [r0, #4] + mov r1, #8 + str r3, [r2, #0x18] + ldr r2, [r0, #4] + ldr r0, _02036434 ; =_0209B208 + str r1, [sp] + add r1, r2, #0xa4 + str r1, [sp, #4] + ldr r1, [r2, #8] + ldr r3, _02036438 ; =_0209B228 + orr r1, r1, #0x33 + orr r1, r1, #0x9800 + add r2, r2, #0xc + bl CreateDebugMenu + ldr r1, _0203642C ; =_020AFDE0 + mov r3, #0 + ldr r2, [r1, #4] + strb r0, [r2] + ldr r2, [r1, #4] + mov r0, #1 + str r3, [r2, #4] + strb r3, [r1] + add sp, sp, #8 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_0203642C: .word _020AFDE0 +#if defined(EUROPE) +_02036430: .word 0x00003C66 +#elif defined(JAPAN) +_02036430: .word 0x000003BB +#else +_02036430: .word 0x00003C64 +#endif +_02036434: .word _0209B208 +_02036438: .word _0209B228 + arm_func_end sub_02036358 + + arm_func_start sub_0203643C +sub_0203643C: ; 0x0203643C + stmdb sp!, {r3, lr} + ldr r0, _02036474 ; =_020AFDE0 + ldr r0, [r0, #4] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0] + bl CloseDebugMenu + ldr r0, _02036474 ; =_020AFDE0 + ldr r0, [r0, #4] + bl MemFree + ldr r0, _02036474 ; =_020AFDE0 + mov r1, #0 + str r1, [r0, #4] + ldmia sp!, {r3, pc} + .align 2, 0 +_02036474: .word _020AFDE0 + arm_func_end sub_0203643C + + arm_func_start sub_02036478 +sub_02036478: ; 0x02036478 + stmdb sp!, {r3, r4, r5, lr} + ldr r4, _02036568 ; =_020AFDE0 + ldr r1, [r4, #4] + ldr r0, [r1, #4] + cmp r0, #0 + beq _020364A4 + cmp r0, #1 + beq _020364C4 + cmp r0, #2 + beq _020364FC + b _02036560 +_020364A4: + ldrsb r0, [r1] + bl CheckDebugMenuField0x1A4 + cmp r0, #0 + moveq r0, r4 + ldreq r0, [r0, #4] + moveq r1, #1 + streq r1, [r0, #4] + b _02036560 +_020364C4: + ldrsb r0, [r1] + bl IsDebugMenuActive + cmp r0, #0 + bne _02036560 + mov r0, r4 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl sub_0202DF64 + mov r1, r4 + strb r0, [r1] + ldr r0, [r1, #4] + mov r2, #2 + str r2, [r0, #4] + b _02036560 +_020364FC: + mov r0, #3 + str r0, [r1, #4] + ldrb r0, [r4] + cmp r0, #0 + beq _02036534 + mov r5, #0 +_02036514: + ldr r1, [r4, #4] + and r0, r5, #0xff + add r1, r1, r5 + ldrb r1, [r1, #0xa4] + bl Debug_SetDebugFlag + add r5, r5, #1 + cmp r5, #0xc + blt _02036514 +_02036534: + ldr r0, _02036568 ; =_020AFDE0 + ldr r2, [r0, #4] + ldr r1, [r2, #8] + tst r1, #0x100 + beq _02036558 + ldrb r1, [r0] + ldr r0, [r2, #0x94] + ldr r2, [r2, #0x90] + blx r2 +_02036558: + mov r0, #4 + ldmia sp!, {r3, r4, r5, pc} +_02036560: + mov r0, #1 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_02036568: .word _020AFDE0 + arm_func_end sub_02036478 + + arm_func_start sub_0203656C +sub_0203656C: ; 0x0203656C + stmdb sp!, {r3, lr} + mov r3, r0 + mov r2, r1 + ldr r0, _02036598 ; =_0209B254 + mov r1, r3 + bl sub_02034974 + cmp r0, #0 + ldrne r0, _0203659C ; =_020AFDE8 + movne r1, #0 + strneb r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_02036598: .word _0209B254 +_0203659C: .word _020AFDE8 + arm_func_end sub_0203656C + + arm_func_start sub_020365A0 +sub_020365A0: ; 0x020365A0 + stmdb sp!, {r3, r4, r5, lr} + sub sp, sp, #8 + mov r0, #0xb4 + mov r1, #8 + bl MemAlloc + ldr r1, _02036674 ; =_020AFDE8 + str r0, [r1, #4] + add r0, r0, #0xc + bl sub_02034A38 + ldr r4, _02036674 ; =_020AFDE8 + mov r5, #0 + ldr r1, [r4, #4] + str r0, [r1, #8] +_020365D4: + and r0, r5, #0xff + bl Debug_GetLogFlag + ldr r1, [r4, #4] + add r1, r1, r5 + add r5, r5, #1 + strb r0, [r1, #0xa4] + cmp r5, #0x10 + blt _020365D4 + ldr r0, _02036674 ; =_020AFDE8 + mov r3, #0 + ldr r1, [r0, #4] + ldr r2, _02036678 ; =0x00003C73 + str r3, [r1, #0xc] + ldr r1, [r0, #4] + mov r3, #0x10 + strh r2, [r1, #0x14] + ldr r2, [r0, #4] + mov r1, #8 + str r3, [r2, #0x18] + ldr r2, [r0, #4] + ldr r0, _0203667C ; =_0209B244 + str r1, [sp] + add r1, r2, #0xa4 + str r1, [sp, #4] + ldr r1, [r2, #8] + ldr r3, _02036680 ; =_0209B264 + orr r1, r1, #0x33 + orr r1, r1, #0x9800 + add r2, r2, #0xc + bl CreateDebugMenu + ldr r1, _02036674 ; =_020AFDE8 + mov r3, #0 + ldr r2, [r1, #4] + strb r0, [r2] + ldr r2, [r1, #4] + mov r0, #1 + str r3, [r2, #4] + strb r3, [r1] + add sp, sp, #8 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_02036674: .word _020AFDE8 +#if defined(EUROPE) +_02036678: .word 0x00003C75 +#elif defined(JAPAN) +_02036678: .word 0x000003CA +#else +_02036678: .word 0x00003C73 +#endif +_0203667C: .word _0209B244 +_02036680: .word _0209B264 + arm_func_end sub_020365A0 + + arm_func_start sub_02036684 +sub_02036684: ; 0x02036684 + stmdb sp!, {r3, lr} + ldr r0, _020366BC ; =_020AFDE8 + ldr r0, [r0, #4] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0] + bl CloseDebugMenu + ldr r0, _020366BC ; =_020AFDE8 + ldr r0, [r0, #4] + bl MemFree + ldr r0, _020366BC ; =_020AFDE8 + mov r1, #0 + str r1, [r0, #4] + ldmia sp!, {r3, pc} + .align 2, 0 +_020366BC: .word _020AFDE8 + arm_func_end sub_02036684 + + arm_func_start sub_020366C0 +sub_020366C0: ; 0x020366C0 + stmdb sp!, {r3, r4, r5, lr} + ldr r4, _020367B0 ; =_020AFDE8 + ldr r1, [r4, #4] + ldr r0, [r1, #4] + cmp r0, #0 + beq _020366EC + cmp r0, #1 + beq _0203670C + cmp r0, #2 + beq _02036744 + b _020367A8 +_020366EC: + ldrsb r0, [r1] + bl CheckDebugMenuField0x1A4 + cmp r0, #0 + moveq r0, r4 + ldreq r0, [r0, #4] + moveq r1, #1 + streq r1, [r0, #4] + b _020367A8 +_0203670C: + ldrsb r0, [r1] + bl IsDebugMenuActive + cmp r0, #0 + bne _020367A8 + mov r0, r4 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl sub_0202DF64 + mov r1, r4 + strb r0, [r1] + ldr r0, [r1, #4] + mov r2, #2 + str r2, [r0, #4] + b _020367A8 +_02036744: + mov r0, #3 + str r0, [r1, #4] + ldrb r0, [r4] + cmp r0, #0 + beq _0203677C + mov r5, #0 +_0203675C: + ldr r1, [r4, #4] + and r0, r5, #0xff + add r1, r1, r5 + ldrb r1, [r1, #0xa4] + bl Debug_SetLogFlag + add r5, r5, #1 + cmp r5, #0x10 + blt _0203675C +_0203677C: + ldr r0, _020367B0 ; =_020AFDE8 + ldr r2, [r0, #4] + ldr r1, [r2, #8] + tst r1, #0x100 + beq _020367A0 + ldrb r1, [r0] + ldr r0, [r2, #0x94] + ldr r2, [r2, #0x90] + blx r2 +_020367A0: + mov r0, #4 + ldmia sp!, {r3, r4, r5, pc} +_020367A8: + mov r0, #1 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_020367B0: .word _020AFDE8 + arm_func_end sub_020366C0 + + arm_func_start sub_020367B4 +sub_020367B4: ; 0x020367B4 + stmdb sp!, {r4, r5, r6, lr} + mov r6, r0 + ldr r0, _020367EC ; =_0209B298 + mov r5, r1 + mov r4, r2 + bl sub_020348E4 + cmp r0, #0 + ldmeqia sp!, {r4, r5, r6, pc} + mov r0, r6 + mov r1, r5 + mov r3, r4 + mov r2, #0 + bl ShowKeyboard + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_020367EC: .word _0209B298 + arm_func_end sub_020367B4 + + arm_func_start ShowKeyboard +ShowKeyboard: ; 0x020367F0 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r6, r0 + mov r5, r1 + mov r0, #0x1e8 + mov r1, #8 + mov r4, r2 + mov r7, r3 + bl MemAlloc + ldr r2, _02036CB0 ; =_020AFDF0 + mov r1, #0x1e8 + str r0, [r2] + bl MemZero + cmp r7, #0 + ldreq r0, _02036CB0 ; =_020AFDF0 + moveq r1, #0 + ldreq r0, [r0] + streqb r1, [r0, #0x16e] + beq _02036850 + ldr r0, _02036CB0 ; =_020AFDF0 + mov r1, r7 + ldr r0, [r0] + add r0, r0, #0x6e + add r0, r0, #0x100 + bl StrcpySimple +_02036850: + ldr r0, _02036CB0 ; =_020AFDF0 +#ifdef JAPAN + cmp r4, #0 + ldr r1, [r0] + mov r2, #0 +#else + mov r2, #0 + ldr r1, [r0] + cmp r4, #0 +#endif + strb r2, [r1, #0x11] + ldr r1, [r0] + and r3, r6, #0xff + strb r2, [r1, #0x12] + ldrne r1, [r0] + movne r2, #1 + strneb r2, [r1, #0x11] + ldrne r0, [r0] +#ifdef JAPAN + mov r4, #0 +#endif + strneb r2, [r0, #0x12] + ldr r0, _02036CB0 ; =_020AFDF0 + mov r2, #0 + ldr r1, [r0] + str r3, [r1, #0xc] + ldr r1, [r0] +#ifdef JAPAN + ldr r3, _02036CB0 ; =_020AFDF0 +#endif + strb r2, [r1, #0x1d] + ldr r1, [r0] + strb r2, [r1, #0x1e] +#if defined(EUROPE) + ldr r2, [r0] + ldr r1, [r2, #0xc] + cmp r1, #0xa + addne r1, r1, #0x118 + addne r0, r2, #0x100 + bne _02036BC4 + mov r1, #1 + str r1, [r2, #0xc] + ldr r0, [r0] + mov r1, #0x120 + add r0, r0, #0x100 +_02036BC4: + strh r1, [r0, #0xa6] + ldr r0, _02036CB0 ; =_020AFDF0 + mov r2, #0 + ldr r1, [r0] + strb r2, [r1, #0x16] + ldr r1, [r0] + strb r2, [r1, #0x15] + ldr r1, [r0] + strh r2, [r1, #8] + ldr r1, [r0] + strb r2, [r1, #0x10] + ldr r3, [r0] + ldr r1, [r3, #0xc] + cmp r1, #9 + addls pc, pc, r1, lsl #2 + b _02036A40 +_02036C04: ; jump table + b _02036A40 ; case 0 + b _02036CEC ; case 1 + b _02036A40 ; case 2 + b _02036A40 ; case 3 + b _02036A20 ; case 4 + b _02036C2C ; case 5 + b _02036C9C ; case 6 + b _02036CCC_EU ; case 7 + b _02036C5C ; case 8 + b _02036D04 ; case 9 +_02036C2C: + mov r1, #9 + strb r1, [r3, #0x18] + ldr r1, [r0] + mov r2, #1 + strb r2, [r1, #0x10] + ldr r1, [r0] + mov r2, #0x36 + strb r2, [r1, #0x1b] + ldr r0, [r0] + mov r1, #2 + strb r1, [r0, #0x16] + b _02036A58 +_02036C5C: + mov r1, #6 + strb r1, [r3, #0x18] + ldr r1, [r0] + mov r2, #3 + strb r2, [r1, #0x16] + ldr r1, [r0] + mov r2, #1 + strb r2, [r1, #0x10] + ldr r1, [r0] + mov r2, #0x36 + strb r2, [r1, #0x1b] + ldr r0, [r0] + add r1, r2, #0xe9 + add r0, r0, #0x100 + strh r1, [r0, #0xa6] + b _02036A58 +_02036C9C: + mov r1, #9 + strb r1, [r3, #0x18] + ldr r1, [r0] + mov r2, #1 + strb r2, [r1, #0x10] + ldr r1, [r0] + mov r2, #0x22 + strb r2, [r1, #0x1b] + ldr r0, [r0] + mov r1, #2 + strb r1, [r0, #0x16] + b _02036A58 +_02036CCC_EU: + strb r2, [r3, #0x16] + ldr r1, [r0] + mov r2, #6 + strb r2, [r1, #0x18] + ldr r0, [r0] + mov r1, #0x36 + strb r1, [r0, #0x1b] + b _02036A58 +_02036CEC: + mov r1, #6 + strb r1, [r3, #0x18] + ldr r0, [r0] + mov r1, #0xa + strb r1, [r0, #0x1b] + b _02036A58 +_02036D04: + mov r1, #4 + strb r1, [r3, #0x16] + ldr r0, [r0] + mov r1, #0x11c +#elif defined(JAPAN) + ldr r1, [r0] + ldr r0, [r1, #0xc] + cmp r0, #0xa + moveq r0, #1 + streq r0, [r1, #0xc] + ldr r2, [r3] + mov r0, #1 + ldr r1, [r2, #0xc] + add r2, r2, #0x100 + add r1, r1, #0xca + add r1, r1, #0x3100 + strh r1, [r2, #0xa6] + ldr r1, [r3] + strb r0, [r1, #0x16] + ldr r1, [r3] + strb r4, [r1, #0x15] + ldr r1, [r3] + strh r4, [r1, #8] + ldr r1, [r3] + strb r4, [r1, #0x10] + ldr r1, [r3] + ldr r2, [r1, #0xc] + cmp r2, #9 + addls pc, pc, r2, lsl #2 + b _02036A40 +_02036C28: ; jump table + b _02036A40 ; case 0 + b _02036D04 ; case 1 + b _02036A40 ; case 2 + b _02036A40 ; case 3 + b _02036A20 ; case 4 + b _02036C50 ; case 5 + b _02036CB8_JP ; case 6 + b _02036CE4 ; case 7 + b _02036C7C ; case 8 + b _02036D1C ; case 9 +_02036C50: + mov r2, #9 + strb r2, [r1, #0x18] + ldr r1, [r3] + mov r2, #0x36 + strb r0, [r1, #0x10] + ldr r0, [r3] + mov r1, #3 + strb r2, [r0, #0x1b] + ldr r0, [r3] + strb r1, [r0, #0x16] + b _02036A58 +_02036C7C: + mov r2, #6 + strb r2, [r1, #0x18] + ldr r1, [r3] + mov r2, #4 + strb r2, [r1, #0x16] + ldr r1, [r3] + mov r2, #0x36 + strb r0, [r1, #0x10] + ldr r0, [r3] + ldr r1, _02036FC8 ; =0x000031D1 + strb r2, [r0, #0x1b] + ldr r0, [r3] + add r0, r0, #0x100 + strh r1, [r0, #0xa6] + b _02036A58 +_02036CB8_JP: + mov r2, #9 + strb r2, [r1, #0x18] + ldr r1, [r3] + mov r2, #0x22 + strb r0, [r1, #0x10] + ldr r0, [r3] + mov r1, #3 + strb r2, [r0, #0x1b] + ldr r0, [r3] + strb r1, [r0, #0x16] + b _02036A58 +_02036CE4: + strb r4, [r1, #0x16] + ldr r0, [r3] + mov r1, #6 + strb r1, [r0, #0x18] + ldr r0, [r3] + mov r1, #0x36 + strb r1, [r0, #0x1b] + b _02036A58 +_02036D04: + mov r0, #6 + strb r0, [r1, #0x18] + ldr r0, [r3] + mov r1, #5 + strb r1, [r0, #0x1b] + b _02036A58 +_02036D1C: + mov r0, #5 + strb r0, [r1, #0x16] + ldr r0, [r3] + ldr r1, _02036FCC ; =0x000031CE +#else + ldr r1, [r0] + mov r2, #0 + ldr r0, [r1, #0xc] + cmp r0, #0xa + moveq r0, #1 + streq r0, [r1, #0xc] + ldr r1, _02036CB0 ; =_020AFDF0 + ldr r0, [r1] + ldr r3, [r0, #0xc] + add r0, r0, #0x100 + add r3, r3, #0x118 + strh r3, [r0, #0xa6] + ldr r0, [r1] + strb r2, [r0, #0x16] + ldr r0, [r1] + strb r2, [r0, #0x15] + ldr r0, [r1] + strh r2, [r0, #8] + ldr r0, [r1] + strb r2, [r0, #0x10] + ldr r3, [r1] + ldr r0, [r3, #0xc] + cmp r0, #9 + addls pc, pc, r0, lsl #2 + b _02036A40 +_02036908: ; jump table + b _02036A40 ; case 0 + b _020369F0 ; case 1 + b _02036A40 ; case 2 + b _02036A40 ; case 3 + b _02036A20 ; case 4 + b _02036930 ; case 5 + b _020369A0 ; case 6 + b _020369D0 ; case 7 + b _02036960 ; case 8 + b _02036A08 ; case 9 +_02036930: + mov r0, #9 + strb r0, [r3, #0x18] + ldr r0, [r1] + mov r2, #1 + strb r2, [r0, #0x10] + ldr r0, [r1] + mov r2, #0x36 + strb r2, [r0, #0x1b] + ldr r0, [r1] + mov r1, #2 + strb r1, [r0, #0x16] + b _02036A58 +_02036960: + mov r0, #6 + strb r0, [r3, #0x18] + ldr r0, [r1] + mov r2, #3 + strb r2, [r0, #0x16] + ldr r0, [r1] + mov r2, #1 + strb r2, [r0, #0x10] + ldr r0, [r1] + mov r2, #0x36 + strb r2, [r0, #0x1b] + ldr r0, [r1] + add r1, r2, #0xe9 + add r0, r0, #0x100 + strh r1, [r0, #0xa6] + b _02036A58 +_020369A0: + mov r0, #9 + strb r0, [r3, #0x18] + ldr r0, [r1] + mov r2, #1 + strb r2, [r0, #0x10] + ldr r0, [r1] + mov r2, #0x22 + strb r2, [r0, #0x1b] + ldr r0, [r1] + mov r1, #2 + strb r1, [r0, #0x16] + b _02036A58 +_020369D0: + strb r2, [r3, #0x16] + ldr r0, [r1] + mov r2, #6 + strb r2, [r0, #0x18] + ldr r0, [r1] + mov r1, #0x36 + strb r1, [r0, #0x1b] + b _02036A58 +_020369F0: + mov r0, #6 + strb r0, [r3, #0x18] + ldr r0, [r1] + mov r1, #0xa + strb r1, [r0, #0x1b] + b _02036A58 +_02036A08: + mov r0, #4 + strb r0, [r3, #0x16] + ldr r0, [r1] + mov r1, #0x11c +#endif + add r0, r0, #0x100 + strh r1, [r0, #0xa6] +_02036A20: + ldr r0, _02036CB0 ; =_020AFDF0 + mov r3, #6 + ldr r2, [r0] + mov r1, #1 + strb r3, [r2, #0x18] + ldr r0, [r0] + strb r1, [r0, #0x1b] + b _02036A58 +_02036A40: +#ifdef JAPAN + mov r2, #6 + ldr r0, _02036CB0 ; =_020AFDF0 + strb r2, [r1, #0x18] + ldr r0, [r0] + mov r1, #5 +#else + mov r1, #6 + ldr r0, _02036CB0 ; =_020AFDF0 + strb r1, [r3, #0x18] + ldr r0, [r0] + mov r1, #0xa +#endif + strb r1, [r0, #0x1b] +_02036A58: + ldr r0, _02036CB0 ; =_020AFDF0 + mov r3, #0 + ldr r2, [r0] + add r1, r2, #0xfc + str r1, [r2, #0xf8] + mov r2, r3 +_02036A70: + ldr r1, [r0] + ldr r1, [r1, #0xf8] + strb r2, [r1, r3] + add r3, r3, #1 + cmp r3, #0x36 + blt _02036A70 + cmp r5, #0 + ldreq r0, _02036CB0 ; =_020AFDF0 + ldreq r1, [r0] + addeq r0, r1, #0x138 + streq r0, [r1, #0x134] + beq _02036AE4 + ldr r0, _02036CB0 ; =_020AFDF0 + ldr r1, [r0] + str r5, [r1, #0x134] + ldr r1, [r0] + ldrb r2, [r1, #0x1b] + ldr r0, [r1, #0xf8] + ldr r1, [r1, #0x134] + bl MemcpySimple + ldr r0, _02036CB0 ; =_020AFDF0 + ldr r2, [r0] + add r1, r2, #0x138 + str r1, [r2, #0x134] + ldr r1, [r0] + ldrb r2, [r1, #0x1b] + ldr r0, [r1, #0x134] + ldr r1, [r1, #0xf8] + bl MemcpySimple +_02036AE4: + ldr r0, _02036CB0 ; =_020AFDF0 + mov r4, #0 + ldr r2, [r0] + ldrb r1, [r2, #0x1b] + b _02036B0C +_02036AF8: + ldr r0, [r2, #0xf8] + ldrb r0, [r0, r4] + cmp r0, #0 + beq _02036B14 + add r4, r4, #1 +_02036B0C: + cmp r4, r1 + blt _02036AF8 +_02036B14: + mov r2, #0 + ldr r0, _02036CB0 ; =_020AFDF0 + b _02036B2C +_02036B20: + ldr r1, [r3, #0xf8] + strb r2, [r1, r4] + add r4, r4, #1 +_02036B2C: + ldr r3, [r0] + ldrb r1, [r3, #0x1b] + cmp r4, r1 + blt _02036B20 + bl sub_02038A54 + ldr r1, _02036CB0 ; =_020AFDF0 + ldr r2, [r1] + strb r0, [r2, #0x1c] + ldr r2, [r1] + ldrb r1, [r2, #0x1c] + ldrb r0, [r2, #0x1b] + cmp r1, r0 + subeq r0, r1, #1 + streqb r0, [r2, #0x1c] + ldr r0, _02036CB0 ; =_020AFDF0 + mvn r1, #1 + ldr r3, [r0] + ldrb r2, [r3, #0x16] + strb r2, [r3, #0x17] + ldr r0, [r0] + strb r1, [r0, #2] + bl sub_02038ADC + ldr r0, _02036CB0 ; =_020AFDF0 + ldr r0, [r0] + ldr r0, [r0, #0xc] + sub r0, r0, #5 + cmp r0, #3 + addls pc, pc, r0, lsl #2 + b _02036C30 +_02036BA0: ; jump table + b _02036BB0 ; case 0 + b _02036BB0 ; case 1 + b _02036BB0 ; case 2 + b _02036BB0 ; case 3 +_02036BB0: + ldr r0, _02036CB4 ; =_0209B2FC + ldr r1, _02036CB8 ; =sub_02037F58 + bl CreateTextBox + ldr r1, _02036CB0 ; =_020AFDF0 + ldr r2, [r1] + strb r0, [r2] + ldr r1, [r1] + ldrb r0, [r1, #0x12] + cmp r0, #1 + mvneq r0, #1 + streqb r0, [r1, #2] + beq _02036C84 + ldr r0, [r1, #0xc] + cmp r0, #8 + beq _02036BF8 + sub r0, r0, #5 + cmp r0, #1 + bhi _02036C14 +_02036BF8: + ldr r0, _02036CBC ; =_0209B31C + ldr r1, _02036CC0 ; =sub_02037CA8 + bl CreateTextBox + ldr r1, _02036CB0 ; =_020AFDF0 + ldr r1, [r1] + strb r0, [r1, #2] + b _02036C84 +_02036C14: + ldr r0, _02036CBC ; =_0209B31C + ldr r1, _02036CC4 ; =sub_02037C78 + bl CreateTextBox + ldr r1, _02036CB0 ; =_020AFDF0 + ldr r1, [r1] + strb r0, [r1, #2] + b _02036C84 +_02036C30: + ldr r0, _02036CC8 ; =_0209B2EC + ldr r1, _02036CB8 ; =sub_02037F58 + bl CreateTextBox + ldr r1, _02036CB0 ; =_020AFDF0 + ldr r2, [r1] + strb r0, [r2] + ldr r1, [r1] + ldr r0, [r1, #0xc] + cmp r0, #4 + cmpne r0, #9 + ldrneb r0, [r1, #0x12] + cmpne r0, #1 + mvneq r0, #1 + streqb r0, [r1, #2] + beq _02036C84 + ldr r0, _02036CBC ; =_0209B31C + ldr r1, _02036CC4 ; =sub_02037C78 + bl CreateTextBox + ldr r1, _02036CB0 ; =_020AFDF0 + ldr r1, [r1] + strb r0, [r1, #2] +_02036C84: + ldr r0, _02036CCC ; =_0209B2DC + ldr r1, _02036CD0 ; =sub_02037CD8 + bl CreateTextBox + ldr r1, _02036CB0 ; =_020AFDF0 + mov r2, #0 + ldr r3, [r1] + strb r0, [r3, #1] + ldr r1, [r1] + mov r0, #1 + str r2, [r1, #4] + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_02036CB0: .word _020AFDF0 +#ifdef JAPAN +_02036FC8: .word 0x000031D1 +_02036FCC: .word 0x000031CE +#endif +_02036CB4: .word _0209B2FC +_02036CB8: .word sub_02037F58 +_02036CBC: .word _0209B31C +_02036CC0: .word sub_02037CA8 +_02036CC4: .word sub_02037C78 +_02036CC8: .word _0209B2EC +_02036CCC: .word _0209B2DC +_02036CD0: .word sub_02037CD8 + arm_func_end ShowKeyboard + + arm_func_start GetKeyboardStatus +GetKeyboardStatus: ; 0x02036CD4 + stmdb sp!, {r4, r5, lr} + sub sp, sp, #0x5c + ldr r0, _02037444 ; =_020AFDF0 + ldr r4, [r0] + ldr r0, [r4, #0xc] + sub r1, r0, #4 + cmp r1, #5 + addls pc, pc, r1, lsl #2 + b _02036DE8 +_02036CF8: ; jump table + b _02036DB8 ; case 0 + b _02036D10 ; case 1 + b _02036D40 ; case 2 + b _02036D70 ; case 3 + b _02036D10 ; case 4 + b _02036DB8 ; case 5 +_02036D10: + ldrb r2, [r4, #0x1c] + ldr r1, _02037448 ; =_0209B3B4 + ldr r0, _0203744C ; =_0209B3B6 + mov r3, r2, lsl #2 + ldrsh r2, [r1, r3] + ldrsh r1, [r0, r3] + ldrsb r0, [r4, #1] + add r2, r2, #0xc + add r3, r1, #0x24 + mov r1, #5 + bl sub_020288FC + b _02036E30 +_02036D40: + ldrb r2, [r4, #0x1c] + ldr r1, _02037450 ; =_0209B32C + ldr r0, _02037454 ; =_0209B32E + mov r3, r2, lsl #2 + ldrsh r2, [r1, r3] + ldrsh r1, [r0, r3] + ldrsb r0, [r4, #1] + add r2, r2, #0xc + add r3, r1, #0x24 + mov r1, #5 + bl sub_020288FC + b _02036E30 +_02036D70: + ldrb r5, [r4, #0x1c] + mov r1, #0x12 + mov r0, r5 + bl _s32_div_f + mov r1, #0x12 + mul r1, r0, r1 + ldr r0, _02037448 ; =_0209B3B4 + mov r2, r5, lsl #2 + ldrsh r2, [r0, r2] + ldr r0, _0203744C ; =_0209B3B6 + mov r1, r1, lsl #2 + ldrsh r1, [r0, r1] + ldrsb r0, [r4, #1] + add r2, r2, #0xc + add r3, r1, #0x24 + mov r1, #5 + bl sub_020288FC + b _02036E30 +_02036DB8: + ldr r2, _02037458 ; =_0209B2C4 + ldr r1, _0203745C ; =_0209B2D0 + ldrsh r3, [r4, #0x20] + ldrb r1, [r1, r0] + ldrb r2, [r2, r0] + add r3, r3, #0x25 + ldrsb r0, [r4, #1] + add r2, r3, r2 + add r3, r1, #0x24 + mov r1, #5 + bl sub_020288FC + b _02036E30 +_02036DE8: + ldr r1, _02037444 ; =_020AFDF0 + ldr r2, _02037458 ; =_0209B2C4 + ldr ip, [r1] + ldr r1, _0203745C ; =_0209B2D0 + ldrb r5, [ip, #0x1c] + ldrb r3, [r1, r0] + ldrb r4, [r2, r0] + add r0, ip, r5, lsl #1 + ldrsh r2, [r0, #0x20] + ldrsh r1, [r0, #0x8c] + ldrsb r0, [ip, #1] + add r2, r2, #0x1f + add r2, r4, r2 + add r1, r1, r1, lsr #31 + add r2, r2, r1, asr #1 + add r3, r3, #0x24 + mov r1, #5 + bl sub_020288FC +_02036E30: + ldr r1, _02037444 ; =_020AFDF0 + add r0, sp, #0x38 + ldr r3, [r1] + mov r1, #1 + ldrb r2, [r3, #0x14] + add r2, r2, #1 + strb r2, [r3, #0x14] + bl sub_02031914 + ldr r0, [sp, #0x3c] + ldr r1, [sp, #0x40] + mov r0, r0, lsl #0x10 + mov r1, r1, lsl #0x10 + mov r0, r0, lsr #0x10 + mov r1, r1, lsr #0x10 + mov r2, #0 + bl sub_02038B80 + cmp r0, #0x64 + blt _02036EB4 + ldr r1, _02037444 ; =_020AFDF0 + sub r0, r0, #0x64 + ldr r2, [r1] + and r1, r0, #0xff + ldrb r0, [r2, #0x1c] + cmp r0, r1 + beq _02036EE0 + mov r0, #3 + strb r1, [r2, #0x1c] + bl PlaySeVolumeWrapper + ldr r0, _02037444 ; =_020AFDF0 + mov r1, #8 + ldr r0, [r0] + strb r1, [r0, #0x14] + b _02036EE0 +_02036EB4: + cmp r0, #0 + blt _02036EE0 + ldr r1, _02037444 ; =_020AFDF0 + and r0, r0, #0xff + ldr r3, [r1] + ldrb r2, [r3, #0x18] + cmp r2, r0 + strneb r0, [r3, #0x18] + ldrne r0, [r1] + movne r1, #8 + strneb r1, [r0, #0x14] +_02036EE0: + ldr r0, _02037444 ; =_020AFDF0 + ldr r1, [r0] + ldrb r0, [r1, #0x1e] + cmp r0, #0 + subne r0, r0, #1 + strneb r0, [r1, #0x1e] + add r1, sp, #8 + mov r0, #0 + bl sub_020063F4 + add r1, sp, #0xa + mov r0, #0 + bl GetHeldButtons + ldrh r0, [sp, #0xa] + tst r0, #0x100 + beq _02036F5C + ldr r0, _02037444 ; =_020AFDF0 + mov r2, #0xa + ldr r5, [r0] +#ifdef JAPAN + ldr r3, [r0, #4] +#else + ldr r3, [r0, #8] +#endif + ldrb r1, [r5, #0x16] + ldrb r4, [r5, #0x18] + ldrsb r0, [r5] + ldr r3, [r3, r1, lsl #2] + mov r1, #3 + mla r3, r4, r2, r3 + ldrb r2, [r3, #4] + ldrb r3, [r3, #5] + add r2, r2, #2 + add r3, r3, #0x61 + bl sub_020288FC + b _020370A4 +_02036F5C: + ldrh r0, [sp, #8] + cmp r0, #0x20 + bgt _02036F78 + bge _02036FE4 + cmp r0, #0x10 + beq _0203700C + b _02037034 +_02036F78: + cmp r0, #0x40 + bgt _02036F88 + beq _02036F94 + b _02037034 +_02036F88: + cmp r0, #0x80 + beq _02036FBC + b _02037034 +_02036F94: + ldr r0, _02037444 ; =_020AFDF0 + mov r2, #0xa +#ifdef JAPAN + ldmia r0, {r1, r4} +#else + ldr r1, [r0] + ldr r4, [r0, #8] +#endif + ldrb r0, [r1, #0x18] + ldrb r3, [r1, #0x16] + smulbb r2, r0, r2 + ldr r3, [r4, r3, lsl #2] + ldrb r2, [r3, r2] + b _02037044 +_02036FBC: + ldr r0, _02037444 ; =_020AFDF0 + mov r2, #0xa +#ifdef JAPAN + ldmia r0, {r1, r4} +#else + ldr r1, [r0] + ldr r4, [r0, #8] +#endif + ldrb r3, [r1, #0x16] + ldrb r0, [r1, #0x18] + ldr r3, [r4, r3, lsl #2] + mla r2, r0, r2, r3 + ldrb r2, [r2, #1] + b _02037044 +_02036FE4: + ldr r0, _02037444 ; =_020AFDF0 + mov r2, #0xa +#ifdef JAPAN + ldmia r0, {r1, r4} +#else + ldr r1, [r0] + ldr r4, [r0, #8] +#endif + ldrb r3, [r1, #0x16] + ldrb r0, [r1, #0x18] + ldr r3, [r4, r3, lsl #2] + mla r2, r0, r2, r3 + ldrb r2, [r2, #2] + b _02037044 +_0203700C: + ldr r0, _02037444 ; =_020AFDF0 + mov r2, #0xa +#ifdef JAPAN + ldmia r0, {r1, r4} +#else + ldr r1, [r0] + ldr r4, [r0, #8] +#endif + ldrb r3, [r1, #0x16] + ldrb r0, [r1, #0x18] + ldr r3, [r4, r3, lsl #2] + mla r2, r0, r2, r3 + ldrb r2, [r2, #3] + b _02037044 +_02037034: + ldr r0, _02037444 ; =_020AFDF0 + ldr r1, [r0] + ldrb r0, [r1, #0x18] + mov r2, r0 +_02037044: + cmp r2, r0 + beq _02037068 + mov r0, #3 + strb r2, [r1, #0x18] + bl PlaySeVolumeWrapper + ldr r0, _02037444 ; =_020AFDF0 + mov r1, #8 + ldr r0, [r0] + strb r1, [r0, #0x14] +_02037068: + ldr r0, _02037444 ; =_020AFDF0 + mov r2, #0xa + ldr r5, [r0] +#ifdef JAPAN + ldr r3, [r0, #4] +#else + ldr r3, [r0, #8] +#endif + ldrb r1, [r5, #0x16] + ldrb r4, [r5, #0x18] + ldrsb r0, [r5] + ldr r3, [r3, r1, lsl #2] + mov r1, #3 + mla r3, r4, r2, r3 + ldrb r2, [r3, #4] + ldrb r3, [r3, #5] + add r2, r2, #2 + add r3, r3, #0x61 + bl sub_020288FC +_020370A4: + add r0, sp, #0x14 + mov r1, #1 + bl sub_02031914 + ldrh r0, [sp, #0x14] + tst r0, #2 + beq _020371C0 + ldr r0, _02037444 ; =_020AFDF0 + ldr r0, [r0] + ldrb r0, [r0, #0x1e] + cmp r0, #0 + bne _020371C0 + ldr r0, [sp, #0x18] + ldr r1, [sp, #0x1c] + mov r0, r0, lsl #0x10 + mov r1, r1, lsl #0x10 + mov r0, r0, lsr #0x10 + mov r1, r1, lsr #0x10 + mov r2, #1 + bl sub_02038B80 + mov r4, r0 + cmp r4, #0x64 + bge _02037108 + mvn r0, #0 + cmp r4, r0 + bne _02037110 +_02037108: + mvn r4, #0 + b _020371C4 +_02037110: + ldr r0, _02037444 ; =_020AFDF0 + ldr r0, [r0] + ldrsb r0, [r0, #1] + bl GetWindow + ldr r3, _02037444 ; =_020AFDF0 + mov r1, #0xa + ldr ip, [r3] + mul r5, r4, r1 + ldrb r1, [ip, #0x16] +#ifdef JAPAN + ldr ip, [r3, #4] +#else + ldr ip, [r3, #8] +#endif + ldr r3, _02037460 ; =_0209B28C + ldr ip, [ip, r1, lsl #2] + mov r1, #0x40 + str r3, [sp] + str r1, [sp, #4] + add r1, ip, r5 + ldrb ip, [r1, #4] + ldrb lr, [r0, #4] + ldrb r3, [r0, #5] + ldrb r1, [r1, #5] + add r0, ip, lr, lsl #3 + mov r0, r0, lsl #0x10 + add r1, r1, r3, lsl #3 + mov r1, r1, lsl #0x10 + mov r2, #0xc + cmp r4, #5 + movle r2, #0x24 + mov r2, r2, lsl #0x10 + mov r0, r0, asr #0x10 + mov r1, r1, asr #0x10 + mov r2, r2, asr #0x10 + mov r3, #0xc + bl sub_0202A2A4 + ldr r0, _02037444 ; =_020AFDF0 + ldr r2, [r0] +#ifdef JAPAN + ldr r1, [r0, #4] +#else + ldr r1, [r0, #8] +#endif + ldrb r0, [r2, #0x16] + ldr r0, [r1, r0, lsl #2] + add r0, r0, r5 + ldrh r0, [r0, #8] + cmp r0, #0x108 + movne r0, #5 + strneb r0, [r2, #0x1e] + b _020371C4 +_020371C0: + mvn r4, #0 +_020371C4: + mvn r0, #0 + cmp r4, r0 + beq _020371D8 + bl sub_020384B0 + b _0203743C +_020371D8: + add r1, sp, #0x10 + mov r0, #0 + bl GetPressedButtons + add r1, sp, #0xe + mov r0, #0 + bl GetHeldButtons + add r1, sp, #0xc + mov r0, #0 + bl sub_020063F4 + ldrh r0, [sp, #0xe] + tst r0, #0x100 + beq _02037374 + ldrh r0, [sp, #0xc] + cmp r0, #0x20 + bgt _02037224 + bge _02037240 + cmp r0, #0x10 + beq _02037274 + b _02037374 +_02037224: + cmp r0, #0x40 + bgt _02037234 + beq _020372C0 + b _02037374 +_02037234: + cmp r0, #0x80 + beq _02037308 + b _02037374 +_02037240: + ldr r0, _02037444 ; =_020AFDF0 + ldr r2, [r0] + ldrb r0, [r2, #0x1c] + cmp r0, #0 + beq _02037268 + sub r1, r0, #1 + mov r0, #3 + strb r1, [r2, #0x1c] + bl PlaySeVolumeWrapper + b _02037374 +_02037268: + mov r0, #2 + bl PlaySeVolumeWrapper + b _02037374 +_02037274: + ldr r0, _02037444 ; =_020AFDF0 + ldr r4, [r0] + ldrb r0, [r4, #0x1b] + ldrb r1, [r4, #0x1c] + sub r0, r0, #1 + cmp r1, r0 + beq _020372B4 + bl sub_02038A54 + ldrb r1, [r4, #0x1c] + cmp r1, r0 + bge _020372B4 + add r1, r1, #1 + mov r0, #3 + strb r1, [r4, #0x1c] + bl PlaySeVolumeWrapper + b _02037374 +_020372B4: + mov r0, #2 + bl PlaySeVolumeWrapper + b _02037374 +_020372C0: + ldr r0, _02037444 ; =_020AFDF0 + ldr r1, _02037464 ; =_0209B2B8 + ldr r2, [r0] + ldr r0, [r2, #0xc] + ldrsb r1, [r1, r0] + cmp r1, #0 + beq _02037374 + ldrb r0, [r2, #0x1c] + cmp r0, r1 + blt _020372FC + sub r1, r0, r1 + mov r0, #3 + strb r1, [r2, #0x1c] + bl PlaySeVolumeWrapper + b _02037374 +_020372FC: + mov r0, #2 + bl PlaySeVolumeWrapper + b _02037374 +_02037308: + ldr r0, _02037444 ; =_020AFDF0 + ldr r1, _02037464 ; =_0209B2B8 + ldr r4, [r0] + ldr r0, [r4, #0xc] + ldrsb r5, [r1, r0] + cmp r5, #0 + beq _02037374 + ldrb r0, [r4, #0x1b] + ldrb r1, [r4, #0x1c] + sub r0, r0, #1 + cmp r1, r0 + beq _0203736C + bl sub_02038A54 + ldrb r1, [r4, #0x1c] + add r1, r1, r5 + cmp r1, r0 + bge _0203736C + ldr r1, _02037444 ; =_020AFDF0 + mov r0, #3 + ldr r2, [r1] + ldrb r1, [r2, #0x1c] + add r1, r1, r5 + strb r1, [r2, #0x1c] + bl PlaySeVolumeWrapper + b _02037374 +_0203736C: + mov r0, #2 + bl PlaySeVolumeWrapper +_02037374: + ldrh r0, [sp, #0x10] + cmp r0, #8 +#ifdef JAPAN + bgt _020376BC + cmp r0, #0 + addge pc, pc, r0, lsl #2 +#else + addls pc, pc, r0, lsl #2 +#endif + b _02037438 +_02037384: ; jump table + b _02037438 ; case 0 + b _020373A8 ; case 1 + b _020373B0 ; case 2 + b _02037438 ; case 3 + b _020373E0 ; case 4 + b _02037438 ; case 5 + b _02037438 ; case 6 + b _02037438 ; case 7 + b _020373C4 ; case 8 +#ifdef JAPAN +_020376BC: + cmp r0, #0x400 + beq _02037760 + b _02037438 +#endif +_020373A8: + bl sub_020384B0 + b _0203743C +_020373B0: + bl sub_02038904 + cmp r0, #0 + beq _02037438 + mov r0, #2 + b _0203743C +_020373C4: + mov r0, #3 + bl PlaySeVolumeWrapper + ldr r0, _02037444 ; =_020AFDF0 + mov r1, #5 + ldr r0, [r0] + strb r1, [r0, #0x18] + b _02037438 +_020373E0: + ldr r0, _02037444 ; =_020AFDF0 + ldr r2, [r0] + ldrb r1, [r2, #0x10] + cmp r1, #0 + bne _02037438 + ldrb r1, [r2, #0x16] +#ifdef JAPAN + cmp r1, #3 +#else + cmp r1, #2 +#endif + bhi _02037438 + add r1, r1, #1 + strb r1, [r2, #0x16] +#ifdef JAPAN + ldr r4, [r0] + mov r1, #3 + ldrb r0, [r4, #0x16] + bl _s32_div_f + mov r0, #4 + strb r1, [r4, #0x16] +#else + ldr r2, [r0] + mov r0, #4 + ldrb r1, [r2, #0x16] + and r1, r1, #1 + strb r1, [r2, #0x16] +#endif + bl PlaySeVolumeWrapper + ldr r0, _02037444 ; =_020AFDF0 + ldr r0, [r0] + ldrsb r0, [r0, #1] + bl sub_02037CD8 + mov r0, #1 + bl sub_020383FC +#ifdef JAPAN + b _02037438 +_02037760: + mov r0, #2 + bl sub_0203935C + ldr r0, _02037444 ; =_020AFDF0 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_02037F58 +#endif +_02037438: + mov r0, #0 +_0203743C: + add sp, sp, #0x5c + ldmia sp!, {r4, r5, pc} + .align 2, 0 +_02037444: .word _020AFDF0 +_02037448: .word _0209B3B4 +_0203744C: .word _0209B3B6 +_02037450: .word _0209B32C +_02037454: .word _0209B32E +_02037458: .word _0209B2C4 +_0203745C: .word _0209B2D0 +_02037460: .word _0209B28C +_02037464: .word _0209B2B8 + arm_func_end GetKeyboardStatus + + arm_func_start sub_02037468 +sub_02037468: ; 0x02037468 + stmdb sp!, {r3, lr} + ldr r0, _02037558 ; =_020AFDF0 + ldr r0, [r0] + cmp r0, #0 + beq _02037550 + ldrsh r1, [r0, #8] + cmp r1, #3 + beq _0203749C + cmp r1, #4 + beq _020374D4 + cmp r1, #5 + beq _0203751C + b _02037534 +_0203749C: + ldrsb r0, [r0] + bl sub_0202F954 + ldr r0, _02037558 ; =_020AFDF0 + ldr r0, [r0] + ldrsb r0, [r0, #1] + bl sub_0202F954 + ldr r0, _02037558 ; =_020AFDF0 + mvn r1, #1 + ldr r0, [r0] + ldrsb r0, [r0, #2] + cmp r0, r1 + beq _02037534 + bl sub_0202F954 + b _02037534 +_020374D4: + ldrsb r0, [r0] + bl CloseTextBox + ldr r0, _02037558 ; =_020AFDF0 + ldr r0, [r0] + ldrsb r0, [r0, #1] + bl CloseTextBox + ldr r0, _02037558 ; =_020AFDF0 + mvn r1, #1 + ldr r0, [r0] + ldrsb r0, [r0, #2] + cmp r0, r1 + beq _02037534 + bl CloseTextBox + ldr r0, _02037558 ; =_020AFDF0 + mvn r1, #1 + ldr r0, [r0] + strb r1, [r0, #2] + b _02037534 +_0203751C: + bl MemFree + ldr r0, _02037558 ; =_020AFDF0 + mov r1, #0 + str r1, [r0] + mov r0, #1 + ldmia sp!, {r3, pc} +_02037534: + ldr r1, _02037558 ; =_020AFDF0 + mov r0, #0 + ldr r2, [r1] + ldrsh r1, [r2, #8] + add r1, r1, #1 + strh r1, [r2, #8] + ldmia sp!, {r3, pc} +_02037550: + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_02037558: .word _020AFDF0 + arm_func_end sub_02037468 + + arm_func_start GetKeyboardStringResult +GetKeyboardStringResult: ; 0x0203755C + ldr r0, _0203756C ; =_020AFDF0 + ldr r0, [r0] + ldr r0, [r0, #0xf8] + bx lr + .align 2, 0 +_0203756C: .word _020AFDF0 + arm_func_end GetKeyboardStringResult + + arm_func_start sub_02037570 +sub_02037570: ; 0x02037570 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + mov r0, #0x1e8 + mov r1, #8 + mov r4, r3 + bl MemAlloc + ldr r2, _020376E0 ; =_020AFDF0 + mov r1, #0x1e8 + str r0, [r2] + bl MemZero + ldr r0, _020376E0 ; =_020AFDF0 + mov r2, #1 + ldr r1, [r0] + cmp r5, #0 + strb r2, [r1, #0x1a4] + bne _020375DC + ldr r1, [r0] + mov r2, #5 + str r2, [r1, #0xc] + ldr r1, [r0] + mov r2, #0x36 + strb r2, [r1, #0x1b] + ldr r0, [r0] + ldrh r1, [sp, #0x10] + add r0, r0, #0x100 + strh r1, [r0, #0xa6] + b _0203760C +_020375DC: + cmp r5, #1 + bne _0203760C + ldr r1, [r0] + mov r2, #6 + str r2, [r1, #0xc] + ldr r1, [r0] + mov r2, #0x22 + strb r2, [r1, #0x1b] + ldr r0, [r0] + ldrh r1, [sp, #0x10] + add r0, r0, #0x100 + strh r1, [r0, #0xa6] +_0203760C: + ldr r0, _020376E0 ; =_020AFDF0 + mov r3, #0 + ldr r1, [r0] + str r3, [r1, #0x134] + ldr r2, [r0] + add r1, r2, #0xfc + str r1, [r2, #0xf8] + mov r2, r3 +_0203762C: + ldr r1, [r0] + ldr r1, [r1, #0xf8] + strb r2, [r1, r3] + add r3, r3, #1 + cmp r3, #0x36 + blt _0203762C + ldr r0, _020376E0 ; =_020AFDF0 + mov r1, r4 + ldr r0, [r0] + ldrb r2, [r0, #0x1b] + ldr r0, [r0, #0xf8] + bl MemcpySimple + ldr r0, _020376E0 ; =_020AFDF0 + mov r4, #0 + ldr r2, [r0] + ldrb r1, [r2, #0x1b] + b _02037684 +_02037670: + ldr r0, [r2, #0xf8] + ldrb r0, [r0, r4] + cmp r0, #0 + beq _0203768C + add r4, r4, #1 +_02037684: + cmp r4, r1 + blt _02037670 +_0203768C: + mov r2, #0 + ldr r0, _020376E0 ; =_020AFDF0 + b _020376A4 +_02037698: + ldr r1, [r3, #0xf8] + strb r2, [r1, r4] + add r4, r4, #1 +_020376A4: + ldr r3, [r0] + ldrb r1, [r3, #0x1b] + cmp r4, r1 + blt _02037698 + ldr r0, _020376E4 ; =_0209B30C + ldr r1, _020376E8 ; =sub_02037F58 + bl CreateTextBox + ldr r1, _020376E0 ; =_020AFDF0 + mov r2, #0 + ldr r3, [r1] + strb r0, [r3] + ldr r1, [r1] + mov r0, #1 + str r2, [r1, #4] + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_020376E0: .word _020AFDF0 +_020376E4: .word _0209B30C +_020376E8: .word sub_02037F58 + arm_func_end sub_02037570 + + arm_func_start sub_020376EC +sub_020376EC: ; 0x020376EC + stmdb sp!, {r3, lr} + ldr r0, _02037774 ; =_020AFDF0 + ldr r0, [r0] + cmp r0, #0 + beq _0203776C + ldrsh r1, [r0, #8] + cmp r1, #0 + beq _02037720 + cmp r1, #1 + beq _0203772C + cmp r1, #0xc + beq _02037738 + b _02037750 +_02037720: + ldrsb r0, [r0] + bl sub_0202F954 + b _02037750 +_0203772C: + ldrsb r0, [r0] + bl CloseTextBox + b _02037750 +_02037738: + bl MemFree + ldr r0, _02037774 ; =_020AFDF0 + mov r1, #0 + str r1, [r0] + mov r0, #1 + ldmia sp!, {r3, pc} +_02037750: + ldr r1, _02037774 ; =_020AFDF0 + mov r0, #0 + ldr r2, [r1] + ldrsh r1, [r2, #8] + add r1, r1, #1 + strh r1, [r2, #8] + ldmia sp!, {r3, pc} +_0203776C: + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_02037774: .word _020AFDF0 + arm_func_end sub_020376EC + + arm_func_start sub_02037778 +sub_02037778: ; 0x02037778 + stmdb sp!, {r3, r4, r5, lr} + sub sp, sp, #0x40 + ldr r0, _02037C28 ; =_020AFDF0 + ldr r3, [r0] +#ifdef JAPAN + ldr r1, [r0, #8] +#else + ldr r1, [r0, #4] +#endif + ldr r2, [r3, #4] + cmp r2, r1 + beq _020377B0 + ldr r0, _02037C2C ; =_0209B48C + bl Debug_Print0 + ldr r0, _02037C28 ; =_020AFDF0 + ldr r3, [r0] + ldr r1, [r3, #4] +#ifdef JAPAN + str r1, [r0, #8] +#else + str r1, [r0, #4] +#endif +_020377B0: + ldr r0, [r3, #4] + cmp r0, #9 + addls pc, pc, r0, lsl #2 + b _02037C1C +_020377C0: ; jump table + b _020377E8 ; case 0 + b _020377F4 ; case 1 + b _02037858 ; case 2 + b _0203799C ; case 3 + b _02037C1C ; case 4 + b _02037A5C ; case 5 + b _02037AA0 ; case 6 + b _02037C1C ; case 7 + b _02037AEC ; case 8 + b _02037B24 ; case 9 +_020377E8: + mov r0, #1 + str r0, [r3, #4] + b _02037C1C +_020377F4: + bl GetKeyboardStatus + cmp r0, #3 + bne _02037C1C + ldr r0, _02037C28 ; =_020AFDF0 + ldr r1, [r0] + ldr r0, [r1, #0xc] + cmp r0, #9 + addls pc, pc, r0, lsl #2 + b _0203784C +_02037818: ; jump table + b _02037840 ; case 0 + b _02037840 ; case 1 + b _02037840 ; case 2 + b _02037840 ; case 3 + b _02037840 ; case 4 + b _02037840 ; case 5 + b _02037840 ; case 6 + b _02037840 ; case 7 + b _0203784C ; case 8 + b _02037840 ; case 9 +_02037840: + mov r0, #2 + str r0, [r1, #4] + b _02037C1C +_0203784C: + mov r0, #2 + str r0, [r1, #4] + b _02037C1C +_02037858: + cmp r3, #0 + beq _02037924 + ldrsh r0, [r3, #8] + cmp r0, #3 + beq _02037880 + cmp r0, #4 + beq _020378B8 + cmp r0, #5 + beq _02037900 + b _02037908 +_02037880: + ldrsb r0, [r3] + bl sub_0202F954 + ldr r0, _02037C28 ; =_020AFDF0 + ldr r0, [r0] + ldrsb r0, [r0, #1] + bl sub_0202F954 + ldr r0, _02037C28 ; =_020AFDF0 + mvn r1, #1 + ldr r0, [r0] + ldrsb r0, [r0, #2] + cmp r0, r1 + beq _02037908 + bl sub_0202F954 + b _02037908 +_020378B8: + ldrsb r0, [r3] + bl CloseTextBox + ldr r0, _02037C28 ; =_020AFDF0 + ldr r0, [r0] + ldrsb r0, [r0, #1] + bl CloseTextBox + ldr r0, _02037C28 ; =_020AFDF0 + mvn r1, #1 + ldr r0, [r0] + ldrsb r0, [r0, #2] + cmp r0, r1 + beq _02037908 + bl CloseTextBox + ldr r0, _02037C28 ; =_020AFDF0 + mvn r1, #1 + ldr r0, [r0] + strb r1, [r0, #2] + b _02037908 +_02037900: + mov r2, #1 + b _02037928 +_02037908: + ldr r0, _02037C28 ; =_020AFDF0 + mov r2, #0 + ldr r1, [r0] + ldrsh r0, [r1, #8] + add r0, r0, #1 + strh r0, [r1, #8] + b _02037928 +_02037924: + mov r2, #1 +_02037928: + cmp r2, #0 + beq _02037C1C + ldr r0, _02037C28 ; =_020AFDF0 + ldr r2, [r0] + ldr r1, [r2, #4] + add r1, r1, #1 + str r1, [r2, #4] + ldr r1, [r0] + ldr r0, [r1, #0xc] + cmp r0, #9 + addls pc, pc, r0, lsl #2 + b _0203798C +_02037958: ; jump table + b _02037980 ; case 0 + b _02037980 ; case 1 + b _02037980 ; case 2 + b _02037980 ; case 3 + b _02037980 ; case 4 + b _02037980 ; case 5 + b _02037980 ; case 6 + b _02037980 ; case 7 + b _0203798C ; case 8 + b _02037980 ; case 9 +_02037980: + mov r0, #5 + str r0, [r1, #4] + b _02037C1C +_0203798C: + ldr r0, [r1, #4] + add r0, r0, #1 + str r0, [r1, #4] + b _02037C1C +_0203799C: + ldr r0, [r3, #0xc] + cmp r0, #9 + addls pc, pc, r0, lsl #2 + b _02037A54 +_020379AC: ; jump table + b _020379D4 ; case 0 + b _02037A40 ; case 1 + b _02037A54 ; case 2 + b _02037A54 ; case 3 + b _02037A54 ; case 4 + b _02037A54 ; case 5 + b _02037A54 ; case 6 + b _02037A54 ; case 7 + b _02037A54 ; case 8 + b _02037A54 ; case 9 +_020379D4: + bl GetMainCharacter1MemberIdx + mov r5, r0 + bl GetActiveRosterIndex + mov r4, r0 + mov r0, r5 + bl GetTeamMember + mov r5, r0 + mov r0, r4 + bl GetActiveTeamMember + ldr r1, _02037C28 ; =_020AFDF0 + mov r4, r0 + ldr r1, [r1] + add r0, r5, #0x3a + add r1, r1, #0xfc + mov r2, #0xa + bl StrncpySimple + mov r0, #0x3f + add r1, r5, #0x3a + mov r2, #0xa + bl SaveScriptVariableValueBytes + cmp r4, #0 + beq _02037A54 + add r0, r4, #0x5e + add r1, r5, #0x3a + mov r2, #0xa + bl StrncpySimple + b _02037A54 +_02037A40: + bl ov11_0230D71C + ldr r0, _02037C28 ; =_020AFDF0 + ldr r0, [r0] + add r0, r0, #0xfc + bl SetMainTeamName +_02037A54: + mov r0, #4 + b _02037C20 +_02037A5C: + add r0, sp, #0 + add r1, r3, #0xfc + mov r2, #0x40 + bl StrncpySimpleNoPadSafe + add r0, sp, #0 + bl sub_0203909C + ldr r0, _02037C28 ; =_020AFDF0 + ldr r0, [r0] + ldr r0, [r0, #0xc] + cmp r0, #1 + bne _02037A8C + bl sub_02039304 +_02037A8C: + ldr r0, _02037C28 ; =_020AFDF0 + mov r1, #6 + ldr r0, [r0] + str r1, [r0, #4] + b _02037C1C +_02037AA0: + bl sub_0203931C + cmp r0, #0 + beq _02037AB8 + cmp r0, #1 + beq _02037ACC + b _02037C1C +_02037AB8: + ldr r0, _02037C28 ; =_020AFDF0 + mov r1, #8 + ldr r0, [r0] + str r1, [r0, #4] + b _02037C1C +_02037ACC: + ldr r0, _02037C28 ; =_020AFDF0 + mov r3, #9 + ldr r2, [r0] + mov r1, #0 + str r3, [r2, #4] + ldr r0, [r0] + strh r1, [r0, #8] + b _02037C1C +_02037AEC: + bl sub_02039218 + cmp r0, #0 + beq _02037C1C + ldr r0, _02037C28 ; =_020AFDF0 + ldr r0, [r0] + ldrb r0, [r0, #0x11] + cmp r0, #0 + bne _02037B10 + bl ov11_022E6E68 +_02037B10: + ldr r0, _02037C28 ; =_020AFDF0 + mov r1, #3 + ldr r0, [r0] + str r1, [r0, #4] + b _02037C1C +_02037B24: + bl sub_02039218 + cmp r0, #0 + beq _02037C1C + ldr r2, _02037C28 ; =_020AFDF0 + ldr r3, [r2] + ldr r0, [r3, #0xc] + cmp r0, #5 + cmpne r0, #6 + bne _02037B64 + ldr r0, _02037C30 ; =_0209B2FC + ldr r1, _02037C34 ; =sub_02037F58 + bl CreateTextBox + ldr r1, _02037C28 ; =_020AFDF0 + ldr r1, [r1] + strb r0, [r1] + b _02037BF8 +_02037B64: + ldrb r1, [r3, #0x17] + mov ip, #6 + ldr r0, _02037C38 ; =_0209B2EC + strb r1, [r3, #0x16] + ldr r3, [r2] + ldr r1, _02037C34 ; =sub_02037F58 + strb ip, [r3, #0x18] + ldr r2, [r2] + mov r3, #0 + strb r3, [r2, #0x15] + bl CreateTextBox + ldr r1, _02037C28 ; =_020AFDF0 + ldr r2, [r1] + strb r0, [r2] + ldr r1, [r1] + ldr r0, [r1, #0xc] + cmp r0, #4 + cmpne r0, #9 + mvneq r0, #1 + streqb r0, [r1, #2] + beq _02037BD0 + ldr r0, _02037C3C ; =_0209B31C + ldr r1, _02037C40 ; =sub_02037C78 + bl CreateTextBox + ldr r1, _02037C28 ; =_020AFDF0 + ldr r1, [r1] + strb r0, [r1, #2] +_02037BD0: + bl sub_02038A54 + ldr r1, _02037C28 ; =_020AFDF0 + ldr r2, [r1] + strb r0, [r2, #0x1c] + ldr r2, [r1] + ldrb r1, [r2, #0x1c] + ldrb r0, [r2, #0x1b] + cmp r1, r0 + subeq r0, r1, #1 + streqb r0, [r2, #0x1c] +_02037BF8: + ldr r0, _02037C44 ; =_0209B2DC + ldr r1, _02037C48 ; =sub_02037CD8 + bl CreateTextBox + ldr r1, _02037C28 ; =_020AFDF0 + mov r2, #0 + ldr r3, [r1] + strb r0, [r3, #1] + ldr r0, [r1] + str r2, [r0, #4] +_02037C1C: + mov r0, #1 +_02037C20: + add sp, sp, #0x40 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_02037C28: .word _020AFDF0 +_02037C2C: .word _0209B48C +_02037C30: .word _0209B2FC +_02037C34: .word sub_02037F58 +_02037C38: .word _0209B2EC +_02037C3C: .word _0209B31C +_02037C40: .word sub_02037C78 +_02037C44: .word _0209B2DC +_02037C48: .word sub_02037CD8 + arm_func_end sub_02037778 + + arm_func_start sub_02037C4C +sub_02037C4C: ; 0x02037C4C + stmdb sp!, {r3, lr} + ldr r0, _02037C74 ; =_020AFDF0 + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + bl MemFree + ldr r0, _02037C74 ; =_020AFDF0 + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_02037C74: .word _020AFDF0 + arm_func_end sub_02037C4C + + arm_func_start sub_02037C78 +sub_02037C78: ; 0x02037C78 + stmdb sp!, {r4, lr} + mov r4, r0 + bl sub_02027B1C + mov r1, #0 + ldr r3, _02037CA4 ; =0x00000122 + mov r0, r4 + mov r2, r1 + bl sub_02026268 + mov r0, r4 + bl UpdateWindow + ldmia sp!, {r4, pc} + .align 2, 0 +#ifdef JAPAN +_02037CA4: .word 0x000031D4 +#else +_02037CA4: .word 0x00000122 +#endif + arm_func_end sub_02037C78 + + arm_func_start sub_02037CA8 +sub_02037CA8: ; 0x02037CA8 + stmdb sp!, {r4, lr} + mov r4, r0 + bl sub_02027B1C + mov r1, #0 + ldr r3, _02037CD4 ; =0x00000123 + mov r0, r4 + mov r2, r1 + bl sub_02026268 + mov r0, r4 + bl UpdateWindow + ldmia sp!, {r4, pc} + .align 2, 0 +#ifdef JAPAN +_02037CD4: .word 0x000031D5 +#else +_02037CD4: .word 0x00000123 +#endif + arm_func_end sub_02037CA8 + + arm_func_start sub_02037CD8 +sub_02037CD8: ; 0x02037CD8 + stmdb sp!, {r4, r5, r6, r7, r8, lr} + sub sp, sp, #0x40 +#ifdef JAPAN + mov r7, r0 + bl sub_02027B1C + mov r4, #0 +#else + ldr r1, _02037F10 ; =_020AFDF0 + mov r7, r0 + ldr r0, [r1] + mov r4, #0 + ldrb r0, [r0, #0x16] + cmp r0, #0 + moveq r4, #1 + beq _02037D14 + cmp r0, #1 + moveq r4, #1 + beq _02037D14 + cmp r0, #2 + moveq r4, #3 +_02037D14: + mov r0, r7 + bl sub_02027B1C + b _02037EF8 +#endif +_02037D20: + ldr r2, _02037F10 ; =_020AFDF0 + mov r0, #0xa + ldr r1, [r2] + mul r6, r4, r0 + ldrb r0, [r1, #0x16] +#ifdef JAPAN + ldr r2, [r2, #4] +#else + ldr r2, [r2, #8] +#endif + ldr r3, _02037F14 ; =0x00000111 + ldr r2, [r2, r0, lsl #2] + add r2, r2, r6 + ldrh r5, [r2, #8] + cmp r5, r3 + cmpne r5, #0x110 + beq _02037EF4 + add r2, r5, #0xfe + add r2, r2, #0xfe00 + mov r2, r2, lsl #0x10 + mov r2, r2, lsr #0x10 + cmp r2, #7 + bhi _02037E0C +#ifdef JAPAN + cmp r0, #2 +#else + cmp r0, #0 +#endif + moveq ip, #0x104 + beq _02037D84 + cmp r0, #1 +#ifdef JAPAN + subeq ip, r3, #0xe + beq _02037D84 + cmp r0, #0 + subeq ip, r3, #0xf +#else + subeq ip, r3, #0xc +#endif + movne ip, #0 +_02037D84: + cmp r5, #0x100 + blo _02037EA8 + ldr r0, _02037F18 ; =0x00000109 + cmp r5, r0 + bhi _02037EA8 + mov lr, #0 + ldr r3, _02037F1C ; =KEYBOARD_STRING_IDS + mov r0, #6 + b _02037DF4 +_02037DA8: + cmp r5, r8 + bne _02037DE8 + ldr r0, _02037F18 ; =0x00000109 + cmp r5, r0 + bne _02037DD0 +#ifdef JAPAN + ldrb r0, [r1, #0x15] + cmp r0, #0 + ldrne r1, _020381EC ; =0x000031D8 + ldreq r1, _020381F0 ; =0x000031D9 +#else + ldrb r1, [r1, #0x15] + cmp r1, #0 + addne r1, r0, #0x1d + addeq r1, r0, #0x1e +#endif + b _02037DDC +_02037DD0: + cmp ip, r5 + ldreqh r1, [r2, #4] + ldrneh r1, [r2, #2] +_02037DDC: + add r0, sp, #0 + bl GetStringFromFileVeneer + b _02037EA8 +_02037DE8: + add r2, lr, #1 + mov r2, r2, lsl #0x10 + mov lr, r2, asr #0x10 +_02037DF4: + smulbb r2, lr, r0 + ldrh r8, [r3, r2] + add r2, r3, r2 + cmp r8, #0 + bne _02037DA8 + b _02037EA8 +_02037E0C: + ldr r1, [r1, #0xc] + cmp r1, #8 + beq _02037E38 +#ifdef JAPAN + cmp r0, #3 +#else + cmp r0, #2 +#endif + bne _02037E38 + cmp r4, #5 + ble _02037E38 + and r0, r5, #0xff + bl sub_0204DA1C + cmp r0, #0xff +#ifdef JAPAN + bne _02037E38 + ldr r1, _020381F4 ; =_020B12A0_JP + add r0, sp, #0 + ldr r2, [r1, r5, lsl #2] + ldr r1, _020381F8 ; =_0209B4A4 + bl SprintfStatic__02037F30 + b _02037EA8 +_02037E38: + ldr r1, _020381F4 ; =_020B12A0_JP + add r0, sp, #0 + ldr r1, [r1, r5, lsl #2] + bl strcpy +#else + beq _02037E5C +_02037E38: + ldr r0, _02037F10 ; =_020AFDF0 + ldr r0, [r0] + ldr r0, [r0, #0xc] + cmp r0, #9 + bne _02037E84 + cmp r5, #0x41 + blo _02037E5C + cmp r5, #0x5a + bls _02037E84 +_02037E5C: + cmp r5, #0x20 + add r0, sp, #0 + bne _02037E74 + ldr r1, _02037F20 ; =_0209B4A4 + bl SprintfStatic__02037F30 + b _02037EA8 +_02037E74: + ldr r1, _02037F24 ; =_0209B4AC + mov r2, r5 + bl SprintfStatic__02037F30 + b _02037EA8 +_02037E84: + cmp r5, #0x20 + add r0, sp, #0 + bne _02037E9C + ldr r1, _02037F28 ; =_0209B4B8 + bl SprintfStatic__02037F30 + b _02037EA8 +_02037E9C: + ldr r1, _02037F2C ; =_0209B4C0 + mov r2, r5 + bl SprintfStatic__02037F30 +#endif +_02037EA8: + add r0, sp, #0 + bl sub_020265A8 + cmp r0, #0xc + rsble r0, r0, #0xc + movgt r1, #0 + addle r0, r0, r0, lsr #31 + movle r1, r0, asr #1 + ldr r0, _02037F10 ; =_020AFDF0 + add r3, sp, #0 +#ifdef JAPAN + ldmia r0, {r2, r5} +#else + ldr r2, [r0] + ldr r5, [r0, #8] +#endif + ldrb r2, [r2, #0x16] + mov r0, r7 + ldr r2, [r5, r2, lsl #2] + add r2, r2, r6 + ldrb r5, [r2, #4] + ldrb r2, [r2, #5] + add r1, r1, r5 + bl DrawTextInWindow +_02037EF4: + add r4, r4, #1 +_02037EF8: + cmp r4, #0x54 +#ifdef JAPAN + blt _02037D20 +#else + bne _02037D20 +#endif + mov r0, r7 + bl UpdateWindow + add sp, sp, #0x40 + ldmia sp!, {r4, r5, r6, r7, r8, pc} + .align 2, 0 +_02037F10: .word _020AFDF0 +_02037F14: .word 0x00000111 +_02037F18: .word 0x00000109 +_02037F1C: .word KEYBOARD_STRING_IDS +#ifdef JAPAN +_020381EC: .word 0x000031D8 +_020381F0: .word 0x000031D9 +_020381F4: .word _020B12A0_JP +_020381F8: .word _0209B4A4 +#else +_02037F20: .word _0209B4A4 +_02037F24: .word _0209B4AC +_02037F28: .word _0209B4B8 +_02037F2C: .word _0209B4C0 +#endif + arm_func_end sub_02037CD8 + + arm_func_start SprintfStatic__02037F30 +SprintfStatic__02037F30: ; 0x02037F30 + stmdb sp!, {r0, r1, r2, r3} + stmdb sp!, {r3, lr} + add r2, sp, #0xc + bic r2, r2, #3 + ldr r1, [sp, #0xc] + add r2, r2, #4 + bl vsprintf + ldmia sp!, {r3, lr} + add sp, sp, #0x10 + bx lr + arm_func_end SprintfStatic__02037F30 + + arm_func_start sub_02037F58 +sub_02037F58: ; 0x02037F58 +#ifdef JAPAN + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0x108 +#else + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0x114 +#endif + ldr r1, _020383DC ; =_0209B288 + mov sb, r0 + ldrb r2, [r1] + ldrb r0, [r1, #1] +#ifdef JAPAN + strb r2, [sp, #4] + strb r0, [sp, #5] +#else + mov sl, #0 + strb r2, [sp, #0x10] + strb r0, [sp, #0x11] +#endif + bl sub_02038ADC + mov r0, sb + bl sub_02027B1C + ldr r0, _020383E0 ; =_020AFDF0 + ldr r1, [r0] + ldr r0, [r1, #0xc] + cmp r0, #7 + addeq r0, r1, #0x100 +#ifdef JAPAN + moveq r1, #0 +#else + moveq r1, sl +#endif + streqh r1, [r0, #0xa6] + ldr r0, _020383E0 ; =_020AFDF0 + ldr r0, [r0] + add r0, r0, #0x100 + ldrh r1, [r0, #0xa6] + cmp r1, #0 + beq _02037FF8 +#ifdef JAPAN + add r0, sp, #6 +#else + add r0, sp, #0x12 +#endif + bl GetStringFromFileVeneer + mov r0, sb + bl GetWindow + mov r4, r0 +#ifdef JAPAN + add r0, sp, #6 +#else + add r0, sp, #0x12 +#endif + bl sub_020265A8 + ldrb r1, [r4, #6] + mov r2, #0 +#ifdef JAPAN + add r3, sp, #6 +#else + add r3, sp, #0x12 +#endif + rsb r0, r0, r1, lsl #3 + add r0, r0, r0, lsr #31 + mov r1, r0, asr #1 + mov r0, sb + bl DrawTextInWindow +_02037FF8: + ldr r0, _020383E0 ; =_020AFDF0 + ldr r0, [r0] + ldr r0, [r0, #0xc] + cmp r0, #5 + moveq r8, #0x36 + movne r8, #0x22 + cmp r0, #7 + moveq r8, #0x36 + cmp r0, #8 + ldr r0, _020383E0 ; =_020AFDF0 + moveq r8, #0x36 + ldr r0, [r0] + ldrb r5, [r0, #0x1b] + ldr r4, [r0, #0xf8] + bl sub_02038B5C + cmp r0, #0 + beq _02038054 + mov r0, r4 + mov r1, r5 + bl sub_02038A8C +#ifdef JAPAN +_02038054: +#else + cmp r0, #0x3c + movgt r0, #1 + bgt _02038058 +_02038054: + mov r0, #0 +_02038058: + cmp r0, #0 + movne sl, #1 +#endif + mov r6, #0 + ldr r4, _020383E4 ; =_0209B3B4 + ldr fp, _020383E0 ; =_020AFDF0 + b _02038394 +_02038070: + ldr r1, [fp] + add r0, r1, r6 + ldr r7, [r1, #0xc] + ldrb r5, [r0, #0xfc] + sub r0, r7, #4 + cmp r0, #5 + addls pc, pc, r0, lsl #2 + b _020382E8 +_02038090: ; jump table + b _0203825C ; case 0 + b _020380A8 ; case 1 + b _02038148 ; case 2 + b _020381FC ; case 3 + b _020380A8 ; case 4 + b _0203825C ; case 5 +_020380A8: + mov r0, r6 + mov r1, #0x12 + bl _s32_div_f + cmp r1, #5 + ble _020380D0 + cmp r1, #0xc +#ifdef JAPAN + movlt sl, #0x43 +#else + movlt r0, #0x43 + strlt r0, [sp, #8] +#endif + movlt r7, #1 + blt _020380DC +_020380D0: +#ifdef JAPAN + mov sl, #0x44 +#else + mov r0, #0x44 + str r0, [sp, #8] +#endif + mov r7, #0 +_020380DC: + cmp r5, #0 + beq _02038114 + mov r0, r5 + bl sub_020251F0 +#ifdef JAPAN + and r1, sl, #0xff + str r1, [sp] + mov r3, r0 + mov r0, sb + mov r1, r6, lsl #2 + ldrsh r1, [r4, r1] + add r2, r4, r6, lsl #2 + ldrsh r2, [r2, #2] + bl sub_020264F8 +_02038114: + add r0, sp, #4 +#else + ldr r1, [sp, #8] + add r2, r4, r6, lsl #2 + and r1, r1, #0xff + str r1, [sp] + mov r1, r6, lsl #2 + mov r3, r0 + ldrsh r1, [r4, r1] + ldrsh r2, [r2, #2] + mov r0, sb + bl sub_020264F8 +_02038114: + add r0, sp, #0x10 +#endif + ldrsb r2, [r0, r7] + mov r1, r6, lsl #2 + mov r0, sb + str r2, [sp] + ldrsh r3, [r4, r1] + add r1, r4, r6, lsl #2 + ldrsh r2, [r1, #2] + sub r1, r3, #1 + mov r3, #0xc + add r2, r2, #0xc + bl sub_02025D50 + b _02038390 +_02038148: + mov r0, r6 +#ifdef JAPAN + cmp r5, #2 +#else + cmp r5, #0x20 +#endif + mov r1, #0x11 + moveq r5, #0 + bl _s32_div_f + cmp r1, #5 + blt _02038178 + cmp r1, #0xc +#ifdef JAPAN + movlt sl, #0x43 +#else + movlt r0, #0x43 + strlt r0, [sp, #4] +#endif + movlt r7, #1 + blt _02038184 +_02038178: +#ifdef JAPAN + mov sl, #0x44 +#else + mov r0, #0x44 + str r0, [sp, #4] +#endif + mov r7, #0 +_02038184: + cmp r5, #0 + beq _020381C4 + mov r0, r5 + bl sub_020251F0 +#ifdef JAPAN + and r1, sl, #0xff + str r1, [sp] + ldr r1, _020383E8 ; =_0209B32C + mov r2, r6, lsl #2 + ldrsh r1, [r1, r2] + ldr r2, _020383E8 ; =_0209B32C + mov r3, r0 + add r2, r2, r6, lsl #2 + ldrsh r2, [r2, #2] + mov r0, sb + bl sub_020264F8 +_020381C4: + add r0, sp, #4 +#else + ldr r1, [sp, #4] + mov r2, r6, lsl #2 + and r1, r1, #0xff + str r1, [sp] + ldr r1, _020383E8 ; =_0209B32C + mov r3, r0 + ldrsh r1, [r1, r2] + ldr r2, _020383E8 ; =_0209B32C + mov r0, sb + add r2, r2, r6, lsl #2 + ldrsh r2, [r2, #2] + bl sub_020264F8 +_020381C4: + add r0, sp, #0x10 +#endif + ldrsb r1, [r0, r7] + mov r2, r6, lsl #2 + mov r0, sb + str r1, [sp] + ldr r1, _020383E8 ; =_0209B32C + ldrsh r3, [r1, r2] + add r1, r1, r6, lsl #2 + ldrsh r2, [r1, #2] + sub r1, r3, #1 + mov r3, #0xc + add r2, r2, #0xc + bl sub_02025D50 + b _02038390 +_020381FC: + cmp r5, #0 +#ifdef JAPAN + moveq r5, #0xa + cmp r5, #2 +#else + moveq r5, #0x2a + cmp r5, #0x20 +#endif + moveq r5, #0 + cmp r5, #0 + beq _02038390 + mov r0, r5 + bl sub_020251F0 + mov r5, r0 + mov r0, r6 + mov r1, #0x12 + bl _s32_div_f + mov r1, #0x44 + str r1, [sp] + mov r1, #0x12 + mul r1, r0, r1 + add r0, r4, r1, lsl #2 + mov r1, r6, lsl #2 + ldrsh r2, [r0, #2] + ldrsh r1, [r4, r1] + mov r3, r5 + mov r0, sb + bl sub_020264F8 + b _02038390 +_0203825C: +#ifdef JAPAN + cmp r5, #2 +#else + cmp r5, #0x20 +#endif + moveq r5, #0 + cmp r5, #0 + beq _020382AC + ldr r1, _020383EC ; =_0209B2C4 + ldr r2, [fp] +#ifdef JAPAN + mov r0, r5 + ldrb sl, [r1, r7] + ldrsh r5, [r2, #0x20] + bl sub_020251F0 + ldr r2, _020383F0 ; =_0209B2D0 +#else + ldrb r1, [r1, r7] + mov r0, r5 + ldrsh r5, [r2, #0x20] + str r1, [sp, #0xc] + bl sub_020251F0 + ldr r2, _020383F0 ; =_0209B2D0 + ldr r1, [sp, #0xc] +#endif + mov r3, #0x44 + str r3, [sp] + mov r3, r0 + ldrb r2, [r2, r7] +#ifdef JAPAN + add r1, sl, r5 +#else + add r1, r1, r5 +#endif + mov r0, sb + bl sub_020264F8 +_020382AC: +#ifdef JAPAN + ldr r5, [fp] + mov r2, #0x17 + ldr r1, [r5, #0xc] + mov r0, sb + str r2, [sp] + ldr r2, _020383EC ; =_0209B2C4 + ldrsh r5, [r5, #0x20] + ldrb r7, [r2, r1] + ldr r2, _020383F0 ; =_0209B2D0 + mov r3, #0xc + ldrb r2, [r2, r1] + add r1, r7, r5 + add r2, r2, #0xc + bl sub_02025D50 + b _02038390 +_020382E8: + ldr r1, [fp] + ldr r0, _0203864C_JP ; =_020B12A0 + cmp r5, #2 + moveq r5, #0 + ldr r3, [r0, r5, lsl #2] + add r1, r1, r6, lsl #1 + ldrsh r5, [r1, #0x20] + ldr r1, _020383EC ; =_0209B2C4 + mov r0, sb + ldrb sl, [r1, r7] + ldr r1, _020383F0 ; =_0209B2D0 + ldrb r2, [r1, r7] + add r1, sl, r5 + bl DrawTextInWindow + ldr r5, [fp] + mov r2, #0x17 + ldr r1, [r5, #0xc] + mov r0, sb + str r2, [sp] + ldr r2, _020383EC ; =_0209B2C4 + ldrsh r5, [r5, #0x20] + ldrb r7, [r2, r1] + ldr r2, _020383F0 ; =_0209B2D0 + mov r3, #0x32 + ldrb r2, [r2, r1] + add r1, r7, r5 + add r2, r2, #0xc +#else + ldr r2, [fp] + mov r1, #0x17 + ldr r5, [r2, #0xc] + ldr r7, _020383F0 ; =_0209B2D0 + str r1, [sp] + ldrsh r1, [r2, #0x20] + ldr r2, _020383EC ; =_0209B2C4 + mov r0, sb + ldrb r2, [r2, r5] + ldrb r5, [r7, r5] + mov r3, #0xc + add r1, r2, r1 + add r2, r5, #0xc + bl sub_02025D50 + b _02038390 +_020382E8: + cmp r5, #0x20 + moveq r5, #0 + cmp sl, #0 + mov r0, r5 + beq _02038314 + bl sub_020251F0 + mov r2, r0 + ldr r1, _020383F4 ; =_0209B4C4 + add r0, sp, #0x12 + bl SprintfStatic__02037F30 + b _02038328 +_02038314: + bl sub_020251F0 + mov r2, r0 + ldr r1, _020383F8 ; =_0209B4C0 + add r0, sp, #0x12 + bl sprintf +_02038328: + ldr r1, [fp] + ldr r3, _020383EC ; =_0209B2C4 + ldr r2, [r1, #0xc] + add r1, r1, r6, lsl #1 + ldrb r5, [r3, r2] + ldr r3, _020383F0 ; =_0209B2D0 + ldrsh r1, [r1, #0x20] + ldrb r2, [r3, r2] + mov r0, sb + add r3, sp, #0x12 + add r1, r5, r1 + bl DrawTextInWindow + ldr r2, [fp] + mov r1, #0x17 + ldr r5, [r2, #0xc] + ldr r7, _020383F0 ; =_0209B2D0 + str r1, [sp] + ldrsh r1, [r2, #0x20] + ldr r2, _020383EC ; =_0209B2C4 + mov r0, sb + ldrb r2, [r2, r5] + ldrb r5, [r7, r5] + mov r3, #0x3c + add r1, r2, r1 + add r2, r5, #0xc +#endif + bl sub_02025D50 +_02038390: + add r6, r6, #1 +_02038394: + cmp r6, r8 + blt _02038070 + ldr r0, _020383E0 ; =_020AFDF0 + ldr r0, [r0] + ldr r0, [r0, #0xc] + cmp r0, #7 + bne _020383CC +#ifdef JAPAN + ldrsb r4, [sp, #4] +#else + ldrsb r4, [sp, #0x10] +#endif + mov r0, sb + mov r1, #3 + mov r2, #0x1d + mov r3, #0xea + str r4, [sp] + bl sub_02025D50 +_020383CC: + mov r0, sb + bl UpdateWindow +#ifdef JAPAN + add sp, sp, #0x108 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} +#else + add sp, sp, #0x114 + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc} +#endif + .align 2, 0 +_020383DC: .word _0209B288 +_020383E0: .word _020AFDF0 +_020383E4: .word _0209B3B4 +_020383E8: .word _0209B32C +_020383EC: .word _0209B2C4 +_020383F0: .word _0209B2D0 +#ifdef JAPAN +_0203864C_JP: .word _020B12A0_JP +#else +_020383F4: .word _0209B4C4 +_020383F8: .word _0209B4C0 +#endif + arm_func_end sub_02037F58 + + arm_func_start sub_020383FC +sub_020383FC: ; 0x020383FC + stmdb sp!, {r3, r4, r5, r6, r7, lr} + ldr r1, _020384A8 ; =_020AFDF0 + mov r4, #0 + ldr r2, [r1] + ldrb r1, [r2, #0x10] + cmp r1, #0 + bne _02038444 + cmp r0, #0 + beq _02038444 + ldrb r0, [r2, #0x16] + cmp r0, #0 + beq _0203843C + cmp r0, #1 +#ifdef JAPAN + beq _020386A0 + cmp r0, #2 +#endif + moveq r0, #2 + streqb r0, [r2, #0x18] + b _02038444 +_0203843C: +#ifdef JAPAN + strb r4, [r2, #0x18] + b _02038444 +_020386A0: +#endif + mov r0, #1 + strb r0, [r2, #0x18] +_02038444: + ldr r7, _020384A8 ; =_020AFDF0 + mov r5, #0xa + ldr r6, _020384AC ; =0x00000111 + b _02038484 +_02038454: + ldrb r0, [r0, #6] + cmp r0, #1 + cmpne r0, #2 + cmpne r0, #3 + ldrneb r0, [r2, #0x10] + cmpne r0, #0 + beq _02038480 + cmp r1, #0x100 + bge _02038480 + and r0, r1, #0xff + bl sub_0204DA1C +_02038480: + add r4, r4, #1 +_02038484: + ldr r2, [r7] +#ifdef JAPAN + ldr r1, [r7, #4] +#else + ldr r1, [r7, #8] +#endif + ldrb r0, [r2, #0x16] + ldr r0, [r1, r0, lsl #2] + mla r0, r4, r5, r0 + ldrh r1, [r0, #8] + cmp r1, r6 + bne _02038454 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_020384A8: .word _020AFDF0 +_020384AC: .word 0x00000111 + arm_func_end sub_020383FC + + arm_func_start sub_020384B0 +sub_020384B0: ; 0x020384B0 + stmdb sp!, {r3, r4, r5, lr} + ldr r2, _02038900 ; =_020AFDF0 + mov r0, #0xa +#ifdef JAPAN + ldmia r2, {r1, r3} +#else + ldr r1, [r2] + ldr r3, [r2, #8] +#endif + ldrb ip, [r1, #0x16] + ldrb r2, [r1, #0x18] + ldr r3, [r3, ip, lsl #2] + mla r0, r2, r0, r3 + ldrh r4, [r0, #8] +#ifdef JAPAN + sub r0, r4, #0x100 + cmp r0, #9 +#else + sub r0, r4, #0x104 + cmp r0, #5 +#endif + addls pc, pc, r0, lsl #2 + b _020387B4 +_020384E8: ; jump table +#ifdef JAPAN + b _02038770 ; case 0 + b _0203878C ; case 1 + b _02038500 ; case 2 + b _02038544 ; case 3 + b _02038830 ; case 4 + b _020387B4 ; case 5 + b _020387B4 ; case 6 + b _020385C0 ; case 7 + b _020385F0 ; case 8 + b _02038588 ; case 9 +_02038770: + mov r0, #0 + bl sub_0203935C + ldr r0, _02038900 ; =_020AFDF0 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_02037F58 + b _020388F8 +_0203878C: + mov r0, #1 + bl sub_0203935C + ldr r0, _02038900 ; =_020AFDF0 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_02037F58 + b _020388F8 +#else + b _02038500 ; case 0 + b _02038544 ; case 1 + b _020387B4 ; case 2 + b _020385C0 ; case 3 + b _020385F0 ; case 4 + b _02038588 ; case 5 +#endif +_02038500: + cmp ip, #0 + bne _02038514 + mov r0, #2 + bl PlaySeVolumeWrapper + b _020388F8 +_02038514: + mov r0, #0 + bl PlaySeVolumeWrapper + ldr r0, _02038900 ; =_020AFDF0 + mov r2, #0 + ldr r1, [r0] + strb r2, [r1, #0x16] + ldr r0, [r0] + ldrsb r0, [r0, #1] + bl sub_02037CD8 + mov r0, #1 + bl sub_020383FC + b _020388F8 +_02038544: + cmp ip, #1 + bne _02038558 + mov r0, #2 + bl PlaySeVolumeWrapper + b _020388F8 +_02038558: + mov r0, #0 + bl PlaySeVolumeWrapper + ldr r0, _02038900 ; =_020AFDF0 + mov r2, #1 + ldr r1, [r0] + strb r2, [r1, #0x16] + ldr r0, [r0] + ldrsb r0, [r0, #1] + bl sub_02037CD8 + mov r0, #1 + bl sub_020383FC + b _020388F8 +#ifdef JAPAN +_02038830: + cmp ip, #2 + bne _02038844 + mov r0, #2 + bl PlaySeVolumeWrapper + b _020388F8 +_02038844: + mov r0, #0 + bl PlaySeVolumeWrapper + ldr r0, _02038900 ; =_020AFDF0 + mov r2, #2 + ldr r1, [r0] + strb r2, [r1, #0x16] + ldr r0, [r0] + ldrsb r0, [r0, #1] + bl sub_02037CD8 + mov r0, #1 + bl sub_020383FC + b _020388F8 +#endif +_02038588: + ldrb r0, [r1, #0x15] + cmp r0, #0 + moveq r2, #1 + movne r2, #0 + mov r0, #4 + strb r2, [r1, #0x15] + bl PlaySeVolumeWrapper + mov r0, #0 + bl sub_020383FC + ldr r0, _02038900 ; =_020AFDF0 + ldr r0, [r0] + ldrsb r0, [r0, #1] + bl sub_02037CD8 + b _020388F8 +_020385C0: + ldrsb r0, [r1] + bl sub_02037F58 + bl sub_02038904 + cmp r0, #0 + beq _020388F8 + ldr r0, _02038900 ; =_020AFDF0 + ldr r0, [r0] + ldr r0, [r0, #0xc] + cmp r0, #8 + bne _020388F8 + mov r0, #2 + ldmia sp!, {r3, r4, r5, pc} +_020385F0: + ldrb r0, [r1, #0x1e] + cmp r0, #0 + movne r0, #0 + ldmneia sp!, {r3, r4, r5, pc} + ldr r0, [r1, #0xc] + cmp r0, #7 + bne _02038680 + bl sub_02038A54 + movs r4, r0 + beq _02038680 + cmp r4, #0x12 + bge _02038680 + mov r0, #2 + bl PlaySeVolumeWrapper +#ifdef JAPAN + mov r1, #2 +#else + mov r1, #0x20 +#endif + ldr r0, _02038900 ; =_020AFDF0 + b _0203864C +_02038634: + ldr r2, [r0] + ldr r3, [r2, #0xf8] + ldrb r2, [r3, r4] + cmp r2, #0 + streqb r1, [r3, r4] + add r4, r4, #1 +_0203864C: + cmp r4, #0x12 + bne _02038634 + ldr r0, _02038900 ; =_020AFDF0 + mov r1, #0x12 + ldr r0, [r0] + strb r1, [r0, #0x1c] + bl sub_02038ADC + ldr r0, _02038900 ; =_020AFDF0 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_02037F58 + mov r0, #0 + ldmia sp!, {r3, r4, r5, pc} +_02038680: + ldr r0, _02038900 ; =_020AFDF0 + ldr r1, [r0] + ldrb r0, [r1, #0x16e] + ldrb r5, [r1, #0x10] + cmp r0, #0 + movne r2, #1 + moveq r2, #0 + ldr r0, [r1, #0xc] + and r4, r2, #0xff + cmp r0, #8 + moveq r5, #0 + bl sub_02038A54 + cmp r0, #0 + beq _020386E8 + cmp r5, #1 + bne _020386E8 + bl sub_02038A54 + ldr r1, _02038900 ; =_020AFDF0 + ldr r1, [r1] + ldrb r1, [r1, #0x1b] + cmp r1, r0 + beq _020386E8 + mov r0, #2 + bl PlaySeVolumeWrapper + mov r0, #3 + ldmia sp!, {r3, r4, r5, pc} +_020386E8: + cmp r4, #0 + bne _020386FC + bl sub_02038A54 + cmp r0, #0 + beq _0203871C +_020386FC: + cmp r5, #0 + beq _0203872C + bl sub_02038A54 + ldr r1, _02038900 ; =_020AFDF0 + ldr r1, [r1] + ldrb r1, [r1, #0x1b] + cmp r1, r0 + beq _0203872C +_0203871C: + mov r0, #2 + bl PlaySeVolumeWrapper + mov r0, #2 + ldmia sp!, {r3, r4, r5, pc} +_0203872C: + bl sub_02038B5C + cmp r0, #0 + beq _02038760 + ldr r0, _02038900 ; =_020AFDF0 + ldr r0, [r0] + ldrb r1, [r0, #0x1b] + ldr r0, [r0, #0xf8] + bl sub_02038A8C + cmp r0, #0x3c + ble _02038760 + mov r0, #2 + bl PlaySeVolumeWrapper + b _020388F8 +_02038760: + mov r0, #0 + bl PlaySeVolumeWrapper + cmp r4, #0 + beq _02038794 + bl sub_02038A54 + cmp r0, #0 + bne _02038794 + ldr r0, _02038900 ; =_020AFDF0 + ldr r0, [r0] + add r1, r0, #0x6e + ldr r0, [r0, #0xf8] + add r1, r1, #0x100 + bl StrcpySimple +_02038794: + ldr r0, _02038900 ; =_020AFDF0 + ldr r1, [r0] + ldrb r2, [r1, #0x1b] + ldr r0, [r1, #0x134] + ldr r1, [r1, #0xf8] + bl MemcpySimple + mov r0, #3 + ldmia sp!, {r3, r4, r5, pc} +_020387B4: + ldrb r0, [r1, #0x10] + cmp r0, #0 + ldrne r0, [r1, #0xc] + cmpne r0, #8 + beq _020387E4 + and r0, r4, #0xff + bl sub_0204DA1C + cmp r0, #0xff + bne _02038810 + mov r0, #2 + bl PlaySeVolumeWrapper + b _020388F8 +_020387E4: +#ifndef JAPAN + ldr r0, [r1, #0xc] + cmp r0, #9 + bne _02038810 + and r0, r4, #0xff + cmp r0, #0x41 + blo _02038804 + cmp r0, #0x5a + bls _02038810 +_02038804: + mov r0, #2 + bl PlaySeVolumeWrapper + b _020388F8 +#endif +_02038810: + ldr r0, _02038900 ; =_020AFDF0 + ldr r2, [r0] + ldrb r1, [r2, #0x15] + cmp r1, #1 + bne _020388A4 + ldr r1, [r2, #0xc] + cmp r1, #7 + bne _02038870 + ldrb r1, [r2, #0x1c] + cmp r1, #0x11 + bhi _02038870 + beq _020388A4 + mov r3, #0x10 + b _0203885C +_02038848: + ldr r2, [r2, #0xf8] + ldrb r1, [r2, r3] + add r2, r2, r3 + sub r3, r3, #1 + strb r1, [r2, #1] +_0203885C: + ldr r2, [r0] + ldrb r1, [r2, #0x1c] + cmp r3, r1 + bge _02038848 + b _020388A4 +_02038870: + ldrb r0, [r2, #0x1b] + sub r3, r0, #2 + ldr r0, _02038900 ; =_020AFDF0 + b _02038894 +_02038880: + ldr r2, [r2, #0xf8] + ldrb r1, [r2, r3] + add r2, r2, r3 + sub r3, r3, #1 + strb r1, [r2, #1] +_02038894: + ldr r2, [r0] + ldrb r1, [r2, #0x1c] + cmp r3, r1 + bge _02038880 +_020388A4: + ldr r0, _02038900 ; =_020AFDF0 + ldr r2, [r0] + ldrb r1, [r2, #0x1c] + ldr r2, [r2, #0xf8] + strb r4, [r2, r1] + ldr r2, [r0] + ldrb r0, [r2, #0x1b] + ldrb r1, [r2, #0x1c] + sub r0, r0, #1 + cmp r1, r0 + addlt r0, r1, #1 + strltb r0, [r2, #0x1c] + movge r0, #5 + strgeb r0, [r2, #0x18] + mov r0, #0 + bl PlaySeVolumeWrapper + bl sub_02038ADC + ldr r0, _02038900 ; =_020AFDF0 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_02037F58 +_020388F8: + mov r0, #0 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_02038900: .word _020AFDF0 + arm_func_end sub_020384B0 + + arm_func_start sub_02038904 +sub_02038904: ; 0x02038904 + stmdb sp!, {r3, lr} + ldr r0, _02038A50 ; =_020AFDF0 + ldr r3, [r0] + ldrb r2, [r3, #0x1c] + ldr r1, [r3, #0xf8] + ldrb r1, [r1, r2] + cmp r1, #0 + bne _02038978 + cmp r2, #0 + bne _0203893C + mov r0, #2 + bl PlaySeVolumeWrapper + mov r0, #1 + ldmia sp!, {r3, pc} +_0203893C: + sub r1, r2, #1 + strb r1, [r3, #0x1c] + ldr r0, [r0] + mov r3, #0 + ldrb r1, [r0, #0x1c] + ldr r2, [r0, #0xf8] + mov r0, #1 + strb r3, [r2, r1] + bl PlaySeVolumeWrapper + ldr r0, _02038A50 ; =_020AFDF0 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_02037F58 + bl sub_02038ADC + b _02038A48 +_02038978: + bl sub_02038A54 + ldr r1, _02038A50 ; =_020AFDF0 + sub r0, r0, #1 + ldr r2, [r1] + mov ip, #0 + ldr r1, [r2, #0xc] + cmp r1, #7 + bne _020389EC + ldrb lr, [r2, #0x1c] + cmp lr, #0x11 + bhi _020389EC + cmp r0, #0x11 + movge r0, #0x11 +#ifdef JAPAN + movge ip, #2 +#else + movge ip, #0x20 +#endif + ldr r1, _02038A50 ; =_020AFDF0 + b _020389D0 +_020389B8: + ldr r2, [r1] + ldr r3, [r2, #0xf8] + add r2, r3, lr + ldrb r2, [r2, #1] + strb r2, [r3, lr] + add lr, lr, #1 +_020389D0: + cmp lr, r0 + blt _020389B8 + ldr r1, _02038A50 ; =_020AFDF0 + ldr r1, [r1] + ldr r1, [r1, #0xf8] + strb ip, [r1, r0] + b _02038A2C +_020389EC: + ldrb ip, [r2, #0x1c] + ldr r1, _02038A50 ; =_020AFDF0 + b _02038A10 +_020389F8: + ldr r2, [r1] + ldr r3, [r2, #0xf8] + add r2, r3, ip + ldrb r2, [r2, #1] + strb r2, [r3, ip] + add ip, ip, #1 +_02038A10: + cmp ip, r0 + blt _020389F8 + ldr r1, _02038A50 ; =_020AFDF0 + mov r2, #0 + ldr r1, [r1] + ldr r1, [r1, #0xf8] + strb r2, [r1, r0] +_02038A2C: + mov r0, #1 + bl PlaySeVolumeWrapper + ldr r0, _02038A50 ; =_020AFDF0 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_02037F58 + bl sub_02038ADC +_02038A48: + mov r0, #0 + ldmia sp!, {r3, pc} + .align 2, 0 +_02038A50: .word _020AFDF0 + arm_func_end sub_02038904 + + arm_func_start sub_02038A54 +sub_02038A54: ; 0x02038A54 + ldr r1, _02038A88 ; =_020AFDF0 + mov r0, #0 + ldr r2, [r1] + ldrb r3, [r2, #0x1b] + b _02038A7C +_02038A68: + ldr r1, [r2, #0xf8] + ldrb r1, [r1, r0] + cmp r1, #0 + bxeq lr + add r0, r0, #1 +_02038A7C: + cmp r0, r3 + blt _02038A68 + bx lr + .align 2, 0 +_02038A88: .word _020AFDF0 + arm_func_end sub_02038A54 + + arm_func_start sub_02038A8C +sub_02038A8C: ; 0x02038A8C + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r4, #0 + mov r7, r0 + mov r6, r1 + mov r5, r4 + b _02038ACC +_02038AA4: + ldrb r0, [r7, r5] + cmp r0, #0 + beq _02038AD4 + bl sub_020251F0 + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_02025C7C +#ifdef JAPAN + ldrsh r0, [r0, #6] +#else + ldrb r0, [r0, #2] +#endif + add r5, r5, #1 + add r4, r4, r0 +_02038ACC: + cmp r5, r6 + blt _02038AA4 +_02038AD4: + mov r0, r4 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end sub_02038A8C + + arm_func_start sub_02038ADC +sub_02038ADC: ; 0x02038ADC + stmdb sp!, {r4, r5, r6, lr} + mov r4, #0 + mov r5, r4 + ldr r6, _02038B58 ; =_020AFDF0 + b _02038B44 +_02038AF0: + add r0, r1, r5, lsl #1 + strh r4, [r0, #0x20] + ldr r1, [r6] + ldr r0, [r1, #0xf8] + ldrb r0, [r0, r5] + cmp r0, #0 + addeq r0, r1, r5, lsl #1 + moveq r1, #8 + streqh r1, [r0, #0x8c] + ldmeqia sp!, {r4, r5, r6, pc} + bl sub_020251F0 + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_02025C7C + ldr r1, [r6] +#ifdef JAPAN + ldrsh r2, [r0, #6] +#else + ldrb r2, [r0, #2] +#endif + add r1, r1, r5, lsl #1 + add r5, r5, #1 + strh r2, [r1, #0x8c] +#ifdef JAPAN + ldrsh r0, [r0, #6] +#else + ldrb r0, [r0, #2] +#endif + add r4, r4, r0 +_02038B44: + ldr r1, [r6] + ldrb r0, [r1, #0x1b] + cmp r5, r0 + blt _02038AF0 + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_02038B58: .word _020AFDF0 + arm_func_end sub_02038ADC + + arm_func_start sub_02038B5C +sub_02038B5C: ; 0x02038B5C + ldr r0, _02038B7C ; =_020AFDF0 + ldr r0, [r0] + ldr r0, [r0, #0xc] + cmp r0, #3 + movls r0, #1 + movhi r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_02038B7C: .word _020AFDF0 + arm_func_end sub_02038B5C + + arm_func_start sub_02038B80 +sub_02038B80: ; 0x02038B80 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr} + sub sp, sp, #8 + ldr r2, _02039068 ; =_020AFDF0 + mov sb, r0 + ldr r7, [r2] + mov r8, r1 + ldrb r3, [r7, #0x10] + ldr ip, [r7, #0xc] + mov r2, #1 + cmp ip, #7 + moveq r3, r2 + cmp r3, #0 + ldr r4, _0203906C ; =_0209B2E0 + movne r2, #2 + ldr r1, _02039070 ; =_0209B2E1 + ldr r0, _02039074 ; =_0209B2E2 + ldrb r4, [r4, r2, lsl #4] + ldr lr, _02039078 ; =0x0000FFFF + ldr r5, _0203907C ; =_0209B2E3 + cmp sb, lr + ldrb r1, [r1, r2, lsl #4] + ldrb r0, [r0, r2, lsl #4] + ldrb r2, [r5, r2, lsl #4] + mov r4, r4, lsl #3 + mov r5, r1, lsl #3 + add r0, r4, r0, lsl #3 + cmpne r8, lr + add r1, r5, r2, lsl #3 + mvneq r0, #0 + beq _02039060 + add r2, r1, #8 + cmp r8, r2 + bge _02038FA0 + cmp r3, #0 + beq _02038CEC + add r1, r5, #8 + cmp r8, r1 + sublt r0, lr, #0x10000 + blt _02039060 + cmp r8, r2 + subgt r0, lr, #0x10000 + bgt _02039060 + sub r1, r4, #4 + cmp sb, r1 + sublt r0, lr, #0x10000 + blt _02039060 + add r0, r0, #4 + cmp sb, r0 + subgt r0, lr, #0x10000 + bgt _02039060 + cmp ip, #5 + beq _02038C5C + sub r0, ip, #7 + cmp r0, #1 + bhi _02038CA0 +_02038C5C: + add r0, r4, #3 + sub sb, sb, r0 + cmp sb, #0 + movle sb, #1 + cmp sb, #0xea + movge sb, #0xe9 + mov r0, sb + mov r1, #0xd + bl _s32_div_f + add r1, r5, #0x1e + mov r6, r0 + cmp r8, r1 + addgt r6, r6, #0x12 + add r0, r5, #0x2d + cmp r8, r0 + addgt r6, r6, #0x12 + b _02038D88 +_02038CA0: + add r0, r4, #6 + sub sb, sb, r0 + cmp sb, #0 + movle sb, #1 + cmp sb, #0xe5 + movge sb, #0xe4 + cmp sb, #0xaa + subgt sb, sb, #8 + bgt _02038CCC + cmp sb, #0x4b + subgt sb, sb, #4 +_02038CCC: + mov r0, sb + mov r1, #0xd + bl _s32_div_f + add r1, r5, #0x24 + mov r6, r0 + cmp r8, r1 + addgt r6, r6, #0x11 + b _02038D88 +_02038CEC: + bl sub_02038A54 + ldr r1, _02039068 ; =_020AFDF0 + ldr r3, _02039080 ; =_0209B2C4 + ldr r1, [r1] + ldr r7, [r1, #0xc] + ldrb r2, [r1, #0x1b] + ldrb r3, [r3, r7] + cmp r0, r2 + subeq r0, r0, #1 + add r2, r5, #0x16 + cmp r8, r2 + add r2, r2, #0x20 + add r3, r4, r3 + mvnlt r0, #0 + blt _02039060 + cmp r8, r2 + mvngt r0, #0 + bgt _02039060 + sub r2, r3, #4 + cmp sb, r2 + mvnlt r0, #0 + blt _02039060 + add r2, r3, #0x68 + cmp sb, r2 + mvngt r0, #0 + bgt _02039060 + sub r5, sb, r3 + mov r4, #0 + b _02038D80 +_02038D60: + add r2, r1, r4, lsl #1 + ldrsh r3, [r2, #0x20] + ldrsh r2, [r2, #0x8c] + mov r6, r4 + add r2, r3, r2 + cmp r5, r2 + blt _02038D88 + add r4, r4, #1 +_02038D80: + cmp r4, r0 + ble _02038D60 +_02038D88: + bl sub_02038A54 + cmp r6, r0 + bgt _02038F98 + ldr r0, _02039068 ; =_020AFDF0 + ldr r1, [r0] + strb r6, [r1, #0x1d] + ldr r0, [r0] + ldrsb r0, [r0] + bl GetWindow + mov r4, r0 + bl sub_02038ADC + ldr r0, _02039068 ; =_020AFDF0 + ldr r3, [r0] + ldr r1, [r3, #0xc] + sub r0, r1, #4 + cmp r0, #5 + addls pc, pc, r0, lsl #2 + b _02038F30 +_02038DD0: ; jump table + b _02038ED8 ; case 0 + b _02038DE8 ; case 1 + b _02038E60 ; case 2 + b _02038DE8 ; case 3 + b _02038DE8 ; case 4 + b _02038ED8 ; case 5 +_02038DE8: + ldr r0, _02039084 ; =_0209B28C + ldr r5, _02039088 ; =_0209B2D0 + str r0, [sp] + mov r0, #0x40 + str r0, [sp, #4] + ldr sb, _02039080 ; =_0209B2C4 + ldrb r2, [r4, #5] + ldrb r0, [r4, #4] + ldr r3, _0203908C ; =_0209B3B6 + mov r8, r6, lsl #2 + ldr r7, _02039090 ; =_0209B3B4 + ldrb r4, [r5, r1] + ldrsh r3, [r3, r8] + ldrb r1, [sb, r1] + ldrsh r5, [r7, r8] + add r3, r4, r3 + sub r2, r2, #1 + add r2, r3, r2, lsl #3 + sub r2, r2, #0xe + mov r2, r2, lsl #0x10 + add r1, r1, r5 + sub r0, r0, #1 + add r0, r1, r0, lsl #3 + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + mov r1, r2, asr #0x10 + mov r2, #0xc + mov r3, #0xb + bl sub_0202A2A4 + b _02038F90 +_02038E60: + ldr r0, _02039084 ; =_0209B28C + ldr r5, _02039088 ; =_0209B2D0 + str r0, [sp] + mov r0, #0x40 + str r0, [sp, #4] + ldr sb, _02039080 ; =_0209B2C4 + ldrb r2, [r4, #5] + ldrb r0, [r4, #4] + ldr r3, _02039094 ; =_0209B32E + mov r8, r6, lsl #2 + ldr r7, _02039098 ; =_0209B32C + ldrb r4, [r5, r1] + ldrsh r3, [r3, r8] + ldrb r1, [sb, r1] + ldrsh r5, [r7, r8] + add r3, r4, r3 + sub r2, r2, #1 + add r2, r3, r2, lsl #3 + sub r2, r2, #0xe + mov r2, r2, lsl #0x10 + add r1, r1, r5 + sub r0, r0, #1 + add r0, r1, r0, lsl #3 + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + mov r1, r2, asr #0x10 + mov r2, #0xc + mov r3, #0xb + bl sub_0202A2A4 + b _02038F90 +_02038ED8: + ldr r0, _02039084 ; =_0209B28C + ldr r2, _02039080 ; =_0209B2C4 + str r0, [sp] + mov r0, #0x40 + str r0, [sp, #4] + ldr r0, _02039088 ; =_0209B2D0 + ldrb r5, [r2, r1] + ldrsh r3, [r3, #0x20] + ldrb r2, [r4, #4] + ldrb r1, [r0, r1] + ldrb r0, [r4, #5] + add r3, r5, r3 + add r2, r3, r2, lsl #3 + add r1, r1, r0, lsl #3 + mov r0, r2, lsl #0x10 + mov r1, r1, lsl #0x10 + mov r0, r0, asr #0x10 + mov r1, r1, asr #0x10 + mov r2, #0xc + mov r3, #0xb + bl sub_0202A2A4 + b _02038F90 +_02038F30: + ldr r0, _02039068 ; =_020AFDF0 + ldr r2, _02039080 ; =_0209B2C4 + ldr r5, [r0] + ldr r3, _02039084 ; =_0209B28C + mov r0, #0x40 + str r3, [sp] + str r0, [sp, #4] + add r5, r5, r6, lsl #1 + ldr r0, _02039088 ; =_0209B2D0 + ldrb r7, [r2, r1] + ldrsh r3, [r5, #0x20] + ldrb r2, [r4, #4] + ldrb r1, [r0, r1] + ldrb r0, [r4, #5] + add r3, r7, r3 + add r2, r3, r2, lsl #3 + add r1, r1, r0, lsl #3 + mov r0, r2, lsl #0x10 + mov r1, r1, lsl #0x10 + ldrsh r2, [r5, #0x8c] + mov r0, r0, asr #0x10 + mov r1, r1, asr #0x10 + mov r3, #0xb + bl sub_0202A2A4 +_02038F90: + add r0, r6, #0x64 + b _02039060 +_02038F98: + mvn r0, #0 + b _02039060 +_02038FA0: + cmp r8, #0x60 + blt _02038FB0 + cmp r8, #0xb8 + ble _02038FB8 +_02038FB0: + mvn r0, #0 + b _02039060 +_02038FB8: + cmp r8, #8 + sublt r0, lr, #0x10000 + blt _02039060 + cmp r8, #0xf8 + subgt r0, lr, #0x10000 + bgt _02039060 + cmp sb, #8 + sublt r0, lr, #0x10000 + blt _02039060 + cmp sb, #0xf8 + subgt r0, lr, #0x10000 + bgt _02039060 + cmp sb, #0x23 + movle sb, #0x24 + cmp sb, #0xf5 + movge sb, #0xf4 + cmp r8, #0x63 + movle r8, #0x64 + cmp r8, #0xb1 + movge r8, #0xb0 + sub r0, r8, #0x63 + mov r1, #0xd + bl _s32_div_f + mov r4, r0 + sub r0, sb, #0x23 + mov r1, #0xf + bl _s32_div_f + mov r1, #6 + ldr r2, _02039068 ; =_020AFDF0 + mla r0, r1, r0, r4 + ldrb r3, [r7, #0x16] +#ifdef JAPAN + ldr r2, [r2, #4] +#else + ldr r2, [r2, #8] +#endif + mov r1, #0xa + ldr r2, [r2, r3, lsl #2] + mla r2, r0, r1, r2 + ldrh r2, [r2, #8] + cmp r2, #0x110 + subeq r0, r1, #0xb + beq _02039060 + ldrb r2, [r7, #0x1e] + cmp r2, #0 + subne r0, r1, #0xb +_02039060: + add sp, sp, #8 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + .align 2, 0 +_02039068: .word _020AFDF0 +_0203906C: .word _0209B2E0 +_02039070: .word _0209B2E1 +_02039074: .word _0209B2E2 +_02039078: .word 0x0000FFFF +_0203907C: .word _0209B2E3 +_02039080: .word _0209B2C4 +_02039084: .word _0209B28C +_02039088: .word _0209B2D0 +_0203908C: .word _0209B3B6 +_02039090: .word _0209B3B4 +_02039094: .word _0209B32E +_02039098: .word _0209B32C + arm_func_end sub_02038B80 + +#ifdef JAPAN + arm_func_start sub_0203935C +sub_0203935C: ; 0x0203935C + stmdb sp!, {r3, lr} + ldr r1, _0203942C_JP ; =_020AFDF0 + ldr r2, [r1] + ldrb r1, [r2, #0x10] + cmp r1, #0 + beq _02039380 + mov r0, #2 + bl PlaySeVolumeWrapper + ldmia sp!, {r3, pc} +_02039380: + ldrb r3, [r2, #0x1c] + ldr r2, [r2, #0xf8] + ldrb r1, [r2, r3] + cmp r1, #0 + bne _020393F0 + cmp r3, #0 + bne _020393A8 + mov r0, #2 + bl PlaySeVolumeWrapper + ldmia sp!, {r3, pc} +_020393A8: + add r1, r2, r3 + ldrb r1, [r1, #-1] + bl sub_02039430 + ldr r1, _0203942C_JP ; =_020AFDF0 + ldr r2, [r1] + ldr r1, [r2, #0xf8] + ldrb r2, [r2, #0x1c] + sub r3, r1, #1 + ldrb r1, [r3, r2] + cmp r0, r1 + beq _020393E4 + strb r0, [r3, r2] + mov r0, #0 + bl PlaySeVolumeWrapper + ldmia sp!, {r3, pc} +_020393E4: + mov r0, #2 + bl PlaySeVolumeWrapper + ldmia sp!, {r3, pc} +_020393F0: + bl sub_02039430 + ldr r1, _0203942C_JP ; =_020AFDF0 + ldr r1, [r1] + ldrb r2, [r1, #0x1c] + ldr r3, [r1, #0xf8] + ldrb r1, [r3, r2] + cmp r0, r1 + beq _02039420 + strb r0, [r3, r2] + mov r0, #0 + bl PlaySeVolumeWrapper + ldmia sp!, {r3, pc} +_02039420: + mov r0, #2 + bl PlaySeVolumeWrapper + ldmia sp!, {r3, pc} + .align 2, 0 +_0203942C_JP: .word _020AFDF0 + arm_func_end sub_0203935C + + arm_func_start sub_02039430 +sub_02039430: ; 0x02039430 + cmp r0, #0 + beq _02039454 + cmp r0, #1 + beq _02039464 + cmp r0, #2 + ldreq r0, _02039474 ; =_0209C29E_JP + addeq r1, r1, r1, lsl #1 + ldreqb r0, [r0, r1] + bx lr +_02039454: + ldr r0, _02039478 ; =_0209C29C_JP + add r1, r1, r1, lsl #1 + ldrb r0, [r0, r1] + bx lr +_02039464: + ldr r0, _0203947C ; =_0209C29D_JP + add r1, r1, r1, lsl #1 + ldrb r0, [r0, r1] + bx lr + .align 2, 0 +_02039474: .word _0209C29E_JP +_02039478: .word _0209C29C_JP +_0203947C: .word _0209C29D_JP + arm_func_end sub_02039430 +#endif + + arm_func_start sub_0203909C +sub_0203909C: ; 0x0203909C + stmdb sp!, {r3, r4, r5, r6, lr} + sub sp, sp, #0x9c + mov r6, r0 + mov r4, #0 + mov r0, #0x4c + mov r1, #8 + mov r5, r4 + bl MemAlloc +#ifdef JAPAN + ldr r2, _02039208 ; =_020AFE40 + mov r1, r4 + str r0, [r2] + str r1, [r0, #8] + ldr r0, [r2] + sub r3, r1, #2 + strb r1, [r0, #0xc] + ldr r0, [r2] + strb r3, [r0] + ldr r0, [r2] + strb r3, [r0, #1] + ldr r0, [r2] + strb r3, [r0, #2] + ldr r0, [r2] + str r1, [r0, #0x10] + ldr r0, _02039608 ; =0x00008140 + b _02039118 +_020394E4: + add r2, r6, r1 + ldrb r3, [r6, r1] + ldrb r2, [r2, #1] + cmp r3, #0 + orr r2, r2, r3, lsl #8 + mov r2, r2, lsl #0x10 + mov r2, r2, lsr #0x10 + beq _02039120 + cmp r2, r0 + addeq r4, r4, #1 + add r5, r5, #1 + add r1, r1, #2 +_02039118: + cmp r1, #0x36 + bne _020394E4 +#else + ldr r1, _02039208 ; =_020AFE40 + mov r3, r4 + str r0, [r1] + str r3, [r0, #8] + ldr r0, [r1] + sub r2, r3, #2 + strb r3, [r0, #0xc] + ldr r0, [r1] + strb r2, [r0] + ldr r0, [r1] + strb r2, [r0, #1] + ldr r0, [r1] + strb r2, [r0, #2] + ldr r0, [r1] + str r3, [r0, #0x10] + b _02039118 +_020390FC: + ldrb r0, [r6, r3] + cmp r0, #0 + beq _02039120 + cmp r0, #0x20 + addeq r4, r4, #1 + add r5, r5, #1 + add r3, r3, #1 +_02039118: + cmp r3, #0x36 + blt _020390FC +#endif +_02039120: + cmp r5, r4 + ldreq r0, _02039208 ; =_020AFE40 + moveq r1, #1 + ldreq r0, [r0] + mov r3, #0 + streqb r1, [r0, #0xc] + ldr r0, _02039208 ; =_020AFE40 +_0203913C: + ldr r1, [r0] + ldrb r2, [r6, r3] + add r1, r1, r3 + add r3, r3, #1 + strb r2, [r1, #0x14] + cmp r3, #0x36 + blt _0203913C + ldr r0, _02039208 ; =_020AFE40 + ldr r0, [r0] + ldrb r0, [r0, #0xc] + cmp r0, #0 + bne _020391C0 + ldr r0, _0203920C ; =_0209B4D4 + mov r2, #1 + ldr r1, _02039210 ; =sub_0203939C + str r2, [sp, #4] + bl CreateTextBox + ldr r1, _02039208 ; =_020AFE40 + ldr r3, _02039214 ; =_0209B4E4 + ldr r1, [r1] + add r2, sp, #4 + strb r0, [r1] + mov r0, #0 + mov r1, #0x31 + str r0, [sp] + bl CreateSimpleMenuFromStringIds + ldr r1, _02039208 ; =_020AFE40 + mov r2, #0 + ldr r3, [r1] + strb r0, [r3, #1] + ldr r0, [r1] + str r2, [r0, #4] + b _020391FC +_020391C0: + mov r0, #0 + bl CreateDialogueBox + ldr r3, _02039208 ; =_020AFE40 +#ifdef JAPAN + ldr r2, _02039618 ; =0x000031D7 + ldr r4, [r3] + mov r1, #0x218 +#else + mov r1, #0x218 + ldr r4, [r3] + sub r2, r1, #0xf3 +#endif + strb r0, [r4, #2] + ldr r0, [r3] + mov r3, #0 + ldrsb r0, [r0, #2] + bl ShowStringIdInDialogueBox + ldr r0, _02039208 ; =_020AFE40 + mov r1, #1 + ldr r0, [r0] + str r1, [r0, #4] +_020391FC: + mov r0, #1 + add sp, sp, #0x9c + ldmia sp!, {r3, r4, r5, r6, pc} + .align 2, 0 +_02039208: .word _020AFE40 +#ifdef JAPAN +_02039608: .word 0x00008140 +#endif +_0203920C: .word _0209B4D4 +_02039210: .word sub_0203939C +_02039214: .word _0209B4E4 +#ifdef JAPAN +_02039618: .word 0x000031D7 +#endif + arm_func_end sub_0203909C + + arm_func_start sub_02039218 +sub_02039218: ; 0x02039218 + stmdb sp!, {r3, lr} + ldr r0, _02039300 ; =_020AFE40 + ldr r0, [r0] + cmp r0, #0 + beq _020392F8 + ldr r1, [r0, #8] + cmp r1, #0 + beq _0203924C + cmp r1, #1 + beq _02039290 + cmp r1, #0xb + beq _020392C4 + b _020392DC +_0203924C: + ldrsb r0, [r0] + mvn r1, #1 + cmp r0, r1 + beq _02039270 + bl sub_0202F954 + ldr r0, _02039300 ; =_020AFE40 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_0202836C +_02039270: + ldr r0, _02039300 ; =_020AFE40 + mvn r1, #1 + ldr r0, [r0] + ldrsb r0, [r0, #1] + cmp r0, r1 + beq _020392DC + bl CloseSimpleMenu + b _020392DC +_02039290: + ldrsb r0, [r0] + mvn r1, #1 + cmp r0, r1 + beq _020392A4 + bl CloseTextBox +_020392A4: + ldr r0, _02039300 ; =_020AFE40 + mvn r1, #1 + ldr r0, [r0] + ldrsb r0, [r0, #2] + cmp r0, r1 + beq _020392DC + bl CloseDialogueBox + b _020392DC +_020392C4: + bl MemFree + ldr r0, _02039300 ; =_020AFE40 + mov r1, #0 + str r1, [r0] + mov r0, #1 + ldmia sp!, {r3, pc} +_020392DC: + ldr r1, _02039300 ; =_020AFE40 + mov r0, #0 + ldr r2, [r1] + ldr r1, [r2, #8] + add r1, r1, #1 + str r1, [r2, #8] + ldmia sp!, {r3, pc} +_020392F8: + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_02039300: .word _020AFE40 + arm_func_end sub_02039218 + + arm_func_start sub_02039304 +sub_02039304: ; 0x02039304 + ldr r0, _02039318 ; =_020AFE40 + mov r1, #1 + ldr r0, [r0] + str r1, [r0, #0x10] + bx lr + .align 2, 0 +_02039318: .word _020AFE40 + arm_func_end sub_02039304 + + arm_func_start sub_0203931C +sub_0203931C: ; 0x0203931C + stmdb sp!, {r3, lr} + ldr r0, _02039398 ; =_020AFE40 + ldr r1, [r0] + ldr r0, [r1, #4] + cmp r0, #1 + bne _0203934C + ldrsb r0, [r1, #2] + bl IsDialogueBoxActive + cmp r0, #0 + bne _02039390 + mov r0, #1 + ldmia sp!, {r3, pc} +_0203934C: + ldrb r0, [r1, #0xc] + cmp r0, #0 + bne _0203937C + ldrsb r0, [r1, #1] + bl IsSimpleMenuActive + cmp r0, #0 + bne _02039390 + ldr r0, _02039398 ; =_020AFE40 + ldr r0, [r0] + ldrsb r0, [r0, #1] + bl GetSimpleMenuResult + ldmia sp!, {r3, pc} +_0203937C: + ldrsb r0, [r1, #2] + bl IsDialogueBoxActive + cmp r0, #0 + moveq r0, #1 + ldmeqia sp!, {r3, pc} +_02039390: + mvn r0, #0 + ldmia sp!, {r3, pc} + .align 2, 0 +_02039398: .word _020AFE40 + arm_func_end sub_0203931C + + arm_func_start sub_0203939C +sub_0203939C: ; 0x0203939C + stmdb sp!, {r3, r4, lr} + sub sp, sp, #0x254 + mov r4, r0 + bl sub_02027B1C + ldr r0, _02039428 ; =_020AFE40 + ldr r2, [r0] + ldr r0, [r2, #0x10] + cmp r0, #0 + add r0, sp, #0x54 + bne _020393D4 + ldr r1, _0203942C ; =_0209B4FC + add r2, r2, #0x14 + bl SprintfStatic__02039438 + b _020393E0 +_020393D4: + ldr r1, _02039430 ; =_0209B50C + add r2, r2, #0x14 + bl SprintfStatic__02039438 +_020393E0: + add r0, sp, #0x54 + str r0, [sp, #0x3c] + add ip, sp, #4 +#ifdef JAPAN + ldr r2, _02039838 ; =0x000031D6 +#endif + ldr r3, _02039434 ; =0x0000C402 + add r0, sp, #0x154 + mov r1, #0x400 +#ifndef JAPAN + mov r2, #0x124 +#endif + str ip, [sp] + bl PreprocessStringFromId + add r3, sp, #0x154 + mov r0, r4 + mov r1, #4 + mov r2, #3 + bl DrawTextInWindow + mov r0, r4 + bl UpdateWindow + add sp, sp, #0x254 + ldmia sp!, {r3, r4, pc} + .align 2, 0 +_02039428: .word _020AFE40 +_0203942C: .word _0209B4FC +_02039430: .word _0209B50C +#ifdef JAPAN +_02039838: .word 0x000031D6 +#endif +_02039434: .word 0x0000C402 + arm_func_end sub_0203939C + + arm_func_start SprintfStatic__02039438 +SprintfStatic__02039438: ; 0x02039438 + stmdb sp!, {r0, r1, r2, r3} + stmdb sp!, {r3, lr} + add r2, sp, #0xc + bic r2, r2, #3 + ldr r1, [sp, #0xc] + add r2, r2, #4 + bl vsprintf + ldmia sp!, {r3, lr} + add sp, sp, #0x10 + bx lr + arm_func_end SprintfStatic__02039438 + + arm_func_start sub_02039460 +sub_02039460: ; 0x02039460 + stmdb sp!, {r4, lr} + sub sp, sp, #0x18 + ldr r1, _02039514 ; =_020AFE58 + mov r4, r0 + str r4, [r1] + ldr r0, [r4, #0x10] + add ip, sp, #8 + cmp r0, #0x10 + blt _020394C8 + and r1, r0, #0xf + ldr r0, _02039518 ; =_0209C5C0 + str r1, [r4, #0x10] + ldmia r0, {r0, r1, r2, r3} + stmia ip, {r0, r1, r2, r3} + ldr r0, [r4, #0x18] + mov r2, #0 + strb r0, [sp, #0xc] + ldr r0, [r4, #0x1c] + ldr r1, _0203951C ; =0x00001007 + strb r0, [sp, #0xd] + str r2, [sp] + ldr r3, _02039520 ; =sub_02039C14 + mov r0, ip + str r2, [sp, #4] + bl CreateAdvancedTextBox + b _02039500 +_020394C8: + ldr r0, _02039524 ; =_0209C5D0 + ldmia r0, {r0, r1, r2, r3} + stmia ip, {r0, r1, r2, r3} + ldr r0, [r4, #0x18] + mov r2, #0 + strb r0, [sp, #0xc] + ldr r0, [r4, #0x1c] + ldr r1, _0203951C ; =0x00001007 + strb r0, [sp, #0xd] + str r2, [sp] + ldr r3, _02039520 ; =sub_02039C14 + mov r0, ip + str r2, [sp, #4] + bl CreateAdvancedTextBox +_02039500: + strb r0, [r4, #0x14] + mov r0, r4 + bl sub_020395CC + add sp, sp, #0x18 + ldmia sp!, {r4, pc} + .align 2, 0 +_02039514: .word _020AFE58 +_02039518: .word _0209C5C0 +_0203951C: .word 0x00001007 +_02039520: .word sub_02039C14 +_02039524: .word _0209C5D0 + arm_func_end sub_02039460 + + arm_func_start sub_02039528 +sub_02039528: ; 0x02039528 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + ldr r4, [r5] + ldr r1, _020395C8 ; =_020AFE58 + str r5, [r1] + bl sub_020396E4 + cmp r0, #3 + addls pc, pc, r0, lsl #2 + b _020395AC +_0203954C: ; jump table + b _020395AC ; case 0 + b _020395AC ; case 1 + b _02039584 ; case 2 + b _0203955C ; case 3 +_0203955C: + mov r0, #0 + bl PlaySeVolumeWrapper + ldrsb r0, [r5, #0x14] + bl sub_0202836C + ldrsb r0, [r5, #0x14] + bl SetAdvancedTextBoxState5 + ldrsb r0, [r5, #0x14] + bl CloseAdvancedTextBox + ldr r0, [r5] + ldmia sp!, {r3, r4, r5, pc} +_02039584: + ldrsb r0, [r5, #0x14] + bl sub_0202836C + ldrsb r0, [r5, #0x14] + bl SetAdvancedTextBoxState5 + ldrsb r0, [r5, #0x14] + bl CloseAdvancedTextBox + mov r0, #1 + bl PlaySeVolumeWrapper + mvn r0, #0 + ldmia sp!, {r3, r4, r5, pc} +_020395AC: + ldr r0, [r5] + cmp r4, r0 + beq _020395C0 + ldrsb r0, [r5, #0x14] + bl SetAdvancedTextBoxField0x1C2 +_020395C0: + mvn r0, #1 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_020395C8: .word _020AFE58 + arm_func_end sub_02039528 + + arm_func_start sub_020395CC +sub_020395CC: ; 0x020395CC + stmdb sp!, {r4, lr} + sub sp, sp, #0x28 + ldr r1, _0203967C ; =_020AFE58 + mov r4, r0 + str r4, [r1] + ldr r1, [r4, #0xc] + ldr r2, [r4, #0x10] + add r0, sp, #0 + bl sub_02039680 + ldr r0, [r4, #0x10] + add r1, sp, #0 + strb r0, [r4, #0x29] + b _0203960C +_02039600: + ldrb r0, [r4, #0x29] + sub r0, r0, #1 + strb r0, [r4, #0x29] +_0203960C: + ldrb r2, [r4, #0x29] + add r0, r1, r2, lsl #2 + ldr r0, [r0, #-4] + cmp r0, #0 + bne _02039628 + cmp r2, #1 + bhi _02039600 +_02039628: + ldr r1, [r4, #4] + add r0, sp, #0 + str r1, [r4] + ldr r2, [r4, #0x10] + bl sub_02039680 + ldrb r0, [r4, #0x29] + add r1, sp, #0 + sub r0, r0, #1 + strb r0, [r4, #0x28] + b _0203965C +_02039650: + ldrb r0, [r4, #0x28] + sub r0, r0, #1 + strb r0, [r4, #0x28] +_0203965C: + ldrb r2, [r4, #0x28] + ldr r0, [r1, r2, lsl #2] + cmp r0, #0 + bne _02039674 + cmp r2, #0 + bne _02039650 +_02039674: + add sp, sp, #0x28 + ldmia sp!, {r4, pc} + .align 2, 0 +_0203967C: .word _020AFE58 + arm_func_end sub_020395CC + + arm_func_start sub_02039680 +sub_02039680: ; 0x02039680 + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, lr} + mov sb, r1 + cmp sb, #0 + movgt r6, #1 + mov r5, #0xa + mov sl, r0 + mov r8, r2 + rsble sb, sb, #0 + mvnle r6, #0 + mov r7, #0 + mov r4, r5 + b _020396D4 +_020396B0: + mov r0, sb + mov r1, r5 + bl _s32_div_f + str r1, [sl, r7, lsl #2] + mov r0, sb + mov r1, r4 + bl _s32_div_f + mov sb, r0 + add r7, r7, #1 +_020396D4: + cmp r7, r8 + blt _020396B0 + mov r0, r6 + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, pc} + arm_func_end sub_02039680 + + arm_func_start sub_020396E4 +sub_020396E4: ; 0x020396E4 + stmdb sp!, {r4, r5, lr} + sub sp, sp, #0x34 + mov r4, r0 + add r1, sp, #0xc + mov r0, #0 + bl GetPressedButtons + ldrsb r0, [r4, #0x14] + bl IsAdvancedTextBoxActive + cmp r0, #0 + bne _02039730 + ldrsb r0, [r4, #0x14] + bl sub_02030940 + mvn r1, #0 + cmp r0, r1 + bne _02039728 + mov r0, #2 + b _02039940 +_02039728: + mov r0, #3 + b _02039940 +_02039730: + add r1, sp, #0xa + mov r0, #0 + ldrb r5, [r4, #0x28] + bl sub_020063F4 + ldrh r0, [sp, #0xa] + cmp r0, #0x10 + beq _02039774 + cmp r0, #0x20 + bne _02039788 + ldrb r0, [r4, #0x29] + ldrb r1, [r4, #0x28] + sub r0, r0, #1 + cmp r1, r0 + movge r0, #0 + addlt r0, r1, #1 + and r5, r0, #0xff + b _02039788 +_02039774: + ldrb r0, [r4, #0x28] + cmp r0, #0 + ldreqb r0, [r4, #0x29] + sub r0, r0, #1 + and r5, r0, #0xff +_02039788: + ldrb r0, [r4, #0x28] + cmp r5, r0 + beq _020397A0 + mov r0, #3 + strb r5, [r4, #0x28] + bl PlaySeVolumeWrapper +_020397A0: + ldrb r1, [r4, #0x28] + mov r0, #0xc + ldr r3, [r4, #0x24] + add r1, r1, #1 + mul r2, r1, r0 + ldr r1, [r4, #0x20] + add r0, r3, #0xf + sub r1, r1, r2 + add r2, r1, #3 + str r2, [sp] + str r0, [sp, #4] + ldrsb r0, [r4, #0x14] + sub r3, r3, #1 + mov r1, #7 + bl sub_020309B8 + add r1, sp, #8 + mov r0, #0 + bl sub_020063F4 + mov r0, r4 + bl sub_0203994C + cmp r0, #0 + ldreqh r0, [sp, #8] + cmp r0, #0x40 + beq _0203980C + cmp r0, #0x80 + beq _0203985C + b _020398AC +_0203980C: + ldr r3, [r4] + ldr r0, [r4, #0xc] + cmp r3, r0 + bne _0203982C + mov r0, #2 + bl PlaySeVolumeWrapper + mov r0, #0 + b _020398B0 +_0203982C: + ldrb r2, [r4, #0x28] + ldr r1, _02039948 ; =_0209C5E0 + mov r0, #3 + ldr r1, [r1, r2, lsl #2] + add r5, r3, r1 + bl PlaySeVolumeWrapper + ldr r0, [r4, #0xc] + cmp r5, r0 + strgt r0, [r4] + strle r5, [r4] + mov r0, #1 + b _020398B0 +_0203985C: + ldr r3, [r4] + ldr r0, [r4, #8] + cmp r3, r0 + bne _0203987C + mov r0, #2 + bl PlaySeVolumeWrapper + mov r0, #0 + b _020398B0 +_0203987C: + ldrb r2, [r4, #0x28] + ldr r1, _02039948 ; =_0209C5E0 + mov r0, #3 + ldr r1, [r1, r2, lsl #2] + sub r5, r3, r1 + bl PlaySeVolumeWrapper + ldr r0, [r4, #8] + cmp r5, r0 + strlt r0, [r4] + strge r5, [r4] + mov r0, #1 + b _020398B0 +_020398AC: + mov r0, #0 +_020398B0: + cmp r0, #0 + movne r0, #1 + bne _02039940 + mov r0, r4 + bl sub_0203994C + cmp r0, #0 + ldreqh r0, [sp, #0xc] + cmp r0, #1 + beq _020398E4 + cmp r0, #2 + bne _020398EC + mov r0, #2 + b _02039940 +_020398E4: + mov r0, #3 + b _02039940 +_020398EC: + add r0, sp, #0x10 + mov r1, #1 + bl sub_02031914 + ldr r1, [sp, #0x14] + ldr r0, [sp, #0x18] + mov r1, r1, lsl #0x10 + mov r2, r0, lsl #0x10 + mov r0, r4 + mov r1, r1, lsr #0x10 + mov r2, r2, lsr #0x10 + bl sub_020399FC + cmp r0, #0 + blt _0203993C + ldrb r1, [r4, #0x28] + and r2, r0, #0xff + cmp r2, r1 + beq _0203993C + mov r0, #3 + strb r2, [r4, #0x28] + bl PlaySeVolumeWrapper +_0203993C: + mov r0, #0 +_02039940: + add sp, sp, #0x34 + ldmia sp!, {r4, r5, pc} + .align 2, 0 +_02039948: .word _0209C5E0 + arm_func_end sub_020396E4 + + arm_func_start sub_0203994C +sub_0203994C: ; 0x0203994C + stmdb sp!, {r3, r4, lr} + sub sp, sp, #0x24 + mov r4, r0 + add r0, sp, #0 + mov r1, #1 + bl sub_02031914 + ldrh r0, [sp] + tst r0, #2 + moveq r0, #0 + beq _020399F0 + ldr r2, [sp, #4] + ldr r0, _020399F8 ; =0x0000FFFF + cmp r2, r0 + ldreq r1, [sp, #8] + cmpeq r1, r0 + moveq r0, #0 + beq _020399F0 + ldr r0, [sp, #8] + mov r1, r2, lsl #0x10 + mov r2, r0, lsl #0x10 + mov r0, r4 + mov r1, r1, lsr #0x10 + mov r2, r2, lsr #0x10 + bl sub_020399FC + ldrb r1, [r4, #0x28] + cmp r1, r0 + movne r0, #0 + bne _020399F0 + ldrsb r0, [r4, #0x14] + bl GetWindow + ldrb r1, [r0, #5] + ldr r2, [r4, #0x24] + ldr r0, [sp, #8] + add r1, r2, r1, lsl #3 + cmp r0, r1 + add r1, r1, #0xc + movlt r0, #0x40 + blt _020399F0 + cmp r0, r1 + movgt r0, #0x80 + movle r0, #0 +_020399F0: + add sp, sp, #0x24 + ldmia sp!, {r3, r4, pc} + .align 2, 0 +_020399F8: .word 0x0000FFFF + arm_func_end sub_0203994C + + arm_func_start sub_020399FC +sub_020399FC: ; 0x020399FC + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr} + mov r6, r0 + ldrsb r0, [r6, #0x14] + mov r5, r1 + mov r4, r2 + bl GetWindow + ldrb r1, [r0, #5] + ldr r3, [r6, #0x24] + ldr ip, _02039B08 ; =0x0000FFFF + add r3, r3, r1, lsl #3 + cmp r5, ip + ldrb r7, [r6, #0x29] + ldr r8, [r6, #0x20] + ldrb r2, [r0, #4] + mov r6, #0xc + ldrb sb, [r0, #6] + sub lr, r3, #0xa + ldrb r0, [r0, #7] + smulbb r7, r7, r6 + add r8, r8, r2, lsl #3 + mov r3, r2, lsl #3 + mov r1, r1, lsl #3 + add r2, r3, sb, lsl #3 + add sb, r1, r0, lsl #3 + sub r7, r8, r7 + add r0, lr, #0x20 + cmpne r4, ip + mvneq r0, #0 + ldmeqia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + sub r3, r3, #6 + cmp r5, r3 + sublt r0, r6, #0xe + ldmltia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + sub r1, r1, #6 + cmp r4, r1 + sublt r0, r6, #0xe + ldmltia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + add r1, r2, #6 + cmp r5, r1 + subgt r0, r6, #0xe + ldmgtia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + add r1, sb, #6 + cmp r4, r1 + subgt r0, r6, #0xe + ldmgtia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + cmp r4, lr + sublt r0, ip, #0x10000 + ldmltia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + cmp r4, r0 + subgt r0, ip, #0x10000 + ldmgtia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + sub r0, r7, #4 + cmp r5, r0 + sublt r0, ip, #0x10000 + ldmltia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + add r0, r8, #4 + cmp r5, r0 + subgt r0, ip, #0x10000 + ldmgtia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + cmp r5, r7 + addle r5, r7, #1 + cmp r5, r8 + subge r5, r8, #1 + sub r0, r8, r5 + mov r1, #0xc + bl _s32_div_f + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + .align 2, 0 +_02039B08: .word 0x0000FFFF + arm_func_end sub_020399FC + + arm_func_start sub_02039B0C +sub_02039B0C: ; 0x02039B0C + stmdb sp!, {r4, r5, r6, r7, r8, sb, lr} + sub sp, sp, #0x2c + mov r8, r0 + ldr r1, [r8] + ldr r2, [r8, #0x10] + add r0, sp, #4 + bl sub_02039680 + ldr r0, [r8, #0x10] + add r2, sp, #4 + sub r3, r0, #1 + mov r0, #0xff + b _02039B50 +_02039B3C: + ldr r1, [r2, r3, lsl #2] + cmp r1, #0 + bne _02039B58 + str r0, [r2, r3, lsl #2] + sub r3, r3, #1 +_02039B50: + cmp r3, #0 + bgt _02039B3C +_02039B58: + mov r7, #0 + add r6, sp, #4 +#ifdef JAPAN + mov r5, #0xa +#else + mov r5, #0x2a +#endif + mov r4, #0x44 + mov sb, #0xc + b _02039BB0 +_02039B70: + ldr r0, [r6, r7, lsl #2] + cmp r0, #0xff + moveq r0, r5 +#ifdef JAPAN + addne r0, r0, #0x1e +#else + addne r0, r0, #0x30 +#endif + andne r0, r0, #0xff + bl sub_020251F0 + add r1, r7, #1 + mul r2, r1, sb + str r4, [sp] + ldr r1, [r8, #0x20] + mov r3, r0 + sub r1, r1, r2 + ldrsb r0, [r8, #0x14] + ldr r2, [r8, #0x24] + bl sub_020264F8 + add r7, r7, #1 +_02039BB0: + ldr r0, [r8, #0x10] + cmp r7, r0 + blt _02039B70 + mov r5, #0 + mov r4, #0x17 + mov r7, #0xb + mov r6, #0xc + b _02039C00 +_02039BD0: + add r0, r5, #1 + mul r1, r0, r6 + str r4, [sp] + ldr r0, [r8, #0x20] + ldr r2, [r8, #0x24] + sub r1, r0, r1 + ldrsb r0, [r8, #0x14] + mov r3, r7 + sub r1, r1, #1 + add r2, r2, #0xc + bl sub_02025D50 + add r5, r5, #1 +_02039C00: + ldr r0, [r8, #0x10] + cmp r5, r0 + blt _02039BD0 + add sp, sp, #0x2c + ldmia sp!, {r4, r5, r6, r7, r8, sb, pc} + arm_func_end sub_02039B0C + + arm_func_start sub_02039C14 +sub_02039C14: ; 0x02039C14 + ldr r0, _02039C24 ; =_020AFE58 + ldr ip, _02039C28 ; =sub_02039B0C + ldr r0, [r0] + bx ip + .align 2, 0 +_02039C24: .word _020AFE58 +_02039C28: .word sub_02039B0C + arm_func_end sub_02039C14 + + arm_func_start sub_02039C2C +sub_02039C2C: ; 0x02039C2C + ldr ip, _02039C38 ; =sub_02039C64 + mov r2, #0 + bx ip + .align 2, 0 +_02039C38: .word sub_02039C64 + arm_func_end sub_02039C2C + + arm_func_start sub_02039C3C +sub_02039C3C: ; 0x02039C3C + stmdb sp!, {r4, lr} + mov r2, #2 + bl sub_02039C64 + ldr r1, _02039C60 ; =sub_0203BA80 + mov r2, #0 + mov r4, r0 + bl sub_0203189C + mov r0, r4 + ldmia sp!, {r4, pc} + .align 2, 0 +_02039C60: .word sub_0203BA80 + arm_func_end sub_02039C3C + + arm_func_start sub_02039C64 +sub_02039C64: ; 0x02039C64 + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0x4c + mov r5, r0 + mov r4, r2 + bl sub_0203AD68 + cmp r0, #0 + mvnne r0, #1 + bne _0203A4CC + ldr r0, _0203A4D4 ; =_020AFE5C + ldr r0, [r0, #0x10] + cmp r0, #0 + bne _02039CA8 + mov r0, #0x8a0 + mov r1, #8 + bl MemAlloc + ldr r1, _0203A4D4 ; =_020AFE5C + str r0, [r1, #0x10] +_02039CA8: + ldr r1, _0203A4D4 ; =_020AFE5C + ldr r0, _0203A4D8 ; =_0209C764 + ldrsh r6, [r1, #2] + mov r2, r5 + mov r3, r4 + str r6, [sp] + ldr r1, [r1, #4] + bl Debug_Print0 + ldr r0, _0203A4D4 ; =_020AFE5C + ldr r1, [r0, #4] + cmp r1, r5 + beq _02039CF0 + mov r1, #1 + str r1, [r0, #0xc] + mov r1, #0 + str r1, [r0, #8] + str r5, [r0, #4] + strh r1, [r0, #2] +_02039CF0: + ldr r2, _0203A4D4 ; =_020AFE5C + mov r0, #0 + ldrsh r1, [r2, #2] + sub r3, r0, #2 + strh r1, [r2] + ldr r1, [r2, #0x10] + str r4, [r1] + ldr r1, [r2, #0x10] + strb r0, [r1, #8] + ldr r1, [r2, #0x10] + strb r0, [r1, #9] + ldr r1, [r2, #0x10] + strb r0, [r1, #0xa] + ldr r1, [r2, #0x10] + strb r0, [r1, #0xb] + ldr r1, [r2, #0x10] + strb r0, [r1, #0xc] + ldr r1, [r2, #0x10] + strb r0, [r1, #0xd] + ldr r1, [r2, #0x10] + strb r0, [r1, #0xe] + ldr r1, [r2, #0x10] + strb r0, [r1, #0x10] + ldr r1, [r2, #0x10] + strb r3, [r1, #0x468] + ldr r1, [r2, #0x10] + strb r3, [r1, #0x469] + ldr r1, [r2, #0x10] + strb r3, [r1, #0x505] + ldr r1, [r2, #0x10] + strb r3, [r1, #0x506] + ldr r1, [r2, #0x10] + strb r3, [r1, #0x507] + ldr r1, [r2, #0x10] + strb r3, [r1, #0x50c] + ldr r1, [r2, #0x10] + strb r3, [r1, #0x5bc] + ldr r1, [r2, #0x10] + add r1, r1, #0x600 + strh r0, [r1, #0x70] + ldr r1, [r2, #0x10] + strb r0, [r1, #0x46a] + ldr r1, [r2, #0x10] + strb r0, [r1, #0xf] + ldr r1, [r2, #4] + cmp r1, #0xc + addls pc, pc, r1, lsl #2 + b _02039E94 +_02039DB0: ; jump table + b _02039E94 ; case 0 + b _02039DE4 ; case 1 + b _02039DF4 ; case 2 + b _02039E54 ; case 3 + b _02039E44 ; case 4 + b _02039E94 ; case 5 + b _02039E78 ; case 6 + b _02039E10 ; case 7 + b _02039E04 ; case 8 + b _02039E78 ; case 9 + b _02039E78 ; case 10 + b _02039E78 ; case 11 + b _02039E78 ; case 12 +_02039DE4: + ldr r0, [r2, #0x10] + mov r1, #1 + strb r1, [r0, #0xe] + b _02039E94 +_02039DF4: + ldr r0, [r2, #0x10] + mov r1, #1 + strb r1, [r0, #8] + b _02039E94 +_02039E04: + ldr r0, [r2, #0x10] + mov r1, #1 + strb r1, [r0, #0x10] +_02039E10: + ldr r0, _0203A4D4 ; =_020AFE5C + mov r1, #1 + ldr r0, [r0, #0x10] + strb r1, [r0, #0xd] + bl sub_0204E210 + cmp r0, #2 + bne _02039E44 + bl sub_0204E3C8 + cmp r0, #0 + ldrne r0, _0203A4D4 ; =_020AFE5C + movne r1, #1 + ldrne r0, [r0, #0x10] + strneb r1, [r0, #0xf] +_02039E44: + ldr r0, _0203A4D4 ; =_020AFE5C + mov r1, #1 + ldr r0, [r0, #0x10] + strb r1, [r0, #0xc] +_02039E54: + ldr r0, _0203A4D4 ; =_020AFE5C + mov r2, #1 + ldr r1, [r0, #0x10] + strb r2, [r1, #0xb] + ldr r1, [r0, #0x10] + strb r2, [r1, #9] + ldr r0, [r0, #0x10] + strb r2, [r0, #0xa] + b _02039E94 +_02039E78: + ldr r1, [r2, #0x10] + mov r3, #1 + strb r3, [r1, #8] + ldr r1, [r2, #0x10] + strb r0, [r1, #9] + ldr r1, [r2, #0x10] + strb r0, [r1, #0xa] +_02039E94: + ldr r2, _0203A4D4 ; =_020AFE5C + mvn r4, #0 + ldr r0, [r2, #0x10] + mov r5, #0 + str r5, [r0, #4] + add r1, r4, #0x22c +_02039EAC: + ldr r3, [r2, #0x10] + add r0, r5, #1 + add r3, r3, r5, lsl #1 + mov r0, r0, lsl #0x10 + strh r4, [r3, #0x12] + cmp r1, r0, asr #16 + mov r5, r0, asr #0x10 + bgt _02039EAC + ldr r0, _0203A4D4 ; =_020AFE5C + ldr r0, [r0, #4] + sub r0, r0, #5 + cmp r0, #7 + addls pc, pc, r0, lsl #2 + b _0203A144 +_02039EE4: ; jump table + b _02039F04 ; case 0 + b _0203A034 ; case 1 + b _0203A144 ; case 2 + b _0203A144 ; case 3 + b _0203A034 ; case 4 + b _0203A034 ; case 5 + b _0203A034 ; case 6 + b _0203A034 ; case 7 +_02039F04: + bl sub_02059B08 + cmp r0, #0 + beq _02039FA8 + bl GetHero + mov r5, r0 + bl GetPartner + mov r4, r0 + cmp r5, #0 + beq _02039F64 + add r1, sp, #0x10 + mov r0, r5 + bl GetEvolutionPossibilities + ldrsh r0, [sp, #0x18] + cmp r0, #0 + beq _02039F64 + bl GetHeroMemberIdx + ldr r1, _0203A4D4 ; =_020AFE5C + ldr r5, [r1, #0x10] + ldr r3, [r5, #4] + add r2, r3, #1 + str r2, [r5, #4] + ldr r1, [r1, #0x10] + add r1, r1, r3, lsl #1 + strh r0, [r1, #0x12] +_02039F64: + cmp r4, #0 + beq _02039FA8 + add r1, sp, #0x10 + mov r0, r4 + bl GetEvolutionPossibilities + ldrsh r0, [sp, #0x18] + cmp r0, #0 + beq _02039FA8 + bl GetPartnerMemberIdx + ldr r1, _0203A4D4 ; =_020AFE5C + ldr r4, [r1, #0x10] + ldr r3, [r4, #4] + add r2, r3, #1 + str r2, [r4, #4] + ldr r1, [r1, #0x10] + add r1, r1, r3, lsl #1 + strh r0, [r1, #0x12] +_02039FA8: + ldr r6, _0203A4D4 ; =_020AFE5C + ldr r4, _0203A4DC ; =0x0000022B + ldr r7, _0203A4E0 ; =TEAM_MEMBER_TABLE_PTR + mov sb, #5 + mov sl, #0 + mov r8, #1 + add fp, sp, #0x10 + mov r5, #0x44 +_02039FC8: + smulbb r2, sb, r5 + ldr r3, [r7] + ldrb r0, [r3, r2] + tst r0, #1 + movne r0, r8 + moveq r0, sl + tst r0, #0xff + beq _0203A01C + mov r1, fp + add r0, r3, r2 + bl GetEvolutionPossibilities + ldrsh r0, [sp, #0x18] + cmp r0, #0 + beq _0203A01C + ldr r2, [r6, #0x10] + ldr r1, [r2, #4] + add r0, r1, #1 + str r0, [r2, #4] + ldr r0, [r6, #0x10] + add r0, r0, r1, lsl #1 + strh sb, [r0, #0x12] +_0203A01C: + add r0, sb, #1 + mov r0, r0, lsl #0x10 + cmp r4, r0, asr #16 + mov sb, r0, asr #0x10 + bgt _02039FC8 + b _0203A278 +_0203A034: + bl GetMainCharacter1MemberIdx + mvn r1, #0 + cmp r0, r1 + beq _0203A064 + ldr r1, _0203A4D4 ; =_020AFE5C + ldr r4, [r1, #0x10] + ldr r3, [r4, #4] + add r2, r3, #1 + str r2, [r4, #4] + ldr r1, [r1, #0x10] + add r1, r1, r3, lsl #1 + strh r0, [r1, #0x12] +_0203A064: + bl GetMainCharacter2MemberIdx + mvn r1, #0 + cmp r0, r1 + beq _0203A094 + ldr r1, _0203A4D4 ; =_020AFE5C + ldr r4, [r1, #0x10] + ldr r3, [r4, #4] + add r2, r3, #1 + str r2, [r4, #4] + ldr r1, [r1, #0x10] + add r1, r1, r3, lsl #1 + strh r0, [r1, #0x12] +_0203A094: + bl GetMainCharacter3MemberIdx + mvn r1, #0 + cmp r0, r1 + beq _0203A0C4 + ldr r1, _0203A4D4 ; =_020AFE5C + ldr r4, [r1, #0x10] + ldr r3, [r4, #4] + add r2, r3, #1 + str r2, [r4, #4] + ldr r1, [r1, #0x10] + add r1, r1, r3, lsl #1 + strh r0, [r1, #0x12] +_0203A0C4: + ldr r6, _0203A4D4 ; =_020AFE5C + ldr r4, _0203A4DC ; =0x0000022B + ldr r7, _0203A4E0 ; =TEAM_MEMBER_TABLE_PTR + mov sb, #5 + mov sl, #0 + mov r8, #1 + mov r5, #0x44 +_0203A0E0: + smulbb r0, sb, r5 + ldr r1, [r7] + ldrb r0, [r1, r0] + tst r0, #1 + movne r0, r8 + moveq r0, sl + tst r0, #0xff + beq _0203A12C + mov r0, sb + bl sub_02056410 + cmp r0, #0 + beq _0203A12C + ldr r2, [r6, #0x10] + ldr r1, [r2, #4] + add r0, r1, #1 + str r0, [r2, #4] + ldr r0, [r6, #0x10] + add r0, r0, r1, lsl #1 + strh sb, [r0, #0x12] +_0203A12C: + add r0, sb, #1 + mov r0, r0, lsl #0x10 + cmp r4, r0, asr #16 + mov sb, r0, asr #0x10 + bgt _0203A0E0 + b _0203A278 +_0203A144: + ldr r0, _0203A4D4 ; =_020AFE5C + ldr r0, [r0, #0x10] + ldrb r0, [r0, #9] + cmp r0, #0 + bne _0203A198 + bl GetMainCharacter1MemberIdx + mov r4, r0 + mvn r1, #0 + cmp r4, r1 + beq _0203A198 + bl sub_0203AB3C + cmp r0, #0 + beq _0203A198 + ldr r0, _0203A4D4 ; =_020AFE5C + ldr r3, [r0, #0x10] + ldr r2, [r3, #4] + add r1, r2, #1 + str r1, [r3, #4] + ldr r0, [r0, #0x10] + add r0, r0, r2, lsl #1 + strh r4, [r0, #0x12] +_0203A198: + ldr r0, _0203A4D4 ; =_020AFE5C + ldr r0, [r0, #0x10] + ldrb r0, [r0, #0xa] + cmp r0, #0 + bne _0203A22C + bl GetMainCharacter2MemberIdx + mov r4, r0 + mvn r1, #0 + cmp r4, r1 + beq _0203A1EC + bl sub_0203AB3C + cmp r0, #0 + beq _0203A1EC + ldr r0, _0203A4D4 ; =_020AFE5C + ldr r3, [r0, #0x10] + ldr r2, [r3, #4] + add r1, r2, #1 + str r1, [r3, #4] + ldr r0, [r0, #0x10] + add r0, r0, r2, lsl #1 + strh r4, [r0, #0x12] +_0203A1EC: + bl GetMainCharacter3MemberIdx + mov r4, r0 + mvn r1, #0 + cmp r4, r1 + beq _0203A22C + bl sub_0203AB3C + cmp r0, #0 + beq _0203A22C + ldr r0, _0203A4D4 ; =_020AFE5C + ldr r3, [r0, #0x10] + ldr r2, [r3, #4] + add r1, r2, #1 + str r1, [r3, #4] + ldr r0, [r0, #0x10] + add r0, r0, r2, lsl #1 + strh r4, [r0, #0x12] +_0203A22C: + ldr r6, _0203A4D4 ; =_020AFE5C + ldr r5, _0203A4DC ; =0x0000022B + mov r4, #5 +_0203A238: + mov r0, r4 + bl sub_0203AB3C + cmp r0, #0 + beq _0203A264 + ldr r2, [r6, #0x10] + ldr r1, [r2, #4] + add r0, r1, #1 + str r0, [r2, #4] + ldr r0, [r6, #0x10] + add r0, r0, r1, lsl #1 + strh r4, [r0, #0x12] +_0203A264: + add r0, r4, #1 + mov r0, r0, lsl #0x10 + cmp r5, r0, asr #16 + mov r4, r0, asr #0x10 + bgt _0203A238 +_0203A278: + ldr r1, _0203A4E4 ; =_0209C604 + add r0, sp, #8 + ldr r2, [r1, #4] + ldr r1, [r1] + str r2, [sp, #0xc] + str r1, [sp, #8] + bl sub_020584F8 + bl sub_0203AF28 + ldr r0, _0203A4D4 ; =_020AFE5C + ldrsh r0, [r0, #2] + bl sub_0203AAF8 + ldr r1, _0203A4D4 ; =_020AFE5C + ldr r2, [r1, #0x10] + str r0, [r2, #0x46c] + ldr r0, [r1, #4] + cmp r0, #0xc + addls pc, pc, r0, lsl #2 + b _0203A330 +_0203A2C0: ; jump table + b _0203A330 ; case 0 + b _0203A330 ; case 1 + b _0203A31C ; case 2 + b _0203A330 ; case 3 + b _0203A330 ; case 4 + b _0203A330 ; case 5 + b _0203A31C ; case 6 + b _0203A330 ; case 7 + b _0203A330 ; case 8 + b _0203A2F4 ; case 9 + b _0203A308 ; case 10 + b _0203A31C ; case 11 + b _0203A31C ; case 12 +_0203A2F4: + ldr r0, [r1, #0x10] + ldr r1, _0203A4E8 ; =0x000002B7 + add r0, r0, #0x400 + strh r1, [r0, #0x74] + b _0203A344 +_0203A308: + ldr r0, [r1, #0x10] +#ifdef JAPAN + ldr r1, _0203A8F4 ; =0x00002FD8 +#else + mov r1, #0x2b8 +#endif + add r0, r0, #0x400 + strh r1, [r0, #0x74] + b _0203A344 +_0203A31C: + ldr r0, [r1, #0x10] + ldr r1, _0203A4EC ; =0x00000302 + add r0, r0, #0x400 + strh r1, [r0, #0x74] + b _0203A344 +_0203A330: + ldr r0, _0203A4D4 ; =_020AFE5C + ldr r1, _0203A4F0 ; =0x00000303 + ldr r0, [r0, #0x10] + add r0, r0, #0x400 + strh r1, [r0, #0x74] +_0203A344: + ldr r2, _0203A4D4 ; =_020AFE5C + mov r3, #0x10 + ldr r0, [r2, #0x10] + mov r1, #0xd + str r3, [r0, #0x478] + ldr r0, [r2, #0x10] + str r1, [r0, #0x470] + ldr r0, [r2, #4] + sub r0, r0, #6 + cmp r0, #6 + addls pc, pc, r0, lsl #2 + b _0203A420 +_0203A374: ; jump table + b _0203A3E0 ; case 0 + b _0203A420 ; case 1 + b _0203A420 ; case 2 + b _0203A390 ; case 3 + b _0203A3E0 ; case 4 + b _0203A3E0 ; case 5 + b _0203A3E0 ; case 6 +_0203A390: + ldr r3, [r2, #0x10] + ldr r0, _0203A4F4 ; =_0209C668 + add r1, r3, #0x72 + add r1, r1, #0x600 + str r1, [r3, #0x4cc] + ldr r3, [r2, #0x10] + ldr r1, _0203A4F8 ; =0x00401E33 + add r2, r3, #0x500 + ldrsh r4, [r2, #0xd4] + add r2, r3, #0x6c + ldr r3, _0203A4FC ; =TeamSelectionMenuGetItem + str r4, [sp] + mov r4, #6 + add r2, r2, #0x400 + str r4, [sp, #4] + bl CreateTeamSelectionMenu + ldr r1, _0203A4D4 ; =_020AFE5C + ldr r1, [r1, #0x10] + strb r0, [r1, #0x468] + b _0203A4BC +_0203A3E0: + ldr r2, [r2, #0x10] + ldr r0, _0203A4F4 ; =_0209C668 + add r1, r2, #0x500 + ldrsh r4, [r1, #0xd4] + add r2, r2, #0x6c + ldr r1, _0203A500 ; =0x00401C33 + ldr r3, _0203A4FC ; =TeamSelectionMenuGetItem + str r4, [sp] + mov r4, #6 + add r2, r2, #0x400 + str r4, [sp, #4] + bl CreateTeamSelectionMenu + ldr r1, _0203A4D4 ; =_020AFE5C + ldr r1, [r1, #0x10] + strb r0, [r1, #0x468] + b _0203A4BC +_0203A420: + ldr r1, _0203A4D4 ; =_020AFE5C + ldr r3, _0203A504 ; =sub_0203B91C + ldr r0, [r1, #0x10] + ldr r2, _0203A508 ; =_0203BA24 + str r3, [r0, #0x4e0] + ldr r0, [r1, #0x10] + mov r3, #0 + str r2, [r0, #0x4e8] + ldr r2, [r1, #0x10] + ldr r0, _0203A4F4 ; =_0209C668 + str r3, [r2, #0x508] + ldr r3, [r1, #0x10] + ldr r1, _0203A50C ; =0x00447C33 + add r2, r3, #0x500 + ldrsh r4, [r2, #0xd4] + add r2, r3, #0x6c + ldr r3, _0203A4FC ; =TeamSelectionMenuGetItem + str r4, [sp] + mov r4, #8 + add r2, r2, #0x400 + str r4, [sp, #4] + bl CreateTeamSelectionMenu + ldr r2, _0203A4D4 ; =_020AFE5C + ldr r1, _0203A510 ; =_0203B884 + ldr r3, [r2, #0x10] + strb r0, [r3, #0x468] + ldr r0, [r2, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x68] + bl sub_02031888 + ldr r0, _0203A514 ; =_0209C638 + ldr r1, _0203A518 ; =sub_0203C784 + bl CreateTextBox + ldr r1, _0203A4D4 ; =_020AFE5C + mov r2, #1 + ldr r3, [r1, #0x10] + strb r0, [r3, #0x469] + ldr r0, [r1, #0x10] + strb r2, [r0, #0x46a] +_0203A4BC: + ldr r0, _0203A4D4 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x68] +_0203A4CC: + add sp, sp, #0x4c + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_0203A4D4: .word _020AFE5C +_0203A4D8: .word _0209C764 +_0203A4DC: .word 0x0000022B +_0203A4E0: .word TEAM_MEMBER_TABLE_PTR +_0203A4E4: .word _0209C604 +#ifdef JAPAN +_0203A4E8: .word 0x00002FD7 +_0203A8F4: .word 0x00002FD8 +_0203A4EC: .word 0x000023AA +_0203A4F0: .word 0x000023AB +#else +_0203A4E8: .word 0x000002B7 +_0203A4EC: .word 0x00000302 +_0203A4F0: .word 0x00000303 +#endif +_0203A4F4: .word _0209C668 +_0203A4F8: .word 0x00401E33 +_0203A4FC: .word TeamSelectionMenuGetItem +_0203A500: .word 0x00401C33 +_0203A504: .word sub_0203B91C +_0203A508: .word sub_0203BA24 +_0203A50C: .word 0x00447C33 +_0203A510: .word sub_0203B884 +_0203A514: .word _0209C638 +_0203A518: .word sub_0203C784 + arm_func_end sub_02039C64 + + arm_func_start sub_0203A51C +sub_0203A51C: ; 0x0203A51C + stmdb sp!, {r3, lr} + ldr r0, _0203A5A4 ; =_020AFE5C + ldr r0, [r0, #0x10] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + bl sub_0203AA20 + ldr r1, _0203A5A4 ; =_020AFE5C + strh r0, [r1] + bl sub_0203AAB0 + ldr r1, _0203A5A4 ; =_020AFE5C + strh r0, [r1, #2] + ldr r0, [r1, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x68] + bl CloseTeamSelectionMenu + ldr r0, _0203A5A4 ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x69] + cmp r0, r1 + beq _0203A588 + bl CloseTextBox + ldr r0, _0203A5A4 ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + strb r1, [r0, #0x469] +_0203A588: + ldr r0, _0203A5A4 ; =_020AFE5C + ldr r0, [r0, #0x10] + bl MemFree + ldr r0, _0203A5A4 ; =_020AFE5C + mov r1, #0 + str r1, [r0, #0x10] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203A5A4: .word _020AFE5C + arm_func_end sub_0203A51C + + arm_func_start sub_0203A5A8 +sub_0203A5A8: ; 0x0203A5A8 + stmdb sp!, {r3, lr} + ldr r0, _0203A5EC ; =_020AFE5C + ldr r0, [r0, #0x10] + cmp r0, #0 + moveq r0, #0 + ldmeqia sp!, {r3, pc} + bl sub_0203AA20 + ldr r1, _0203A5EC ; =_020AFE5C + strh r0, [r1] + bl sub_0203AAB0 + ldr r1, _0203A5EC ; =_020AFE5C + strh r0, [r1, #2] + ldr r0, [r1, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x68] + bl IsTeamSelectionMenuActive + ldmia sp!, {r3, pc} + .align 2, 0 +_0203A5EC: .word _020AFE5C + arm_func_end sub_0203A5A8 + + arm_func_start sub_0203A5F0 +sub_0203A5F0: ; 0x0203A5F0 + stmdb sp!, {r3, lr} + ldr r0, _0203A614 ; =_020AFE5C + ldr r0, [r0, #0x10] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + add r0, r0, #0x400 + ldrsb r0, [r0, #0x68] + bl sub_020318D0 + ldmia sp!, {r3, pc} + .align 2, 0 +_0203A614: .word _020AFE5C + arm_func_end sub_0203A5F0 + + arm_func_start sub_0203A618 +sub_0203A618: ; 0x0203A618 + stmdb sp!, {r3, lr} + ldr r0, _0203A634 ; =_020AFE5C + ldr r0, [r0, #0x10] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + bl sub_0203A658 + ldmia sp!, {r3, pc} + .align 2, 0 +_0203A634: .word _020AFE5C + arm_func_end sub_0203A618 + + arm_func_start sub_0203A638 +sub_0203A638: ; 0x0203A638 + stmdb sp!, {r3, lr} + ldr r0, _0203A654 ; =_020AFE5C + ldr r0, [r0, #0x10] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + bl sub_0203A6BC + ldmia sp!, {r3, pc} + .align 2, 0 +_0203A654: .word _020AFE5C + arm_func_end sub_0203A638 + + arm_func_start sub_0203A658 +sub_0203A658: ; 0x0203A658 + stmdb sp!, {r3, lr} + bl sub_0203AA20 + ldr r1, _0203A6B8 ; =_020AFE5C + strh r0, [r1] + bl sub_0203AAB0 + ldr r1, _0203A6B8 ; =_020AFE5C + strh r0, [r1, #2] + ldr r0, [r1, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x68] + bl sub_0202812C + ldr r0, _0203A6B8 ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x69] + cmp r0, r1 + ldmeqia sp!, {r3, pc} + bl CloseTextBox + ldr r0, _0203A6B8 ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + strb r1, [r0, #0x469] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203A6B8: .word _020AFE5C + arm_func_end sub_0203A658 + + arm_func_start sub_0203A6BC +sub_0203A6BC: ; 0x0203A6BC + stmdb sp!, {r3, lr} + ldr r0, _0203A750 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x68] + bl sub_02028354 + cmp r0, #3 + bne _0203A6F0 + ldr r0, _0203A750 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x68] + bl sub_0202810C +_0203A6F0: + ldr r0, _0203A750 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x68] + bl sub_0203111C + ldr r0, _0203A750 ; =_020AFE5C + ldr r1, [r0, #0x10] + ldrb r0, [r1, #0x46a] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + add r0, r1, #0x400 + ldrsb r0, [r0, #0x69] + mvn r1, #1 + cmp r0, r1 + bne _0203A748 + ldr r0, _0203A754 ; =_0209C638 + ldr r1, _0203A758 ; =sub_0203C784 + bl CreateTextBox + ldr r1, _0203A750 ; =_020AFE5C + ldr r1, [r1, #0x10] + strb r0, [r1, #0x469] + ldmia sp!, {r3, pc} +_0203A748: + bl sub_0202F9B8 + ldmia sp!, {r3, pc} + .align 2, 0 +_0203A750: .word _020AFE5C +_0203A754: .word _0209C638 +_0203A758: .word sub_0203C784 + arm_func_end sub_0203A6BC + + arm_func_start TeamSelectionMenuGetItem +TeamSelectionMenuGetItem: ; 0x0203A75C + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr} + sub sp, sp, #0x28 + ldr r3, _0203A960 ; =_020AFE5C + ldr r2, _0203A964 ; =TEAM_MEMBER_TABLE_PTR + ldr r5, [r3, #0x10] + mov r8, r1 + add r1, r5, r8, lsl #1 + ldrsh r6, [r1, #0x12] + ldr r4, [r2] + add r1, r5, r8 + mov r2, #0 + strb r2, [r1, #0x672] + mov r7, #0x44 + ldr r1, [r3, #4] + smlabb r4, r6, r7, r4 + mov sb, r0 + cmp r1, #9 + bne _0203A85C + ldr r0, [r3, #0x10] + add r0, r0, #0x600 + ldrsh r0, [r0, #0x70] + bl GetItemMoveId16 + mov r5, #0 + mov r3, r5 + mov ip, #1 + mov r2, #6 + b _0203A7FC +_0203A7C8: + smlabb lr, r5, r2, r4 + ldrb r1, [lr, #0x22] + tst r1, #1 + movne r1, ip + moveq r1, r3 + tst r1, #0xff + beq _0203A7F0 + ldrh r1, [lr, #0x24] + cmp r0, r1 + beq _0203A804 +_0203A7F0: + add r1, r5, #1 + mov r1, r1, lsl #0x10 + mov r5, r1, asr #0x10 +_0203A7FC: + cmp r5, #4 + blt _0203A7C8 +_0203A804: + ldrsh r1, [r4, #4] + bl sub_02053D1C + cmp r0, #0 + beq _0203A844 + cmp r5, #4 + blt _0203A844 + mov r0, r6 + bl sub_02056410 + cmp r0, #0 + beq _0203A8E4 + mov r0, r6 + bl sub_020564B0 + cmp r0, #0 + movne r7, #0x59 + moveq r7, #0x46 + b _0203A8E4 +_0203A844: + ldr r0, _0203A960 ; =_020AFE5C + mov r1, #3 + ldr r0, [r0, #0x10] + add r0, r0, r8 + strb r1, [r0, #0x672] + b _0203A8E4 +_0203A85C: + mov r0, r6 + bl sub_02056410 + cmp r0, #0 + beq _0203A884 + mov r0, r6 + bl sub_020564B0 + cmp r0, #0 + movne r7, #0x59 + moveq r7, #0x46 + b _0203A8E4 +_0203A884: + ldr r0, _0203A960 ; =_020AFE5C + ldr r0, [r0, #4] +#ifdef JAPAN + sub r0, r0, #5 + cmp r0, #7 +#else + cmp r0, #0xc +#endif + addls pc, pc, r0, lsl #2 + b _0203A8D0 +_0203A898: ; jump table +#ifndef JAPAN + b _0203A8D0 ; case 0 + b _0203A8D0 ; case 1 + b _0203A8D0 ; case 2 + b _0203A8CC ; case 3 + b _0203A8CC ; case 4 +#endif + b _0203A8CC ; case 5 + b _0203A8CC ; case 6 + b _0203A8CC ; case 7 + b _0203A8CC ; case 8 + b _0203A8CC ; case 9 + b _0203A8CC ; case 10 + b _0203A8CC ; case 11 + b _0203A8CC ; case 12 +_0203A8CC: + b _0203A8E4 +_0203A8D0: + mov r0, r6 + bl sub_02056F60 + cmp r0, #0 + movne r7, #0x44 + moveq r7, #0x57 +_0203A8E4: + add r0, sp, #0x14 + add r1, r4, #0x3a + mov r2, #0xa + bl StrncpySimpleNoPadSafe + ldrsh r0, [r4, #4] + bl GetDexNumber + mov r1, r0 + add r0, sp, #4 + mov r2, #3 + bl sub_0202372C + ldr r0, _0203A960 ; =_020AFE5C + add r2, sp, #4 + ldr r0, [r0, #0x10] + add r0, r0, r8 + ldrb r0, [r0, #0x672] + cmp r0, #0 + bne _0203A944 + ldr r1, _0203A968 ; =_0209C798 + add r4, sp, #0x14 + mov r0, sb + mov r3, r7 + str r4, [sp] + bl SprintfStatic__0203A970 + b _0203A954 +_0203A944: + ldr r1, _0203A96C ; =_0209C7B8 + add r3, sp, #0x14 + mov r0, sb + bl SprintfStatic__0203A970 +_0203A954: + mov r0, sb + add sp, sp, #0x28 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + .align 2, 0 +_0203A960: .word _020AFE5C +_0203A964: .word TEAM_MEMBER_TABLE_PTR +_0203A968: .word _0209C798 +_0203A96C: .word _0209C7B8 + arm_func_end TeamSelectionMenuGetItem + + arm_func_start SprintfStatic__0203A970 +SprintfStatic__0203A970: ; 0x0203A970 + stmdb sp!, {r0, r1, r2, r3} + stmdb sp!, {r3, lr} + add r2, sp, #0xc + bic r2, r2, #3 + ldr r1, [sp, #0xc] + add r2, r2, #4 + bl vsprintf + ldmia sp!, {r3, lr} + add sp, sp, #0x10 + bx lr + arm_func_end SprintfStatic__0203A970 + + arm_func_start sub_0203A998 +sub_0203A998: ; 0x0203A998 + ldr r0, _0203A9B4 ; =_020AFE5C + ldr r0, [r0, #0x10] + cmp r0, #0 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_0203A9B4: .word _020AFE5C + arm_func_end sub_0203A998 + + arm_func_start sub_0203A9B8 +sub_0203A9B8: ; 0x0203A9B8 + stmdb sp!, {r3, lr} + ldr r0, _0203A9E8 ; =_020AFE5C + ldr r0, [r0, #0x10] + cmp r0, #0 + addne r0, r0, #0x400 + ldrnesb r0, [r0, #0x68] + mvnne r1, #1 + cmpne r0, r1 + moveq r0, #0 + ldmeqia sp!, {r3, pc} + bl IsTeamSelectionMenuActive + ldmia sp!, {r3, pc} + .align 2, 0 +_0203A9E8: .word _020AFE5C + arm_func_end sub_0203A9B8 + + arm_func_start sub_0203A9EC +sub_0203A9EC: ; 0x0203A9EC + stmdb sp!, {r3, lr} + ldr r0, _0203AA1C ; =_020AFE5C + ldr r0, [r0, #0x10] + cmp r0, #0 + addne r0, r0, #0x400 + ldrnesb r0, [r0, #0x68] + mvnne r1, #1 + cmpne r0, r1 + moveq r0, #0 + ldmeqia sp!, {r3, pc} + bl IsTeamSelectionMenuState3 + ldmia sp!, {r3, pc} + .align 2, 0 +_0203AA1C: .word _020AFE5C + arm_func_end sub_0203A9EC + + arm_func_start sub_0203AA20 +sub_0203AA20: ; 0x0203AA20 + stmdb sp!, {r3, lr} + ldr r0, _0203AAAC ; =_020AFE5C + ldr r0, [r0, #0x10] + cmp r0, #0 + addne r0, r0, #0x400 + ldrnesb r0, [r0, #0x68] + mvnne r1, #1 + cmpne r0, r1 + beq _0203AAA0 + bl IsTeamSelectionMenuActive + cmp r0, #0 + beq _0203AA68 + ldr r0, _0203AAAC ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x68] + bl sub_020311D4 + b _0203AA7C +_0203AA68: + ldr r0, _0203AAAC ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x68] + bl sub_020311E8 +_0203AA7C: + mov r0, r0, lsl #0x10 + mov r1, r0, asr #0x10 + cmp r1, #0 + mvnlt r0, #0 + ldrge r0, _0203AAAC ; =_020AFE5C + ldrge r0, [r0, #0x10] + addge r0, r0, r1, lsl #1 + ldrgesh r0, [r0, #0x12] + ldmia sp!, {r3, pc} +_0203AAA0: + ldr r0, _0203AAAC ; =_020AFE5C + ldrsh r0, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203AAAC: .word _020AFE5C + arm_func_end sub_0203AA20 + + arm_func_start sub_0203AAB0 +sub_0203AAB0: ; 0x0203AAB0 + stmdb sp!, {r3, lr} + ldr r0, _0203AAF4 ; =_020AFE5C + ldr r0, [r0, #0x10] + cmp r0, #0 + addne r0, r0, #0x400 + ldrnesb r0, [r0, #0x68] + mvnne r1, #1 + cmpne r0, r1 + ldreq r0, _0203AAF4 ; =_020AFE5C + ldreqsh r0, [r0, #2] + ldmeqia sp!, {r3, pc} + bl sub_020311D4 + ldr r1, _0203AAF4 ; =_020AFE5C + ldr r1, [r1, #0x10] + add r0, r1, r0, lsl #1 + ldrsh r0, [r0, #0x12] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203AAF4: .word _020AFE5C + arm_func_end sub_0203AAB0 + + arm_func_start sub_0203AAF8 +sub_0203AAF8: ; 0x0203AAF8 + ldr r1, _0203AB38 ; =_020AFE5C + mov r2, #0 + ldr r3, [r1, #0x10] + add r1, r3, #0x500 + ldrsh ip, [r1, #0xd4] + b _0203AB28 +_0203AB10: + add r1, r3, r2, lsl #1 + ldrsh r1, [r1, #0x12] + cmp r0, r1 + moveq r0, r2 + bxeq lr + add r2, r2, #1 +_0203AB28: + cmp r2, ip + blt _0203AB10 + mvn r0, #0 + bx lr + .align 2, 0 +_0203AB38: .word _020AFE5C + arm_func_end sub_0203AAF8 + + arm_func_start sub_0203AB3C +sub_0203AB3C: ; 0x0203AB3C + stmdb sp!, {r3, r4, r5, lr} + ldr r1, _0203AD60 ; =TEAM_MEMBER_TABLE_PTR + mov r5, r0 + mov r0, #0x44 + smulbb r2, r5, r0 + ldr r1, [r1] + ldrb r0, [r1, r2] + add r4, r1, r2 + tst r0, #1 + movne r0, #1 + moveq r0, #0 + tst r0, #0xff + moveq r0, #0 + ldmeqia sp!, {r3, r4, r5, pc} + ldr r0, _0203AD64 ; =_020AFE5C + ldr r1, [r0, #0x10] + ldrb r0, [r1, #0xc] + cmp r0, #0 + beq _0203AB98 + ldrsh r0, [r4, #4] + cmp r0, #0x214 + moveq r0, #0 + ldmeqia sp!, {r3, r4, r5, pc} +_0203AB98: + ldrb r0, [r1, #0x10] + cmp r0, #0 + beq _0203ABCC + ldrsh r0, [r4, #4] + bl sub_02054F18 + cmp r0, #0 + bne _0203ABC4 + add r0, r4, #0x22 + bl IsMovesetValidInTimeDarkness + cmp r0, #0 + bne _0203ABCC +_0203ABC4: + mov r0, #0 + ldmia sp!, {r3, r4, r5, pc} +_0203ABCC: + ldr r0, _0203AD64 ; =_020AFE5C + ldr r1, [r0, #0x10] + ldrb r0, [r1, #0xd] + cmp r0, #0 + beq _0203AD10 + ldrsh r0, [r4, #4] + bl IsShaymin + cmp r0, #0 + movne r0, #0 + ldmneia sp!, {r3, r4, r5, pc} + ldr r0, _0203AD64 ; =_020AFE5C + ldr r0, [r0, #0x10] + ldrb r0, [r0, #0xb] + cmp r0, #0 + beq _0203AC20 + mov r0, r5 + mov r1, #0 + bl sub_02056460 + cmp r0, #0 + movne r0, #0 + ldmneia sp!, {r3, r4, r5, pc} +_0203AC20: + ldr r0, _0203AD64 ; =_020AFE5C + ldr r0, [r0, #0x10] + ldrb r0, [r0, #0xb] + cmp r0, #0 + beq _0203AC4C + mov r0, r5 + mov r1, #1 + bl sub_02056460 + cmp r0, #0 + movne r0, #0 + ldmneia sp!, {r3, r4, r5, pc} +_0203AC4C: + ldr r0, _0203AD64 ; =_020AFE5C + ldr r1, [r0, #0x10] + ldrb r0, [r1, #0xf] + cmp r0, #0 + ldrneb r0, [r1, #0xb] + cmpne r0, #0 + beq _0203AC80 + mov r0, r5 + mov r1, #2 + bl sub_02056460 + cmp r0, #0 + movne r0, #0 + ldmneia sp!, {r3, r4, r5, pc} +_0203AC80: + ldr r0, _0203AD64 ; =_020AFE5C + ldr r0, [r0, #0x10] + ldrb r0, [r0, #8] + cmp r0, #0 + beq _0203ACAC + mov r0, r5 + mov r1, #0 + bl sub_02056460 + cmp r0, #0 + moveq r0, #0 + ldmeqia sp!, {r3, r4, r5, pc} +_0203ACAC: + ldr r0, _0203AD64 ; =_020AFE5C + ldr r0, [r0, #0x10] + ldrb r0, [r0, #8] + cmp r0, #0 + beq _0203ACD8 + mov r0, r5 + mov r1, #1 + bl sub_02056460 + cmp r0, #0 + moveq r0, #0 + ldmeqia sp!, {r3, r4, r5, pc} +_0203ACD8: + ldr r0, _0203AD64 ; =_020AFE5C + ldr r1, [r0, #0x10] + ldrb r0, [r1, #0xf] + cmp r0, #0 + ldrneb r0, [r1, #8] + cmpne r0, #0 + beq _0203AD58 + mov r0, r5 + mov r1, #2 + bl sub_02056460 + cmp r0, #0 + bne _0203AD58 + mov r0, #0 + ldmia sp!, {r3, r4, r5, pc} +_0203AD10: + ldrb r0, [r1, #0xb] + cmp r0, #0 + beq _0203AD30 + mov r0, r5 + bl sub_02056410 + cmp r0, #0 + movne r0, #0 + ldmneia sp!, {r3, r4, r5, pc} +_0203AD30: + ldr r0, _0203AD64 ; =_020AFE5C + ldr r0, [r0, #0x10] + ldrb r0, [r0, #8] + cmp r0, #0 + beq _0203AD58 + mov r0, r5 + bl sub_02056410 + cmp r0, #0 + moveq r0, #0 + ldmeqia sp!, {r3, r4, r5, pc} +_0203AD58: + mov r0, #1 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_0203AD60: .word TEAM_MEMBER_TABLE_PTR +_0203AD64: .word _020AFE5C + arm_func_end sub_0203AB3C + + arm_func_start sub_0203AD68 +sub_0203AD68: ; 0x0203AD68 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + mov sl, r0 + sub sb, sl, #7 + mov r6, #0 + ldr r5, _0203AF04 ; =TEAM_MEMBER_TABLE_PTR + mov r4, #0x44 + ldr fp, _0203AF08 ; =0x0000022B + b _0203AEF4 +_0203AD88: + ldr r1, [r5] + mov r0, r6, lsl #0x10 + mla r7, r6, r4, r1 + mov r0, r0, asr #0x10 + bl IsValidTeamMember + cmp r0, #0 + beq _0203AEF0 + cmp sl, #2 + bne _0203ADC4 + mov r0, r6, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02056410 + cmp r0, #0 + beq _0203AEF0 + b _0203AEE8 +_0203ADC4: + cmp sl, #3 + bne _0203ADE4 + mov r0, r6, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02056410 + cmp r0, #0 + bne _0203AEF0 + b _0203AEE8 +_0203ADE4: + cmp sl, #4 + bne _0203AE2C + cmp r6, #5 + blt _0203AEF0 + mov r0, r6, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02056410 + cmp r0, #0 + bne _0203AEF0 + mov r0, r6, lsl #0x10 + mov r0, r0, asr #0x10 + bl IsMainCharacter + cmp r0, #0 + bne _0203AEF0 + ldrsh r0, [r7, #4] + cmp r0, #0x214 + bne _0203AEE8 + b _0203AEF0 +_0203AE2C: + cmp sb, #1 + bhi _0203AEE8 + mov r8, #0 + bl sub_0204E210 + cmp r0, #2 + bne _0203AE50 + bl sub_0204E3C8 + cmp r0, #0 + movne r8, #1 +_0203AE50: + mov r0, r6, lsl #0x10 + mov r0, r0, asr #0x10 + mov r1, #0 + bl sub_02056460 + cmp r0, #0 + bne _0203AEF0 + mov r0, r6, lsl #0x10 + mov r0, r0, asr #0x10 + mov r1, #1 + bl sub_02056460 + cmp r0, #0 + bne _0203AEF0 + cmp r8, #0 + beq _0203AEA0 + mov r0, r6, lsl #0x10 + mov r1, #2 + mov r0, r0, asr #0x10 + bl sub_02056460 + cmp r0, #0 + bne _0203AEF0 +_0203AEA0: + mov r0, r6, lsl #0x10 + mov r0, r0, asr #0x10 + bl IsMainCharacter + cmp r0, #0 + bne _0203AEF0 + ldrsh r0, [r7, #4] + cmp r0, #0x214 + beq _0203AEF0 + cmp sl, #8 + bne _0203AED8 + ldrsh r0, [r7, #4] + bl sub_02054F18 + cmp r0, #0 + bne _0203AEF0 +_0203AED8: + ldrsh r0, [r7, #4] + bl IsShaymin + cmp r0, #0 + bne _0203AEF0 +_0203AEE8: + mov r0, #0 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} +_0203AEF0: + add r6, r6, #1 +_0203AEF4: + cmp r6, fp + blt _0203AD88 + mov r0, #1 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_0203AF04: .word TEAM_MEMBER_TABLE_PTR +_0203AF08: .word 0x0000022B + arm_func_end sub_0203AD68 + +#ifndef JAPAN + arm_func_start sub_0203AF0C +sub_0203AF0C: ; 0x0203AF0C + ldr r0, _0203AF24 ; =_020AFE5C + mvn r1, #0 + strh r1, [r0] + mov r1, #0 + strh r1, [r0, #2] + bx lr + .align 2, 0 +_0203AF24: .word _020AFE5C + arm_func_end sub_0203AF0C +#endif + + arm_func_start sub_0203AF28 +sub_0203AF28: ; 0x0203AF28 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + ldr r1, _0203B738 ; =_020AFE5C + ldr r0, [r1, #0x10] + ldr r2, [r0, #4] + add r0, r0, #0x500 + strh r2, [r0, #0xd4] + ldr r0, [r1, #8] + cmp r0, #4 + addls pc, pc, r0, lsl #2 + b _0203B29C +_0203AF50: ; jump table + b _0203B29C ; case 0 + b _0203AF64 ; case 1 + b _0203B050 ; case 2 + b _0203B114 ; case 3 + b _0203B1CC ; case 4 +_0203AF64: + ldr r0, _0203B73C ; =_022AADF8 + ldrb r8, [r0] + mov r0, r8 + bl sub_0203BAEC + cmp r0, #0 + mvneq r6, #0 + beq _0203B03C + ldr r0, _0203B73C ; =_022AADF8 + mov r6, #0 + ldr r5, _0203B738 ; =_020AFE5C + mov r1, #1 + mov sb, r6 + str r1, [r5, #8] + strb r8, [r0] + mov fp, r6 + mov sl, #0x44 + ldr r4, _0203B740 ; =TEAM_MEMBER_TABLE_PTR + b _0203B02C +_0203AFAC: + add r0, r1, sb, lsl #1 + ldrsh r2, [r0, #0x12] + ldr r0, [r4] + mov r1, fp + smulbb r7, r2, sl + add r0, r0, r7 + ldrsh r0, [r0, #4] + bl GetType + cmp r8, r0 + beq _0203AFF0 + ldr r0, [r4] + mov r1, #1 + add r0, r0, r7 + ldrsh r0, [r0, #4] + bl GetType + cmp r8, r0 + bne _0203B020 +_0203AFF0: + ldr r0, [r5, #0x10] + add r2, r6, #1 + add r1, r0, r6, lsl #1 + add r3, r0, sb, lsl #1 + ldrsh r0, [r1, #0x12] + ldrsh r3, [r3, #0x12] + mov r2, r2, lsl #0x10 + mov r6, r2, asr #0x10 + strh r3, [r1, #0x12] + ldr r1, [r5, #0x10] + add r1, r1, sb, lsl #1 + strh r0, [r1, #0x12] +_0203B020: + add r0, sb, #1 + mov r0, r0, lsl #0x10 + mov sb, r0, asr #0x10 +_0203B02C: + ldr r1, [r5, #0x10] + ldr r0, [r1, #4] + cmp sb, r0 + blt _0203AFAC +_0203B03C: + ldr r0, _0203B738 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + strh r6, [r0, #0xd4] + b _0203B29C +_0203B050: + ldr r0, _0203B73C ; =_022AADF8 + ldrsh r6, [r0] + mov r0, r6 + bl sub_0203BB80 + cmp r0, #0 + mvneq r5, #0 + beq _0203B100 + ldr r0, _0203B73C ; =_022AADF8 + mov r5, #0 + ldr sb, _0203B738 ; =_020AFE5C + mov r1, #2 + mov r4, r5 + str r1, [sb, #8] + strh r6, [r0] + ldr r8, _0203B740 ; =TEAM_MEMBER_TABLE_PTR + mov r7, #0x44 + b _0203B0F0 +_0203B094: + add r0, r1, r4, lsl #1 + ldrsh r0, [r0, #0x12] + ldr r1, [r8] + smlabb r0, r0, r7, r1 + ldrsh r0, [r0, #4] + bl GetDexNumber + cmp r6, r0 + bne _0203B0E4 + ldr r0, [sb, #0x10] + add r1, r5, #1 + add r3, r0, r5, lsl #1 + add r2, r0, r4, lsl #1 + ldrsh r0, [r3, #0x12] + ldrsh r2, [r2, #0x12] + mov r1, r1, lsl #0x10 + mov r5, r1, asr #0x10 + strh r2, [r3, #0x12] + ldr r1, [sb, #0x10] + add r1, r1, r4, lsl #1 + strh r0, [r1, #0x12] +_0203B0E4: + add r0, r4, #1 + mov r0, r0, lsl #0x10 + mov r4, r0, asr #0x10 +_0203B0F0: + ldr r1, [sb, #0x10] + ldr r0, [r1, #4] + cmp r4, r0 + blt _0203B094 +_0203B100: + ldr r0, _0203B738 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + strh r5, [r0, #0xd4] + b _0203B29C +_0203B114: + ldr r0, _0203B73C ; =_022AADF8 + ldrb r4, [r0] + mov r0, r4 + bl sub_0203BBEC + cmp r0, #0 + mvneq r2, #0 + beq _0203B1B8 + ldr r0, _0203B73C ; =_022AADF8 + mov r2, #0 + ldr r6, _0203B738 ; =_020AFE5C + mov r3, #3 + str r3, [r6, #8] + mov r1, r2 + strb r4, [r0] + ldr r5, _0203B740 ; =TEAM_MEMBER_TABLE_PTR + mov r3, #0x44 + b _0203B1A8 +_0203B158: + add r0, r7, r1, lsl #1 + ldrsh r0, [r0, #0x12] + ldr r7, [r5] + smlabb r7, r0, r3, r7 + ldrb r7, [r7, #0x3a] + cmp r4, r7 + bne _0203B19C + ldr r8, [r6, #0x10] + add r7, r2, #1 + add sb, r8, r2, lsl #1 + ldrsh r8, [sb, #0x12] + mov r2, r7, lsl #0x10 + mov r2, r2, asr #0x10 + strh r0, [sb, #0x12] + ldr r0, [r6, #0x10] + add r0, r0, r1, lsl #1 + strh r8, [r0, #0x12] +_0203B19C: + add r0, r1, #1 + mov r0, r0, lsl #0x10 + mov r1, r0, asr #0x10 +_0203B1A8: + ldr r7, [r6, #0x10] + ldr r0, [r7, #4] + cmp r1, r0 + blt _0203B158 +_0203B1B8: + ldr r0, _0203B738 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + strh r2, [r0, #0xd4] + b _0203B29C +_0203B1CC: + ldr r0, _0203B73C ; =_022AADF8 + ldrh sb, [r0] + mov r0, sb + bl sub_0203BC50 + cmp r0, #0 + mvneq r8, #0 + beq _0203B28C + ldr r0, _0203B73C ; =_022AADF8 + mov r8, #0 + ldr r6, _0203B738 ; =_020AFE5C + mov r1, #4 + mov r7, r8 + str r1, [r6, #8] + strh sb, [r0] + add sl, sp, #0 + ldr r5, _0203B740 ; =TEAM_MEMBER_TABLE_PTR + mov r4, #0x44 + b _0203B27C +_0203B214: + add r0, r1, r7, lsl #1 + ldrsh r0, [r0, #0x12] + ldr r1, [r5] + smlabb r0, r0, r4, r1 + ldrsh r0, [r0, #4] + bl GetNameString + str r0, [sp] + mov r0, sl + bl sub_0202065C + cmp sb, r0 + bne _0203B270 + ldr r0, [r6, #0x10] + add r2, r8, #1 + add r1, r0, r8, lsl #1 + add r3, r0, r7, lsl #1 + ldrsh r0, [r1, #0x12] + ldrsh r3, [r3, #0x12] + mov r2, r2, lsl #0x10 + mov r8, r2, asr #0x10 + strh r3, [r1, #0x12] + ldr r1, [r6, #0x10] + add r1, r1, r7, lsl #1 + strh r0, [r1, #0x12] +_0203B270: + add r0, r7, #1 + mov r0, r0, lsl #0x10 + mov r7, r0, asr #0x10 +_0203B27C: + ldr r1, [r6, #0x10] + ldr r0, [r1, #4] + cmp r7, r0 + blt _0203B214 +_0203B28C: + ldr r0, _0203B738 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + strh r8, [r0, #0xd4] +_0203B29C: + ldr r0, _0203B738 ; =_020AFE5C + mov r8, #0 + ldr r2, [r0, #0x10] + add r0, r2, #0x500 + ldrsh r1, [r0, #0xd4] + cmp r1, #0 + ldrle r1, [r2, #4] + strleh r1, [r0, #0xd4] + mov r1, r8 +_0203B2C0: + ldr r0, _0203B740 ; =TEAM_MEMBER_TABLE_PTR + mov r3, r1, lsl #1 + ldr r0, [r0] + mvn r2, #0 + add r0, r0, #0x9000 + ldr r0, [r0, #0x870] + ldrsh r0, [r0, r3] + cmp r0, r2 + beq _0203B35C + ldr r2, _0203B738 ; =_020AFE5C + mov r5, #0 + ldr r4, [r2, #0x10] + add r2, r4, #0x500 + ldrsh r3, [r2, #0xd4] + b _0203B354 +_0203B2FC: + add r2, r4, r5, lsl #1 + ldrsh r2, [r2, #0x12] + cmp r0, r2 + bne _0203B350 + sub r5, r5, #1 + ldr r2, _0203B738 ; =_020AFE5C + b _0203B32C +_0203B318: + ldr r3, [r2, #0x10] + add r4, r3, r5, lsl #1 + ldrsh r3, [r4, #0x12] + sub r5, r5, #1 + strh r3, [r4, #0x14] +_0203B32C: + cmp r5, r8 + bge _0203B318 + ldr r2, _0203B738 ; =_020AFE5C + mov r3, r8, lsl #1 + ldr r2, [r2, #0x10] + add r8, r8, #1 + add r2, r2, r3 + strh r0, [r2, #0x12] + b _0203B35C +_0203B350: + add r5, r5, #1 +_0203B354: + cmp r5, r3 + blt _0203B2FC +_0203B35C: + add r1, r1, #1 + cmp r1, #4 + blt _0203B2C0 + bl sub_020568A4 + bl sub_0203B7AC + cmp r0, r8 + addge r8, r8, #1 + bl GetMainCharacter3MemberIdx + bl sub_0203B7AC + cmp r0, r8 + addge r8, r8, #1 + bl GetMainCharacter2MemberIdx + bl sub_0203B7AC + cmp r0, r8 + addge r8, r8, #1 + bl GetMainCharacter1MemberIdx + bl sub_0203B7AC + cmp r0, r8 + ldr r0, _0203B738 ; =_020AFE5C + addge r8, r8, #1 + ldr r1, [r0, #0xc] + cmp r1, #4 + addls pc, pc, r1, lsl #2 + b _0203B714 +_0203B3BC: ; jump table + b _0203B714 ; case 0 + b _0203B578 ; case 1 + b _0203B648 ; case 2 + b _0203B3D0 ; case 3 + b _0203B4A8 ; case 4 +_0203B3D0: + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsh sb, [r0, #0xd4] + cmp r8, sb + bge _0203B714 + mov r0, r8, lsl #0x10 + mov sl, r0, asr #0x10 + b _0203B49C +_0203B3F0: + ldr r0, _0203B738 ; =_020AFE5C + ldr r1, _0203B740 ; =TEAM_MEMBER_TABLE_PTR + ldr r0, [r0, #0x10] + ldr r3, [r1] + add r0, r0, sl, lsl #1 + ldrsh r2, [r0, #0x12] + mov r0, #0x44 + mov r1, #0 + smlabb r0, r2, r0, r3 + ldrsh r0, [r0, #4] + bl GetKeyM2NSwitch + mov r1, r8, lsl #0x10 + mov r6, r0 + mov r7, r1, asr #0x10 + ldr r5, _0203B740 ; =TEAM_MEMBER_TABLE_PTR + ldr r4, _0203B738 ; =_020AFE5C + mov fp, #0x44 + b _0203B46C +_0203B438: + ldr r0, [r4, #0x10] + ldr r2, [r5] + add r0, r0, r7, lsl #1 + ldrsh r0, [r0, #0x12] + mov r1, #0 + smlabb r0, r0, fp, r2 + ldrsh r0, [r0, #4] + bl GetKeyM2NSwitch + cmp r6, r0 + blt _0203B474 + add r0, r7, #1 + mov r0, r0, lsl #0x10 + mov r7, r0, asr #0x10 +_0203B46C: + cmp r7, sl + blt _0203B438 +_0203B474: + ldr r0, _0203B738 ; =_020AFE5C + mov r1, r7 + ldr r0, [r0, #0x10] + mov r2, sl + add r0, r0, sl, lsl #1 + ldrsh r0, [r0, #0x12] + bl sub_0203B83C + add r0, sl, #1 + mov r0, r0, lsl #0x10 + mov sl, r0, asr #0x10 +_0203B49C: + cmp sl, sb + blt _0203B3F0 + b _0203B714 +_0203B4A8: + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsh r7, [r0, #0xd4] + cmp r8, r7 + bge _0203B714 + mov r0, r8, lsl #0x10 + mov sb, r0, asr #0x10 + b _0203B56C +_0203B4C8: + ldr r4, _0203B738 ; =_020AFE5C + mov r0, r8, lsl #0x10 + ldr r1, [r4, #0x10] + mov r5, r0, asr #0x10 + add r0, r1, sb, lsl #1 + ldrsh r6, [r0, #0x12] + b _0203B50C +_0203B4E4: + ldr r1, [r4, #0x10] + mov r0, r6 + add r1, r1, r5, lsl #1 + ldrsh r1, [r1, #0x12] + bl sub_02052FF8 + cmp r0, #0 + bne _0203B514 + add r0, r5, #1 + mov r0, r0, lsl #0x10 + mov r5, r0, asr #0x10 +_0203B50C: + cmp r5, sb + blt _0203B4E4 +_0203B514: + ldr r2, _0203B738 ; =_020AFE5C + mov r6, sb + ldr r0, [r2, #0x10] + add r0, r0, sb, lsl #1 + ldrsh r0, [r0, #0x12] + b _0203B548 +_0203B52C: + ldr r3, [r2, #0x10] + sub r1, r6, #1 + add r4, r3, r6, lsl #1 + ldrsh r3, [r4, #0x10] + mov r1, r1, lsl #0x10 + mov r6, r1, asr #0x10 + strh r3, [r4, #0x12] +_0203B548: + cmp r6, r5 + bgt _0203B52C + ldr r1, _0203B738 ; =_020AFE5C + add r2, sb, #1 + ldr r3, [r1, #0x10] + mov r1, r2, lsl #0x10 + add r2, r3, r5, lsl #1 + strh r0, [r2, #0x12] + mov sb, r1, asr #0x10 +_0203B56C: + cmp sb, r7 + blt _0203B4C8 + b _0203B714 +_0203B578: + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsh sb, [r0, #0xd4] + cmp r8, sb + bge _0203B714 + mov r0, r8, lsl #0x10 + mov sl, r0, asr #0x10 + b _0203B63C +_0203B598: + ldr r0, _0203B738 ; =_020AFE5C + ldr r1, _0203B740 ; =TEAM_MEMBER_TABLE_PTR + ldr r0, [r0, #0x10] + ldr r2, [r1] + add r0, r0, sl, lsl #1 + ldrsh r1, [r0, #0x12] + mov r0, #0x44 + smlabb r0, r1, r0, r2 + ldrsh r0, [r0, #4] + bl FemaleToMaleForm + mov r1, r8, lsl #0x10 + mov r7, r0 + mov r6, r1, asr #0x10 + ldr r5, _0203B740 ; =TEAM_MEMBER_TABLE_PTR + ldr r4, _0203B738 ; =_020AFE5C + mov fp, #0x44 + b _0203B60C +_0203B5DC: + ldr r0, [r4, #0x10] + ldr r1, [r5] + add r0, r0, r6, lsl #1 + ldrsh r0, [r0, #0x12] + smlabb r0, r0, fp, r1 + ldrsh r0, [r0, #4] + bl FemaleToMaleForm + cmp r7, r0 + blt _0203B614 + add r0, r6, #1 + mov r0, r0, lsl #0x10 + mov r6, r0, asr #0x10 +_0203B60C: + cmp r6, sl + blt _0203B5DC +_0203B614: + ldr r0, _0203B738 ; =_020AFE5C + mov r1, r6 + ldr r0, [r0, #0x10] + mov r2, sl + add r0, r0, sl, lsl #1 + ldrsh r0, [r0, #0x12] + bl sub_0203B83C + add r0, sl, #1 + mov r0, r0, lsl #0x10 + mov sl, r0, asr #0x10 +_0203B63C: + cmp sl, sb + blt _0203B598 + b _0203B714 +_0203B648: + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsh sb, [r0, #0xd4] + cmp r8, sb + bge _0203B714 + mov r0, r8, lsl #0x10 + mov sl, r0, asr #0x10 + b _0203B70C +_0203B668: + ldr r0, _0203B738 ; =_020AFE5C + ldr r1, _0203B740 ; =TEAM_MEMBER_TABLE_PTR + ldr r0, [r0, #0x10] + ldr r2, [r1] + add r0, r0, sl, lsl #1 + ldrsh r1, [r0, #0x12] + mov r0, #0x44 + smlabb r0, r1, r0, r2 + ldrb r0, [r0, #1] + bl FemaleToMaleForm + mov r1, r8, lsl #0x10 + mov r6, r0 + mov r7, r1, asr #0x10 + ldr r5, _0203B740 ; =TEAM_MEMBER_TABLE_PTR + ldr r4, _0203B738 ; =_020AFE5C + mov fp, #0x44 + b _0203B6DC +_0203B6AC: + ldr r0, [r4, #0x10] + ldr r1, [r5] + add r0, r0, r7, lsl #1 + ldrsh r0, [r0, #0x12] + smlabb r0, r0, fp, r1 + ldrb r0, [r0, #1] + bl FemaleToMaleForm + cmp r6, r0 + bgt _0203B6E4 + add r0, r7, #1 + mov r0, r0, lsl #0x10 + mov r7, r0, asr #0x10 +_0203B6DC: + cmp r7, sl + blt _0203B6AC +_0203B6E4: + ldr r0, _0203B738 ; =_020AFE5C + mov r1, r7 + ldr r0, [r0, #0x10] + mov r2, sl + add r0, r0, sl, lsl #1 + ldrsh r0, [r0, #0x12] + bl sub_0203B83C + add r0, sl, #1 + mov r0, r0, lsl #0x10 + mov sl, r0, asr #0x10 +_0203B70C: + cmp sl, sb + blt _0203B668 +_0203B714: + ldr r0, _0203B738 ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x69] + cmp r0, r1 + ldmeqia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + bl sub_0202F9B8 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_0203B738: .word _020AFE5C +_0203B73C: .word _022AADF8 +_0203B740: .word TEAM_MEMBER_TABLE_PTR + arm_func_end sub_0203AF28 + + arm_func_start sub_0203B744 +sub_0203B744: ; 0x0203B744 + stmdb sp!, {r3, lr} + bl sub_0203AA20 + ldr r1, _0203B7A8 ; =_020AFE5C + strh r0, [r1] + bl sub_0203AAB0 + ldr r1, _0203B7A8 ; =_020AFE5C + strh r0, [r1, #2] + bl sub_0203AF28 + ldr r0, _0203B7A8 ; =_020AFE5C + ldr r1, [r0, #0x10] + add r0, r1, #0x400 + add r1, r1, #0x500 + ldrsb r0, [r0, #0x68] + ldrsh r1, [r1, #0xd4] + bl sub_0203117C + ldr r0, _0203B7A8 ; =_020AFE5C + ldrsh r0, [r0, #2] + bl sub_0203AAF8 + ldr r2, _0203B7A8 ; =_020AFE5C + mov r1, r0 + ldr r0, [r2, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x68] + bl sub_02031220 + ldmia sp!, {r3, pc} + .align 2, 0 +_0203B7A8: .word _020AFE5C + arm_func_end sub_0203B744 + + arm_func_start sub_0203B7AC +sub_0203B7AC: ; 0x0203B7AC + stmdb sp!, {r3, lr} + mvn r1, #0 + cmp r0, r1 + beq _0203B830 + ldr r1, _0203B838 ; =_020AFE5C + mov ip, #0 + ldr r2, [r1, #0x10] + add r1, r2, #0x500 + ldrsh r3, [r1, #0xd4] + b _0203B828 +_0203B7D4: + add r1, r2, ip, lsl #1 + ldrsh r1, [r1, #0x12] + cmp r0, r1 + bne _0203B824 + mov lr, ip + sub ip, ip, #1 + ldr r1, _0203B838 ; =_020AFE5C + b _0203B808 +_0203B7F4: + ldr r2, [r1, #0x10] + add r3, r2, ip, lsl #1 + ldrsh r2, [r3, #0x12] + sub ip, ip, #1 + strh r2, [r3, #0x14] +_0203B808: + cmp ip, #0 + bge _0203B7F4 + ldr r1, _0203B838 ; =_020AFE5C + ldr r1, [r1, #0x10] + strh r0, [r1, #0x12] + mov r0, lr + ldmia sp!, {r3, pc} +_0203B824: + add ip, ip, #1 +_0203B828: + cmp ip, r3 + blt _0203B7D4 +_0203B830: + mvn r0, #0 + ldmia sp!, {r3, pc} + .align 2, 0 +_0203B838: .word _020AFE5C + arm_func_end sub_0203B7AC + + arm_func_start sub_0203B83C +sub_0203B83C: ; 0x0203B83C + stmdb sp!, {r4, lr} + ldr r3, _0203B880 ; =_020AFE5C + b _0203B864 +_0203B848: + ldr r4, [r3, #0x10] + sub ip, r2, #1 + add r4, r4, r2, lsl #1 + ldrsh lr, [r4, #0x10] + mov r2, ip, lsl #0x10 + mov r2, r2, asr #0x10 + strh lr, [r4, #0x12] +_0203B864: + cmp r2, r1 + bgt _0203B848 + ldr r2, _0203B880 ; =_020AFE5C + ldr r2, [r2, #0x10] + add r1, r2, r1, lsl #1 + strh r0, [r1, #0x12] + ldmia sp!, {r4, pc} + .align 2, 0 +_0203B880: .word _020AFE5C + arm_func_end sub_0203B83C + + arm_func_start sub_0203B884 +sub_0203B884: ; 0x0203B884 + stmdb sp!, {r3, lr} + ldr r0, _0203B918 ; =_020AFE5C + ldr r1, [r0, #0xc] + cmp r1, #4 + addls pc, pc, r1, lsl #2 + b _0203B8DC +_0203B89C: ; jump table + b _0203B8D4 ; case 0 + b _0203B8B0 ; case 1 + b _0203B8BC ; case 2 + b _0203B8C8 ; case 3 + b _0203B8D4 ; case 4 +_0203B8B0: + mov r1, #2 + str r1, [r0, #0xc] + b _0203B8DC +_0203B8BC: + mov r1, #3 + str r1, [r0, #0xc] + b _0203B8DC +_0203B8C8: + mov r1, #4 + str r1, [r0, #0xc] + b _0203B8DC +_0203B8D4: + mov r1, #1 + str r1, [r0, #0xc] +_0203B8DC: + bl sub_0203B744 + ldr r0, _0203B918 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x68] + bl sub_0203115C + ldr r0, _0203B918 ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x69] + cmp r0, r1 + ldmeqia sp!, {r3, pc} + bl sub_0202F9B8 + ldmia sp!, {r3, pc} + .align 2, 0 +_0203B918: .word _020AFE5C + arm_func_end sub_0203B884 + + arm_func_start sub_0203B91C +sub_0203B91C: ; 0x0203B91C + stmdb sp!, {r3, lr} + ldr r0, _0203BA18 ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #6] + cmp r0, r1 + bne _0203B968 + ldr r0, _0203BA1C ; =_0209C658 + mov ip, #5 + ldr r3, _0203BA20 ; =_0209C688 + mov r1, #0x13 + mov r2, #0 + str ip, [sp] + bl CreateSimpleMenuFromStringIds + ldr r1, _0203BA18 ; =_020AFE5C + ldr r1, [r1, #0x10] + strb r0, [r1, #0x506] + ldmia sp!, {r3, pc} +_0203B968: + bl IsSimpleMenuActive + cmp r0, #0 + ldmneia sp!, {r3, pc} + ldr r0, _0203BA18 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #6] + bl GetSimpleMenuResult + cmp r0, #5 + addls pc, pc, r0, lsl #2 + b _0203B9E8 +_0203B994: ; jump table + b _0203B9AC ; case 0 + b _0203B9BC ; case 1 + b _0203B9E8 ; case 2 + b _0203B9CC ; case 3 + b _0203B9DC ; case 4 + b _0203B9E8 ; case 5 +_0203B9AC: + ldr r0, _0203BA18 ; =_020AFE5C + mov r1, #1 + str r1, [r0, #0xc] + b _0203B9E8 +_0203B9BC: + ldr r0, _0203BA18 ; =_020AFE5C + mov r1, #2 + str r1, [r0, #0xc] + b _0203B9E8 +_0203B9CC: + ldr r0, _0203BA18 ; =_020AFE5C + mov r1, #3 + str r1, [r0, #0xc] + b _0203B9E8 +_0203B9DC: + ldr r0, _0203BA18 ; =_020AFE5C + mov r1, #4 + str r1, [r0, #0xc] +_0203B9E8: + ldr r0, _0203BA18 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #6] + bl CloseSimpleMenu + ldr r0, _0203BA18 ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + strb r1, [r0, #0x506] + bl sub_0203B744 + bl sub_0203A6BC + ldmia sp!, {r3, pc} + .align 2, 0 +_0203BA18: .word _020AFE5C +_0203BA1C: .word _0209C658 +_0203BA20: .word _0209C688 + arm_func_end sub_0203B91C + + arm_func_start sub_0203BA24 +sub_0203BA24: ; 0x0203BA24 + stmdb sp!, {r4, lr} + sub sp, sp, #0x58 + ldr r4, _0203BA78 ; =_0209C70C + add lr, sp, #0 + mov ip, #5 +_0203BA38: + ldmia r4!, {r0, r1, r2, r3} + stmia lr!, {r0, r1, r2, r3} + subs ip, ip, #1 + bne _0203BA38 + ldr r2, _0203BA7C ; =_020AFE5C + ldmia r4, {r0, r1} + stmia lr, {r0, r1} + ldr r0, [r2, #0x10] + ldr r1, [r0, #0x508] + cmp r1, #0x16 + bge _0203BA70 + add r0, sp, #0 + ldr r0, [r0, r1, lsl #2] + blx r0 +_0203BA70: + add sp, sp, #0x58 + ldmia sp!, {r4, pc} + .align 2, 0 +_0203BA78: .word _0209C70C +_0203BA7C: .word _020AFE5C + arm_func_end sub_0203BA24 + + arm_func_start sub_0203BA80 +sub_0203BA80: ; 0x0203BA80 + stmdb sp!, {r3, lr} + ldr r0, _0203BABC ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + add r0, r0, #0x400 + ldrsb r0, [r0, #0x68] + cmp r0, r1 + ldmeqia sp!, {r3, pc} + bl sub_020311D4 + ldr r1, _0203BABC ; =_020AFE5C + ldr r1, [r1, #0x10] + add r0, r1, r0, lsl #1 + ldrsh r0, [r0, #0x12] + bl sub_0203C9A0 + ldmia sp!, {r3, pc} + .align 2, 0 +_0203BABC: .word _020AFE5C + arm_func_end sub_0203BA80 + + arm_func_start sub_0203BAC0 +sub_0203BAC0: ; 0x0203BAC0 + cmp r1, #0 + blt _0203BAD0 + cmp r1, #0x11 + blt _0203BAD8 +_0203BAD0: + mov r1, #0 + b _0203BADC +_0203BAD8: + add r1, r1, #1 +_0203BADC: + ldr ip, _0203BAE8 ; =sub_02024B94 + and r1, r1, #0xff + bx ip + .align 2, 0 +_0203BAE8: .word sub_02024B94 + arm_func_end sub_0203BAC0 + + arm_func_start sub_0203BAEC +sub_0203BAEC: ; 0x0203BAEC + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + mov r8, #0 + mov sl, r0 + mov r7, r8 + mov fp, #1 + mov r4, #0x44 + ldr r6, _0203BB78 ; =TEAM_MEMBER_TABLE_PTR + ldr r5, _0203BB7C ; =_020AFE5C + b _0203BB60 +_0203BB10: + add r0, r1, r8, lsl #1 + ldrsh r2, [r0, #0x12] + ldr r0, [r6] + mov r1, r7 + smulbb sb, r2, r4 + add r0, r0, sb + ldrsh r0, [r0, #4] + bl GetType + cmp sl, r0 + beq _0203BB54 + ldr r0, [r6] + mov r1, fp + add r0, r0, sb + ldrsh r0, [r0, #4] + bl GetType + cmp sl, r0 + bne _0203BB5C +_0203BB54: + mov r0, #1 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} +_0203BB5C: + add r8, r8, #1 +_0203BB60: + ldr r1, [r5, #0x10] + ldr r0, [r1, #4] + cmp r8, r0 + blt _0203BB10 + mov r0, #0 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_0203BB78: .word TEAM_MEMBER_TABLE_PTR +_0203BB7C: .word _020AFE5C + arm_func_end sub_0203BAEC + + arm_func_start sub_0203BB80 +sub_0203BB80: ; 0x0203BB80 + stmdb sp!, {r4, r5, r6, r7, r8, lr} + mov r5, r0 + mov r4, #0 + ldr r8, _0203BBE4 ; =TEAM_MEMBER_TABLE_PTR + mov r6, #0x44 + ldr r7, _0203BBE8 ; =_020AFE5C + b _0203BBCC +_0203BB9C: + add r0, r1, r4, lsl #1 + ldrsh r0, [r0, #0x12] + ldr r1, [r8] + smlabb r0, r0, r6, r1 + ldrsh r0, [r0, #4] + bl GetDexNumber + cmp r5, r0 + moveq r0, #1 + ldmeqia sp!, {r4, r5, r6, r7, r8, pc} + add r0, r4, #1 + mov r0, r0, lsl #0x10 + mov r4, r0, asr #0x10 +_0203BBCC: + ldr r1, [r7, #0x10] + ldr r0, [r1, #4] + cmp r4, r0 + blt _0203BB9C + mov r0, #0 + ldmia sp!, {r4, r5, r6, r7, r8, pc} + .align 2, 0 +_0203BBE4: .word TEAM_MEMBER_TABLE_PTR +_0203BBE8: .word _020AFE5C + arm_func_end sub_0203BB80 + + arm_func_start sub_0203BBEC +sub_0203BBEC: ; 0x0203BBEC + stmdb sp!, {r4, lr} + ldr r1, _0203BC48 ; =_020AFE5C + ldr r2, _0203BC4C ; =TEAM_MEMBER_TABLE_PTR + ldr lr, [r1, #0x10] + ldr ip, [r2] + ldr r4, [lr, #4] + mov r3, #0 + mov r2, #0x44 + b _0203BC38 +_0203BC10: + add r1, lr, r3, lsl #1 + ldrsh r1, [r1, #0x12] + smlabb r1, r1, r2, ip + ldrb r1, [r1, #0x3a] + cmp r0, r1 + moveq r0, #1 + ldmeqia sp!, {r4, pc} + add r1, r3, #1 + mov r1, r1, lsl #0x10 + mov r3, r1, asr #0x10 +_0203BC38: + cmp r3, r4 + blt _0203BC10 + mov r0, #0 + ldmia sp!, {r4, pc} + .align 2, 0 +_0203BC48: .word _020AFE5C +_0203BC4C: .word TEAM_MEMBER_TABLE_PTR + arm_func_end sub_0203BBEC + + arm_func_start sub_0203BC50 +sub_0203BC50: ; 0x0203BC50 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr} + mov r6, r0 + mov r5, #0 + add r4, sp, #0 + ldr sb, _0203BCC4 ; =TEAM_MEMBER_TABLE_PTR + mov r7, #0x44 + ldr r8, _0203BCC8 ; =_020AFE5C + b _0203BCAC +_0203BC70: + add r0, r1, r5, lsl #1 + ldrsh r0, [r0, #0x12] + ldr r1, [sb] + smlabb r0, r0, r7, r1 + ldrsh r0, [r0, #4] + bl GetNameString + str r0, [sp] + mov r0, r4 + bl sub_0202065C + cmp r6, r0 + moveq r0, #1 + ldmeqia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + add r0, r5, #1 + mov r0, r0, lsl #0x10 + mov r5, r0, asr #0x10 +_0203BCAC: + ldr r1, [r8, #0x10] + ldr r0, [r1, #4] + cmp r5, r0 + blt _0203BC70 + mov r0, #0 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + .align 2, 0 +_0203BCC4: .word TEAM_MEMBER_TABLE_PTR +_0203BCC8: .word _020AFE5C + arm_func_end sub_0203BC50 + + arm_func_start sub_0203BCCC +sub_0203BCCC: ; 0x0203BCCC + ldr r0, _0203BCE4 ; =_020AFE5C + ldr ip, _0203BCE8 ; =sub_02039B0C + ldr r0, [r0, #0x10] + add r0, r0, #0x1a8 + add r0, r0, #0x400 + bx ip + .align 2, 0 +_0203BCE4: .word _020AFE5C +_0203BCE8: .word sub_02039B0C + arm_func_end sub_0203BCCC + + arm_func_start sub_0203BCEC +sub_0203BCEC: ; 0x0203BCEC + stmdb sp!, {r3, r4, lr} + sub sp, sp, #4 + ldr r0, _0203BE0C ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #7] + cmp r0, r1 + bne _0203BD3C + ldr r0, _0203BE10 ; =_0209C678 + mov ip, #6 + ldr r3, _0203BE14 ; =_0209C6B8 + mov r1, #0x13 + mov r2, #0 + str ip, [sp] + bl CreateSimpleMenuFromStringIds + ldr r1, _0203BE0C ; =_020AFE5C + ldr r1, [r1, #0x10] + strb r0, [r1, #0x507] + b _0203BE04 +_0203BD3C: + bl IsSimpleMenuActive + cmp r0, #0 + bne _0203BE04 + ldr r0, _0203BE0C ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #7] + bl GetSimpleMenuResult + ldr r1, _0203BE0C ; =_020AFE5C + mov r0, r0, lsl #0x10 + ldr r1, [r1, #0x10] + mov r4, r0, asr #0x10 + add r0, r1, #0x500 + ldrsb r0, [r0, #7] + bl CloseSimpleMenu + ldr r0, _0203BE0C ; =_020AFE5C + mvn r2, #1 + ldr r1, [r0, #0x10] + cmp r4, #6 + strb r2, [r1, #0x507] + addls pc, pc, r4, lsl #2 + b _0203BE00 +_0203BD94: ; jump table + b _0203BDB0 ; case 0 + b _0203BE00 ; case 1 + b _0203BDC0 ; case 2 + b _0203BDD0 ; case 3 + b _0203BDE0 ; case 4 + b _0203BE00 ; case 5 + b _0203BDF0 ; case 6 +_0203BDB0: + ldr r0, [r0, #0x10] + mov r1, #7 + str r1, [r0, #0x508] + b _0203BE04 +_0203BDC0: + ldr r0, [r0, #0x10] + mov r1, #1 + str r1, [r0, #0x508] + b _0203BE04 +_0203BDD0: + ldr r0, [r0, #0x10] + mov r1, #0xa + str r1, [r0, #0x508] + b _0203BE04 +_0203BDE0: + ldr r0, [r0, #0x10] + mov r1, #0xf + str r1, [r0, #0x508] + b _0203BE04 +_0203BDF0: + ldr r0, [r0, #0x10] + mov r1, #0x14 + str r1, [r0, #0x508] + b _0203BE04 +_0203BE00: + bl sub_0203A6BC +_0203BE04: + add sp, sp, #4 + ldmia sp!, {r3, r4, pc} + .align 2, 0 +_0203BE0C: .word _020AFE5C +_0203BE10: .word _0209C678 +_0203BE14: .word _0209C6B8 + arm_func_end sub_0203BCEC + + arm_func_start sub_0203BE18 +sub_0203BE18: ; 0x0203BE18 + stmdb sp!, {r3, lr} + sub sp, sp, #8 + ldr r3, _0203BECC ; =_020AFE5C + mvn r2, #1 + ldr r0, [r3, #0x10] + add r1, r0, #0x500 + ldrsb r0, [r1, #7] + cmp r0, r2 + bne _0203BE94 +#ifdef JAPAN + ldr r0, _0203C2B0 ; =0x000023B0 + mov r2, #0x10 + strh r0, [r1, #0x18] + ldr r1, [r3, #0x10] + mov r0, #0x11 + str r2, [r1, #0x51c] +#else + mov r0, #0x308 + strh r0, [r1, #0x18] + ldr r0, [r3, #0x10] + mov r1, #0x10 + str r1, [r0, #0x51c] + mov r0, #0x11 +#endif + str r0, [sp] + mov r0, #8 + str r0, [sp, #4] + ldr r2, [r3, #0x10] + ldr r0, _0203BED0 ; =_0209C618 + ldr r1, _0203BED4 ; =0x00001833 + ldr r3, _0203BED8 ; =sub_0203BAC0 + add r2, r2, #0x510 + bl CreateAdvancedMenu + ldr r1, _0203BECC ; =_020AFE5C + mov r2, #2 + ldr r3, [r1, #0x10] + strb r0, [r3, #0x50c] + ldr r0, [r1, #0x10] + str r2, [r0, #0x508] + b _0203BEC4 +_0203BE94: + bl IsSimpleMenuActive + cmp r0, #0 + bne _0203BEC4 + ldr r0, _0203BECC ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #7] + bl CloseSimpleMenu + ldr r0, _0203BECC ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + strb r1, [r0, #0x507] +_0203BEC4: + add sp, sp, #8 + ldmia sp!, {r3, pc} + .align 2, 0 +_0203BECC: .word _020AFE5C +#ifdef JAPAN +_0203C2B0: .word 0x000023B0 +#endif +_0203BED0: .word _0209C618 +_0203BED4: .word 0x00001833 +_0203BED8: .word sub_0203BAC0 + arm_func_end sub_0203BE18 + + arm_func_start sub_0203BEDC +sub_0203BEDC: ; 0x0203BEDC + stmdb sp!, {r3, lr} + ldr r0, _0203BF0C ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #0xc] + bl IsAdvancedMenuActive2 + cmp r0, #0 + ldreq r0, _0203BF0C ; =_020AFE5C + moveq r1, #3 + ldreq r0, [r0, #0x10] + streq r1, [r0, #0x508] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203BF0C: .word _020AFE5C + arm_func_end sub_0203BEDC + + arm_func_start sub_0203BF10 +sub_0203BF10: ; 0x0203BF10 + stmdb sp!, {r4, lr} + ldr r0, _0203C028 ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #0xc] + cmp r0, r1 + bne _0203BF48 + bl sub_0203A6BC + ldr r0, _0203C028 ; =_020AFE5C + mov r1, #0 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + ldmia sp!, {r4, pc} +_0203BF48: + bl IsAdvancedMenuActive2 + cmp r0, #0 + ldmneia sp!, {r4, pc} + ldr r0, _0203C028 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #0xc] + bl GetAdvancedMenuResult + and r0, r0, #0xff + add r0, r0, #1 + and r4, r0, #0xff + cmp r4, #1 + blo _0203BFEC + cmp r4, #0x12 + bhs _0203BFEC + mov r0, r4 + bl sub_0203BAEC + cmp r0, #0 + bne _0203BFBC + ldr r0, _0203C028 ; =_020AFE5C + mov r1, #0 + str r1, [r0, #8] + bl sub_0203B744 + bl sub_0203A658 + ldr r0, _0203C028 ; =_020AFE5C + mov r1, #4 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + b _0203C000 +_0203BFBC: + ldr r0, _0203C02C ; =_022AADF8 + ldr r1, _0203C028 ; =_020AFE5C + mov r2, #1 + str r2, [r1, #8] + strb r4, [r0] + bl sub_0203B744 + bl sub_0203A6BC + ldr r0, _0203C028 ; =_020AFE5C + mov r1, #0 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + b _0203C000 +_0203BFEC: + bl sub_0203A6BC + ldr r0, _0203C028 ; =_020AFE5C + mov r1, #0 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] +_0203C000: + ldr r0, _0203C028 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #0xc] + bl CloseAdvancedMenu + ldr r0, _0203C028 ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + strb r1, [r0, #0x50c] + ldmia sp!, {r4, pc} + .align 2, 0 +_0203C028: .word _020AFE5C +_0203C02C: .word _022AADF8 + arm_func_end sub_0203BF10 + + arm_func_start sub_0203C030 +sub_0203C030: ; 0x0203C030 + stmdb sp!, {r3, lr} + ldr r0, _0203C078 ; =_0209C648 + bl CreateDialogueBox + ldr r3, _0203C07C ; =_020AFE5C + ldr r1, _0203C080 ; =0x00000418 + ldr ip, [r3, #0x10] + ldr r2, _0203C084 ; =0x0000030B + strb r0, [ip, #0x505] + ldr r0, [r3, #0x10] + mov r3, #0 + add r0, r0, #0x500 + ldrsb r0, [r0, #5] + bl ShowStringIdInDialogueBox + ldr r0, _0203C07C ; =_020AFE5C + mov r1, #5 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C078: .word _0209C648 +_0203C07C: .word _020AFE5C +_0203C080: .word 0x00000418 +#ifdef JAPAN +_0203C084: .word 0x000023B3 +#else +_0203C084: .word 0x0000030B +#endif + arm_func_end sub_0203C030 + + arm_func_start sub_0203C088 +sub_0203C088: ; 0x0203C088 + stmdb sp!, {r3, lr} + ldr r0, _0203C0D0 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #5] + bl IsDialogueBoxActive + cmp r0, #0 + ldmneia sp!, {r3, pc} + ldr r0, _0203C0D0 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #5] + bl sub_0202F2C4 + ldr r0, _0203C0D0 ; =_020AFE5C + mov r1, #6 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C0D0: .word _020AFE5C + arm_func_end sub_0203C088 + + arm_func_start sub_0203C0D4 +sub_0203C0D4: ; 0x0203C0D4 + stmdb sp!, {r3, lr} + ldr r0, _0203C120 ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #5] + cmp r0, r1 + ldmeqia sp!, {r3, pc} + bl CloseDialogueBox + ldr r0, _0203C120 ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + strb r1, [r0, #0x505] + bl sub_0203A6BC + ldr r0, _0203C120 ; =_020AFE5C + mov r1, #0 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C120: .word _020AFE5C + arm_func_end sub_0203C0D4 + + arm_func_start sub_0203C124 +sub_0203C124: ; 0x0203C124 + stmdb sp!, {r3, lr} + sub sp, sp, #8 + ldr r1, _0203C1E8 ; =_020AFE5C +#ifdef JAPAN + mov r3, #0x1ec + ldr r0, [r1, #0x10] + mov lr, #1 + str lr, [r0, #0x5ac] + ldr r0, [r1, #0x10] + mov r2, #3 +#else + mov lr, #1 + ldr r0, [r1, #0x10] + mov r2, #3 + str lr, [r0, #0x5ac] + ldr r0, [r1, #0x10] + mov r3, #0x1ec +#endif + str r2, [r0, #0x5b8] + ldr r0, [r1, #0x10] + mov ip, #0x50 + str lr, [r0, #0x5b0] + ldr r0, [r1, #0x10] + mov r2, #0x16 + str r3, [r0, #0x5b4] + ldr r0, [r1, #0x10] +#ifdef JAPAN + add r3, r3, #0x21c0 +#else + mov r3, #0x304 +#endif + str ip, [r0, #0x5c8] + ldr r0, [r1, #0x10] + mov ip, #0x10 + str r2, [r0, #0x5cc] + ldr r0, [r1, #0x10] + mov r2, #0 + add r0, r0, #0x500 + strh r3, [r0, #0xe0] + ldr r3, [r1, #0x10] + ldr r0, _0203C1EC ; =_0209C628 + str ip, [r3, #0x5e4] + str r2, [sp] + str r2, [sp, #4] + ldr r2, [r1, #0x10] + ldr r1, _0203C1F0 ; =0x00401807 + add r2, r2, #0x1d8 + ldr r3, _0203C1F4 ; =sub_0203BCCC + add r2, r2, #0x400 + bl CreateAdvancedTextBox + ldr r1, _0203C1E8 ; =_020AFE5C + mov r2, #8 + ldr r3, [r1, #0x10] + strb r0, [r3, #0x5bc] + ldr r0, [r1, #0x10] + str r2, [r0, #0x508] + ldr r0, [r1, #0x10] + add r0, r0, #0x1a8 + add r0, r0, #0x400 + bl sub_020395CC + add sp, sp, #8 + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C1E8: .word _020AFE5C +_0203C1EC: .word _0209C628 +_0203C1F0: .word 0x00401807 +_0203C1F4: .word sub_0203BCCC + arm_func_end sub_0203C124 + + arm_func_start sub_0203C1F8 +sub_0203C1F8: ; 0x0203C1F8 + stmdb sp!, {r3, lr} + ldr r0, _0203C324 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x1a8 + add r0, r0, #0x400 + bl sub_020396E4 + cmp r0, #3 + addls pc, pc, r0, lsl #2 + ldmia sp!, {r3, pc} +_0203C21C: ; jump table + ldmia sp!, {r3, pc} ; case 0 + b _0203C22C ; case 1 + b _0203C2F4 ; case 2 + b _0203C244 ; case 3 +_0203C22C: + ldr r0, _0203C324 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #0xbc] + bl SetAdvancedTextBoxField0x1C2 + ldmia sp!, {r3, pc} +_0203C244: + mov r0, #0 + bl PlaySeVolumeWrapper + ldr r0, _0203C324 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #0xbc] + bl SetAdvancedTextBoxState5 + ldr r0, _0203C324 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #0xbc] + bl CloseAdvancedTextBox + ldr r0, _0203C324 ; =_020AFE5C + ldr r0, [r0, #0x10] + ldr r0, [r0, #0x5a8] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_0203BB80 + cmp r0, #0 + bne _0203C2BC + ldr r0, _0203C324 ; =_020AFE5C + mov r1, #0 + str r1, [r0, #8] + bl sub_0203B744 + bl sub_0203A658 + ldr r0, _0203C324 ; =_020AFE5C + mov r1, #4 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + ldmia sp!, {r3, pc} +_0203C2BC: + ldr r0, _0203C324 ; =_020AFE5C + mov r1, #2 + str r1, [r0, #8] + ldr r1, [r0, #0x10] + ldr r0, _0203C328 ; =_022AADF8 + ldr r1, [r1, #0x5a8] + strh r1, [r0] + bl sub_0203B744 + bl sub_0203A6BC + ldr r0, _0203C324 ; =_020AFE5C + mov r1, #0 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + ldmia sp!, {r3, pc} +_0203C2F4: + mov r0, #1 + bl PlaySeVolumeWrapper + ldr r0, _0203C324 ; =_020AFE5C + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #0xbc] + bl SetAdvancedTextBoxState5 + ldr r0, _0203C324 ; =_020AFE5C + mov r1, #9 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C324: .word _020AFE5C +_0203C328: .word _022AADF8 + arm_func_end sub_0203C1F8 + + arm_func_start sub_0203C32C +sub_0203C32C: ; 0x0203C32C + stmdb sp!, {r3, lr} + ldr r0, _0203C378 ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + add r0, r0, #0x500 + ldrsb r0, [r0, #0xbc] + cmp r0, r1 + ldmeqia sp!, {r3, pc} + bl CloseAdvancedTextBox + ldr r0, _0203C378 ; =_020AFE5C + mvn r1, #1 + ldr r0, [r0, #0x10] + strb r1, [r0, #0x5bc] + bl sub_0203A6BC + ldr r0, _0203C378 ; =_020AFE5C + mov r1, #0 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C378: .word _020AFE5C + arm_func_end sub_0203C32C + + arm_func_start sub_0203C37C +sub_0203C37C: ; 0x0203C37C + stmdb sp!, {r3, lr} + bl sub_0203A658 + ldr r1, _0203C3A8 ; =_020AFE5C + mov r3, #0xa + ldr r0, [r1, #0x10] + mov r2, #0xb + add r0, r0, #0x800 + strh r3, [r0, #0x9e] + ldr r0, [r1, #0x10] + str r2, [r0, #0x508] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C3A8: .word _020AFE5C + arm_func_end sub_0203C37C + + arm_func_start sub_0203C3AC +sub_0203C3AC: ; 0x0203C3AC + stmdb sp!, {r3, lr} + ldr r1, _0203C404 ; =_020AFE5C + ldr r0, [r1, #0x10] + add r0, r0, #0x800 + ldrsh r2, [r0, #0x9e] + sub r2, r2, #1 + strh r2, [r0, #0x9e] + ldr r0, [r1, #0x10] + add r0, r0, #0x800 + ldrsh r0, [r0, #0x9e] + cmp r0, #0 + ldmneia sp!, {r3, pc} + mov r1, #0 + mov r2, r1 + mov r3, r1 + mov r0, #9 + bl ShowKeyboard + ldr r0, _0203C404 ; =_020AFE5C + mov r1, #0xc + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C404: .word _020AFE5C + arm_func_end sub_0203C3AC + + arm_func_start sub_0203C408 +sub_0203C408: ; 0x0203C408 + stmdb sp!, {r4, lr} + bl GetKeyboardStatus + cmp r0, #3 + bne _0203C484 + bl GetKeyboardStringResult + ldrb r0, [r0] + bl sub_020251F0 + mov r4, r0 + bl sub_0203BC50 + cmp r0, #0 + bne _0203C458 + ldr r0, _0203C4B0 ; =_020AFE5C + mov r1, #0 + str r1, [r0, #8] + bl sub_0203B744 + ldr r0, _0203C4B0 ; =_020AFE5C + mov r1, #0x15 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + ldmia sp!, {r4, pc} +_0203C458: + ldr r0, _0203C4B4 ; =_022AADF8 + ldr r1, _0203C4B0 ; =_020AFE5C + mov r2, #4 + str r2, [r1, #8] + strh r4, [r0] + bl sub_0203B744 + ldr r0, _0203C4B0 ; =_020AFE5C + mov r1, #0xd + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + ldmia sp!, {r4, pc} +_0203C484: + cmp r0, #2 + ldmneia sp!, {r4, pc} + ldr r0, _0203C4B0 ; =_020AFE5C + mov r1, #0 + str r1, [r0, #8] + bl sub_0203B744 + ldr r0, _0203C4B0 ; =_020AFE5C + mov r1, #0xd + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + ldmia sp!, {r4, pc} + .align 2, 0 +_0203C4B0: .word _020AFE5C +_0203C4B4: .word _022AADF8 + arm_func_end sub_0203C408 + + arm_func_start sub_0203C4B8 +sub_0203C4B8: ; 0x0203C4B8 + stmdb sp!, {r3, lr} + bl sub_02037468 + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldr r1, _0203C4EC ; =_020AFE5C + mov r3, #0xa + ldr r0, [r1, #0x10] + mov r2, #0xe + add r0, r0, #0x800 + strh r3, [r0, #0x9e] + ldr r0, [r1, #0x10] + str r2, [r0, #0x508] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C4EC: .word _020AFE5C + arm_func_end sub_0203C4B8 + + arm_func_start sub_0203C4F0 +sub_0203C4F0: ; 0x0203C4F0 + stmdb sp!, {r3, lr} + ldr r1, _0203C538 ; =_020AFE5C + ldr r0, [r1, #0x10] + add r0, r0, #0x800 + ldrsh r2, [r0, #0x9e] + sub r2, r2, #1 + strh r2, [r0, #0x9e] + ldr r0, [r1, #0x10] + add r0, r0, #0x800 + ldrsh r0, [r0, #0x9e] + cmp r0, #0 + ldmneia sp!, {r3, pc} + bl sub_0203A6BC + ldr r0, _0203C538 ; =_020AFE5C + mov r1, #0 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C538: .word _020AFE5C + arm_func_end sub_0203C4F0 + + arm_func_start sub_0203C53C +sub_0203C53C: ; 0x0203C53C + stmdb sp!, {r3, lr} + bl sub_0203A658 + ldr r1, _0203C568 ; =_020AFE5C + mov r3, #0xa + ldr r0, [r1, #0x10] + mov r2, #0x10 + add r0, r0, #0x800 + strh r3, [r0, #0x9e] + ldr r0, [r1, #0x10] + str r2, [r0, #0x508] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C568: .word _020AFE5C + arm_func_end sub_0203C53C + + arm_func_start sub_0203C56C +sub_0203C56C: ; 0x0203C56C + stmdb sp!, {r3, lr} + ldr r1, _0203C5C4 ; =_020AFE5C + ldr r0, [r1, #0x10] + add r0, r0, #0x800 + ldrsh r2, [r0, #0x9e] + sub r2, r2, #1 + strh r2, [r0, #0x9e] + ldr r0, [r1, #0x10] + add r0, r0, #0x800 + ldrsh r0, [r0, #0x9e] + cmp r0, #0 + ldmneia sp!, {r3, pc} + mov r1, #0 + mov r2, r1 + mov r3, r1 + mov r0, #4 + bl ShowKeyboard + ldr r0, _0203C5C4 ; =_020AFE5C + mov r1, #0x11 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C5C4: .word _020AFE5C + arm_func_end sub_0203C56C + + arm_func_start sub_0203C5C8 +sub_0203C5C8: ; 0x0203C5C8 + stmdb sp!, {r3, lr} + sub sp, sp, #0x40 + bl GetKeyboardStatus + cmp r0, #3 + bne _0203C650 + bl GetKeyboardStringResult + mov r1, r0 + add r0, sp, #0 + bl StrcpySimple + ldrb r0, [sp] + bl sub_0203BBEC + cmp r0, #0 + bne _0203C620 + ldr r0, _0203C680 ; =_020AFE5C + mov r1, #0 + str r1, [r0, #8] + bl sub_0203B744 + ldr r0, _0203C680 ; =_020AFE5C + mov r1, #0x15 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + b _0203C678 +_0203C620: + ldrb r2, [sp] + ldr r0, _0203C684 ; =_022AADF8 + ldr r1, _0203C680 ; =_020AFE5C + mov r3, #3 + str r3, [r1, #8] + strb r2, [r0] + bl sub_0203B744 + ldr r0, _0203C680 ; =_020AFE5C + mov r1, #0x12 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + b _0203C678 +_0203C650: + cmp r0, #2 + bne _0203C678 + ldr r0, _0203C680 ; =_020AFE5C + mov r1, #0 + str r1, [r0, #8] + bl sub_0203B744 + ldr r0, _0203C680 ; =_020AFE5C + mov r1, #0x12 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] +_0203C678: + add sp, sp, #0x40 + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C680: .word _020AFE5C +_0203C684: .word _022AADF8 + arm_func_end sub_0203C5C8 + + arm_func_start sub_0203C688 +sub_0203C688: ; 0x0203C688 + stmdb sp!, {r3, lr} + bl sub_02037468 + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldr r1, _0203C6BC ; =_020AFE5C + mov r3, #0xa + ldr r0, [r1, #0x10] + mov r2, #0x13 + add r0, r0, #0x800 + strh r3, [r0, #0x9e] + ldr r0, [r1, #0x10] + str r2, [r0, #0x508] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C6BC: .word _020AFE5C + arm_func_end sub_0203C688 + + arm_func_start sub_0203C6C0 +sub_0203C6C0: ; 0x0203C6C0 + stmdb sp!, {r3, lr} + ldr r1, _0203C708 ; =_020AFE5C + ldr r0, [r1, #0x10] + add r0, r0, #0x800 + ldrsh r2, [r0, #0x9e] + sub r2, r2, #1 + strh r2, [r0, #0x9e] + ldr r0, [r1, #0x10] + add r0, r0, #0x800 + ldrsh r0, [r0, #0x9e] + cmp r0, #0 + ldmneia sp!, {r3, pc} + bl sub_0203A6BC + ldr r0, _0203C708 ; =_020AFE5C + mov r1, #0 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C708: .word _020AFE5C + arm_func_end sub_0203C6C0 + + arm_func_start sub_0203C70C +sub_0203C70C: ; 0x0203C70C + stmdb sp!, {r3, lr} + ldr r0, _0203C738 ; =_020AFE5C + mov r1, #0 + str r1, [r0, #8] + bl sub_0203B744 + bl sub_0203A6BC + ldr r0, _0203C738 ; =_020AFE5C + mov r1, #0 + ldr r0, [r0, #0x10] + str r1, [r0, #0x508] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C738: .word _020AFE5C + arm_func_end sub_0203C70C + + arm_func_start sub_0203C73C +sub_0203C73C: ; 0x0203C73C + stmdb sp!, {r3, lr} + bl sub_02037468 + cmp r0, #0 + ldrne r0, _0203C75C ; =_020AFE5C + movne r1, #4 + ldrne r0, [r0, #0x10] + strne r1, [r0, #0x508] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C75C: .word _020AFE5C + arm_func_end sub_0203C73C + + arm_func_start sub_0203C760 +sub_0203C760: ; 0x0203C760 + ldr r0, _0203C770 ; =_020AFE5C + mov r1, #0 + str r1, [r0, #8] + bx lr + .align 2, 0 +_0203C770: .word _020AFE5C + arm_func_end sub_0203C760 + + arm_func_start sub_0203C774 +sub_0203C774: ; 0x0203C774 + cmp r0, #0 + movne r0, #7 + moveq r0, #8 + bx lr + arm_func_end sub_0203C774 + + arm_func_start sub_0203C784 +sub_0203C784: ; 0x0203C784 + stmdb sp!, {r3, r4, lr} + sub sp, sp, #0x54 + mov r4, r0 + bl sub_02027B1C + ldr r0, _0203C7DC ; =_020AFE5C + ldr r1, _0203C7E0 ; =_0209C60C + ldr r0, [r0, #0xc] + mov r0, r0, lsl #1 + ldrh r0, [r1, r0] + bl StringFromId + str r0, [sp, #0x3c] + add ip, sp, #4 +#ifdef JAPAN + ldr r3, _0203CBC8 ; =0x000023B4 +#endif + mov r0, r4 + mov r1, #0xa + mov r2, #2 +#ifndef JAPAN + mov r3, #0x30c +#endif + str ip, [sp] + bl sub_020262E0 + mov r0, r4 + bl UpdateWindow + add sp, sp, #0x54 + ldmia sp!, {r3, r4, pc} + .align 2, 0 +_0203C7DC: .word _020AFE5C +_0203C7E0: .word _0209C60C +#ifdef JAPAN +_0203CBC8: .word 0x000023B4 +#endif + arm_func_end sub_0203C784 + + arm_func_start sub_0203C7E4 +sub_0203C7E4: ; 0x0203C7E4 + stmdb sp!, {r4, lr} + ldr r1, _0203C870 ; =_020AFE70 + mov r4, r0 + ldr r0, [r1] + cmp r0, #0 + bne _0203C810 + mov r0, #0x10 + mov r1, #8 + bl MemAlloc + ldr r1, _0203C870 ; =_020AFE70 + str r0, [r1] +_0203C810: + ldr r1, _0203C870 ; =_020AFE70 + mvn r3, #0 + ldr r2, [r1] + mov r0, r4 + strh r3, [r2, #6] + ldr r1, [r1] + strh r3, [r1, #4] + bl sub_0203C9A0 + ldr r0, _0203C870 ; =_020AFE70 + mvn r2, #1 + ldr r1, [r0] + strb r2, [r1] + ldr r1, [r0] + strb r2, [r1, #1] + ldr r0, [r0] + strb r2, [r0, #2] + bl sub_0203C984 + ldr r0, _0203C870 ; =_020AFE70 + mov r2, #0 + ldr r1, [r0] + strb r2, [r1, #0xa] + ldr r0, [r0] + str r2, [r0, #0xc] + ldmia sp!, {r4, pc} + .align 2, 0 +_0203C870: .word _020AFE70 + arm_func_end sub_0203C7E4 + + arm_func_start sub_0203C874 +sub_0203C874: ; 0x0203C874 + ldr r0, _0203C8DC ; =_020AFE70 + mov r2, #1 + ldr r1, [r0] + strb r2, [r1, #0xa] + ldr r1, [r0] + ldr r0, [r1, #0xc] + cmp r0, #4 + addls pc, pc, r0, lsl #2 + bx lr +_0203C898: ; jump table + b _0203C8AC ; case 0 + b _0203C8B8 ; case 1 + b _0203C8C4 ; case 2 + bx lr ; case 3 + b _0203C8D0 ; case 4 +_0203C8AC: + mov r0, #7 + str r0, [r1, #0xc] + bx lr +_0203C8B8: + mov r0, #7 + str r0, [r1, #0xc] + bx lr +_0203C8C4: + mov r0, #7 + str r0, [r1, #0xc] + bx lr +_0203C8D0: + mov r0, #5 + str r0, [r1, #0xc] + bx lr + .align 2, 0 +_0203C8DC: .word _020AFE70 + arm_func_end sub_0203C874 + + arm_func_start sub_0203C8E0 +sub_0203C8E0: ; 0x0203C8E0 + ldr r0, _0203C90C ; =_020AFE70 + ldr r0, [r0] + cmp r0, #0 + moveq r0, #0 + bxeq lr + ldr r0, [r0, #0xc] + cmp r0, #0xa + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_0203C90C: .word _020AFE70 + arm_func_end sub_0203C8E0 + + arm_func_start sub_0203C910 +sub_0203C910: ; 0x0203C910 + ldr r0, _0203C93C ; =_020AFE70 + ldr r0, [r0] + cmp r0, #0 + moveq r0, #0 + bxeq lr + ldr r0, [r0, #0xc] + cmp r0, #4 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_0203C93C: .word _020AFE70 + arm_func_end sub_0203C910 + + arm_func_start sub_0203C940 +sub_0203C940: ; 0x0203C940 + stmdb sp!, {r3, lr} + ldr r0, _0203C980 ; =_020AFE70 + ldr r0, [r0] + cmp r0, #0 + moveq r0, #1 + ldmeqia sp!, {r3, pc} + ldr r1, [r0, #0xc] + cmp r1, #0xa + movne r0, #0 + ldmneia sp!, {r3, pc} + bl MemFree + ldr r0, _0203C980 ; =_020AFE70 + mov r1, #0 + str r1, [r0] + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_0203C980: .word _020AFE70 + arm_func_end sub_0203C940 + + arm_func_start sub_0203C984 +sub_0203C984: ; 0x0203C984 + ldr r0, _0203C99C ; =_020AFE70 + ldr r1, [r0] + cmp r1, #0 + movne r0, #0 + strneh r0, [r1, #8] + bx lr + .align 2, 0 +_0203C99C: .word _020AFE70 + arm_func_end sub_0203C984 + + arm_func_start sub_0203C9A0 +sub_0203C9A0: ; 0x0203C9A0 + ldr r1, _0203C9C0 ; =_020AFE70 + ldr r2, [r1] + ldrsh r1, [r2, #4] + cmp r0, r1 + moveq r0, #0 + strneh r0, [r2, #4] + movne r0, #1 + bx lr + .align 2, 0 +_0203C9C0: .word _020AFE70 + arm_func_end sub_0203C9A0 + + arm_func_start sub_0203C9C4 +sub_0203C9C4: ; 0x0203C9C4 + ldr r0, _0203C9E0 ; =_020AFE70 + mvn r2, #0 + ldr r1, [r0] + strh r2, [r1, #6] + ldr r0, [r0] + strh r2, [r0, #4] + bx lr + .align 2, 0 +_0203C9E0: .word _020AFE70 + arm_func_end sub_0203C9C4 + + arm_func_start sub_0203C9E4 +sub_0203C9E4: ; 0x0203C9E4 + stmdb sp!, {r4, r5, lr} + sub sp, sp, #0x2c + ldr r0, _0203CA38 ; =_020AFE70 + ldr r5, [r0] + cmp r5, #0 + beq _0203CA30 + ldr r4, _0203CA3C ; =_0209C7F4 + add lr, sp, #0 + mov ip, #2 +_0203CA08: + ldmia r4!, {r0, r1, r2, r3} + stmia lr!, {r0, r1, r2, r3} + subs ip, ip, #1 + bne _0203CA08 + ldmia r4, {r0, r1, r2} + stmia lr, {r0, r1, r2} + ldr r1, [r5, #0xc] + add r0, sp, #0 + ldr r0, [r0, r1, lsl #2] + blx r0 +_0203CA30: + add sp, sp, #0x2c + ldmia sp!, {r4, r5, pc} + .align 2, 0 +_0203CA38: .word _020AFE70 +_0203CA3C: .word _0209C7F4 + arm_func_end sub_0203C9E4 + + arm_func_start sub_0203CA40 +sub_0203CA40: ; 0x0203CA40 + stmdb sp!, {r3, lr} + bl ov11_0230D220 + cmp r0, #0 + ldmneia sp!, {r3, pc} + bl ov11_0230D92C + ldr r0, _0203CA68 ; =_020AFE70 + mov r1, #1 + ldr r0, [r0] + str r1, [r0, #0xc] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203CA68: .word _020AFE70 + arm_func_end sub_0203CA40 + + arm_func_start sub_0203CA6C +sub_0203CA6C: ; 0x0203CA6C + stmdb sp!, {r3, lr} + bl ov11_0230D220 + cmp r0, #0 + ldreq r0, _0203CA8C ; =_020AFE70 + moveq r1, #2 + ldreq r0, [r0] + streq r1, [r0, #0xc] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203CA8C: .word _020AFE70 + arm_func_end sub_0203CA6C + + arm_func_start sub_0203CA90 +sub_0203CA90: ; 0x0203CA90 + stmdb sp!, {r3, lr} + bl ov11_0230D220 + cmp r0, #0 + ldmneia sp!, {r3, pc} + ldr r0, _0203CAC8 ; =_020AFE70 + ldr r0, [r0] + ldrsh r0, [r0, #4] + bl sub_0203CCD8 + bl ov11_02310C18 + ldr r0, _0203CAC8 ; =_020AFE70 + mov r1, #3 + ldr r0, [r0] + str r1, [r0, #0xc] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203CAC8: .word _020AFE70 + arm_func_end sub_0203CA90 + + arm_func_start sub_0203CACC +sub_0203CACC: ; 0x0203CACC + stmdb sp!, {r3, lr} + bl ov11_0230D220 + cmp r0, #0 + ldreq r0, _0203CAEC ; =_020AFE70 + moveq r1, #4 + ldreq r0, [r0] + streq r1, [r0, #0xc] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203CAEC: .word _020AFE70 + arm_func_end sub_0203CACC + + arm_func_start sub_0203CAF0 +sub_0203CAF0: ; 0x0203CAF0 + stmdb sp!, {r3, lr} + ldr r0, _0203CB54 ; =_020AFE70 + ldr r2, [r0] + ldrb r1, [r2, #0xa] + cmp r1, #0 + movne r0, #5 + strne r0, [r2, #0xc] + ldmneia sp!, {r3, pc} + ldrh r1, [r2, #8] + add r1, r1, #1 + strh r1, [r2, #8] + ldr r3, [r0] + ldrh r1, [r3, #8] + cmp r1, #0x1e + ldmloia sp!, {r3, pc} + ldrsh r2, [r3, #4] + ldrsh r1, [r3, #6] + cmp r2, r1 + ldmeqia sp!, {r3, pc} + mov r1, #0 + strh r1, [r3, #8] + ldr r0, [r0] + ldrsh r0, [r0, #4] + bl sub_0203CCD8 + ldmia sp!, {r3, pc} + .align 2, 0 +_0203CB54: .word _020AFE70 + arm_func_end sub_0203CAF0 + + arm_func_start sub_0203CB58 +sub_0203CB58: ; 0x0203CB58 + stmdb sp!, {r3, lr} + bl ov11_0230D220 + cmp r0, #0 + ldmneia sp!, {r3, pc} + bl ov11_0230D92C + ldr r0, _0203CB80 ; =_020AFE70 + mov r1, #6 + ldr r0, [r0] + str r1, [r0, #0xc] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203CB80: .word _020AFE70 + arm_func_end sub_0203CB58 + + arm_func_start sub_0203CB84 +sub_0203CB84: ; 0x0203CB84 + stmdb sp!, {r3, lr} + bl ov11_0230D220 + cmp r0, #0 + ldmneia sp!, {r3, pc} + ldr r0, _0203CC5C ; =_020AFE70 + mvn r1, #1 + ldr r0, [r0] + ldrsb r0, [r0] + cmp r0, r1 + beq _0203CBD0 + bl HidePortraitBox + ldr r0, _0203CC5C ; =_020AFE70 + ldr r0, [r0] + ldrsb r0, [r0] + bl ClosePortraitBox + ldr r0, _0203CC5C ; =_020AFE70 + mvn r1, #1 + ldr r0, [r0] + strb r1, [r0] +_0203CBD0: + ldr r0, _0203CC5C ; =_020AFE70 + mvn r1, #1 + ldr r0, [r0] + ldrsb r0, [r0, #2] + cmp r0, r1 + beq _0203CC0C + bl sub_0202F954 + ldr r0, _0203CC5C ; =_020AFE70 + ldr r0, [r0] + ldrsb r0, [r0, #2] + bl CloseTextBox + ldr r0, _0203CC5C ; =_020AFE70 + mvn r1, #1 + ldr r0, [r0] + strb r1, [r0, #2] +_0203CC0C: + ldr r0, _0203CC5C ; =_020AFE70 + mvn r1, #1 + ldr r0, [r0] + ldrsb r0, [r0, #1] + cmp r0, r1 + beq _0203CC48 + bl sub_0202F954 + ldr r0, _0203CC5C ; =_020AFE70 + ldr r0, [r0] + ldrsb r0, [r0, #1] + bl CloseTextBox + ldr r0, _0203CC5C ; =_020AFE70 + mvn r1, #1 + ldr r0, [r0] + strb r1, [r0, #1] +_0203CC48: + ldr r0, _0203CC5C ; =_020AFE70 + mov r1, #0xa + ldr r0, [r0] + str r1, [r0, #0xc] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203CC5C: .word _020AFE70 + arm_func_end sub_0203CB84 + + arm_func_start sub_0203CC60 +sub_0203CC60: ; 0x0203CC60 + stmdb sp!, {r3, lr} + bl ov11_0230D220 + cmp r0, #0 + ldreq r0, _0203CC80 ; =_020AFE70 + moveq r1, #0xa + ldreq r0, [r0] + streq r1, [r0, #0xc] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203CC80: .word _020AFE70 + arm_func_end sub_0203CC60 + + arm_func_start sub_0203CC84 +sub_0203CC84: ; 0x0203CC84 + stmdb sp!, {r3, lr} + bl ov11_0230D220 + cmp r0, #0 + ldmneia sp!, {r3, pc} + bl ov11_0230D000 + ldr r0, _0203CCAC ; =_020AFE70 + mov r1, #9 + ldr r0, [r0] + str r1, [r0, #0xc] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203CCAC: .word _020AFE70 + arm_func_end sub_0203CC84 + + arm_func_start sub_0203CCB0 +sub_0203CCB0: ; 0x0203CCB0 + stmdb sp!, {r3, lr} + bl ov11_0230D220 + cmp r0, #0 + ldreq r0, _0203CCD0 ; =_020AFE70 + moveq r1, #0xa + ldreq r0, [r0] + streq r1, [r0, #0xc] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203CCD0: .word _020AFE70 + arm_func_end sub_0203CCB0 + + arm_func_start sub_0203CCD4 +sub_0203CCD4: ; 0x0203CCD4 + bx lr + arm_func_end sub_0203CCD4 + + arm_func_start sub_0203CCD8 +sub_0203CCD8: ; 0x0203CCD8 + stmdb sp!, {r4, lr} + sub sp, sp, #0x10 + ldr r1, _0203CE00 ; =TEAM_MEMBER_TABLE_PTR + ldr r2, _0203CE04 ; =_020AFE70 + ldr r4, [r1] + ldr r3, [r2] + mov r1, #0x44 + strh r0, [r3, #6] + ldr r3, [r2] + sub r2, r1, #0x46 + ldrsb r3, [r3] + smlabb r4, r0, r1, r4 + cmp r3, r2 + bne _0203CD2C + mov r0, #1 + mov r1, #3 + mov r2, #0 + bl CreatePortraitBox + ldr r1, _0203CE04 ; =_020AFE70 + ldr r1, [r1] + strb r0, [r1] +_0203CD2C: + ldr r1, _0203CE04 ; =_020AFE70 + mvn r0, #1 + ldr r1, [r1] + ldrsb r1, [r1, #1] + cmp r1, r0 + bne _0203CD5C + ldr r0, _0203CE08 ; =_0209C7E4 + ldr r1, _0203CE0C ; =sub_0203CE1C + bl CreateTextBox + ldr r1, _0203CE04 ; =_020AFE70 + ldr r1, [r1] + strb r0, [r1, #1] +_0203CD5C: + ldr r1, _0203CE04 ; =_020AFE70 + mvn r0, #1 + ldr r1, [r1] + ldrsb r1, [r1, #2] + cmp r1, r0 + bne _0203CD8C + ldr r0, _0203CE10 ; =_0209C7D4 + ldr r1, _0203CE14 ; =sub_0203CFCC + bl CreateTextBox + ldr r1, _0203CE04 ; =_020AFE70 + ldr r1, [r1] + strb r0, [r1, #2] +_0203CD8C: + add r0, sp, #0 + bl InitPortraitParams + ldrsh r1, [r4, #4] + add r0, sp, #0 + bl InitPortraitParamsWithMonsterId + add r0, sp, #0 + mov r1, #2 + bl SetPortraitLayout + ldr r1, _0203CE18 ; =_0209C7CC + add r0, sp, #0 + bl SetPortraitOffset + add r0, sp, #0 + mov r1, #0 + bl SetPortraitEmotion + ldr r0, _0203CE04 ; =_020AFE70 + add r1, sp, #0 + ldr r0, [r0] + ldrsb r0, [r0] + bl ShowPortraitInPortraitBox + ldr r0, _0203CE04 ; =_020AFE70 + ldr r0, [r0] + ldrsb r0, [r0, #1] + bl sub_0202F9B8 + ldr r0, _0203CE04 ; =_020AFE70 + ldr r0, [r0] + ldrsb r0, [r0, #2] + bl sub_0202F9B8 + add sp, sp, #0x10 + ldmia sp!, {r4, pc} + .align 2, 0 +_0203CE00: .word TEAM_MEMBER_TABLE_PTR +_0203CE04: .word _020AFE70 +_0203CE08: .word _0209C7E4 +_0203CE0C: .word sub_0203CE1C +_0203CE10: .word _0209C7D4 +_0203CE14: .word sub_0203CFCC +_0203CE18: .word _0209C7CC + arm_func_end sub_0203CCD8 + + arm_func_start sub_0203CE1C +sub_0203CE1C: ; 0x0203CE1C + stmdb sp!, {r3, r4, r5, r6, lr} + sub sp, sp, #0x1d4 + mov r5, r0 + mvn r1, #1 + cmp r5, r1 + beq _0203CF84 + ldr r1, _0203CF8C ; =_020AFE70 + ldr r2, _0203CF90 ; =TEAM_MEMBER_TABLE_PTR + ldr r1, [r1] + ldr r3, [r2] + ldrsh r2, [r1, #6] + mov r1, #0x44 + smlabb r4, r2, r1, r3 + bl ClearWindow + ldrsh r0, [r4, #4] + bl GetDexNumber + str r0, [sp, #0xa8] + add r1, sp, #0x84 + str r1, [sp] + ldr r2, _0203CF94 ; =_0209C820 + ldr r3, _0203CF98 ; =0x0000C402 + add r0, sp, #0xd4 + mov r1, #0x100 + bl PreprocessString + mov r0, r5 + mov r1, #0x20 + mov r2, #0 + add r3, sp, #0xd4 + bl DrawTextInWindow + ldr r0, _0203CF8C ; =_020AFE70 + ldr r0, [r0] + ldrsh r0, [r0, #6] + bl sub_02056410 + cmp r0, #0 + beq _0203CEC8 + ldr r0, _0203CF8C ; =_020AFE70 + ldr r0, [r0] + ldrsh r0, [r0, #6] + bl sub_020564B0 + cmp r0, #0 + movne r0, #0x59 + moveq r0, #0x46 + b _0203CEE4 +_0203CEC8: + ldr r0, _0203CF8C ; =_020AFE70 + ldr r0, [r0] + ldrsh r0, [r0, #6] + bl sub_02056F60 + cmp r0, #0 + movne r0, #0x44 + moveq r0, #0x57 +_0203CEE4: + mov r0, r0, lsl #0x10 + mov r6, r0, asr #0x10 + add r0, sp, #0xd4 + add r1, r4, #0x3a + mov r2, #0xa + bl StrncpySimpleNoPadSafe + ldr r1, _0203CF9C ; =_0209C82C + add r0, sp, #0x44 + add r3, sp, #0xd4 + mov r2, r6 + bl SprintfStatic__0203CFA4 + ldrsh r1, [r4, #4] + add r0, sp, #0xd4 + bl GetSpeciesString + ldr r1, _0203CF9C ; =_0209C82C + add r0, sp, #4 + mov r2, #0x4b + add r3, sp, #0xd4 + bl SprintfStatic__0203CFA4 + ldr r1, _0203CFA0 ; =_0209C83C + add r0, sp, #0xd4 + add r2, sp, #0x44 + add r3, sp, #4 + bl SprintfStatic__0203CFA4 + mov r0, r5 + mov r1, #0x4c + mov r2, #0 + add r3, sp, #0xd4 + bl DrawTextInWindow + ldrsh r1, [r4, #4] + add r0, sp, #0xd4 + orr r1, r1, #0x10000 + bl sub_02024D7C + mov r0, r5 + mov r1, #0xd0 + mov r2, #0 + add r3, sp, #0xd4 + bl DrawTextInWindow + mov r0, r5 + bl UpdateWindow +_0203CF84: + add sp, sp, #0x1d4 + ldmia sp!, {r3, r4, r5, r6, pc} + .align 2, 0 +_0203CF8C: .word _020AFE70 +_0203CF90: .word TEAM_MEMBER_TABLE_PTR +_0203CF94: .word _0209C820 +_0203CF98: .word 0x0000C402 +_0203CF9C: .word _0209C82C +_0203CFA0: .word _0209C83C + arm_func_end sub_0203CE1C + + arm_func_start SprintfStatic__0203CFA4 +SprintfStatic__0203CFA4: ; 0x0203CFA4 + stmdb sp!, {r0, r1, r2, r3} + stmdb sp!, {r3, lr} + add r2, sp, #0xc + bic r2, r2, #3 + ldr r1, [sp, #0xc] + add r2, r2, #4 + bl vsprintf + ldmia sp!, {r3, lr} + add sp, sp, #0x10 + bx lr + arm_func_end SprintfStatic__0203CFA4 + + arm_func_start sub_0203CFCC +sub_0203CFCC: ; 0x0203CFCC + stmdb sp!, {r3, r4, r5, r6, r7, r8, lr} + sub sp, sp, #0xcc + sub sp, sp, #0x400 + mov r5, #4 + mov r6, r0 + sub r0, r5, #6 + cmp r6, r0 + beq _0203D3F4 + ldr r1, _0203D400 ; =_020AFE70 + add r0, sp, #4 + ldr r1, [r1] + ldrsh r1, [r1, #6] + bl sub_0205B028 + ldr r0, _0203D400 ; =_020AFE70 + ldr r1, _0203D404 ; =TEAM_MEMBER_TABLE_PTR + ldr r0, [r0] + ldr r3, [r1] + ldrsh r2, [r0, #6] + mov r1, #0x44 + mov r0, r6 + smlabb r4, r2, r1, r3 + bl ClearWindow + ldrsh r0, [sp, #4] + mov r1, #0 + bl GetType + mov r8, r0 + ldrsh r0, [sp, #4] + mov r1, #1 + bl GetType + mov r1, r5 + mov r7, r0 + ldr r3, _0203D408 ; =0x00000976 + mov r0, r6 + mov r2, r1 + bl sub_02026268 + mov r0, r8 + bl GetTypeStringId + mov r3, r0 + mov r0, r6 + mov r1, #0x38 + mov r2, r5 + bl sub_02026268 + cmp r7, #0 + beq _0203D098 + mov r0, r7 + bl GetTypeStringId + mov r3, r0 + mov r0, r6 + mov r1, #0x68 + mov r2, r5 + bl sub_02026268 +_0203D098: + add r0, r5, #0xc + mov r1, r0, lsl #0x10 + ldr r2, [sp, #0x30] + ldr r0, _0203D40C ; =0x00000977 + str r2, [sp, #0xa0] + mov r5, r1, asr #0x10 + bl StringFromId + mov r2, r0 + add ip, sp, #0x7c + add r0, sp, #0xcc + mov r1, #0x400 + mov r3, #0 + str ip, [sp] + bl PreprocessString + add r3, sp, #0xcc + mov r0, r6 + mov r1, #4 + mov r2, r5 + bl DrawTextInWindow + add r0, r5, #0xc + mov r0, r0, lsl #0x10 + mov r5, r0, asr #0x10 + ldr r0, [sp, #0x2c] + ldr r1, [sp, #0x28] + str r0, [sp, #0xa4] + ldr r0, _0203D410 ; =0x00000978 + str r1, [sp, #0xa0] + bl StringFromId + add r1, sp, #0x7c + mov r2, r0 + str r1, [sp] + add r0, sp, #0xcc + mov r1, #0x400 + mov r3, #0 + bl PreprocessString + mov r0, r6 + mov r1, #4 + mov r2, r5 + add r3, sp, #0xcc + bl DrawTextInWindow + add r0, r5, #0xc + mov r0, r0, lsl #0x10 + mov r5, r0, asr #0x10 + ldr r0, _0203D414 ; =0x00000979 + bl StringFromId + add r1, sp, #0x7c + mov r2, r0 + str r1, [sp] + add r0, sp, #0xcc + mov r1, #0x400 + mov r3, #0 + bl PreprocessString + mov r0, r6 + mov r1, #4 + mov r2, r5 + add r3, sp, #0xcc + bl DrawTextInWindow + ldrb r2, [sp, #0x38] + ldrb r1, [sp, #0x3d] + ldr r0, _0203D418 ; =0x0000097B + str r2, [sp, #0xa0] + cmp r1, #0 + addne r1, r2, r1 + addne r0, r0, #1 + strne r1, [sp, #0xa0] + bl StringFromId + mov r2, r0 + add ip, sp, #0x7c + add r0, sp, #0xcc + mov r1, #0x400 + mov r3, #0 + str ip, [sp] + bl PreprocessString + add r3, sp, #0xcc + mov r0, r6 + mov r2, r5 + mov r1, #4 + bl DrawTextInWindow + ldrb r2, [sp, #0x3a] + ldrb r1, [sp, #0x3f] + ldr r0, _0203D41C ; =0x0000097F + str r2, [sp, #0xa0] + cmp r1, #0 +#ifdef JAPAN + addne r1, r2, r1 + strne r1, [sp, #0xa0] + addne r0, r0, #1 +#else + addne r0, r2, r1 + strne r0, [sp, #0xa0] + movne r0, #0x980 +#endif + bl StringFromId + mov r2, r0 + add ip, sp, #0x7c + add r0, sp, #0xcc + mov r1, #0x400 + mov r3, #0 + str ip, [sp] + bl PreprocessString + add r3, sp, #0xcc + mov r0, r6 + mov r2, r5 + mov r1, #4 + bl DrawTextInWindow + add r0, r5, #0xc + mov r0, r0, lsl #0x10 + mov r5, r0, asr #0x10 + ldr r0, _0203D420 ; =0x0000097A + bl StringFromId + add r1, sp, #0x7c + mov r2, r0 + str r1, [sp] + add r0, sp, #0xcc + mov r1, #0x400 + mov r3, #0 + bl PreprocessString + mov r0, r6 + mov r1, #4 + mov r2, r5 + add r3, sp, #0xcc + bl DrawTextInWindow + ldrb r2, [sp, #0x39] + ldrb r1, [sp, #0x3e] + ldr r0, _0203D424 ; =0x0000097D + str r2, [sp, #0xa0] + cmp r1, #0 + addne r1, r2, r1 + addne r0, r0, #1 + strne r1, [sp, #0xa0] + bl StringFromId + mov r2, r0 + add ip, sp, #0x7c + add r0, sp, #0xcc + mov r1, #0x400 + mov r3, #0 + str ip, [sp] + bl PreprocessString + add r3, sp, #0xcc + mov r0, r6 + mov r2, r5 + mov r1, #4 + bl DrawTextInWindow + ldrb r2, [sp, #0x3b] + ldrb r1, [sp, #0x40] + ldr r0, _0203D428 ; =0x00000981 + str r2, [sp, #0xa0] + cmp r1, #0 + addne r1, r2, r1 + addne r0, r0, #1 + strne r1, [sp, #0xa0] + bl StringFromId + mov r2, r0 + add ip, sp, #0x7c + add r0, sp, #0xcc + mov r1, #0x400 + mov r3, #0 + str ip, [sp] + bl PreprocessString + add r3, sp, #0xcc + mov r0, r6 + mov r2, r5 + mov r1, #4 + bl DrawTextInWindow + ldrsh r0, [sp, #0x42] + mov r1, #0xa + str r0, [sp, #0xa0] + bl _s32_div_f + mov r0, r0, lsl #0x10 + movs r0, r0, asr #0x10 + movmi r0, #0 + bmi _0203D338 + cmp r0, #0x63 + movge r0, #0x63 +_0203D338: + bl sub_0205B0A0 + str r0, [sp, #0xb4] + ldr r0, _0203D42C ; =0x00000983 + bl StringFromId + add r1, sp, #0x7c + mov r2, r0 + str r1, [sp] + add r0, sp, #0xcc + mov r1, #0x400 + mov r3, #0 + bl PreprocessString + add r0, r5, #0xc + mov r0, r0, lsl #0x10 + mov r5, r0, asr #0x10 + mov r0, r6 + mov r1, #4 + mov r2, r5 + add r3, sp, #0xcc + bl DrawTextInWindow + ldrsh r0, [r4, #4] + ldrsh r1, [sp, #0x42] + bl GetNextIqSkill + cmp r0, #0 + add r4, sp, #0x7c + mov r1, #0x400 + bne _0203D3B8 + ldr r2, _0203D430 ; =0x00000986 + add r0, sp, #0xcc + mov r3, #0 + str r4, [sp] + bl PreprocessStringFromId + b _0203D3D0 +_0203D3B8: + ldr r2, _0203D434 ; =0x00000985 + str r0, [sp, #0x8c] + add r0, sp, #0xcc + mov r3, #0 + str r4, [sp] + bl PreprocessStringFromId +_0203D3D0: + add r0, r5, #0xc + mov r1, r0, lsl #0x10 + mov r2, r1, asr #0x10 + add r3, sp, #0xcc + mov r0, r6 + mov r1, #4 + bl DrawTextInWindow + mov r0, r6 + bl UpdateWindow +_0203D3F4: + add sp, sp, #0xcc + add sp, sp, #0x400 + ldmia sp!, {r3, r4, r5, r6, r7, r8, pc} + .align 2, 0 +#ifdef JAPAN +#define SUB_0203CFCC_OFFSET 0x19D0 +#else +#define SUB_0203CFCC_OFFSET 0 +#endif +_0203D400: .word _020AFE70 +_0203D404: .word TEAM_MEMBER_TABLE_PTR +_0203D408: .word 0x00000976 + SUB_0203CFCC_OFFSET +_0203D40C: .word 0x00000977 + SUB_0203CFCC_OFFSET +_0203D410: .word 0x00000978 + SUB_0203CFCC_OFFSET +_0203D414: .word 0x00000979 + SUB_0203CFCC_OFFSET +_0203D418: .word 0x0000097B + SUB_0203CFCC_OFFSET +_0203D41C: .word 0x0000097F + SUB_0203CFCC_OFFSET +_0203D420: .word 0x0000097A + SUB_0203CFCC_OFFSET +_0203D424: .word 0x0000097D + SUB_0203CFCC_OFFSET +_0203D428: .word 0x00000981 + SUB_0203CFCC_OFFSET +_0203D42C: .word 0x00000983 + SUB_0203CFCC_OFFSET +_0203D430: .word 0x00000986 + SUB_0203CFCC_OFFSET +_0203D434: .word 0x00000985 + SUB_0203CFCC_OFFSET + arm_func_end sub_0203CFCC + + arm_func_start sub_0203D438 +sub_0203D438: ; 0x0203D438 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r6, r0 + mov r5, r1 + mov r0, #0x3c0 + mov r1, #8 + mov r4, r2 + bl MemAlloc + ldr r2, _0203D534 ; =_020AFE74 + mov r1, #0x3c0 + str r0, [r2] + bl MemZero + ldr r0, _0203D534 ; =_020AFE74 + mov ip, #2 + ldr r7, [r0] + add lr, r7, #0x14 +_0203D474: + ldmia r6!, {r0, r1, r2, r3} + stmia lr!, {r0, r1, r2, r3} + subs ip, ip, #1 + bne _0203D474 + ldmia r6, {r0, r1, r2} + stmia lr, {r0, r1, r2} + mov r1, #0 + ldr r0, _0203D534 ; =_020AFE74 + str r1, [r7, #0x10] + ldr r1, [r0] + str r5, [r1, #8] + ldr r1, [r0] + str r4, [r1, #0xe4] + ldr r0, [r0] + add r0, r0, #0x8c + bl InitPreprocessorArgs + ldr r0, _0203D534 ; =_020AFE74 + mov r2, #0x70000 + ldr r1, [r0] + str r2, [r1, #0xd8] + ldr r2, [r0] + ldrsh r1, [r2, #0x14] + str r1, [r2, #0x8c] + ldr r0, [r0] + add r0, r0, #0x190 + bl InitPortraitParams + ldr r0, _0203D534 ; =_020AFE74 + ldr r0, [r0] + ldrsh r1, [r0, #0x14] + cmp r1, #0 + beq _0203D4F8 + add r0, r0, #0x190 + bl InitPortraitParamsWithMonsterId +_0203D4F8: + ldr r1, _0203D534 ; =_020AFE74 + mvn r4, #1 + ldr r0, [r1] + mov r3, #0 + strb r4, [r0, #4] + ldr r2, [r1] + mov r0, #1 + strb r4, [r2, #5] + ldr r2, [r1] + strb r4, [r2, #6] + ldr r2, [r1] + str r3, [r2] + ldr r1, [r1] + strb r4, [r1, #0x1a0] + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_0203D534: .word _020AFE74 + arm_func_end sub_0203D438 + + arm_func_start sub_0203D538 +sub_0203D538: ; 0x0203D538 +#ifdef JAPAN +#define SUB_0203D538_STACK_OFFSET -6 +#define SUB_0203D538_STACK_OFFSET_2 -8 +#else +#define SUB_0203D538_STACK_OFFSET 0 +#define SUB_0203D538_STACK_OFFSET_2 0 +#endif + stmdb sp!, {r4, r5, r6, r7, r8, sb, lr} + sub sp, sp, #0x11c + SUB_0203D538_STACK_OFFSET_2 + ldr r1, _0203E4B0 ; =_020AFE74 + ldr r4, [r1] + ldr r0, [r4] + cmp r0, #0x4c + addls pc, pc, r0, lsl #2 + b _0203EF9C +_0203D558: ; jump table + b _0203D68C ; case 0 + b _0203D7D4 ; case 1 + b _0203D89C ; case 2 + b _0203D8CC ; case 3 + b _0203D8EC ; case 4 + b _0203D954 ; case 5 + b _0203D984 ; case 6 + b _0203D9A4 ; case 7 + b _0203DA64 ; case 8 + b _0203DAA0 ; case 9 + b _0203DAEC ; case 10 + b _0203DB20 ; case 11 + b _0203DBB0 ; case 12 + b _0203DC68 ; case 13 + b _0203DC98 ; case 14 + b _0203DCB8 ; case 15 + b _0203DD68 ; case 16 + b _0203DDAC ; case 17 + b _0203DE38 ; case 18 + b _0203DE50 ; case 19 + b _0203DE6C ; case 20 + b _0203DEA0 ; case 21 + b _0203DEBC ; case 22 + b _0203DF1C ; case 23 + b _0203DF40 ; case 24 + b _0203DF5C ; case 25 + b _0203DF74 ; case 26 + b _0203DF90 ; case 27 + b _0203DFB0 ; case 28 + b _0203DFD8 ; case 29 + b _0203E10C ; case 30 + b _0203E150 ; case 31 + b _0203E038 ; case 32 + b _0203E0BC ; case 33 + b _0203E0EC ; case 34 + b _0203E198 ; case 35 + b _0203E1DC ; case 36 + b _0203E20C ; case 37 + b _0203E22C ; case 38 + b _0203E274 ; case 39 + b _0203E2A4 ; case 40 + b _0203E2C4 ; case 41 + b _0203E460 ; case 42 + b _0203E490 ; case 43 + b _0203E518 ; case 44 + b _0203E8E8 ; case 45 + b _0203E934 ; case 46 + b _0203E964 ; case 47 + b _0203E984 ; case 48 + b _0203E9A8 ; case 49 + b _0203E9D8 ; case 50 + b _0203E9F8 ; case 51 + b _0203E5B4 ; case 52 + b _0203E61C ; case 53 + b _0203E6B8 ; case 54 + b _0203E6D8 ; case 55 + b _0203E7EC ; case 56 + b _0203E80C ; case 57 + b _0203EA24 ; case 58 + b _0203EAB8 ; case 59 + b _0203EAE8 ; case 60 + b _0203EB08 ; case 61 + b _0203EB64 ; case 62 + b _0203EB94 ; case 63 + b _0203EBB4 ; case 64 + b _0203EC28 ; case 65 + b _0203EC5C ; case 66 + b _0203ECA8 ; case 67 + b _0203ECC4 ; case 68 + b _0203ED34 ; case 69 + b _0203ED50 ; case 70 + b _0203EE14 ; case 71 + b _0203EE30 ; case 72 + b _0203EE68 ; case 73 + b _0203EEBC ; case 74 + b _0203EF78 ; case 75 + b _0203EF94 ; case 76 +_0203D68C: + ldrb r0, [r4, #0x36] + cmp r0, #0 + beq _0203D6E4 + bl sub_0201077C + cmp r0, #0 + bne _0203D6B4 + mov r0, #0x1e + bl GetPerformanceFlagWithChecks + cmp r0, #0 + bne _0203D73C +_0203D6B4: + ldr r1, _0203E4B0 ; =_020AFE74 + mvn r0, #0 + ldr r4, [r1] + mov r2, #0 + ldr r3, [r4, #0x1c] + mul r0, r3, r0 + str r0, [r4, #0x1c] + ldr r0, [r1] + strb r2, [r0, #0x36] + ldr r0, [r1] + strh r2, [r0, #0x38] + b _0203D73C +_0203D6E4: + ldrsh r0, [r4, #0x38] + cmp r0, #0 + beq _0203D73C + mov r0, #0x1d + bl GetPerformanceFlagWithChecks + cmp r0, #0 + beq _0203D718 + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + ldrsh r0, [r0, #0x38] + bl sub_02062B64 + cmp r0, #0 + beq _0203D73C +_0203D718: + ldr r1, _0203E4B0 ; =_020AFE74 + mov r3, #0 + ldr r2, [r1] + sub r0, r3, #1 + strh r3, [r2, #0x38] + ldr r2, [r1] + ldr r1, [r2, #0x1c] + mul r0, r1, r0 + str r0, [r2, #0x1c] +_0203D73C: + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + ldr r0, [r0, #0xe4] + tst r0, #0x10 + bne _0203D7C0 + mov r0, #0x1f + bl GetPerformanceFlagWithChecks + cmp r0, #0 + bne _0203D7C0 + mov r5, #0 + mov r4, r5 + ldr sb, _0203E4B0 ; =_020AFE74 + mvn r7, #0 + mov r8, #6 + b _0203D7B0 +_0203D778: + mul r6, r5, r8 + add r0, r1, r6 + ldrsh r0, [r0, #0x28] + bl GetItemCategory + cmp r0, #0xf + bne _0203D7AC + ldr r0, [sb] + add r0, r0, r6 + strh r4, [r0, #0x28] + ldr r2, [sb] + ldr r0, [r2, #0x1c] + mul r1, r0, r7 + str r1, [r2, #0x1c] +_0203D7AC: + add r5, r5, #1 +_0203D7B0: + ldr r1, [sb] + ldr r0, [r1, #0x20] + cmp r5, r0 + blt _0203D778 +_0203D7C0: + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #1 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203D7D4: + ldr r0, [r4, #0x1c] + cmp r0, #0 + movle r0, #7 + strle r0, [r4] + ble _0203EF9C + str r0, [r4, #0xb0] +#ifdef JAPAN + ldr r3, [r1] + mov r0, #0xa + ldr r2, [r3, #0x1c] + mul r0, r2, r0 + str r0, [r3, #0xb4] + ldr r1, [r1] + ldr r0, [r1, #8] + cmp r0, #0 + beq _0203D890 + cmp r0, #2 + bne _0203DC0C + ldr r4, _0203E4B4 ; =0x0000245D + bl sub_0203F00C + b _0203D864 +_0203DC0C: + cmp r0, #3 + bne _0203DC20 + ldr r4, _0203E89C ; =0x0000245E + bl sub_0203F00C + b _0203D864 +_0203DC20: + cmp r0, #4 + ldrne r4, _0203E8A0 ; =0x0000245C +#else + ldr r4, [r1] + mov r0, #0xa + ldr r2, [r4, #0x1c] + mul r3, r2, r0 + str r3, [r4, #0xb4] + ldr r2, [r1] + ldr r1, [r2, #8] + cmp r1, #0 + beq _0203D890 + cmp r1, #2 + bne _0203D824 + ldr r4, _0203E4B4 ; =0x00000289 + bl sub_0203F00C + b _0203D864 +_0203D824: + cmp r1, #3 + bne _0203D838 + add r4, r0, #0x280 + bl sub_0203F00C + b _0203D864 +_0203D838: + cmp r1, #4 + movne r4, #0x288 +#endif + bne _0203D864 + mov r0, #0 + mov r1, #0x69 + bl LoadScriptVariableValue +#ifdef JAPAN + add r0, r0, #0x5f + add r0, r0, #0x2400 +#else + add r0, r0, #0x8b + add r0, r0, #0x200 +#endif + mov r0, r0, lsl #0x10 + mov r4, r0, lsr #0x10 + bl sub_0203F00C +_0203D864: + ldr r1, _0203E4B0 ; =_020AFE74 + ldr r0, _0203E4B8 ; =0x0000101C + ldr r2, [r1] + mov r1, r4 + add r2, r2, #0x8c + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #2 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203D890: + mov r0, #4 +#ifdef JAPAN + str r0, [r1] +#else + str r0, [r2] +#endif + b _0203EF9C +_0203D89C: + bl sub_02046C78 + cmp r0, #0 + beq _0203EF9C + bl sub_0203F05C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r3, #0xa + ldr r2, [r0] + mov r1, #3 + str r3, [r2, #0x188] + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203D8CC: + ldr r2, [r4, #0x188] + sub r0, r2, #1 + str r0, [r4, #0x188] + cmp r2, #0 + ldrle r0, [r1] + movle r1, #4 + strle r1, [r0] + b _0203EF9C +_0203D8EC: + mov r0, #4 + bl sub_02017C50 + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + ldr r0, [r0, #0x1c] + bl AddMoneyCarried + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r2, [r0] + ldr r0, [r2, #8] + cmp r0, #2 + ldreq r1, _0203E4BC ; =0x0000026F + beq _0203D934 + cmp r0, #3 +#ifdef JAPAN + ldreq r1, _0203E8AC ; =0x00002444 +#else + moveq r1, #0x270 +#endif + beq _0203D934 + cmp r0, #4 + ldreq r1, _0203E4C0 ; =0x00000271 + ldrne r1, _0203E4C4 ; =0x0000026E +_0203D934: + ldr r0, _0203E4B8 ; =0x0000101C + add r2, r2, #0x8c + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #5 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203D954: + bl sub_02046C78 + cmp r0, #0 + beq _0203EF9C + bl sub_0203F05C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r3, #0xa + ldr r2, [r0] + mov r1, #6 + str r3, [r2, #0x188] + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203D984: + ldr r2, [r4, #0x188] + sub r0, r2, #1 + str r0, [r4, #0x188] + cmp r2, #0 + ldrle r0, [r1] + movle r1, #7 + strle r1, [r0] + b _0203EF9C +_0203D9A4: + ldrsh r0, [r4, #0x38] + cmp r0, #0 + beq _0203D9BC + ldrb r0, [r4, #0x36] + cmp r0, #0 + beq _0203D9C8 +_0203D9BC: + mov r0, #0x29 + str r0, [r4] + b _0203EF9C +_0203D9C8: + ldrsh r0, [r4, #0x14] + str r0, [r4, #0x8c] + ldr r2, [r1] + ldrsh r0, [r2, #0x38] + str r0, [r2, #0x90] + ldr r1, [r1] + ldr r0, [r1, #8] + cmp r0, #0 + beq _0203DA58 + cmp r0, #2 + bne _0203DA00 + ldr r4, _0203E4C8 ; =0x0000029A + bl sub_0203F00C + b _0203DA2C +_0203DA00: + cmp r0, #4 + ldrne r4, _0203E4CC ; =0x00000299 + bne _0203DA2C + mov r0, #0 + mov r1, #0x69 + bl LoadScriptVariableValue +#ifdef JAPAN + add r0, r0, #0x6f + add r0, r0, #0x2400 +#else + add r0, r0, #0x9b + add r0, r0, #0x200 +#endif + mov r0, r0, lsl #0x10 + mov r4, r0, lsr #0x10 + bl sub_0203F00C +_0203DA2C: + ldr r1, _0203E4B0 ; =_020AFE74 + ldr r0, _0203E4D0 ; =0x00003008 + ldr r2, [r1] + mov r1, r4 + add r2, r2, #0x8c + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #8 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203DA58: + mov r0, #0xb + str r0, [r1] + b _0203EF9C +_0203DA64: + bl sub_02046C78 + cmp r0, #0 + beq _0203EF9C + mov r0, #0 + ldr r3, _0203E4D4 ; =_0209C884 + mov r2, r0 + mov r1, #0x11 + bl CreateParentMenuFromStringIds + ldr r1, _0203E4B0 ; =_020AFE74 + mov r2, #9 + ldr r3, [r1] + strb r0, [r3, #4] + ldr r0, [r1] + str r2, [r0] + b _0203EF9C +_0203DAA0: + ldrsb r0, [r4, #4] + bl IsParentMenuActive + cmp r0, #0 + bne _0203EF9C + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + ldrsb r0, [r0, #4] + bl sub_0202ABB0 + ldr r1, _0203E4B0 ; =_020AFE74 + ldr r1, [r1] + str r0, [r1, #0x18c] + bl sub_0203F05C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r2, #0xa + ldr r1, [r0] + str r2, [r1, #0x188] + ldr r0, [r0] + str r2, [r0] + b _0203EF9C +_0203DAEC: + ldr r2, [r4, #0x188] + sub r0, r2, #1 + str r0, [r4, #0x188] + cmp r2, #0 + bgt _0203EF9C + ldr r1, [r1] + ldr r0, [r1, #0x18c] + cmp r0, #0 + moveq r0, #0xb + streq r0, [r1] + movne r0, #0x23 + strne r0, [r1] + b _0203EF9C +_0203DB20: + ldr r3, _0203E4D8 ; =_0209C846 + add r2, sp, #0x22 + SUB_0203D538_STACK_OFFSET + mov r1, #4 +_0203DB2C: + ldrh r0, [r3], #2 + subs r1, r1, #1 + strh r0, [r2], #2 + bne _0203DB2C + ldrsh r1, [r4, #0x38] + add r0, sp, #0x22 + SUB_0203D538_STACK_OFFSET + mov r2, #1 + mov r3, #0 + bl sub_02053A0C + ldr r0, _0203E4B0 ; =_020AFE74 + add r1, sp, #0x22 + SUB_0203D538_STACK_OFFSET + ldr r0, [r0] + ldr r3, _0203E4DC ; =_0209C844 + str r1, [sp] + ldrsh r1, [r0, #0x38] + add r0, r0, #0x40 + mov r2, #0 + bl sub_02052E2C + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + add r0, r0, #0x40 + bl sub_02055D4C + ldr r1, _0203E4B0 ; =_020AFE74 + ldr r2, [r1] + str r0, [r2, #0x3b8] + ldr r1, [r1] + ldr r0, [r1, #0x3b8] + cmp r0, #0 + movne r0, #0xc + strne r0, [r1] + moveq r0, #0x1e + streq r0, [r1] + b _0203EF9C +_0203DBB0: + ldr r0, [r4, #0x18] + cmp r0, #1 + ble _0203DBD0 + mov r1, r0, lsl #0x10 + ldr r0, [r4, #0x3b8] + mov r1, r1, asr #0x10 + mov r2, #1 + bl sub_020544C8 +_0203DBD0: + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r2, [r0] + ldrsh r1, [r2, #0x38] + str r1, [r2, #0x8c] + ldr r4, [r0] + ldr r0, [r4, #8] + cmp r0, #2 + bne _0203DC18 + ldr r0, _0203E4B8 ; =0x0000101C + ldr r1, _0203E4E0 ; =0x0000027A + add r2, r4, #0x8c + bl sub_02046BE8 + bl sub_0203F00C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0xd + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203DC18: + cmp r0, #4 + movne r0, #0xf + strne r0, [r4] + bne _0203EF9C + mov r0, #0 + mov r1, #0x69 + bl LoadScriptVariableValue +#ifdef JAPAN + add r0, r0, #0x4f + add r0, r0, #0x2400 +#else + add r0, r0, #0x7b + add r0, r0, #0x200 +#endif + mov r1, r0, lsl #0x10 + ldr r0, _0203E4B8 ; =0x0000101C + mov r1, r1, lsr #0x10 + add r2, r4, #0x8c + bl sub_02046BE8 + bl sub_0203F00C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0xd + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203DC68: + bl sub_02046C78 + cmp r0, #0 + beq _0203EF9C + bl sub_0203F05C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r3, #0xa + ldr r2, [r0] + mov r1, #0xe + str r3, [r2, #0x188] + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203DC98: + ldr r2, [r4, #0x188] + sub r0, r2, #1 + str r0, [r4, #0x188] + cmp r2, #0 + ldrle r0, [r1] + movle r1, #0xf + strle r1, [r0] + b _0203EF9C +_0203DCB8: + ldrsh r1, [r4, #0x38] + add r0, r4, #0xb5 + add r0, r0, #0x200 + mov r2, #0x4e + bl GetNameWithGender + ldr r3, _0203E4B0 ; =_020AFE74 + ldr r0, _0203E4E4 ; =0x0000100C + ldr r4, [r3] + ldr r1, _0203E4E8 ; =0x000002A6 + add r2, r4, #0xb5 + add r2, r2, #0x200 + str r2, [r4, #0xc4] + ldr r2, [r3] + add r2, r2, #0x8c + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 +#ifndef JAPAN + mov r2, #0xa +#endif + ldr r0, [r0] + ldr r1, [r0, #0x3b8] + add r0, r0, #0xa1 + add r0, r0, #0x100 + add r1, r1, #0x3a +#ifdef JAPAN + bl StrcpySimple +#else + bl StrncpySimple +#endif + ldr r0, _0203E4B0 ; =_020AFE74 + mov r2, #0xa + ldr r0, [r0] + ldr r1, [r0, #0x3b8] + add r0, r0, #0xab + add r0, r0, #0x100 + add r1, r1, #0x3a + bl MemcpySimple + ldr r0, _0203E4B0 ; =_020AFE74 + mov r2, #0xa + ldr r1, [r0] + add r0, r1, #0xb5 + add r0, r0, #0x100 + add r1, r1, #0xab + add r1, r1, #0x100 + bl StrncpySimpleNoPadSafe + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x10 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203DD68: + bl sub_02046C78 + cmp r0, #0 + beq _0203EF9C + ldr r0, _0203E4EC ; =_0209C85C + mov r4, #2 + ldr r1, _0203E4F0 ; =0x00300011 + ldr r3, _0203E4F4 ; =_0209C86C + mov r2, #0 + str r4, [sp] + bl CreateSimpleMenuFromStringIds + ldr r1, _0203E4B0 ; =_020AFE74 + mov r2, #0x11 + ldr r3, [r1] + strb r0, [r3, #0x1a0] + ldr r0, [r1] + str r2, [r0] + b _0203EF9C +_0203DDAC: + add r0, r4, #0x100 + ldrsb r0, [r0, #0xa0] + bl IsSimpleMenuActive + cmp r0, #0 + bne _0203EF9C + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + add r0, r0, #0x100 + ldrsb r0, [r0, #0xa0] + bl GetSimpleMenuResult + ldr r1, _0203E4B0 ; =_020AFE74 + mov r4, r0 + ldr r0, [r1] + add r0, r0, #0x100 + ldrsb r0, [r0, #0xa0] + bl CloseSimpleMenu + ldr r0, _0203E4B0 ; =_020AFE74 + mvn r1, #1 + ldr r0, [r0] + strb r1, [r0, #0x1a0] + bl sub_02046D20 + cmp r4, #0 + beq _0203DE10 + cmp r4, #1 + b _0203DE24 +_0203DE10: + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x12 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203DE24: + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x20 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203DE38: + bl ov11_0230D92C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x13 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203DE50: + bl ov11_0230D220 + cmp r0, #0 + ldreq r0, _0203E4B0 ; =_020AFE74 + moveq r1, #0x14 + ldreq r0, [r0] + streq r1, [r0] + b _0203EF9C +_0203DE6C: + add r0, r4, #0xab + add r2, r4, #0xa1 + add r1, r0, #0x100 + add r3, r2, #0x100 + mov r0, #2 + mov r2, #0 + bl ShowKeyboard + bl ov11_02310BDC + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x15 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203DEA0: + bl ov11_0230D220 + cmp r0, #0 + ldreq r0, _0203E4B0 ; =_020AFE74 + moveq r1, #0x16 + ldreq r0, [r0] + streq r1, [r0] + b _0203EF9C +_0203DEBC: + bl GetKeyboardStatus + cmp r0, #3 + bne _0203EF9C + bl GetKeyboardStringResult + ldr r2, _0203E4B0 ; =_020AFE74 + mov r1, r0 + ldr r0, [r2] + mov r2, #0xa + add r0, r0, #0xab + add r0, r0, #0x100 + bl MemcpySimple + ldr r0, _0203E4B0 ; =_020AFE74 + mov r2, #0xa + ldr r1, [r0] + add r0, r1, #0xb5 + add r1, r1, #0xab + add r0, r0, #0x100 + add r1, r1, #0x100 + bl StrncpySimpleNoPadSafe + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x17 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203DF1C: + bl sub_02037468 + cmp r0, #0 + beq _0203EF9C + bl ov11_0230D92C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x18 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203DF40: + bl ov11_0230D220 + cmp r0, #0 + ldreq r0, _0203E4B0 ; =_020AFE74 + moveq r1, #0x19 + ldreq r0, [r0] + streq r1, [r0] + b _0203EF9C +_0203DF5C: + bl ov11_0230D92C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x1a + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203DF74: + bl ov11_0230D220 + cmp r0, #0 + ldreq r0, _0203E4B0 ; =_020AFE74 + moveq r1, #0x1b + ldreq r0, [r0] + streq r1, [r0] + b _0203EF9C +_0203DF90: + add r0, r4, #0xb5 + add r0, r0, #0x100 + bl sub_0203909C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x1c + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203DFB0: + bl sub_0203931C + ldr r1, _0203E4B0 ; =_020AFE74 + ldr r2, [r1] + str r0, [r2, #0x3bc] + ldr r1, [r1] + ldr r0, [r1, #0x3bc] + cmp r0, #0 + movge r0, #0x1d + strge r0, [r1] + b _0203EF9C +_0203DFD8: + bl sub_02039218 + cmp r0, #0 + beq _0203EF9C + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r1, [r0] + ldr r0, [r1, #0x3bc] + cmp r0, #0 + beq _0203E000 + cmp r0, #1 + b _0203E02C +_0203E000: + ldr r0, [r1, #0x3b8] + add r1, r1, #0xab + add r0, r0, #0x3a + add r1, r1, #0x100 + mov r2, #0xa + bl MemcpySimple + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x20 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E02C: + mov r0, #0x12 + str r0, [r1] + b _0203EF9C +_0203E038: + ldrsh r0, [r4, #0x38] + mov r2, #0xa + orr r0, r0, #0x80000 + str r0, [r4, #0x8c] + ldr r1, [r1] + add r0, r1, #0xb5 + add r1, r1, #0xab + add r0, r0, #0x100 + add r1, r1, #0x100 + bl StrncpySimpleNoPadSafe + ldr r1, _0203E4B0 ; =_020AFE74 + ldr r2, [r1] + add r0, r2, #0xb5 + add r0, r0, #0x100 + str r0, [r2, #0xc4] + ldr r0, [r1] + ldr r0, [r0, #8] + cmp r0, #2 + ldreq r4, _0203E4F8 ; =0x00000283 + mov r0, #5 + ldrne r4, _0203E4FC ; =0x00000281 + bl sub_02017C50 + ldr r1, _0203E4B0 ; =_020AFE74 + ldr r0, _0203E4B8 ; =0x0000101C + ldr r2, [r1] + mov r1, r4 + add r2, r2, #0x8c + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x21 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E0BC: + bl sub_02046C78 + cmp r0, #0 + beq _0203EF9C + bl sub_0203F05C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r3, #0xa + ldr r2, [r0] + mov r1, #0x22 + str r3, [r2, #0x188] + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E0EC: + ldr r2, [r4, #0x188] + sub r0, r2, #1 + str r0, [r4, #0x188] + cmp r2, #0 + ldrle r0, [r1] + movle r1, #0x29 + strle r1, [r0] + b _0203EF9C +_0203E10C: + bl sub_02046D20 + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r1, [r0] + ldr r0, [r1, #8] + sub r0, r0, #2 + cmp r0, #1 + add r0, r1, #0x40 + bhi _0203E138 + mov r1, #1 + bl ov11_023061E4 + b _0203E13C +_0203E138: + bl ov11_023061CC +_0203E13C: + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x1f + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E150: + bl ov11_02306C9C + cmp r0, #3 + cmpne r0, #4 + bne _0203EF9C + bl ov11_02306C64 + cmp r0, #0 + ldreq r0, _0203E4B0 ; =_020AFE74 + moveq r1, #0x23 + ldreq r0, [r0] + streq r1, [r0] + beq _0203EF9C + ldr r1, _0203E4B0 ; =_020AFE74 + mov r2, #0xc + ldr r3, [r1] + str r0, [r3, #0x3b8] + ldr r0, [r1] + str r2, [r0] + b _0203EF9C +_0203E198: + ldrsh r1, [r4, #0x38] + add r0, r4, #0xe8 + bl GetNameRaw + ldr r2, _0203E4B0 ; =_020AFE74 + ldr r0, _0203E4B8 ; =0x0000101C + ldr r4, [r2] +#ifdef JAPAN + ldr r1, _0203E8F0 ; =0x00002458 +#else + mov r1, #0x284 +#endif + add r3, r4, #0xe8 + str r3, [r4, #0xc4] + ldr r2, [r2] + add r2, r2, #0x8c + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x24 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E1DC: + bl sub_02046C78 + cmp r0, #0 + beq _0203EF9C + bl sub_0203F05C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r3, #0xa + ldr r2, [r0] + mov r1, #0x25 + str r3, [r2, #0x188] + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E20C: + ldr r2, [r4, #0x188] + sub r0, r2, #1 + str r0, [r4, #0x188] + cmp r2, #0 + ldrle r0, [r1] + movle r1, #0x26 + strle r1, [r0] + b _0203EF9C +_0203E22C: + mov r0, #4 + bl sub_02017C50 + mov r0, #0x3e8 + bl AddMoneyCarried + ldr r1, _0203E4B0 ; =_020AFE74 + mov r3, #0x3e8 + ldr r2, [r1] + ldr r0, _0203E4B8 ; =0x0000101C + str r3, [r2, #0xb0] + ldr r2, [r1] + ldr r1, _0203E500 ; =0x00000285 + add r2, r2, #0x8c + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x27 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E274: + bl sub_02046C78 + cmp r0, #0 + beq _0203EF9C + bl sub_0203F05C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r3, #0xa + ldr r2, [r0] + mov r1, #0x28 + str r3, [r2, #0x188] + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E2A4: + ldr r2, [r4, #0x188] + sub r0, r2, #1 + str r0, [r4, #0x188] + cmp r2, #0 + ldrle r0, [r1] + movle r1, #0x29 + strle r1, [r0] + b _0203EF9C +_0203E2C4: + ldr r1, [r4, #0x10] + ldr r0, [r4, #0x20] + cmp r1, r0 + movge r0, #0x3a + strge r0, [r4] + bge _0203EF9C + mov r0, #6 + mla r0, r1, r0, r4 + ldrsh r0, [r0, #0x28] + mov r1, #0 + strh r0, [sp, #0x20 + SUB_0203D538_STACK_OFFSET] + strb r1, [sp, #0x1c + SUB_0203D538_STACK_OFFSET] + bl IsStorableItem + cmp r0, #0 + beq _0203E44C + ldrsh r0, [sp, #0x20 + SUB_0203D538_STACK_OFFSET] + bl IsThrownItem + cmp r0, #0 + bne _0203E328 + ldrsh r1, [sp, #0x20 + SUB_0203D538_STACK_OFFSET] + cmp r1, #0x16c + blt _0203E348 + ldr r0, _0203E504 ; =0x0000018F + cmp r1, r0 + bgt _0203E348 +_0203E328: + ldr r1, _0203E4B0 ; =_020AFE74 + mov r0, #6 + ldr r2, [r1] + ldr r1, [r2, #0x10] + mla r0, r1, r0, r2 + ldrh r0, [r0, #0x26] + strh r0, [sp, #0x1e + SUB_0203D538_STACK_OFFSET] + b _0203E350 +_0203E348: + mov r0, #0 + strh r0, [sp, #0x1e + SUB_0203D538_STACK_OFFSET] +_0203E350: + ldr r3, _0203E4B0 ; =_020AFE74 + mov r0, #1 + ldr r6, [r3] + strb r0, [sp, #0x1c + SUB_0203D538_STACK_OFFSET] + ldr r1, [r6, #0x10] + mov r0, #6 + mla r5, r1, r0, r6 + ldrh r0, [sp, #0x1c + SUB_0203D538_STACK_OFFSET] + mov r4, #0 + ldr r2, _0203E508 ; =_0209C850 + strh r0, [r5, #0x24] + ldrh r0, [sp, #0x1e + SUB_0203D538_STACK_OFFSET] + add r1, sp, #0x1c + SUB_0203D538_STACK_OFFSET + strh r0, [r5, #0x26] + ldrh r0, [sp, #0x20 + SUB_0203D538_STACK_OFFSET] + strh r0, [r5, #0x28] + ldrsh r0, [sp, #0x20 + SUB_0203D538_STACK_OFFSET] + str r0, [r6, #0x9c] + ldr r0, [r3] + str r4, [r0, #0xb0] + ldr r0, [r3] + add r0, r0, #0xe8 + bl sub_0200D670 + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r2, [r0] + add r1, r2, #0xe8 + str r1, [r2, #0xc4] + ldr r2, [r0] + ldrsh r1, [r2, #0x14] + str r1, [r2, #0x8c] + ldr r1, [r0] + ldr r0, [r1, #8] + cmp r0, #0 + beq _0203E440 + cmp r0, #2 + bne _0203E3EC + ldr r4, _0203E50C ; =0x00000296 + bl sub_0203F00C + b _0203E414 +_0203E3EC: + cmp r0, #3 + bne _0203E400 + ldr r4, _0203E510 ; =0x00000297 + bl sub_0203F00C + b _0203E414 +_0203E400: + cmp r0, #4 + ldrne r4, _0203E514 ; =0x00000295 + bne _0203E414 +#ifdef JAPAN + ldr r4, _0203E90C ; =0x0000246C +#else + mov r4, #0x298 +#endif + bl sub_0203F00C +_0203E414: + ldr r1, _0203E4B0 ; =_020AFE74 + ldr r0, _0203E4B8 ; =0x0000101C + ldr r2, [r1] + mov r1, r4 + add r2, r2, #0x8c + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x2a + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E440: + mov r0, #0x2c + str r0, [r1] + b _0203EF9C +_0203E44C: + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x33 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E460: + bl sub_02046C78 + cmp r0, #0 + beq _0203EF9C + bl sub_0203F05C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r3, #0xa + ldr r2, [r0] + mov r1, #0x2b + str r3, [r2, #0x188] + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E490: + ldr r2, [r4, #0x188] + sub r0, r2, #1 + str r0, [r4, #0x188] + cmp r2, #0 + ldrle r0, [r1] + movle r1, #0x2c + strle r1, [r0] + b _0203EF9C + .align 2, 0 +#ifdef JAPAN +#define SUB_0203D538_DATA_OFFSET 0x21D4 +#else +#define SUB_0203D538_DATA_OFFSET 0 +#endif +_0203E4B0: .word _020AFE74 +_0203E4B4: .word 0x00000289 + SUB_0203D538_DATA_OFFSET +#ifdef JAPAN +_0203E89C: .word 0x0000245E +_0203E8A0: .word 0x0000245C +#endif +_0203E4B8: .word 0x0000101C +_0203E4BC: .word 0x0000026F + SUB_0203D538_DATA_OFFSET +#ifdef JAPAN +_0203E8AC: .word 0x00002444 +#endif +_0203E4C0: .word 0x00000271 + SUB_0203D538_DATA_OFFSET +_0203E4C4: .word 0x0000026E + SUB_0203D538_DATA_OFFSET +_0203E4C8: .word 0x0000029A + SUB_0203D538_DATA_OFFSET +_0203E4CC: .word 0x00000299 + SUB_0203D538_DATA_OFFSET +_0203E4D0: .word 0x00003008 +_0203E4D4: .word _0209C884 +_0203E4D8: .word _0209C846 +_0203E4DC: .word _0209C844 +_0203E4E0: .word 0x0000027A + SUB_0203D538_DATA_OFFSET +_0203E4E4: .word 0x0000100C +_0203E4E8: .word 0x000002A6 + SUB_0203D538_DATA_OFFSET +_0203E4EC: .word _0209C85C +_0203E4F0: .word 0x00300011 +_0203E4F4: .word _0209C86C +_0203E4F8: .word 0x00000283 + SUB_0203D538_DATA_OFFSET +_0203E4FC: .word 0x00000281 + SUB_0203D538_DATA_OFFSET +#ifdef JAPAN +_0203E8F0: .word 0x00002458 +#endif +_0203E500: .word 0x00000285 + SUB_0203D538_DATA_OFFSET +_0203E504: .word 0x0000018F +_0203E508: .word _0209C850 +_0203E50C: .word 0x00000296 + SUB_0203D538_DATA_OFFSET +_0203E510: .word 0x00000297 + SUB_0203D538_DATA_OFFSET +_0203E514: .word 0x00000295 + SUB_0203D538_DATA_OFFSET +#ifdef JAPAN +_0203E90C: .word 0x0000246C +#endif +_0203E518: + ldr r1, [r4, #0x10] + add r2, r4, #0x24 + mov r0, #6 + mla r0, r1, r0, r2 + bl AddItemToStorage + cmp r0, #0 + beq _0203E5A0 + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + ldr r0, [r0, #0xe4] + tst r0, #2 + bne _0203E550 + mov r0, #4 + bl sub_02017C50 +_0203E550: + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r2, [r0] + ldr r0, [r2, #0xe4] + tst r0, #4 + bne _0203E588 + ldr r1, _0203EFA8 ; =0x00000273 + add r2, r2, #0x8c + mov r0, #0x1c + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x2e + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E588: + tst r0, #8 + movne r0, #0x30 + strne r0, [r2] + moveq r0, #0x33 + streq r0, [r2] + b _0203EF9C +_0203E5A0: + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x34 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E5B4: + ldr r2, [r4, #0x10] + mov r0, #6 + mla r1, r2, r0, r4 + ldrsh r2, [r1, #0x28] + mov r1, #0 + strh r2, [sp, #0x1a + SUB_0203D538_STACK_OFFSET] + ldr r2, [r4, #0x10] + mla r0, r2, r0, r4 + ldrh r0, [r0, #0x26] + strh r0, [sp, #0x18 + SUB_0203D538_STACK_OFFSET] + strb r1, [sp, #0x16 + SUB_0203D538_STACK_OFFSET] + bl sub_02046D20 + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + ldr r0, [r0, #0xe4] + tst r0, #1 + moveq r1, #1 + movne r1, #0 + add r0, sp, #0x16 + SUB_0203D538_STACK_OFFSET + and r1, r1, #0xff + bl sub_020453F8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x35 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E61C: + bl sub_02046028 + cmp r0, #2 + beq _0203E658 + cmp r0, #3 + beq _0203E688 + cmp r0, #4 + bne _0203EF9C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r3, #0xa + ldr r2, [r0] + mov r1, #0x2d + str r3, [r2, #0x188] + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E658: + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + add r0, r0, #0xde + bl sub_02045FD0 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r3, #0xa + ldr r2, [r0] + mov r1, #0x36 + str r3, [r2, #0x188] + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E688: + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + add r0, r0, #0xde + bl sub_02045FD0 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r3, #0xa + ldr r2, [r0] + mov r1, #0x38 + str r3, [r2, #0x188] + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E6B8: + ldr r2, [r4, #0x188] + sub r0, r2, #1 + str r0, [r4, #0x188] + cmp r2, #0 + ldrle r0, [r1] + movle r1, #0x37 + strle r1, [r0] + b _0203EF9C +_0203E6D8: + ldr r1, [r4, #0x10] + add r2, r4, #0x24 + mov r0, #6 + mla r0, r1, r0, r2 + bl AddItemToStorage + cmp r0, #0 + beq _0203E7D8 + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + ldr r0, [r0, #0xe4] + tst r0, #2 + bne _0203E710 + mov r0, #4 + bl sub_02017C50 +_0203E710: + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #6 + ldr r5, [r0] + mov r6, #0 + ldr r4, [r5, #0x10] + ldr r2, _0203E508 ; =_0209C850 + mla r3, r4, r1, r5 + ldrsh r3, [r3, #0x28] + str r3, [r5, #0x9c] + ldr r3, [r0] + str r6, [r3, #0xb0] + ldr r4, [r0] + ldrsh r3, [r4, #0xdc] + str r3, [r4, #0xa4] + ldr r3, [r0] + str r6, [r3, #0xb8] + ldr r5, [r0] + ldrsh r3, [r5, #0xe2] + add r4, r5, #0x24 + add r0, r5, #0xe8 + strh r3, [sp, #0x14 + SUB_0203D538_STACK_OFFSET] + ldrh r3, [r5, #0xe0] + strb r6, [sp, #0x10 + SUB_0203D538_STACK_OFFSET] + strh r3, [sp, #0x12 + SUB_0203D538_STACK_OFFSET] + ldr r3, [r5, #0x10] + mla r1, r3, r1, r4 + bl sub_0200D670 + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r2, _0203E508 ; =_0209C850 + ldr r0, [r0] + add r1, sp, #0x10 + SUB_0203D538_STACK_OFFSET + add r0, r0, #0x138 + bl sub_0200D670 + ldr r2, _0203E4B0 ; =_020AFE74 + ldr r0, _0203E4B8 ; =0x0000101C + ldr r4, [r2] + ldr r1, _0203EFAC ; =0x00000275 + add r3, r4, #0x138 + str r3, [r4, #0xcc] + ldr r4, [r2] + add r3, r4, #0xe8 + str r3, [r4, #0xc4] + ldr r2, [r2] + add r2, r2, #0x8c + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x2e + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E7D8: + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x34 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E7EC: + ldr r2, [r4, #0x188] + sub r0, r2, #1 + str r0, [r4, #0x188] + cmp r2, #0 + ldrle r0, [r1] + movle r1, #0x39 + strle r1, [r0] + b _0203EF9C +_0203E80C: + ldr r1, [r4, #0x10] + add r2, r4, #0x24 + mov r0, #6 + mla r0, r1, r0, r2 + bl AddItemToStorage + cmp r0, #0 + beq _0203E8D4 + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + ldr r0, [r0, #0xe4] + tst r0, #2 + bne _0203E844 + mov r0, #4 + bl sub_02017C50 +_0203E844: + ldr r1, _0203E4B0 ; =_020AFE74 + mov r0, #6 + ldr r6, [r1] + mov r5, #0 + ldr r4, [r6, #0x10] + ldr r2, _0203E508 ; =_0209C850 + mla r3, r4, r0, r6 + ldrsh r3, [r3, #0x28] + str r3, [r6, #0x9c] + ldr r3, [r1] + str r5, [r3, #0xb0] + ldr r4, [r1] + ldrsh r3, [r4, #0xdc] + str r3, [r4, #0xa4] + ldr r3, [r1] + str r5, [r3, #0xb8] + ldr r4, [r1] + ldr r3, [r4, #0x10] + add r1, r4, #0x24 + mla r1, r3, r0, r1 + add r0, r4, #0xe8 + bl sub_0200D670 + ldr r2, _0203E4B0 ; =_020AFE74 + ldr r0, _0203E4B8 ; =0x0000101C + ldr r4, [r2] + ldr r1, _0203EFB0 ; =0x00000277 + add r3, r4, #0xe8 + str r3, [r4, #0xc4] + ldr r2, [r2] + add r2, r2, #0x8c + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x2e + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E8D4: + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x34 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E8E8: + ldr r2, [r4, #0x188] + sub r0, r2, #1 + str r0, [r4, #0x188] + cmp r2, #0 + bgt _0203EF9C + ldr r2, [r1] + ldr r0, _0203E4B8 ; =0x0000101C + ldr r1, _0203EFB4 ; =0x00000286 + add r2, r2, #0x8c + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + add r0, r0, #0xde + bl sub_02045FD0 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x2e + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E934: + bl sub_02046C78 + cmp r0, #0 + beq _0203EF9C + bl sub_0203F05C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r3, #0xa + ldr r2, [r0] + mov r1, #0x2f + str r3, [r2, #0x188] + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E964: + ldr r2, [r4, #0x188] + sub r0, r2, #1 + str r0, [r4, #0x188] + cmp r2, #0 + ldrle r0, [r1] + movle r1, #0x33 + strle r1, [r0] + b _0203EF9C +_0203E984: + ldr r0, _0203E4B8 ; =0x0000101C +#ifdef JAPAN + ldr r1, _0203F34C_JP ; =0x00002FEC + add r2, r4, #0x8c +#else + add r2, r4, #0x8c + mov r1, #0x2cc +#endif + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x31 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E9A8: + bl sub_02046C78 + cmp r0, #0 + beq _0203EF9C + bl sub_0203F05C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r3, #0xa + ldr r2, [r0] + mov r1, #0x32 + str r3, [r2, #0x188] + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203E9D8: + ldr r2, [r4, #0x188] + sub r0, r2, #1 + str r0, [r4, #0x188] + cmp r2, #0 + ldrle r0, [r1] + movle r1, #0x33 + strle r1, [r0] + b _0203EF9C +_0203E9F8: + ldr r0, [r4, #0x10] + add r0, r0, #1 + str r0, [r4, #0x10] + ldr r1, [r1] + ldr r0, [r1, #0x10] + cmp r0, #3 + movlt r0, #0x29 + strlt r0, [r1] + movge r0, #0x3a + strge r0, [r1] + b _0203EF9C +_0203EA24: + ldrb r0, [r4, #0x36] + cmp r0, #0 + moveq r0, #0x40 + streq r0, [r4] + beq _0203EF9C + ldr r0, [r4, #8] + cmp r0, #0 + beq _0203EAAC + cmp r0, #2 + bne _0203EA58 + ldr r4, _0203EFB8 ; =0x00000292 + bl sub_0203F00C + b _0203EA80 +_0203EA58: + cmp r0, #3 + bne _0203EA6C + ldr r4, _0203EFBC ; =0x00000293 + bl sub_0203F00C + b _0203EA80 +_0203EA6C: + cmp r0, #4 + ldrne r4, _0203EFC0 ; =0x00000291 + bne _0203EA80 +#ifdef JAPAN + ldr r4, _0203F35C_JP ; =0x00002468 +#else + mov r4, #0x294 +#endif + bl sub_0203F00C +_0203EA80: + ldr r1, _0203E4B0 ; =_020AFE74 + ldr r0, _0203E4B8 ; =0x0000101C + ldr r2, [r1] + mov r1, r4 + add r2, r2, #0x8c + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x3b + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203EAAC: + mov r0, #0x3d + str r0, [r4] + b _0203EF9C +_0203EAB8: + bl sub_02046C78 + cmp r0, #0 + beq _0203EF9C + bl sub_0203F05C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r3, #0xa + ldr r2, [r0] + mov r1, #0x3c + str r3, [r2, #0x188] + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203EAE8: + ldr r2, [r4, #0x188] + sub r0, r2, #1 + str r0, [r4, #0x188] + cmp r2, #0 + ldrle r0, [r1] + movle r1, #0x3d + strle r1, [r0] + b _0203EF9C +_0203EB08: + mov r0, #5 + bl sub_02017C50 + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + ldrsh r0, [r0, #0x38] + bl sub_02010794 + mov r0, #4 + bl RandIntSafe + add r0, r0, #6 + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_020107F4 + ldr r1, _0203E4B0 ; =_020AFE74 + ldr r0, _0203E4B8 ; =0x0000101C + ldr r2, [r1] + ldr r1, _0203EFC4 ; =0x00000272 + add r2, r2, #0x8c + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x3e + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203EB64: + bl sub_02046C78 + cmp r0, #0 + beq _0203EF9C + bl sub_0203F05C + ldr r0, _0203E4B0 ; =_020AFE74 + mov r3, #0xa + ldr r2, [r0] + mov r1, #0x3f + str r3, [r2, #0x188] + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203EB94: + ldr r2, [r4, #0x188] + sub r0, r2, #1 + str r0, [r4, #0x188] + cmp r2, #0 + ldrle r0, [r1] + movle r1, #0x40 + strle r1, [r0] + b _0203EF9C +_0203EBB4: + ldr r0, [r4, #0x3c] + cmp r0, #0 + moveq r0, #0x4c + streq r0, [r4] + beq _0203EF9C + add r0, sp, #0xcc + SUB_0203D538_STACK_OFFSET_2 + bl InitPreprocessorArgs + bl GetRank + ldr r1, _0203E4B0 ; =_020AFE74 + ldr r2, [r1] + strb r0, [r2, #0xc] + ldr r0, [r1] + ldr r0, [r0, #0x3c] + bl sub_02050C10 + mov r0, #4 + bl sub_02017C50 + ldr r1, _0203E4B0 ; =_020AFE74 + ldr r0, _0203E4B8 ; =0x0000101C + ldr r2, [r1] + ldr r1, _0203EFC8 ; =0x000002A1 + ldr r3, [r2, #0x3c] + add r2, sp, #0xcc + SUB_0203D538_STACK_OFFSET_2 + str r3, [sp, #0xf0 + SUB_0203D538_STACK_OFFSET_2] + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x41 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203EC28: + bl sub_02046C78 + cmp r0, #0 + beq _0203EF9C + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r4, [r0] + bl GetRank + ldrb r1, [r4, #0xc] + cmp r1, r0 + movne r0, #0x42 + strne r0, [r4] + moveq r0, #0x4c + streq r0, [r4] + b _0203EF9C +_0203EC5C: + mov r0, #2 + bl sub_02017C50 + add r0, sp, #0x7c + SUB_0203D538_STACK_OFFSET_2 + bl InitPreprocessorArgs + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + ldrb r0, [r0, #0xc] + str r0, [sp, #0x94 + SUB_0203D538_STACK_OFFSET_2] + bl GetRank + str r0, [sp, #0x98 + SUB_0203D538_STACK_OFFSET_2] + ldr r0, _0203E4B8 ; =0x0000101C + ldr r1, _0203EFCC ; =0x000002A2 + add r2, sp, #0x7c + SUB_0203D538_STACK_OFFSET_2 + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x43 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203ECA8: + bl sub_02046C78 + cmp r0, #0 + ldrne r0, _0203E4B0 ; =_020AFE74 + movne r1, #0x44 + ldrne r0, [r0] + strne r1, [r0] + b _0203EF9C +_0203ECC4: + add r0, sp, #0x2c + SUB_0203D538_STACK_OFFSET_2 + bl InitPreprocessorArgs + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + ldrb r0, [r0, #0xc] + bl GetRankUpEntry + ldr r0, [r0, #8] + str r0, [sp, #0x50 + SUB_0203D538_STACK_OFFSET_2] + bl GetRank + bl GetRankUpEntry + ldr r1, [r0, #8] + ldr r0, [sp, #0x50 + SUB_0203D538_STACK_OFFSET_2] + str r1, [sp, #0x54 + SUB_0203D538_STACK_OFFSET_2] + cmp r0, r1 + ldreq r0, _0203E4B0 ; =_020AFE74 + moveq r1, #0x46 + ldreq r0, [r0] + streq r1, [r0] + beq _0203EF9C + ldr r0, _0203E4B8 ; =0x0000101C + ldr r1, _0203EFD0 ; =0x000002A3 + add r2, sp, #0x2c + SUB_0203D538_STACK_OFFSET_2 + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x45 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203ED34: + bl sub_02046C78 + cmp r0, #0 + ldrne r0, _0203E4B0 ; =_020AFE74 + movne r1, #0x46 + ldrne r0, [r0] + strne r1, [r0] + b _0203EF9C +_0203ED50: + bl GetRank + bl GetRankUpEntry + ldrsh r0, [r0, #0xc] + strh r0, [r4, #0x88] + cmp r0, #0 + bne _0203ED80 + bl sub_02046D20 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x4c + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203ED80: + bl IsStorableItem + cmp r0, #0 + beq _0203EDFC + ldrsh r0, [r4, #0x88] + bl IsThrownItem + cmp r0, #0 + movne r0, #1 + moveq r0, #0 + strh r0, [r4, #0x86] + mov r0, #1 + strb r0, [r4, #0x84] + ldr r0, _0203E4B0 ; =_020AFE74 + ldrsh r3, [r4, #0x88] + ldr r1, [r0] + mov r2, #0 + str r3, [r1, #0x9c] + ldr r1, [r0] + mov r0, #4 + str r2, [r1, #0xb0] + bl sub_02017C50 + ldr r1, _0203E4B0 ; =_020AFE74 + ldr r0, _0203E4B8 ; =0x0000101C + ldr r2, [r1] +#ifdef JAPAN + ldr r1, _0203F370 ; =0x00002478 +#else + mov r1, #0x2a4 +#endif + add r2, r2, #0x8c + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x47 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203EDFC: + bl sub_02046D20 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x4c + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203EE14: + bl sub_02046C78 + cmp r0, #0 + ldrne r0, _0203E4B0 ; =_020AFE74 + movne r1, #0x48 + ldrne r0, [r0] + strne r1, [r0] + b _0203EF9C +_0203EE30: + add r0, r4, #0x84 + bl AddItemToStorage + cmp r0, #0 + ldreq r0, _0203E4B0 ; =_020AFE74 + moveq r1, #0x49 + ldreq r0, [r0] + streq r1, [r0] + beq _0203EF9C + bl sub_02046D20 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x4c + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203EE68: + ldrsh r1, [r4, #0x88] + mov r0, #0 + strh r1, [sp, #0xe + SUB_0203D538_STACK_OFFSET] + ldrh r1, [r4, #0x86] + strh r1, [sp, #0xc + SUB_0203D538_STACK_OFFSET] + strb r0, [sp, #0xa + SUB_0203D538_STACK_OFFSET] + bl sub_02046D20 + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r0, [r0] + ldr r0, [r0, #0xe4] + tst r0, #1 + moveq r1, #1 + movne r1, #0 + add r0, sp, #0xa + SUB_0203D538_STACK_OFFSET + and r1, r1, #0xff + bl sub_020453F8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x4a + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203EEBC: + bl sub_02046028 +#ifdef JAPAN + cmp r0, #2 + cmpne r0, #3 + beq _0203EF64 + cmp r0, #4 + bne _0203EF9C + ldr r1, _0203E4B0 ; =_020AFE74 + ldr r0, _0203E4B8 ; =0x0000101C + ldr r2, [r1] + ldr r1, _0203EFB4 ; =0x0000245A +#else + mov r4, r0 + cmp r4, #1 + beq _0203EF9C + add r0, sp, #4 + bl sub_02045FD0 + ldrsh r0, [sp, #8] + cmp r0, #0 + bne _0203EF00 + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r1, [r0] + ldrh r0, [r1, #0x84] + strh r0, [sp, #4] + ldrh r0, [r1, #0x86] + strh r0, [sp, #6] + ldrh r0, [r1, #0x88] + strh r0, [sp, #8] +_0203EF00: + cmp r4, #2 + cmpne r4, #3 + beq _0203EF64 + cmp r4, #4 + bne _0203EF9C + ldr r0, _0203E4B0 ; =_020AFE74 + ldr r2, _0203E508 ; =_0209C850 + ldr r0, [r0] + add r1, sp, #4 + add r0, r0, #0xe8 + bl sub_0200D670 + ldr r2, _0203E4B0 ; =_020AFE74 + ldr r0, _0203E4B8 ; =0x0000101C + ldr r4, [r2] + ldr r1, _0203EFB4 ; =0x00000286 + add r3, r4, #0xe8 + str r3, [r4, #0xc4] + ldr r2, [r2] +#endif + add r2, r2, #0x8c + bl sub_02046BE8 + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x4b + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203EF64: + ldr r0, _0203E4B0 ; =_020AFE74 + mov r1, #0x48 + ldr r0, [r0] + str r1, [r0] + b _0203EF9C +_0203EF78: + bl sub_02046C78 + cmp r0, #0 + ldrne r0, _0203E4B0 ; =_020AFE74 + movne r1, #0x4c + ldrne r0, [r0] + strne r1, [r0] + b _0203EF9C +_0203EF94: + mov r0, #1 + b _0203EFA0 +_0203EF9C: + mov r0, #0 +_0203EFA0: + add sp, sp, #0x11c + SUB_0203D538_STACK_OFFSET_2 + ldmia sp!, {r4, r5, r6, r7, r8, sb, pc} + .align 2, 0 +_0203EFA8: .word 0x00000273 + SUB_0203D538_DATA_OFFSET +_0203EFAC: .word 0x00000275 + SUB_0203D538_DATA_OFFSET +_0203EFB0: .word 0x00000277 + SUB_0203D538_DATA_OFFSET +_0203EFB4: .word 0x00000286 + SUB_0203D538_DATA_OFFSET +#ifdef JAPAN +_0203F34C_JP: .word 0x00002FEC +#endif +_0203EFB8: .word 0x00000292 + SUB_0203D538_DATA_OFFSET +_0203EFBC: .word 0x00000293 + SUB_0203D538_DATA_OFFSET +_0203EFC0: .word 0x00000291 + SUB_0203D538_DATA_OFFSET +#ifdef JAPAN +_0203F35C_JP: .word 0x00002468 +#endif +_0203EFC4: .word 0x00000272 + SUB_0203D538_DATA_OFFSET +_0203EFC8: .word 0x000002A1 + SUB_0203D538_DATA_OFFSET +_0203EFCC: .word 0x000002A2 + SUB_0203D538_DATA_OFFSET +_0203EFD0: .word 0x000002A3 + SUB_0203D538_DATA_OFFSET +#ifdef JAPAN +_0203F370: .word 0x00002478 +#endif + arm_func_end sub_0203D538 + + arm_func_start sub_0203EFD4 +sub_0203EFD4: ; 0x0203EFD4 + stmdb sp!, {r3, lr} + ldr r0, _0203F008 ; =_020AFE74 + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + bl sub_0203F05C + ldr r0, _0203F008 ; =_020AFE74 + ldr r0, [r0] + bl MemFree + ldr r0, _0203F008 ; =_020AFE74 + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203F008: .word _020AFE74 + arm_func_end sub_0203EFD4 + + arm_func_start sub_0203F00C +sub_0203F00C: ; 0x0203F00C + stmdb sp!, {r3, lr} + ldr r1, _0203F058 ; =_020AFE74 + mvn r0, #1 + ldr r1, [r1] + ldrsb r1, [r1, #6] + cmp r1, r0 + ldmneia sp!, {r3, pc} + mov r0, #0 + mov r1, #3 + mov r2, #1 + bl CreatePortraitBox + ldr r1, _0203F058 ; =_020AFE74 + ldr r2, [r1] + strb r0, [r2, #6] + ldr r1, [r1] + ldrsb r0, [r1, #6] + add r1, r1, #0x190 + bl ShowPortraitInPortraitBox + ldmia sp!, {r3, pc} + .align 2, 0 +_0203F058: .word _020AFE74 + arm_func_end sub_0203F00C + + arm_func_start sub_0203F05C +sub_0203F05C: ; 0x0203F05C + stmdb sp!, {r3, lr} + ldr r0, _0203F0EC ; =_020AFE74 + mvn r1, #1 + ldr r0, [r0] + ldrsb r0, [r0, #4] + cmp r0, r1 + beq _0203F08C + bl CloseParentMenu + ldr r0, _0203F0EC ; =_020AFE74 + mvn r1, #1 + ldr r0, [r0] + strb r1, [r0, #4] +_0203F08C: + ldr r0, _0203F0EC ; =_020AFE74 + mvn r1, #1 + ldr r0, [r0] + ldrsb r0, [r0, #5] + cmp r0, r1 + beq _0203F0B8 + bl CloseDialogueBox + ldr r0, _0203F0EC ; =_020AFE74 + mvn r1, #1 + ldr r0, [r0] + strb r1, [r0, #5] +_0203F0B8: + ldr r0, _0203F0EC ; =_020AFE74 + mvn r1, #1 + ldr r0, [r0] + ldrsb r0, [r0, #6] + cmp r0, r1 + beq _0203F0E4 + bl ClosePortraitBox + ldr r0, _0203F0EC ; =_020AFE74 + mvn r1, #1 + ldr r0, [r0] + strb r1, [r0, #6] +_0203F0E4: + bl sub_02046D20 + ldmia sp!, {r3, pc} + .align 2, 0 +_0203F0EC: .word _020AFE74 + arm_func_end sub_0203F05C + + arm_func_start sub_0203F0F0 +sub_0203F0F0: ; 0x0203F0F0 + stmdb sp!, {r4, lr} + ldr r1, _0203F148 ; =_020AFE78 + ldr r2, _0203F14C ; =_0209C89C + ldr r3, [r1] + mov r4, r0 + ldrsh r1, [r3, #0xc] + add r0, r3, #0xdc + add r1, r3, r1, lsl #2 + ldr r1, [r1, #0x14] + mov r1, r1, lsl #1 + ldrh r1, [r2, r1] + bl GetStringFromFileVeneer + ldr r0, _0203F148 ; =_020AFE78 + mov r3, r4 + ldr r4, [r0] + ldrsh r0, [r4, #0xc] + add r1, r4, #0x64 + add r2, r4, #0x30 + add r0, r4, r0, lsl #2 + ldr r0, [r0, #0x14] + bl sub_0205A4B4 + ldmia sp!, {r4, pc} + .align 2, 0 +_0203F148: .word _020AFE78 +_0203F14C: .word _0209C89C + arm_func_end sub_0203F0F0 + + arm_func_start sub_0203F150 +sub_0203F150: ; 0x0203F150 + stmdb sp!, {r4, r5, r6, lr} + sub sp, sp, #0xa0 + mov r6, r0 + mov r5, r1 + mov r0, #0xfc + mov r1, #8 + bl MemAlloc + ldr r2, _0203F340 ; =_020AFE78 + mvn r1, #1 + str r0, [r2] + mov ip, #0 + strb r1, [r0] + mov r0, ip +_0203F184: + add r1, ip, #1 + ldr r3, [r2] + mov r1, r1, lsl #0x10 + add r3, r3, ip, lsl #2 + mov ip, r1, asr #0x10 + str r0, [r3, #0x14] + cmp ip, #6 + blt _0203F184 + ldr r3, _0203F344 ; =_0209C8C8 + ldr r2, _0203F340 ; =_020AFE78 + mov r1, #0x18 + ldr ip, [r2] + mla r1, r5, r1, r3 + strh r0, [ip, #0xe] + b _0203F1E0 +_0203F1C0: + ldr r0, [r2] + ldr r3, [r1, lr, lsl #2] + add r0, r0, lr, lsl #2 + str r3, [r0, #0x14] + ldr r3, [r2] + ldrsh r0, [r3, #0xe] + add r0, r0, #1 + strh r0, [r3, #0xe] +_0203F1E0: + ldr ip, [r2] + ldrsh lr, [ip, #0xe] + cmp lr, #6 + bge _0203F1FC + ldr r0, [r1, lr, lsl #2] + cmp r0, #0 + bne _0203F1C0 +_0203F1FC: + mov r3, #0 + strh r3, [ip, #0xc] + ldr r0, _0203F340 ; =_020AFE78 + sub r2, r3, #1 + ldr r1, [r0] + mov ip, #1 + strh r2, [r1, #0x10] + ldr r1, [r0] + strh r3, [r1, #0x12] + ldr r2, [r0] + mov r1, r6 + strb ip, [r2, #0x2c] + ldr r3, [r0] + mov r2, #0x78 + str r5, [r3, #4] + ldr r3, [r0] + str ip, [r3, #8] + ldr r0, [r0] + add r0, r0, #0x64 + bl memcpy + ldr r0, _0203F340 ; =_020AFE78 + ldr r1, _0203F348 ; =0x00000975 + ldr r3, [r0] + mov r0, #0x10 + str r0, [sp, #0x14] + strh r1, [sp, #0x10] + ldrsh r2, [r3, #0xc] + add r0, r3, #0xdc + mov r1, #0xc + str r1, [sp, #0xc] + str r0, [sp, #0x50] + str r2, [sp, #8] + ldrsh r2, [r3, #0xc] + ldr r1, _0203F34C ; =_0209C89C + add r2, r3, r2, lsl #2 + ldr r2, [r2, #0x14] + mov r2, r2, lsl #1 + ldrh r1, [r1, r2] + bl GetStringFromFileVeneer + ldr r0, _0203F340 ; =_020AFE78 + ldr r2, [r0] + ldr r0, [r2, #4] + cmp r0, #3 + addls pc, pc, r0, lsl #2 + b _0203F324 +_0203F2B0: ; jump table + b _0203F2C0 ; case 0 + b _0203F2C0 ; case 1 + b _0203F2FC ; case 2 + b _0203F2FC ; case 3 +_0203F2C0: + cmp r0, #1 + ldrsh r4, [r2, #0xe] + ldreq r1, _0203F350 ; =0x60481C3B + ldr r0, _0203F354 ; =_0209C8A8 + str r4, [sp] + mov r4, #1 + ldrne r1, _0203F358 ; =0x60489C3B + ldr r3, _0203F35C ; =sub_0203F0F0 + add r2, sp, #8 + str r4, [sp, #4] + bl CreateAdvancedTextBox + ldr r1, _0203F360 ; =sub_0203F928 + mov r4, r0 + bl SetUnkAdvancedTextBoxWindowFn + b _0203F324 +_0203F2FC: + ldrsh r4, [r2, #0xe] + ldr r0, _0203F354 ; =_0209C8A8 + ldr r1, _0203F364 ; =0x60089C3B + str r4, [sp] + mov r4, #1 + ldr r3, _0203F35C ; =sub_0203F0F0 + add r2, sp, #8 + str r4, [sp, #4] + bl CreateAdvancedTextBox + mov r4, r0 +_0203F324: + ldr r0, _0203F340 ; =_020AFE78 + ldr r1, [r0] + strb r4, [r1] + ldr r0, [r0] + ldrsb r0, [r0] + add sp, sp, #0xa0 + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_0203F340: .word _020AFE78 +_0203F344: .word _0209C8C8 +#ifdef JAPAN +_0203F348: .word 0x00002345 +#else +_0203F348: .word 0x00000975 +#endif +_0203F34C: .word _0209C89C +_0203F350: .word 0x60481C3B +_0203F354: .word _0209C8A8 +_0203F358: .word 0x60489C3B +_0203F35C: .word sub_0203F0F0 +_0203F360: .word sub_0203F928 +_0203F364: .word 0x60089C3B + arm_func_end sub_0203F150 + + arm_func_start sub_0203F368 +sub_0203F368: ; 0x0203F368 + stmdb sp!, {r3, r4, r5, lr} + ldr r2, _0203F394 ; =_020AFE78 + mov r5, r0 + ldr r0, [r2] + mov r4, r1 + add r0, r0, #0x64 + bl sub_0205B0B8 + str r0, [r5] + mov r0, #0xc + str r0, [r4] + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_0203F394: .word _020AFE78 + arm_func_end sub_0203F368 + + arm_func_start sub_0203F398 +sub_0203F398: ; 0x0203F398 + stmdb sp!, {r3, r4, r5, lr} + sub sp, sp, #0x10 + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r4, [r0] + cmp r4, #0 + moveq r0, #1 + beq _0203F8CC + ldr r0, [r4, #8] + cmp r0, #4 + addls pc, pc, r0, lsl #2 + b _0203F8C8 +_0203F3C4: ; jump table + b _0203F3D8 ; case 0 + b _0203F404 ; case 1 + b _0203F8C8 ; case 2 + b _0203F83C ; case 3 + b _0203F898 ; case 4 +_0203F3D8: + ldrsb r0, [r4] + bl sub_020307EC + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_0202810C + ldr r0, _0203F8D4 ; =_020AFE78 + mov r1, #1 + ldr r0, [r0] + str r1, [r0, #8] + b _0203F8C8 +_0203F404: + ldrsb r0, [r4] + mov r1, #0 + bl SetUnkAdvancedTextBoxFn + ldr r0, _0203F8D4 ; =_020AFE78 +#ifdef JAPAN + ldr r1, [r0] + ldrb r0, [r1, #0x2c] + cmp r0, #0 + beq _0203F464 + ldrsb r0, [r1] + ldrsh r1, [r1, #0x12] +#else + ldr r2, [r0] + ldrb r0, [r2, #0x2c] + cmp r0, #0 + beq _0203F464 + ldrsh r0, [r2, #0xc] + add r0, r2, r0, lsl #2 + ldr r0, [r0, #0x14] + cmp r0, #1 + ldreqsh r1, [r2, #0x12] + ldrsb r0, [r2] + movne r1, #0 +#endif + bl sub_02030A50 + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r0, [r0] + ldrsb r0, [r0] + bl SetAdvancedTextBoxField0x1C2 + ldr r0, _0203F8D4 ; =_020AFE78 + mov r1, #0 + ldr r0, [r0] + strb r1, [r0, #0x2c] +_0203F464: + add r1, sp, #0xc + mov r0, #0 + bl sub_02006498 + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_02030A18 + ldr r1, _0203F8D4 ; =_020AFE78 + ldr r2, [r1] + strh r0, [r2, #0xc] + ldr r3, [r1] + ldrsh r2, [r3, #0xc] + ldrsh r0, [r3, #0x10] + cmp r0, r2 + strneh r2, [r3, #0x10] + ldrne r0, [r1] + movne r1, #1 + strneb r1, [r0, #0x2c] + bne _0203F8C8 + add r0, r3, r2, lsl #2 + ldr r0, [r0, #0x14] + cmp r0, #1 + ldrsb r0, [r3] + bne _0203F7EC + ldr r1, _0203F8D8 ; =sub_0203F368 + bl SetUnkAdvancedTextBoxFn + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r0, [r0] + ldrsb r0, [r0] + bl GetAdvancedTextBoxFlags2 + ldr r1, _0203F8D4 ; =_020AFE78 + mov r4, r0 + ldr r0, [r1] + ldrsb r0, [r0] + bl sub_02028354 + cmp r0, #3 + beq _0203F508 + bl sub_0203F8EC + cmp r0, #0 + movne r1, #1 + bne _0203F50C +_0203F508: + mov r1, #0 +_0203F50C: + ldr r0, _0203F8D4 ; =_020AFE78 + and r5, r1, #0xff + ldr r0, [r0] + ldrsb r0, [r0] + bl IsAdvancedTextBoxActive + cmp r0, #0 + bne _0203F588 + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_02030908 + cmp r0, #0 + blt _0203F558 + bl sub_0203F8EC + cmp r0, #0 + beq _0203F558 + bl sub_02001808 + cmp r0, #0xa000 + bge _0203F560 +_0203F558: + mov r0, #1 + b _0203F8CC +_0203F560: + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_0202812C + ldr r0, _0203F8D4 ; =_020AFE78 + mov r1, #3 + ldr r0, [r0] + mov r5, #0 + str r1, [r0, #8] + b _0203F748 +_0203F588: + ldrh r0, [sp, #0xc] + tst r0, #8 + cmpne r5, #0 + beq _0203F5FC + bl sub_0203F8EC + cmp r0, #0 + beq _0203F748 + ldr r0, _0203F8D4 ; =_020AFE78 + mov r1, #0 + ldr r0, [r0] + ldrsb r0, [r0] + bl PlayAdvancedTextBoxInputSound + bl sub_02001808 + cmp r0, #0xa000 + blt _0203F748 + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_02030EF0 + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_0202812C + ldr r0, _0203F8D4 ; =_020AFE78 + mov r1, #3 + ldr r0, [r0] + mov r5, #0 + str r1, [r0, #8] + b _0203F748 +_0203F5FC: + tst r0, #0x40 + bne _0203F60C + tst r4, #0x40000 + beq _0203F698 +_0203F60C: + cmp r5, #0 + beq _0203F698 + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r2, [r0] + ldrsh r1, [r2, #0x12] + cmp r1, #0 + bne _0203F660 + ldrsh r1, [r2, #0xba] + cmp r1, #0 + beq _0203F748 + sub r1, r1, #1 + strh r1, [r2, #0xba] + ldr r0, [r0] + mov r1, #1 + strb r1, [r0, #0x2c] + ldrh r0, [sp, #0xc] + tst r0, #0x40 + beq _0203F748 + mov r0, #3 + bl PlaySeVolumeWrapper + b _0203F748 +_0203F660: + ldrsb r0, [r2] + bl sub_02030A64 + cmp r0, #0 + bne _0203F680 + tst r4, #0x40000 + bne _0203F680 + mov r0, #3 + bl PlaySeVolumeWrapper +_0203F680: + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r1, [r0] + ldrsh r0, [r1, #0x12] + sub r0, r0, #1 + strh r0, [r1, #0x12] + b _0203F748 +_0203F698: + tst r0, #0x80 + bne _0203F6A8 + tst r4, #0x80000 + beq _0203F748 +_0203F6A8: + cmp r5, #0 + beq _0203F748 + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r3, [r0] + ldrsh r1, [r3, #0x12] + cmp r1, #8 + bne _0203F708 + ldrsh r2, [r3, #0xba] + add r1, r2, #9 + add r1, r3, r1 + ldrb r1, [r1, #0xbc] + cmp r1, #0 + beq _0203F748 + add r1, r2, #1 + strh r1, [r3, #0xba] + ldr r0, [r0] + mov r1, #1 + strb r1, [r0, #0x2c] + ldrh r0, [sp, #0xc] + tst r0, #0x80 + beq _0203F748 + mov r0, #3 + bl PlaySeVolumeWrapper + b _0203F748 +_0203F708: + ldrsb r0, [r3] + bl sub_02030A64 + cmp r0, #8 + bne _0203F728 + tst r4, #0x80000 + bne _0203F728 + mov r0, #3 + bl PlaySeVolumeWrapper +_0203F728: + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r2, [r0] + ldrsh r0, [r2, #0x12] + add r1, r0, #1 + add r0, r2, r1 + ldrb r0, [r0, #0xbc] + cmp r0, #0 + strneh r1, [r2, #0x12] +_0203F748: + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r1, [r0] + ldrsh r0, [r1, #0xba] + add r0, r0, #9 + add r0, r1, r0 + ldrb r0, [r0, #0xbc] + cmp r0, #0 + ldrsb r0, [r1] + mov r1, #0x40000000 + beq _0203F778 + bl sub_02030A90 + b _0203F77C +_0203F778: + bl sub_02030A74 +_0203F77C: + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r1, [r0] + ldrsh r0, [r1, #0xba] + cmp r0, #0 + ldrsb r0, [r1] + mov r1, #0x20000000 + bne _0203F7A0 + bl sub_02030A74 + b _0203F7A4 +_0203F7A0: + bl sub_02030A90 +_0203F7A4: + cmp r5, #0 + beq _0203F7D8 + ldr r0, _0203F8D4 ; =_020AFE78 + mov r3, #0xc + ldr r0, [r0] + mov r1, #1 + ldrsh r4, [r0, #0x12] + ldrsb r0, [r0] + mov r2, #3 + smulbb r3, r4, r3 + add r3, r3, #0x11 + bl sub_02030978 + b _0203F8C8 +_0203F7D8: + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_020288DC + b _0203F8C8 +_0203F7EC: + mov r1, #0x20000000 + bl sub_02030A74 + ldr r0, _0203F8D4 ; =_020AFE78 + mov r1, #0x40000000 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_02030A74 + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r0, [r0] + ldrsb r0, [r0] + bl IsAdvancedTextBoxActive + cmp r0, #0 + beq _0203F834 + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_020288DC + b _0203F8C8 +_0203F834: + mov r0, #1 + b _0203F8CC +_0203F83C: + ldrsh r2, [r4, #0xba] + ldrsh r0, [r4, #0x12] + ldr r3, _0203F8DC ; =_0209E912 + ldr r1, _0203F8E0 ; =STATUSES_FULL_DESCRIPTION_STRING_IDS + add r0, r2, r0 + add r0, r4, r0 + ldrb r4, [r0, #0xbc] + mov r2, #0 + ldr r0, _0203F8E4 ; =_0209C8B8 + mov r5, r4, lsl #2 + ldrh r4, [r3, r5] + ldrh r3, [r1, r5] + ldr r1, _0203F8E8 ; =0x00001013 + stmia sp, {r2, r4} + str r2, [sp, #8] + bl CreateScrollBoxSingle + ldr r1, _0203F8D4 ; =_020AFE78 + mov r2, #4 + ldr r3, [r1] + strb r0, [r3, #1] + ldr r0, [r1] + str r2, [r0, #8] + b _0203F8C8 +_0203F898: + ldrsb r0, [r4, #1] + bl IsScrollBoxActive + cmp r0, #0 + bne _0203F8C8 + ldr r0, _0203F8D4 ; =_020AFE78 + ldr r0, [r0] + ldrsb r0, [r0, #1] + bl CloseScrollBox + ldr r0, _0203F8D4 ; =_020AFE78 + mov r1, #0 + ldr r0, [r0] + str r1, [r0, #8] +_0203F8C8: + mov r0, #0 +_0203F8CC: + add sp, sp, #0x10 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_0203F8D4: .word _020AFE78 +_0203F8D8: .word sub_0203F368 +_0203F8DC: .word _0209E912 +_0203F8E0: .word STATUSES_FULL_DESCRIPTION_STRING_IDS +_0203F8E4: .word _0209C8B8 +_0203F8E8: .word 0x00001013 + arm_func_end sub_0203F398 + + arm_func_start sub_0203F8EC +sub_0203F8EC: ; 0x0203F8EC + ldr r0, _0203F924 ; =_020AFE78 + mov r1, #0 + ldr r2, [r0] + b _0203F914 +_0203F8FC: + add r0, r2, r1 + ldrb r0, [r0, #0xbc] + cmp r0, #0 + movne r0, #1 + bxne lr + add r1, r1, #1 +_0203F914: + cmp r1, #0x1e + blt _0203F8FC + mov r0, #0 + bx lr + .align 2, 0 +_0203F924: .word _020AFE78 + arm_func_end sub_0203F8EC + + arm_func_start sub_0203F928 +sub_0203F928: ; 0x0203F928 + stmdb sp!, {r4, lr} + mov r4, r0 + cmp r1, #0 + ldmeqia sp!, {r4, pc} + bl sub_02030908 + ldr r2, _0203F970 ; =_020AFE78 + mov r3, #0xc + ldr ip, [r2] + mov r1, #1 + strh r0, [ip, #0x12] + ldr r2, [r2] + mov r0, r4 + ldrsh ip, [r2, #0x12] + mov r2, #3 + smulbb r3, ip, r3 + add r3, r3, #0x11 + bl sub_02030978 + ldmia sp!, {r4, pc} + .align 2, 0 +_0203F970: .word _020AFE78 + arm_func_end sub_0203F928 + + arm_func_start sub_0203F974 +sub_0203F974: ; 0x0203F974 + ldr r0, _0203F988 ; =_020AFE78 + ldr ip, _0203F98C ; =SetAdvancedTextBoxState5 + ldr r0, [r0] + ldrsb r0, [r0] + bx ip + .align 2, 0 +_0203F988: .word _020AFE78 +_0203F98C: .word SetAdvancedTextBoxState5 + arm_func_end sub_0203F974 + + arm_func_start sub_0203F990 +sub_0203F990: ; 0x0203F990 + stmdb sp!, {r3, lr} + ldr r0, _0203F9C8 ; =_020AFE78 + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0] + bl CloseAdvancedTextBox + ldr r0, _0203F9C8 ; =_020AFE78 + ldr r0, [r0] + bl MemFree + ldr r0, _0203F9C8 ; =_020AFE78 + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_0203F9C8: .word _020AFE78 + arm_func_end sub_0203F990 + + arm_func_start sub_0203F9CC +sub_0203F9CC: ; 0x0203F9CC + stmdb sp!, {r3, r4, r5, lr} + ldr r1, _0203FA50 ; =_022AADFC + mov r2, #0 + mov r5, r0 + str r2, [r1] + ldr r4, [r5, #0xb4] + ldr r0, _0203FA54 ; =_022AAE00 + mov r1, r4 + bl GetMonsterName + ldr r0, _0203FA58 ; =_022AAE2A +#ifdef JAPAN + add r1, r4, #0x120 +#else + add r1, r4, #0x124 +#endif + mov r2, #0x22 + bl memcpy + ldrb r2, [r4, #7] + ldr r1, _0203FA50 ; =_022AADFC + mov r0, #0 + strb r2, [r1, #0x2c] + str r5, [r1] + strb r0, [r1, #0x58] + ldrsh r2, [r4, #4] + ldr r0, _0203FA5C ; =0x000001A2 + ldr r3, _0203FA60 ; =_022AAE58 + cmp r2, r0 + moveq r0, #1 + streqb r0, [r1, #0x58] + ldrsh r1, [r4, #2] + ldr r0, _0203FA50 ; =_022AADFC + strh r1, [r0, #0x5a] + add r0, r4, #0x9c + ldmia r0, {r0, r1, r2} + stmia r3, {r0, r1, r2} + mov r0, #1 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_0203FA50: .word _022AADFC +_0203FA54: .word _022AAE00 +_0203FA58: .word _022AAE2A +_0203FA5C: .word 0x000001A2 +_0203FA60: .word _022AAE58 + arm_func_end sub_0203F9CC + + arm_func_start sub_0203FA64 +sub_0203FA64: ; 0x0203FA64 + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0x14 + ldr r1, _0203FBBC ; =TEAM_MEMBER_TABLE_PTR + mov sl, r0 + mov r0, #0x44 + smulbb r2, sl, r0 + ldr r1, [r1] + mov r4, #0x46 + ldrb r0, [r1, r2] + add r8, r1, r2 + tst r0, #1 + movne r0, #1 + moveq r0, #0 + tst r0, #0xff + moveq r0, #0 + beq _0203FBB4 + ldr r1, _0203FBC0 ; =_022AADFC + mov r2, #0 + mov r0, sl + str r2, [r1] + bl sub_02056410 + cmp r0, #0 + mov r0, sl + beq _0203FAD4 + bl sub_020564B0 + cmp r0, #0 + movne r4, #0x59 + b _0203FAE4 +_0203FAD4: + bl sub_02056F60 + cmp r0, #0 + movne r4, #0x44 + moveq r4, #0x57 +_0203FAE4: + add r0, sp, #0 + add r1, r8, #0x3a + mov r2, #0xa + bl StrncpySimpleNoPadSafe + ldr r0, _0203FBC4 ; =_022AAE00 + ldr r1, _0203FBC8 ; =_0209C96C + add r3, sp, #0 + and r2, r4, #0xff + bl SprintfStatic__0204174C + ldrsh r1, [r8, #4] + ldr r0, _0203FBC0 ; =_022AADFC + ldr r3, _0203FBCC ; =_022AAE58 + strh r1, [r0, #0x5a] + add r4, r8, #0x14 + ldmia r4, {r0, r1, r2} + stmia r3, {r0, r1, r2} + ldrsh r0, [r8, #4] + mov r1, r4 + bl GetPpIncrease + mov r6, #0 + ldr r5, _0203FBD0 ; =_022AAE2A + ldr r4, _0203FBC0 ; =_022AADFC + mov r7, r0 + mov fp, r6 +_0203FB44: + mov r0, #6 + mla sb, r6, r0, r8 + ldrh r1, [sb, #0x24] + add r0, r5, r6, lsl #3 + bl InitMove + ldrb r1, [sb, #0x22] + add r2, r4, r6, lsl #3 + add r0, r5, r6, lsl #3 + strb r1, [r2, #0x2e] + strh r7, [r2, #0x30] + strb fp, [r2, #0x34] + ldrb r1, [sb, #0x26] + strb r1, [r2, #0x35] + bl GetMaxPp + add r1, r6, #1 + add r2, r4, r6, lsl #3 + mov r1, r1, lsl #0x10 + mov r6, r1, lsr #0x10 + strb r0, [r2, #0x34] + cmp r6, #4 + blo _0203FB44 + mov r0, sl + bl sub_020564B0 + ldr r1, _0203FBC0 ; =_022AADFC + strb r0, [r1, #0x2c] + ldrsh r0, [r8, #4] + bl sub_02041724 + mov r0, #1 +_0203FBB4: + add sp, sp, #0x14 + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_0203FBBC: .word TEAM_MEMBER_TABLE_PTR +_0203FBC0: .word _022AADFC +_0203FBC4: .word _022AAE00 +_0203FBC8: .word _0209C96C +_0203FBCC: .word _022AAE58 +_0203FBD0: .word _022AAE2A + arm_func_end sub_0203FA64 + + arm_func_start sub_0203FBD4 +sub_0203FBD4: ; 0x0203FBD4 + stmdb sp!, {r3, r4, r5, r6, r7, r8, lr} + sub sp, sp, #0x14 + ldr r1, _0203FCFC ; =TEAM_MEMBER_TABLE_PTR + mov r2, #0x68 + ldr r1, [r1] + ldr r3, _0203FD00 ; =_022AADFC + add r1, r1, #0x9000 + ldr r1, [r1, #0x84c] + mov r4, #0 + smlabb r8, r0, r2, r1 + str r4, [r3] + ldrsh r0, [r8, #8] + sub r1, r4, #1 + cmp r0, r1 + streqb r4, [r3, #0x2c] + beq _0203FC20 + bl sub_020564B0 + ldr r1, _0203FD00 ; =_022AADFC + strb r0, [r1, #0x2c] +_0203FC20: + ldr r0, _0203FD00 ; =_022AADFC + add r1, r8, #0x5e + ldrb r0, [r0, #0x2c] + mov r2, #0xa + cmp r0, #0 + movne r4, #0x59 + add r0, sp, #0 + moveq r4, #0x46 + bl StrncpySimpleNoPadSafe + ldr r0, _0203FD04 ; =_022AAE00 + ldr r1, _0203FD08 ; =_0209C96C + add r3, sp, #0 + and r2, r4, #0xff + bl SprintfStatic__0204174C + ldrsh r0, [r8, #0xc] + add r1, r8, #0x4c + bl GetPpIncrease + ldr r5, _0203FD0C ; =_022AAE2A + ldr r4, _0203FD00 ; =_022AADFC + mov r7, r0 + mov r6, #0 +_0203FC74: + add r0, r8, r6, lsl #3 + ldrh r1, [r0, #0x20] + add r0, r5, r6, lsl #3 + bl InitMove + add r3, r8, r6, lsl #3 + ldrb r1, [r3, #0x1c] + add r2, r4, r6, lsl #3 + add r0, r5, r6, lsl #3 + strb r1, [r2, #0x2e] + strh r7, [r2, #0x30] + ldrb r1, [r3, #0x22] + strb r1, [r2, #0x34] + ldrb r1, [r3, #0x23] + strb r1, [r2, #0x35] + bl GetMaxPp + add r1, r6, #1 + add r2, r4, r6, lsl #3 + mov r1, r1, lsl #0x10 + mov r6, r1, lsr #0x10 + strb r0, [r2, #0x34] + cmp r6, #4 + blo _0203FC74 + ldrsh r0, [r8, #0xc] + bl sub_02041724 + ldrsh r1, [r8, #0xc] + ldr r0, _0203FD00 ; =_022AADFC + ldr r3, _0203FD10 ; =_022AAE58 + strh r1, [r0, #0x5a] + add r0, r8, #0x4c + ldmia r0, {r0, r1, r2} + stmia r3, {r0, r1, r2} + mov r0, #1 + add sp, sp, #0x14 + ldmia sp!, {r3, r4, r5, r6, r7, r8, pc} + .align 2, 0 +_0203FCFC: .word TEAM_MEMBER_TABLE_PTR +_0203FD00: .word _022AADFC +_0203FD04: .word _022AAE00 +_0203FD08: .word _0209C96C +_0203FD0C: .word _022AAE2A +_0203FD10: .word _022AAE58 + arm_func_end sub_0203FBD4 + + arm_func_start sub_0203FD14 +sub_0203FD14: ; 0x0203FD14 + ldr ip, _0203FD24 ; =InitMove + mov r1, r0 + ldr r0, _0203FD28 ; =_022AAE4C + bx ip + .align 2, 0 +_0203FD24: .word InitMove +_0203FD28: .word _022AAE4C + arm_func_end sub_0203FD14 + + arm_func_start sub_0203FD2C +sub_0203FD2C: ; 0x0203FD2C + ldr r0, _0203FD34 ; =_022AAE4C + bx lr + .align 2, 0 +_0203FD34: .word _022AAE4C + arm_func_end sub_0203FD2C + + arm_func_start sub_0203FD38 +sub_0203FD38: ; 0x0203FD38 + ldr r0, _0203FD40 ; =_022AAE2A + bx lr + .align 2, 0 +_0203FD40: .word _022AAE2A + arm_func_end sub_0203FD38 + + arm_func_start sub_0203FD44 +sub_0203FD44: ; 0x0203FD44 + stmdb sp!, {r4, lr} + ldr r4, [r0, #0xb4] + ldr r1, _0203FD74 ; =_022AAE2A +#ifdef JAPAN + add r0, r4, #0x120 +#else + add r0, r4, #0x124 +#endif + mov r2, #0x22 + bl memcpy + ldr r1, _0203FD78 ; =_022AADFC + ldr r0, _0203FD7C ; =_020AFE7C + ldrb r1, [r1, #0x2c] + strb r1, [r4, #7] + ldrsh r0, [r0, #2] + ldmia sp!, {r4, pc} + .align 2, 0 +_0203FD74: .word _022AAE2A +_0203FD78: .word _022AADFC +_0203FD7C: .word _020AFE7C + arm_func_end sub_0203FD44 + + arm_func_start sub_0203FD80 +sub_0203FD80: ; 0x0203FD80 + stmdb sp!, {r3, r4, r5, lr} + ldr r2, _0203FDE0 ; =TEAM_MEMBER_TABLE_PTR + mov r1, #0x44 + ldr r2, [r2] + ldr ip, _0203FDE4 ; =_022AADFC + mla r5, r0, r1, r2 + mov r4, #0 + mov r0, #6 +_0203FDA0: + mla lr, r4, r0, r5 + add r3, ip, r4, lsl #3 + ldrb r2, [r3, #0x2e] + add r1, r4, #1 + mov r1, r1, lsl #0x10 + strb r2, [lr, #0x22] + ldrh r2, [r3, #0x32] + mov r4, r1, lsr #0x10 + cmp r4, #4 + strh r2, [lr, #0x24] + ldrb r1, [r3, #0x35] + strb r1, [lr, #0x26] + blo _0203FDA0 + ldr r0, _0203FDE8 ; =_020AFE7C + ldrsh r0, [r0, #2] + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_0203FDE0: .word TEAM_MEMBER_TABLE_PTR +_0203FDE4: .word _022AADFC +_0203FDE8: .word _020AFE7C + arm_func_end sub_0203FD80 + + arm_func_start sub_0203FDEC +sub_0203FDEC: ; 0x0203FDEC + stmdb sp!, {r4, lr} + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl GetActiveTeamMember + ldr lr, _0203FE54 ; =_022AADFC + mov r4, #0 +_0203FE04: + add ip, lr, r4, lsl #3 + ldrb r2, [ip, #0x2e] + add r3, r0, r4, lsl #3 + add r1, r4, #1 + strb r2, [r3, #0x1c] + ldrh r2, [ip, #0x30] + mov r1, r1, lsl #0x10 + mov r4, r1, lsr #0x10 + strh r2, [r3, #0x1e] + ldrh r1, [ip, #0x32] + cmp r4, #4 + strh r1, [r3, #0x20] + ldrb r1, [ip, #0x34] + strb r1, [r3, #0x22] + ldrb r1, [ip, #0x35] + strb r1, [r3, #0x23] + blo _0203FE04 + ldr r0, _0203FE58 ; =_020AFE7C + ldrsh r0, [r0, #2] + ldmia sp!, {r4, pc} + .align 2, 0 +_0203FE54: .word _022AADFC +_0203FE58: .word _020AFE7C + arm_func_end sub_0203FDEC + + arm_func_start sub_0203FE5C +sub_0203FE5C: ; 0x0203FE5C + stmdb sp!, {r3, r4, r5, r6, r7, lr} + sub sp, sp, #8 + mov r7, r0 + mov r6, r1 + mov r0, #0x3fc + mov r1, #8 + mov r5, r2 + mov r4, r3 + bl MemAlloc + ldr r1, _02040154 ; =_020AFE7C + mvn r2, #1 + str r0, [r1, #8] + strb r2, [r0] + ldr r0, [r1, #0xc] + ldr r2, _02040154 ; =_020AFE7C + cmp r0, r7 + strne r7, [r1, #0xc] + movne r0, #0 + strneh r0, [r1, #2] + ldr r0, _02040154 ; =_020AFE7C + ldr r3, _02040158 ; =0x00000A3E + ldrsh r1, [r0, #4] + mov r7, #0x17 + cmp r1, r6 + strneh r6, [r0, #4] + movne r1, #0 + strneh r1, [r0, #2] + ldr r0, [r2, #8] + mov r1, #0x10 + str r1, [r0, #0x10] + ldr r0, [r2, #8] + str r1, [r0, #8] + ldr r0, [r2, #8] + mov r1, #0 + strh r3, [r0, #0xc] + ldr r0, [r2, #8] + ldr r3, _0204015C ; =_022AAE00 + str r7, [r0, #0x98] + ldr r0, [r2, #8] + str r1, [r0, #0x64] + ldr r0, [r2, #8] + str r3, [r0, #0x4c] + ldr r0, [r2, #8] + strb r1, [r0, #0x3f8] + ldr r0, [r2, #8] + str r4, [r0, #0x3f4] + ldr r0, [r2, #0xc] + cmp r0, #7 + addls pc, pc, r0, lsl #2 + b _0203FF44 +_0203FF24: ; jump table + b _02040084 ; case 0 + b _0203FF44 ; case 1 + b _0203FFAC ; case 2 + b _0204003C ; case 3 + b _0203FF44 ; case 4 + b _0203FF44 ; case 5 + b _0203FFF4 ; case 6 + b _0203FF7C ; case 7 +_0203FF44: + mov r1, #0 + str r1, [sp] + ldr r0, _02040154 ; =_020AFE7C + str r1, [sp, #4] + ldr r2, [r0, #8] + ldr r0, _02040160 ; =_0209C93C + ldr r1, _02040164 ; =0x00401803 + ldr r3, _02040168 ; =sub_020401A8 + add r2, r2, #4 + bl CreateAdvancedTextBox + ldr r1, _02040154 ; =_020AFE7C + ldr r1, [r1, #8] + strb r0, [r1] + b _020400FC +_0203FF7C: + str r1, [sp] + str r1, [sp, #4] + ldr r2, [r2, #8] + ldr r0, _0204016C ; =_0209C94C + ldr r1, _02040170 ; =0x00400800 + ldr r3, _02040168 ; =sub_020401A8 + add r2, r2, #4 + bl CreateAdvancedTextBox + ldr r1, _02040154 ; =_020AFE7C + ldr r1, [r1, #8] + strb r0, [r1] + b _020400FC +_0203FFAC: + ldr r0, [r2, #8] + mov r3, #1 + strb r3, [r0, #0x3f8] + ldr r4, [r2, #8] + ldr r0, _02040174 ; =_0209C92C + add r3, r4, #0x3e0 + str r3, [r4, #0x64] + str r1, [sp] + str r1, [sp, #4] + ldr r2, [r2, #8] + ldr r1, _02040164 ; =0x00401803 + ldr r3, _02040168 ; =sub_020401A8 + add r2, r2, #4 + bl CreateAdvancedTextBox + ldr r1, _02040154 ; =_020AFE7C + ldr r1, [r1, #8] + strb r0, [r1] + b _020400FC +_0203FFF4: + ldr r0, [r2, #8] + mov r3, #1 + strb r3, [r0, #0x3f8] + ldr r4, [r2, #8] + ldr r0, _02040174 ; =_0209C92C + add r3, r4, #0x3e0 + str r3, [r4, #0x64] + str r1, [sp] + str r1, [sp, #4] + ldr r2, [r2, #8] + ldr r1, _02040178 ; =0x00401A03 + ldr r3, _02040168 ; =sub_020401A8 + add r2, r2, #4 + bl CreateAdvancedTextBox + ldr r1, _02040154 ; =_020AFE7C + ldr r1, [r1, #8] + strb r0, [r1] + b _020400FC +_0204003C: + ldr r0, [r2, #8] + mov r3, #1 + strb r3, [r0, #0x3f8] + ldr r4, [r2, #8] + ldr r0, _0204017C ; =_0209C95C + add r3, r4, #0x3e0 + str r3, [r4, #0x64] + str r1, [sp] + str r1, [sp, #4] + ldr r2, [r2, #8] + ldr r1, _02040180 ; =0x00400A00 + ldr r3, _02040168 ; =sub_020401A8 + add r2, r2, #4 + bl CreateAdvancedTextBox + ldr r1, _02040154 ; =_020AFE7C + ldr r1, [r1, #8] + strb r0, [r1] + b _020400FC +_02040084: + cmp r6, #1 + ble _020400C8 + ldr r1, [r2, #8] + mov r0, #1 + str r5, [r1, #4] + str r6, [sp] + str r0, [sp, #4] + ldr r2, [r2, #8] + ldr r0, _02040160 ; =_0209C93C + ldr r1, _02040184 ; =0x00409823 + ldr r3, _02040168 ; =sub_020401A8 + add r2, r2, #4 + bl CreateAdvancedTextBox + ldr r1, _02040154 ; =_020AFE7C + ldr r1, [r1, #8] + strb r0, [r1] + b _020400FC +_020400C8: + ldr r3, [r2, #8] + ldr r0, _02040160 ; =_0209C93C + str r1, [r3, #4] + str r1, [sp] + str r1, [sp, #4] + ldr r2, [r2, #8] + ldr r1, _02040188 ; =0x00401823 + ldr r3, _02040168 ; =sub_020401A8 + add r2, r2, #4 + bl CreateAdvancedTextBox + ldr r1, _02040154 ; =_020AFE7C + ldr r1, [r1, #8] + strb r0, [r1] +_020400FC: + ldr r0, _02040154 ; =_020AFE7C + ldr r0, [r0, #8] + ldrsb r0, [r0] + bl sub_02030A18 + ldr r1, _02040154 ; =_020AFE7C + ldr r1, [r1, #8] + add r1, r1, #0x300 + strh r0, [r1, #0xe8] + mov r0, #1 + bl sub_0204027C + bl PrintMoveOptionMenu + ldr r1, _02040154 ; =_020AFE7C + mov r2, #0 + ldr r0, [r1, #8] + strb r2, [r0, #0x3e5] + ldr r0, [r1, #8] + add r0, r0, #0x300 + strh r2, [r0, #0xe6] + ldr r0, [r1, #8] + ldrsb r0, [r0] + add sp, sp, #8 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_02040154: .word _020AFE7C +#ifdef JAPAN +_02040158: .word 0x00000879 +#else +_02040158: .word 0x00000A3E +#endif +_0204015C: .word _022AAE00 +_02040160: .word _0209C93C +_02040164: .word 0x00401803 +_02040168: .word sub_020401A8 +_0204016C: .word _0209C94C +_02040170: .word 0x00400800 +_02040174: .word _0209C92C +_02040178: .word 0x00401A03 +_0204017C: .word _0209C95C +_02040180: .word 0x00400A00 +_02040184: .word 0x00409823 +_02040188: .word 0x00401823 + arm_func_end sub_0203FE5C + + arm_func_start sub_0204018C +sub_0204018C: ; 0x0204018C + ldr ip, _02040198 ; =sub_0203FE5C + mov r3, #0 + bx ip + .align 2, 0 +_02040198: .word sub_0203FE5C + arm_func_end sub_0204018C + + arm_func_start sub_0204019C +sub_0204019C: ; 0x0204019C + ldr ip, _020401A4 ; =sub_0203FE5C + bx ip + .align 2, 0 +_020401A4: .word sub_0203FE5C + arm_func_end sub_0204019C + + arm_func_start sub_020401A8 +sub_020401A8: ; 0x020401A8 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + mov sl, r0 + bl sub_02027B1C + ldr r4, _02040274 ; =_020AFE7C + mov sb, #0 + ldr r0, [r4, #8] + ldr r7, _02040278 ; =_022AADFC + ldr r0, [r0, #0x10] + mov fp, #8 + mov r0, r0, lsl #0x10 + mov r8, r0, asr #0x10 + mov r6, #0xd + mov r5, #0x17 + b _02040250 +_020401E0: + add r0, r7, sb, lsl #3 + ldrb r0, [r0, #0x2e] + tst r0, #2 + add r0, r2, sb, lsl #3 + movne r1, r6 + ldr r3, [r0, #0xa8] + moveq r1, fp + mov r0, sl + add r2, r8, #2 + bl DrawTextInWindow + cmp sb, #0 + ble _02040238 + add r0, r7, sb, lsl #3 + ldrb r0, [r0, #0x2e] + tst r0, #2 + bne _02040238 + mov r0, sl + mov r1, #0x10 + mov r2, r8 + mov r3, #0x7e + str r5, [sp] + bl sub_02025D50 +_02040238: + add r0, r8, #0x10 + add r1, sb, #1 + mov r0, r0, lsl #0x10 + mov r1, r1, lsl #0x10 + mov r8, r0, asr #0x10 + mov sb, r1, asr #0x10 +_02040250: + ldr r2, [r4, #8] + ldrsh r0, [r2, #0xa4] + cmp sb, r0 + blt _020401E0 + mov r0, #1 + bl sub_0204027C + mov r0, sl + bl UpdateWindow + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_02040274: .word _020AFE7C +_02040278: .word _022AADFC + arm_func_end sub_020401A8 + + arm_func_start sub_0204027C +sub_0204027C: ; 0x0204027C + cmp r0, #0 + ldrne r0, _020402BC ; =_020AFE7C + movne r3, #2 + ldrne r2, [r0, #8] + ldreq r0, _020402BC ; =_020AFE7C + moveq r3, #1 + ldreq r2, [r0, #8] + movne r1, #1 + str r3, [r2, #0x3ec] + ldr r0, [r0, #8] + moveq r1, #2 + str r1, [r0, #0x3f0] + ldr r0, _020402BC ; =_020AFE7C + ldr r0, [r0, #0xc] + cmp r0, #7 + bx lr + .align 2, 0 +_020402BC: .word _020AFE7C + arm_func_end sub_0204027C + + arm_func_start PrintMoveOptionMenu +PrintMoveOptionMenu: ; 0x020402C0 + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0x5c + ldr r0, _020407AC ; =_020AFE7C + ldr r2, _020407B0 ; =_022AAE00 + ldr r1, [r0, #8] + str r2, [r1, #0x4c] + ldr r1, [r0, #0xc] + cmp r1, #2 + cmpne r1, #3 + cmpne r1, #6 + beq _020402FC + ldrsh r1, [r0, #2] + cmp r1, #4 + movge r1, #0 + strgeh r1, [r0, #2] +_020402FC: + ldr r0, _020407AC ; =_020AFE7C + ldrsh r0, [r0, #2] + bl sub_020410A4 + ldr r1, _020407AC ; =_020AFE7C + mov r0, #0 + ldr r1, [r1, #8] + strh r0, [r1, #0xa4] +_02040318: + ldr r1, _020407AC ; =_020AFE7C + ldr r2, _020407B4 ; =_022AAE2A + ldr r1, [r1, #8] + mov r3, #0 + add r1, r1, r0 + strb r3, [r1, #0x3e0] + ldrb r1, [r2, r0, lsl #3] + add r4, r2, r0, lsl #3 + tst r1, #1 + movne r3, #1 + tst r3, #0xff + beq _020403B4 + ldr r1, _020407AC ; =_020AFE7C + ldr r3, [r1, #8] + ldrsh r2, [r3, #0xa4] + add r2, r2, #1 + strh r2, [r3, #0xa4] + ldr r5, [r1, #8] + ldrb r1, [r5, #0x3f8] + cmp r1, #0 + ldrne r2, [r5, #0x3f4] + cmpne r2, #0 + beq _020403C8 + ldrh r1, [r4, #4] + b _02040388 +_0204037C: + cmp r3, r1 + beq _02040394 + add r2, r2, #2 +_02040388: + ldrh r3, [r2] + cmp r3, #0 + bne _0204037C +_02040394: + cmp r3, #0 + movne r1, #1 + moveq r1, #0 + tst r1, #0xff + addne r1, r5, r0 + movne r2, #3 + strneb r2, [r1, #0x3e0] + b _020403C8 +_020403B4: + ldr r1, _020407AC ; =_020AFE7C + ldrsh r2, [r1, #2] + cmp r0, r2 + moveq r2, #0 + streqh r2, [r1, #2] +_020403C8: + add r0, r0, #1 + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + cmp r0, #4 + blt _02040318 + ldr r1, _020407AC ; =_020AFE7C + mov r0, #0 + ldr r2, [r1, #8] + strb r0, [r2, #0x3e4] + ldr r2, [r1, #8] + ldrb r1, [r2, #0x3f8] + cmp r1, #0 + ldrne r1, [r2, #0x3f4] + cmpne r1, #0 + beq _020404B4 +_02040404: + ldr r1, _020407AC ; =_020AFE7C + ldr r3, _020407B4 ; =_022AAE2A + ldr r2, [r1, #8] + add r2, r2, r0 + ldrb r2, [r2, #0x3e0] + tst r2, #1 + beq _020404A0 + ldrb r2, [r3, r0, lsl #3] + tst r2, #2 + beq _02040464 + sub r6, r0, #1 + mov r5, #3 + ldr r3, _020407B8 ; =_022AADFC + b _0204045C +_0204043C: + ldr r4, [r1, #8] + add r2, r3, r6, lsl #3 + add r4, r4, r6 + strb r5, [r4, #0x3e0] + ldrb r2, [r2, #0x2e] + tst r2, #2 + beq _02040464 + sub r6, r6, #1 +_0204045C: + cmp r6, #0 + bge _0204043C +_02040464: + add r5, r0, #1 + ldr r4, _020407B8 ; =_022AADFC + mov r3, #3 + ldr r1, _020407AC ; =_020AFE7C + b _02040498 +_02040478: + add r2, r4, r5, lsl #3 + ldrb r2, [r2, #0x2e] + tst r2, #2 + beq _020404A0 + ldr r2, [r1, #8] + add r2, r2, r5 + strb r3, [r2, #0x3e0] + add r5, r5, #1 +_02040498: + cmp r5, #4 + blt _02040478 +_020404A0: + add r0, r0, #1 + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + cmp r0, #4 + blt _02040404 +_020404B4: + ldr r0, _020407AC ; =_020AFE7C + mov r8, #0 + ldr r0, [r0, #0xc] + ldr fp, _020407B4 ; =_022AAE2A + cmp r0, #2 + cmpne r0, #3 + cmpne r0, #6 + ldreq r0, _020407AC ; =_020AFE7C + ldr r5, _020407B8 ; =_022AADFC + ldreq r1, [r0, #8] + ldr r4, _020407AC ; =_020AFE7C + ldreqsh r0, [r1, #0xa4] + mov sb, r8 + mov r7, r8 + addeq r0, r0, #1 + streqh r0, [r1, #0xa4] + mov r6, #0x6a +_020404F8: + ldrb r0, [fp, sb, lsl #3] + str r7, [sp] + str r6, [sp, #4] + tst r0, #1 + movne r0, #1 + moveq r0, r7 + strb r7, [sp, #8] + strb r7, [sp, #9] + add sl, fp, sb, lsl #3 + tst r0, #0xff + beq _02040634 + ldrb r0, [r5, #0x2c] + cmp r0, #0 + movne r0, #2 + strne r0, [sp] + moveq r0, #4 + streq r0, [sp] + ldr r0, [r4, #0xc] + cmp r0, #1 + cmpne r0, #5 + bne _02040574 + ldrh r0, [sl, #4] + bl Is2TurnsMove + cmp r0, #0 + movne r0, #1 + strneb r0, [sp, #9] + bne _02040574 + ldrh r0, [sl, #4] + cmp r0, #0x8a + moveq r0, #1 + streqb r0, [sp, #8] +_02040574: + ldr r0, [r4, #0xc] + cmp r0, #0 + cmpne r0, #1 + bne _020405A4 + ldr r0, [r5] + mov r1, sl + mov r2, #1 + bl CanMonsterUseMove + cmp r0, #0 + moveq r0, #1 + streqb r0, [sp, #8] + b _020405B4 +_020405A4: + ldrb r0, [sl, #6] + cmp r0, #0 + moveq r0, #1 + streqb r0, [sp, #8] +_020405B4: + ldr r1, [r4, #8] + ldrb r0, [r1, #0x3f8] + cmp r0, #0 + beq _020405D8 + add r0, r1, sb + ldrb r0, [r0, #0x3e0] + tst r0, #2 + movne r0, #1 + strneb r0, [sp, #8] +_020405D8: + mov r2, sl + add r0, sp, #0xc + mov r1, #0 + add r3, sp, #0 + bl FormatMoveStringMore + mov r0, #0 + bl GetDungeonResultString + mov r1, r0 + ldr r0, [r4, #8] + add r0, r0, #0xe0 + add r0, r0, r8, lsl #7 + bl strcpy + ldr r3, [r4, #8] + add r0, r8, #1 + add r1, r3, #0xe0 + add r2, r1, r8, lsl #7 + add r1, r3, r8, lsl #3 + str r2, [r1, #0xa8] + ldr r1, [r4, #8] + mov r0, r0, lsl #0x10 + add r1, r1, r8, lsl #3 + str r8, [r1, #0xac] + mov r8, r0, asr #0x10 +_02040634: + add r0, sb, #1 + mov r0, r0, lsl #0x10 + mov sb, r0, asr #0x10 + cmp sb, #4 + blt _020404F8 + cmp r8, #4 + bne _02040710 + ldr r0, _020407AC ; =_020AFE7C + ldr r0, [r0, #0xc] + cmp r0, #2 + cmpne r0, #3 + cmpne r0, #6 + bne _02040710 + ldr r0, _020407B8 ; =_022AADFC + mov r2, #0 + ldrb r0, [r0, #0x2c] + str r2, [sp] + strb r2, [sp, #8] + strb r2, [sp, #9] + ldr r2, _020407BC ; =_022AAE4C + cmp r0, #0 + ldrb r0, [r2] + mov r1, #0x6a + str r1, [sp, #4] + movne r1, #2 + bicne r0, r0, #8 + strne r1, [sp] + moveq r1, #4 + biceq r0, r0, #4 + streq r1, [sp] + strb r0, [r2] + add r0, sp, #0xc + add r3, sp, #0 + mov r1, #0 + bl FormatMoveStringMore + mov r0, #0 + bl GetDungeonResultString + ldr r2, _020407AC ; =_020AFE7C + mov r1, r0 + ldr r0, [r2, #8] + add r0, r0, #0xe0 + add r0, r0, r8, lsl #7 + bl strcpy + ldr r1, _020407AC ; =_020AFE7C + add r0, r8, #1 + ldr r4, [r1, #8] + mov r0, r0, lsl #0x10 + add r2, r4, #0xe0 + add r3, r2, r8, lsl #7 + add r2, r4, r8, lsl #3 + str r3, [r2, #0xa8] + ldr r1, [r1, #8] + add r1, r1, r8, lsl #3 + str r8, [r1, #0xac] + mov r8, r0, asr #0x10 +_02040710: + ldr r0, _020407AC ; =_020AFE7C + mov r4, #0 + ldr r1, [r0, #8] + sub r3, r4, #1 + add r1, r1, r8, lsl #3 + str r4, [r1, #0xa8] + ldr r2, [r0, #8] + sub r1, r4, #2 + add r2, r2, r8, lsl #3 + str r3, [r2, #0xac] + ldr r0, [r0, #8] + ldrsb r0, [r0] + cmp r0, r1 + beq _0204075C + bl sub_020307EC + ldr r0, _020407AC ; =_020AFE7C + ldr r0, [r0, #8] + ldrsb r0, [r0] + bl SetAdvancedTextBoxField0x1C2 +_0204075C: + ldr r0, _020407AC ; =_020AFE7C + ldr r1, [r0, #0xc] + cmp r1, #7 + ldrne r3, [r0, #8] + ldrne r2, [r3, #0x3ec] + ldrne r1, [r3, #0x3f0] + cmpne r2, r1 + beq _020407A4 + str r1, [r3, #0x3ec] + ldr r3, [r0, #8] + ldrsh r1, [r0, #2] + ldr r2, [r3, #0x10] + ldrsb r0, [r3] + add r2, r2, r1, lsl #4 + ldr r1, [r3, #0x3ec] + add r3, r2, #4 + mov r2, #0 + bl sub_02030978 +_020407A4: + add sp, sp, #0x5c + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_020407AC: .word _020AFE7C +_020407B0: .word _022AAE00 +_020407B4: .word _022AAE2A +_020407B8: .word _022AADFC +_020407BC: .word _022AAE4C + arm_func_end PrintMoveOptionMenu + + arm_func_start sub_020407C0 +sub_020407C0: ; 0x020407C0 + stmdb sp!, {r3, lr} + ldr r0, _020407E8 ; =_020AFE7C + ldr r0, [r0, #8] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + bl MemFree + ldr r0, _020407E8 ; =_020AFE7C + mov r1, #0 + str r1, [r0, #8] + ldmia sp!, {r3, pc} + .align 2, 0 +_020407E8: .word _020AFE7C + arm_func_end sub_020407C0 + + arm_func_start sub_020407EC +sub_020407EC: ; 0x020407EC + stmdb sp!, {r4, r5, r6, r7, lr} + sub sp, sp, #0x34 + add r1, sp, #0xc + mov r0, #0 + bl GetHeldButtons + add r1, sp, #0xa + mov r0, #0 + bl GetPressedButtons + add r1, sp, #8 + mov r0, #0 + bl sub_020063F4 + ldrh r0, [sp, #0xc] + ldr r5, _02040F90 ; =_022AAE2A + tst r0, #0x200 + movne r1, #1 + moveq r1, #0 + and r6, r1, #0xff + ldr r1, _02040F94 ; =_020AFE7C + tst r0, #0x100 + movne r0, #1 + moveq r0, #0 + ldr r3, [r1, #8] + and r7, r0, #0xff + add r0, r3, #0x300 + ldrsh r2, [r0, #0xe6] + cmp r2, #0 + ble _0204087C + sub r2, r2, #1 + strh r2, [r0, #0xe6] + ldr r0, [r1, #8] + add r0, r0, #0x300 + ldrsh r0, [r0, #0xe6] + cmp r0, #0 + moveq r0, #2 + movne r0, #0 + b _02040F88 +_0204087C: + ldrsb r0, [r3] + bl IsAdvancedTextBoxActive + cmp r0, #0 + bne _020408B8 + ldr r0, _02040F94 ; =_020AFE7C + ldr r0, [r0, #8] + ldrsb r0, [r0] + bl sub_02030940 + mvn r1, #0 + cmp r0, r1 + bne _020408B8 + mov r0, #1 + bl PlaySeVolumeWrapper + mov r0, #1 + b _02040F88 +_020408B8: + ldr r0, _02040F94 ; =_020AFE7C + ldr r0, [r0, #0xc] + cmp r0, #9 + addls pc, pc, r0, lsl #2 + b _02040958 +_020408CC: ; jump table + b _02040958 ; case 0 + b _0204094C ; case 1 + b _0204090C ; case 2 + b _020408F4 ; case 3 + b _02040958 ; case 4 + b _02040958 ; case 5 + b _0204090C ; case 6 + b _0204093C ; case 7 + b _02040924 ; case 8 + b _0204090C ; case 9 +_020408F4: + ldrh r0, [sp, #0xa] + mov r6, #0 + mov r7, r6 + bic r0, r0, #6 + strh r0, [sp, #0xa] + b _02040958 +_0204090C: + ldrh r0, [sp, #0xa] + mov r6, #0 + mov r7, r6 + bic r0, r0, #4 + strh r0, [sp, #0xa] + b _02040958 +_02040924: + ldrh r0, [sp, #0xa] + mov r6, #0 + mov r7, r6 + bic r0, r0, #4 + strh r0, [sp, #0xa] + b _02040958 +_0204093C: + mov r6, #0 + mov r7, r6 + strh r6, [sp, #0xa] + b _02040958 +_0204094C: + ldrh r0, [sp, #8] + bic r0, r0, #0x30 + strh r0, [sp, #8] +_02040958: + ldr r0, _02040F94 ; =_020AFE7C + ldr r0, [r0, #8] + ldrb r0, [r0, #0x3e5] + cmp r0, #0 + beq _02040980 + bl PrintMoveOptionMenu + ldr r0, _02040F94 ; =_020AFE7C + mov r1, #0 + ldr r0, [r0, #8] + strb r1, [r0, #0x3e5] +_02040980: + ldrh r0, [sp, #8] + tst r0, #0x80 + beq _02040A44 + bl sub_02041178 + cmp r7, #0 + beq _020409E4 + ldr r1, _02040F94 ; =_020AFE7C + ldr r0, _02040F90 ; =_022AAE2A + ldrsh r1, [r1, #2] + bl sub_02013E54 + ldr r1, _02040F94 ; =_020AFE7C + mov r0, r0, lsl #0x10 + ldrsh r1, [r1, #2] + mov r4, r0, asr #0x10 + cmp r1, r0, asr #16 + beq _020409D8 + mov r0, #3 + bl PlaySeVolumeWrapper + ldr r1, _02040F94 ; =_020AFE7C + mov r0, #3 + strh r4, [r1, #2] + b _02040F88 +_020409D8: + mov r0, #2 + bl PlaySeVolumeWrapper + b _02040A44 +_020409E4: + mov r0, #3 + bl PlaySeVolumeWrapper + ldr r0, _02040F94 ; =_020AFE7C + ldr r1, [r0, #8] + ldrsh r2, [r0, #2] + ldrsh r1, [r1, #0xa4] + add r0, r2, #1 + mov r0, r0, lsl #0x10 + mov r3, r0, asr #0x10 + b _02040A24 +_02040A0C: + ldrb r0, [r5, r3, lsl #3] + tst r0, #2 + beq _02040A2C + add r0, r3, #1 + mov r0, r0, lsl #0x10 + mov r3, r0, asr #0x10 +_02040A24: + cmp r2, r1 + blt _02040A0C +_02040A2C: + cmp r3, r1 + ldr r1, _02040F94 ; =_020AFE7C + movge r3, #0 + mov r0, #9 + strh r3, [r1, #2] + b _02040F88 +_02040A44: + ldrh r0, [sp, #8] + tst r0, #0x40 + beq _02040B10 + bl sub_02041178 + cmp r7, #0 + beq _02040AA8 + ldr r1, _02040F94 ; =_020AFE7C + ldr r0, _02040F90 ; =_022AAE2A + ldrsh r1, [r1, #2] + bl sub_02013F58 + ldr r1, _02040F94 ; =_020AFE7C + mov r0, r0, lsl #0x10 + ldrsh r1, [r1, #2] + mov r4, r0, asr #0x10 + cmp r1, r0, asr #16 + beq _02040A9C + mov r0, #3 + bl PlaySeVolumeWrapper + ldr r1, _02040F94 ; =_020AFE7C + mov r0, #4 + strh r4, [r1, #2] + b _02040F88 +_02040A9C: + mov r0, #2 + bl PlaySeVolumeWrapper + b _02040B10 +_02040AA8: + mov r0, #3 + bl PlaySeVolumeWrapper + ldr r0, _02040F94 ; =_020AFE7C + ldrsh r1, [r0, #2] + cmp r1, #0 + subgt r0, r1, #1 + ldrle r0, [r0, #8] + ldrlesh r0, [r0, #0xa4] + suble r0, r0, #1 + mov r0, r0, lsl #0x10 + mov r2, r0, asr #0x10 + b _02040AF0 +_02040AD8: + ldrb r0, [r5, r2, lsl #3] + tst r0, #2 + beq _02040AF8 + sub r0, r2, #1 + mov r0, r0, lsl #0x10 + mov r2, r0, asr #0x10 +_02040AF0: + cmp r1, #0 + bge _02040AD8 +_02040AF8: + ldr r1, _02040F94 ; =_020AFE7C + cmp r2, #0 + movlt r2, #0 + mov r0, #9 + strh r2, [r1, #2] + b _02040F88 +_02040B10: + mov r4, #0 + bl sub_0204AE60 + cmp r0, #0 + add r0, sp, #0x10 + beq _02040B2C + bl GetReleasedStylus + b _02040B30 +_02040B2C: + bl sub_02006BFC +_02040B30: + ldrh r0, [sp, #0x10] + tst r0, #0x40 + beq _02040C38 + tst r0, #2 + ldrne r0, _02040F94 ; =_020AFE7C + ldrne r0, [r0, #0xc] + cmpne r0, #7 + beq _02040C38 + cmp r0, #2 + cmpne r0, #3 + cmpne r0, #6 + bne _02040B68 + mov r1, #0x70 + b _02040B6C +_02040B68: + mov r1, #0x60 +_02040B6C: + ldr r0, [sp, #0x14] + cmp r0, #0x10 + blt _02040C38 + cmp r0, #0xa0 + bge _02040C38 + ldr r0, [sp, #0x18] + cmp r0, #0x20 + blt _02040C38 + cmp r0, r1 + bge _02040C38 + sub r1, r0, #0x20 + mov r0, r1, asr #3 + add r0, r1, r0, lsr #28 + mov r0, r0, lsl #0xc + ldr r2, _02040F94 ; =_020AFE7C + mov r1, r0, asr #0x10 + ldr r5, [r2, #8] + add r7, r1, #1 + mov r3, #0 + mvn r2, #0 + b _02040BDC +_02040BC0: + add r0, r5, r3, lsl #3 + ldr r0, [r0, #0xac] + cmp r0, r2 + beq _02040BE4 + add r0, r3, #1 + mov r0, r0, lsl #0x10 + mov r3, r0, asr #0x10 +_02040BDC: + cmp r3, r7 + blt _02040BC0 +_02040BE4: + cmp r3, r1 + ble _02040C38 + ldr r0, _02040F90 ; =_022AAE2A + ldrb r0, [r0, r1, lsl #3] + tst r0, #2 + bne _02040C38 + mov r0, r1, lsl #4 + ldr r3, _02040F94 ; =_020AFE7C + add r0, r0, #0x20 + mov r2, r0, lsl #0x10 + mov r0, #0x10 + ldr r4, _02040F98 ; =_0209C928 + strh r1, [r3, #2] + mov r3, r0 + str r4, [sp] + mov r4, #0x40 + mov r1, r2, asr #0x10 + mov r2, #0x90 + str r4, [sp, #4] + mov r4, #1 + bl sub_0202A2A4 +_02040C38: + ldr r0, _02040F94 ; =_020AFE7C + ldr r5, [r0, #8] + ldrsb r0, [r5] + bl sub_02030A18 + add r1, r5, #0x300 + ldrsh r1, [r1, #0xe8] + cmp r1, r0 + beq _02040C90 + mov r0, #4 + bl PlaySeVolumeWrapper + ldr r0, _02040F94 ; =_020AFE7C + mov r1, #0 + strh r1, [r0, #2] + ldr r0, [r0, #8] + ldrsb r0, [r0] + bl sub_02030A18 + ldr r1, _02040F94 ; =_020AFE7C + ldr r1, [r1, #8] + add r1, r1, #0x300 + strh r0, [r1, #0xe8] + mov r0, #5 + b _02040F88 +_02040C90: + ldrh r0, [sp, #0xa] + tst r0, #2 + beq _02040CAC + mov r0, #1 + bl PlaySeVolumeWrapper + mov r0, #1 + b _02040F88 +_02040CAC: + tst r0, #4 + beq _02040D0C + ldr r0, _02040F9C ; =0x00003F07 + mov r1, #0x100 + bl sub_02017C74 + ldr r0, _02040F94 ; =_020AFE7C + ldr r1, [r0, #0xc] + cmp r1, #3 + addls pc, pc, r1, lsl #2 + b _02040CF4 +_02040CD4: ; jump table + b _02040CE4 ; case 0 + b _02040CE4 ; case 1 + b _02040CE4 ; case 2 + b _02040CE4 ; case 3 +_02040CE4: + ldr r0, [r0, #8] + ldrsb r0, [r0] + bl sub_02030EF0 + b _02040D04 +_02040CF4: + bl sub_02041178 + ldr r0, _02040F94 ; =_020AFE7C + ldrsh r0, [r0, #2] + bl sub_02041000 +_02040D04: + mov r0, #6 + b _02040F88 +_02040D0C: + tst r0, #8 + beq _02040D28 + ldr r0, _02040FA0 ; =0x00003F04 + mov r1, #0x100 + bl sub_02017C74 + mov r0, #7 + b _02040F88 +_02040D28: +#ifndef JAPAN + ldrsb r0, [r5] + bl sub_020308E4 + cmp r0, #0 + bne _02040F84 + ldrh r0, [sp, #0xa] +#endif + tst r0, #0x400 + bne _02040D50 + tst r0, #1 + cmpeq r4, #0 + beq _02040F84 +_02040D50: +#ifdef JAPAN + ldrb r0, [r5, #0x3f8] + cmp r0, #0 + beq _020410EC + ldr r0, _02040F94 ; =_020AFE7C + ldrsh r0, [r0, #2] + add r0, r5, r0 + ldrb r0, [r0, #0x3e0] + tst r0, #1 + bne _02040F70 +_020410EC: + cmp r4, #0 + addne r0, r5, #0x300 +#else + ldr r0, _02040F94 ; =_020AFE7C + mov r2, #0 + ldr r3, [r0, #8] + ldrb r1, [r3, #0x3f8] + cmp r1, #0 + beq _02040D7C + ldrsh r0, [r0, #2] + add r0, r3, r0 + ldrb r0, [r0, #0x3e0] + tst r0, #1 + movne r2, #1 +_02040D7C: + cmp r2, #0 + bne _02040F70 + cmp r4, #0 + addne r0, r3, #0x300 +#endif + movne r1, #6 + strneh r1, [r0, #0xe6] + cmp r6, #0 + beq _02040EC8 + ldr r0, _02040F94 ; =_020AFE7C + ldr r0, [r0, #0xc] + cmp r0, #1 + cmpne r0, #5 + bne _02040EC8 + cmp r4, #0 + ldrne r0, _02040F94 ; =_020AFE7C + movne r1, #0 + ldrne r0, [r0, #8] + addne r0, r0, #0x300 + strneh r1, [r0, #0xe6] + ldr r0, _02040F94 ; =_020AFE7C + ldr r1, [r0, #0xc] + cmp r1, #3 + addls pc, pc, r1, lsl #2 + b _02040E34 +_02040DDC: ; jump table + b _02040DEC ; case 0 + b _02040DEC ; case 1 + b _02040DEC ; case 2 + b _02040DEC ; case 3 +_02040DEC: + ldrsh r0, [r0, #2] + bl sub_02041194 + cmp r0, #0 + bne _02040E10 + ldr r0, _02040F94 ; =_020AFE7C + ldrsh r0, [r0, #2] + bl sub_02041364 + cmp r0, #0 + beq _02040E34 +_02040E10: + ldr r0, _02040F9C ; =0x00003F07 + mov r1, #0x100 + bl sub_02017C74 + ldr r0, _02040F94 ; =_020AFE7C + ldr r0, [r0, #8] + ldrsb r0, [r0] + bl sub_02030EF0 + mov r0, #8 + b _02040F88 +_02040E34: + ldr r0, _02040F94 ; =_020AFE7C + ldrsh r0, [r0, #2] + bl sub_02041194 + cmp r0, #0 + beq _02040E88 + ldr r0, _02040F94 ; =_020AFE7C + ldr r1, [r0, #0xc] + cmp r1, #5 + ldreqb r0, [r0] + cmpeq r0, #0 + bne _02040E6C + ldr r0, _02040FA4 ; =0x00001308 + bl sub_02017C80 + b _02040E78 +_02040E6C: + ldr r0, _02040F9C ; =0x00003F07 + mov r1, #0x100 + bl sub_02017C74 +_02040E78: + ldr r0, _02040F94 ; =_020AFE7C + ldrsh r0, [r0, #2] + bl sub_020412B0 + b _02040EC0 +_02040E88: + ldr r0, _02040F94 ; =_020AFE7C + ldrsh r0, [r0, #2] + bl sub_02041364 + cmp r0, #0 + beq _02040EB8 + ldr r0, _02040F9C ; =0x00003F07 + mov r1, #0x100 + bl sub_02017C74 + ldr r0, _02040F94 ; =_020AFE7C + ldrsh r0, [r0, #2] + bl sub_02041394 + b _02040EC0 +_02040EB8: + mov r0, #2 + bl PlaySeVolumeWrapper +_02040EC0: + bl sub_02041178 + b _02040F84 +_02040EC8: + cmp r4, #0 + beq _02040EEC + mov r0, #0 + bl PlaySeVolumeWrapper + ldr r0, _02040F94 ; =_020AFE7C + ldr r0, [r0, #8] + ldrsb r0, [r0] + bl sub_02030EF0 + b _02040F18 +_02040EEC: + ldrh r0, [sp, #0xa] + tst r0, #0x400 + mov r0, #0 + beq _02040F14 + bl PlaySeVolumeWrapper + ldr r0, _02040F94 ; =_020AFE7C + ldr r0, [r0, #8] + ldrsb r0, [r0] + bl sub_02030EF0 + b _02040F18 +_02040F14: + bl PlaySeVolumeWrapper +_02040F18: + ldr r0, _02040F94 ; =_020AFE7C + mov r1, #2 + ldr r3, [r0, #8] + mov r2, #0 + str r1, [r3, #0x3ec] + ldr r3, [r0, #8] + str r1, [r3, #0x3f0] + ldr r6, [r0, #8] + ldrsh r3, [r0, #2] + ldr r5, [r6, #0x10] + ldrsb r0, [r6] + add r3, r5, r3, lsl #4 + add r3, r3, #4 + bl sub_02030978 + ldr r0, _02040F94 ; =_020AFE7C + ldr r0, [r0, #8] + ldrsb r0, [r0] + bl UpdateWindow + cmp r4, #0 + bne _02040F84 + mov r0, #2 + b _02040F88 +_02040F70: + mov r0, #2 + bl PlaySeVolumeWrapper + cmp r4, #0 + beq _02040F84 + bl sub_02041178 +_02040F84: + mov r0, #0 +_02040F88: + add sp, sp, #0x34 + ldmia sp!, {r4, r5, r6, r7, pc} + .align 2, 0 +_02040F90: .word _022AAE2A +_02040F94: .word _020AFE7C +_02040F98: .word _0209C928 +_02040F9C: .word 0x00003F07 +_02040FA0: .word 0x00003F04 +_02040FA4: .word 0x00001308 + arm_func_end sub_020407EC + + arm_func_start sub_02040FA8 +sub_02040FA8: ; 0x02040FA8 + ldr r0, _02040FF4 ; =_022AADFC + ldrb r0, [r0, #0x2c] + cmp r0, #0 + beq _02040FD0 + ldr r0, _02040FF8 ; =_020AFE7C + ldr r1, _02040FFC ; =_022AAE2A + ldrsh r0, [r0, #2] + ldrb r0, [r1, r0, lsl #3] + tst r0, #8 + b _02040FE4 +_02040FD0: + ldr r0, _02040FF8 ; =_020AFE7C + ldr r1, _02040FFC ; =_022AAE2A + ldrsh r0, [r0, #2] + ldrb r0, [r1, r0, lsl #3] + tst r0, #4 +_02040FE4: + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_02040FF4: .word _022AADFC +_02040FF8: .word _020AFE7C +_02040FFC: .word _022AAE2A + arm_func_end sub_02040FA8 + + arm_func_start sub_02041000 +sub_02041000: ; 0x02041000 + stmdb sp!, {r4, lr} + mov r4, r0 + bl sub_02041178 + ldr r2, _0204108C ; =_022AADFC + ldrb r0, [r2, #0x2c] + cmp r0, #0 + beq _02041078 + ldr r1, _02041090 ; =_022AAE2A + ldrb r0, [r1, r4, lsl #3] + tst r0, #8 + eorne r0, r0, #8 + strneb r0, [r1, r4, lsl #3] + ldmneia sp!, {r4, pc} + mov r3, #0 +_02041038: + add r0, r2, r3, lsl #3 + ldrb r0, [r0, #0x2e] + tst r0, #8 + bne _02041050 + cmp r3, r4 + bne _02041060 +_02041050: + add r1, r2, r3, lsl #3 + ldrb r0, [r1, #0x2e] + eor r0, r0, #8 + strb r0, [r1, #0x2e] +_02041060: + add r0, r3, #1 + mov r0, r0, lsl #0x10 + mov r3, r0, asr #0x10 + cmp r3, #4 + blt _02041038 + ldmia sp!, {r4, pc} +_02041078: + ldr r1, _02041090 ; =_022AAE2A + ldrb r0, [r1, r4, lsl #3] + eor r0, r0, #4 + strb r0, [r1, r4, lsl #3] + ldmia sp!, {r4, pc} + .align 2, 0 +_0204108C: .word _022AADFC +_02041090: .word _022AAE2A + arm_func_end sub_02041000 + + arm_func_start sub_02041094 +sub_02041094: ; 0x02041094 + ldr r0, _020410A0 ; =_020AFE7C + ldrsh r0, [r0, #2] + bx lr + .align 2, 0 +_020410A0: .word _020AFE7C + arm_func_end sub_02041094 + + arm_func_start sub_020410A4 +sub_020410A4: ; 0x020410A4 + ldr r1, _0204114C ; =_020AFE7C + cmp r0, #0 + strh r0, [r1, #2] + movlt r0, #0 + strlth r0, [r1, #2] + ldr r0, _0204114C ; =_020AFE7C + ldrsh r2, [r0, #2] + cmp r2, #4 + blt _02041100 + ldr r1, [r0, #0xc] + cmp r1, #2 + cmpne r1, #3 + arm_func_end sub_020410A4 + + arm_func_start sub_020410D4 +sub_020410D4: ; 0x020410D4 + cmpne r1, #6 + arm_func_end sub_020410D4 + + arm_func_start sub_020410D8 +sub_020410D8: ; 0x020410D8 + bne _020410F8 + arm_func_end sub_020410D8 + + arm_func_start sub_020410DC +sub_020410DC: ; 0x020410DC + cmp r2, #4 + ldreq r0, _0204114C ; =_020AFE7C + moveq r1, #4 + ldrne r0, _0204114C ; =_020AFE7C + movne r1, #0 + strh r1, [r0, #2] + bx lr +_020410F8: + mov r1, #3 + strh r1, [r0, #2] +_02041100: + ldr r2, _02041150 ; =_022AADFC + ldr r0, _0204114C ; =_020AFE7C +_02041108: + ldrsh r1, [r0, #2] + cmp r1, #0 + ldrlt r0, _0204114C ; =_020AFE7C + movlt r1, #0 + strlth r1, [r0, #2] + bxlt lr + add r1, r2, r1, lsl #3 + ldrb r1, [r1, #0x2e] + tst r1, #1 + beq _02041138 + tst r1, #2 + bxeq lr +_02041138: + ldrsh r1, [r0, #2] + sub r1, r1, #1 + strh r1, [r0, #2] + b _02041108 +_02041148: + bx lr + .align 2, 0 +_0204114C: .word _020AFE7C +_02041150: .word _022AADFC + arm_func_end sub_020410DC + + arm_func_start sub_02041154 +sub_02041154: ; 0x02041154 + cmp r0, #4 + ldreq r0, _02041170 ; =_022AADFC + ldrne r1, _02041174 ; =_022AAE2E + ldreqh r0, [r0, #0x54] + movne r0, r0, lsl #3 + ldrneh r0, [r1, r0] + bx lr + .align 2, 0 +_02041170: .word _022AADFC +_02041174: .word _022AAE2E + arm_func_end sub_02041154 + + arm_func_start sub_02041178 +sub_02041178: ; 0x02041178 + ldr r0, _02041190 ; =_020AFE7C + ldr r1, [r0, #8] + cmp r1, #0 + movne r0, #1 + strneb r0, [r1, #0x3e5] + bx lr + .align 2, 0 +_02041190: .word _020AFE7C + arm_func_end sub_02041178 + + arm_func_start sub_02041194 +sub_02041194: ; 0x02041194 + stmdb sp!, {r4, r5, r6, r7, r8, lr} + ldr r4, _020412AC ; =_022AAE2A + mov r6, r0 + add r0, r4, r6, lsl #3 + ldrh r0, [r0, #4] + bl IsNot2TurnsMoveOrSketch + cmp r0, #0 + moveq r0, #0 + ldmeqia sp!, {r4, r5, r6, r7, r8, pc} + add r5, r6, #1 + mov r7, #0 + mov r8, #1 + b _0204129C +_020411C8: + ldrb r0, [r4, r5, lsl #3] + tst r0, #1 + movne r0, r8 + moveq r0, r7 + tst r0, #0xff + beq _020412A4 + add r0, r4, r5, lsl #3 + ldrh r0, [r0, #4] + bl IsNot2TurnsMoveOrSketch + cmp r0, #0 + beq _020412A4 + ldrb r0, [r4, r5, lsl #3] + tst r0, #2 + bne _02041298 + add r0, r5, #1 + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + b _02041228 +_02041210: + ldrb r1, [r4, r0, lsl #3] + tst r1, #2 + beq _02041230 + add r0, r0, #1 + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 +_02041228: + cmp r0, #4 + blt _02041210 +_02041230: + mov r1, r6, lsl #0x10 + mov r5, r1, asr #0x10 + b _02041288 +_0204123C: + add r1, r5, #1 + mov r1, r1, lsl #0x10 + mov r3, r1, asr #0x10 + add r1, r4, r5, lsl #3 + ldrh r2, [r1, #4] + b _02041274 +_02041254: + add r1, r4, r3, lsl #3 + ldrh r1, [r1, #4] + cmp r2, r1 + moveq r0, #0 + ldmeqia sp!, {r4, r5, r6, r7, r8, pc} + add r1, r3, #1 + mov r1, r1, lsl #0x10 + mov r3, r1, asr #0x10 +_02041274: + cmp r3, r0 + blt _02041254 + add r1, r5, #1 + mov r1, r1, lsl #0x10 + mov r5, r1, asr #0x10 +_02041288: + cmp r5, r0 + blt _0204123C + mov r0, #1 + ldmia sp!, {r4, r5, r6, r7, r8, pc} +_02041298: + add r5, r5, #1 +_0204129C: + cmp r5, #4 + blt _020411C8 +_020412A4: + mov r0, #0 + ldmia sp!, {r4, r5, r6, r7, r8, pc} + .align 2, 0 +_020412AC: .word _022AAE2A + arm_func_end sub_02041194 + + arm_func_start sub_020412B0 +sub_020412B0: ; 0x020412B0 + stmdb sp!, {r4, lr} + mov r4, r0 + bl sub_02041194 + cmp r0, #0 + ldmeqia sp!, {r4, pc} + add r1, r4, #1 + ldr r0, _02041358 ; =_022AAE2A + mov r3, #0 + mov ip, #1 + b _0204133C +_020412D8: + ldrb r2, [r0, r1, lsl #3] + tst r2, #1 + movne r2, ip + moveq r2, r3 + tst r2, #0xff + beq _02041344 + ldrb r2, [r0, r1, lsl #3] + tst r2, #2 + bne _02041338 + ldr r2, _0204135C ; =_022AADFC + ldr lr, _02041358 ; =_022AAE2A + ldrb r2, [r2, #0x2c] + cmp r2, #0 + ldrne r3, _02041358 ; =_022AAE2A + ldrneb r2, [r3, r1, lsl #3] + bicne r2, r2, #8 + strneb r2, [r3, r1, lsl #3] + ldrb ip, [lr, r1, lsl #3] + ldr r2, _02041360 ; =_020AFE7C + mov r3, #1 + strb r3, [r2] + bic r2, ip, #4 + strb r2, [lr, r1, lsl #3] + b _02041344 +_02041338: + add r1, r1, #1 +_0204133C: + cmp r1, #4 + blt _020412D8 +_02041344: + ldrb r2, [r0, r1, lsl #3] + orr r2, r2, #2 + strb r2, [r0, r1, lsl #3] + bl sub_02041178 + ldmia sp!, {r4, pc} + .align 2, 0 +_02041358: .word _022AAE2A +_0204135C: .word _022AADFC +_02041360: .word _020AFE7C + arm_func_end sub_020412B0 + + arm_func_start sub_02041364 +sub_02041364: ; 0x02041364 + cmp r0, #3 + ldr r1, _02041390 ; =_022AAE2A + moveq r0, #0 + bxeq lr + add r0, r0, #1 + ldrb r0, [r1, r0, lsl #3] + tst r0, #2 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_02041390: .word _022AAE2A + arm_func_end sub_02041364 + + arm_func_start sub_02041394 +sub_02041394: ; 0x02041394 + stmdb sp!, {r4, lr} + mov r4, r0 + bl sub_02041364 + cmp r0, #0 + ldmeqia sp!, {r4, pc} + add ip, r4, #1 + ldr r3, _020413FC ; =_022AAE2A + mov r1, #0 + mov r2, #1 + b _020413EC +_020413BC: + ldrb r0, [r3, ip, lsl #3] + tst r0, #1 + movne r0, r2 + moveq r0, r1 + tst r0, #0xff + beq _020413F4 + ldrb r0, [r3, ip, lsl #3] + tst r0, #2 + beq _020413F4 + eor r0, r0, #2 + strb r0, [r3, ip, lsl #3] + add ip, ip, #1 +_020413EC: + cmp ip, #4 + blt _020413BC +_020413F4: + bl sub_02041178 + ldmia sp!, {r4, pc} + .align 2, 0 +_020413FC: .word _022AAE2A + arm_func_end sub_02041394 + + arm_func_start sub_02041400 +sub_02041400: ; 0x02041400 + ldr r0, _02041410 ; =_020AFE7C + mov r1, #0 + strb r1, [r0] + bx lr + .align 2, 0 +_02041410: .word _020AFE7C + arm_func_end sub_02041400 + + arm_func_start sub_02041414 +sub_02041414: ; 0x02041414 + ldr r0, _02041420 ; =_020AFE7C + ldrb r0, [r0] + bx lr + .align 2, 0 +_02041420: .word _020AFE7C + arm_func_end sub_02041414 + + arm_func_start sub_02041424 +sub_02041424: ; 0x02041424 + cmp r0, #0 + movgt r0, #1 + bxgt lr + mov ip, #1 + ldr r3, _02041480 ; =_022AAE2A + mov r1, #0 + mov r2, ip + b _02041470 +_02041444: + ldrb r0, [r3, ip, lsl #3] + tst r0, #1 + movne r0, r2 + moveq r0, r1 + tst r0, #0xff + beq _02041478 + ldrb r0, [r3, ip, lsl #3] + tst r0, #2 + moveq r0, #1 + bxeq lr + add ip, ip, #1 +_02041470: + cmp ip, #4 + blt _02041444 +_02041478: + mov r0, #0 + bx lr + .align 2, 0 +_02041480: .word _022AAE2A + arm_func_end sub_02041424 + + arm_func_start sub_02041484 +sub_02041484: ; 0x02041484 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + sub sp, sp, #0x20 + ldr r1, _02041594 ; =_020AFE7C + ldr r0, _02041598 ; =_022AAE2A + ldrsh r2, [r1, #2] + mov r1, #0 + mov r3, r1 + strb r1, [r0, r2, lsl #3] + add r5, r2, #1 + mov r4, #1 + b _020414DC +_020414B0: + ldrb r2, [r0, r5, lsl #3] + tst r2, #1 + movne r2, r4 + moveq r2, r3 + tst r2, #0xff + beq _020414E4 + ldrb r2, [r0, r5, lsl #3] + tst r2, #2 + beq _020414E4 + strb r1, [r0, r5, lsl #3] + add r5, r5, #1 +_020414DC: + cmp r5, #4 + blt _020414B0 +_020414E4: + mov r6, #0 + mov r7, r6 + mov r4, r6 + mov r5, #1 + add lr, sp, #0 +_020414F8: + ldrb r1, [r0, r7, lsl #3] + tst r1, #1 + movne r1, r5 + moveq r1, r4 + tst r1, #0xff + beq _02041530 + add ip, r0, r7, lsl #3 + add r3, lr, r6, lsl #3 + mov r2, #4 +_0204151C: + ldrh r1, [ip], #2 + subs r2, r2, #1 + strh r1, [r3], #2 + bne _0204151C + add r6, r6, #1 +_02041530: + add r7, r7, #1 + cmp r7, #4 + blt _020414F8 + mov r2, #0 + add r1, sp, #0 + b _02041550 +_02041548: + strb r2, [r1, r6, lsl #3] + add r6, r6, #1 +_02041550: + cmp r6, #4 + blt _02041548 + mov r4, #0 + add lr, sp, #0 +_02041560: + add ip, lr, r4, lsl #3 + add r3, r0, r4, lsl #3 + mov r2, #4 +_0204156C: + ldrh r1, [ip], #2 + subs r2, r2, #1 + strh r1, [r3], #2 + bne _0204156C + add r4, r4, #1 + cmp r4, #4 + blt _02041560 + bl sub_02041178 + add sp, sp, #0x20 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_02041594: .word _020AFE7C +_02041598: .word _022AAE2A + arm_func_end sub_02041484 + + arm_func_start sub_0204159C +sub_0204159C: ; 0x0204159C + ldr r0, _020415B8 ; =_022AADFC + ldrb r0, [r0, #0x58] + cmp r0, #0 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_020415B8: .word _022AADFC + arm_func_end sub_0204159C + + arm_func_start sub_020415BC +sub_020415BC: ; 0x020415BC + mov r3, #0 + ldr ip, _02041610 ; =_022AAE2A + mov r1, r3 + mov r2, #1 + b _020415F4 +_020415D0: + ldrb r0, [ip, r3, lsl #3] + tst r0, #1 + movne r0, r2 + moveq r0, r1 + tst r0, #0xff + beq _020415FC + add r0, r3, #1 + mov r0, r0, lsl #0x10 + mov r3, r0, asr #0x10 +_020415F4: + cmp r3, #4 + blt _020415D0 +_020415FC: + cmp r3, #4 + movge r0, #1 + movlt r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_02041610: .word _022AAE2A + arm_func_end sub_020415BC + + arm_func_start sub_02041614 +sub_02041614: ; 0x02041614 + stmdb sp!, {r3, r4, r5, lr} + mov r5, #0 + ldr r4, _020416B0 ; =_022AAE2A + mov r2, r5 + mov r3, #1 + b _02041694 +_0204162C: + ldrb r1, [r4, r5, lsl #3] + tst r1, #1 + movne r1, r3 + moveq r1, r2 + tst r1, #0xff + bne _02041688 + mov r1, #5 + strb r1, [r4, r5, lsl #3] + add r2, r4, r5, lsl #3 + strh r0, [r2, #4] + mov r1, #0 + ldr r0, _020416B4 ; =_022AADFC + strb r1, [r2, #7] + ldrsh r0, [r0, #0x5a] + ldr r1, _020416B8 ; =_022AAE58 + bl GetPpIncrease + add r1, r4, r5, lsl #3 + strh r0, [r1, #2] + mov r0, r1 + bl GetMaxPp + add r1, r4, r5, lsl #3 + strb r0, [r1, #6] + b _0204169C +_02041688: + add r1, r5, #1 + mov r1, r1, lsl #0x10 + mov r5, r1, asr #0x10 +_02041694: + cmp r5, #4 + blt _0204162C +_0204169C: + cmp r5, #4 + mvnge r5, #0 + mov r0, r5, lsl #0x10 + mov r0, r0, asr #0x10 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_020416B0: .word _022AAE2A +_020416B4: .word _022AADFC +_020416B8: .word _022AAE58 + arm_func_end sub_02041614 + + arm_func_start sub_020416BC +sub_020416BC: ; 0x020416BC + stmdb sp!, {r3, lr} + mov r1, r0 + ldr r0, _020416D8 ; =_022AAE2A + bl sub_02013F58 + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + ldmia sp!, {r3, pc} + .align 2, 0 +_020416D8: .word _022AAE2A + arm_func_end sub_020416BC + + arm_func_start sub_020416DC +sub_020416DC: ; 0x020416DC + stmdb sp!, {r3, lr} + mov r1, r0 + ldr r0, _020416F8 ; =_022AAE2A + bl sub_02013E54 + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + ldmia sp!, {r3, pc} + .align 2, 0 +_020416F8: .word _022AAE2A + arm_func_end sub_020416DC + + arm_func_start sub_020416FC +sub_020416FC: ; 0x020416FC + stmdb sp!, {r3, lr} + ldr r0, _02041720 ; =_020AFE7C + ldr r0, [r0, #8] + ldrsb r0, [r0] + bl sub_020307EC + mov r0, #1 + bl sub_0204027C + bl sub_02041178 + ldmia sp!, {r3, pc} + .align 2, 0 +_02041720: .word _020AFE7C + arm_func_end sub_020416FC + + arm_func_start sub_02041724 +sub_02041724: ; 0x02041724 + stmdb sp!, {r3, lr} + bl IsDeoxys + cmp r0, #0 + ldrne r0, _02041748 ; =_022AADFC + movne r1, #1 + ldreq r0, _02041748 ; =_022AADFC + moveq r1, #0 + strb r1, [r0, #0x58] + ldmia sp!, {r3, pc} + .align 2, 0 +_02041748: .word _022AADFC + arm_func_end sub_02041724 + + arm_func_start SprintfStatic__0204174C +SprintfStatic__0204174C: ; 0x0204174C + stmdb sp!, {r0, r1, r2, r3} + stmdb sp!, {r3, lr} + add r2, sp, #0xc + bic r2, r2, #3 + ldr r1, [sp, #0xc] + add r2, r2, #4 + bl vsprintf + ldmia sp!, {r3, lr} + add sp, sp, #0x10 + bx lr + arm_func_end SprintfStatic__0204174C + + arm_func_start sub_02041774 +sub_02041774: ; 0x02041774 + stmdb sp!, {r4, lr} + mov r4, r0 + mov r0, #0x2bc + mov r1, #8 + bl MemAlloc + ldr r1, _020417A4 ; =_020AFE8C + mvn r2, #1 + str r0, [r1] + str r4, [r0, #4] + ldr r0, [r1] + strb r2, [r0] + ldmia sp!, {r4, pc} + .align 2, 0 +_020417A4: .word _020AFE8C + arm_func_end sub_02041774 + + arm_func_start sub_020417A8 +sub_020417A8: ; 0x020417A8 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr} + mov r6, r1 + mov r4, r2 + mov r7, r0 + cmp r4, r6 + mvnge r0, #1 + ldmgeia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + ldrb r0, [r7, r4, lsl #3] + tst r0, #1 + mvneq r0, #1 + ldmeqia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + mov r0, r3 + bl sub_02041774 + ldr r0, _0204185C ; =_020AFE8C + add r1, r7, r4, lsl #3 + ldr r0, [r0] + mov r2, #8 + add r0, r0, #8 + bl memcpy + add r5, r4, #1 + mov r4, #1 + mov sb, #8 + ldr r8, _0204185C ; =_020AFE8C + b _02041840 +_02041808: + ldrb r0, [r7, r5, lsl #3] + mov r1, r5, lsl #3 + tst r0, #1 + beq _0204183C + tst r0, #2 + beq _02041848 + ldr r0, [r8] + mov r2, sb + add r0, r0, #8 + add r0, r0, r4, lsl #3 + add r1, r7, r1 + bl memcpy + add r4, r4, #1 +_0204183C: + add r5, r5, #1 +_02041840: + cmp r5, r6 + blt _02041808 +_02041848: + ldr r0, _0204185C ; =_020AFE8C + ldr r0, [r0] + strh r4, [r0, #0x28] + bl sub_020418A4 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + .align 2, 0 +_0204185C: .word _020AFE8C + arm_func_end sub_020417A8 + + arm_func_start sub_02041860 +sub_02041860: ; 0x02041860 + stmdb sp!, {r4, lr} + mov r4, r0 + mov r0, r1 + bl sub_02041774 + ldr r0, _020418A0 ; =_020AFE8C + mov r1, r4 + ldr r0, [r0] + mov r2, #8 + add r0, r0, #8 + bl memcpy + ldr r0, _020418A0 ; =_020AFE8C + mov r1, #1 + ldr r0, [r0] + strh r1, [r0, #0x28] + bl sub_020418A4 + ldmia sp!, {r4, pc} + .align 2, 0 +_020418A0: .word _020AFE8C + arm_func_end sub_02041860 + + arm_func_start sub_020418A4 +sub_020418A4: ; 0x020418A4 + stmdb sp!, {r4, r5, r6, r7, r8, lr} + sub sp, sp, #0x10 + mov r7, #0 + ldr r6, _020419F0 ; =0x000008D4 + ldr r5, _020419F4 ; =_020AFE8C + mov r4, #0x50 + b _02041950 +_020418C0: + ldr r1, [r5] + mul r8, r7, r4 + add r0, r1, r7, lsl #3 + ldrh r0, [r0, #0xc] + add r1, r1, r7, lsl #1 + add r1, r1, #0x200 + strh r6, [r1, #0xac] + ldr r2, [r5] +#if defined(EUROPE) + add r1, r0, #0x3a4 +#elif defined(JAPAN) + add r1, r0, #0x9f +#else + add r1, r0, #0xa2 +#endif + add r2, r2, r8 + str r0, [r2, #0x3c] + ldr r2, [r5] +#if defined(EUROPE) + add r3, r1, #0x2400 +#elif defined(JAPAN) + add r3, r1, #0x3f00 +#else + add r3, r1, #0x2700 +#endif + add r1, r2, r7, lsl #1 + add r1, r1, #0x200 + strh r3, [r1, #0xb4] + ldr r1, [r5] + add r1, r1, r8 + str r0, [r1, #0x17c] + ldr r0, [r5] + add r0, r0, #8 + add r0, r0, r7, lsl #3 + bl GetMoveRangeId + ldr r1, [r5] + add r1, r1, r8 + str r0, [r1, #0x180] + ldr r0, [r5] + add r0, r0, #8 + add r0, r0, r7, lsl #3 + bl GetMoveType + ldr r2, [r5] + add r1, r7, #1 + add r2, r2, r8 + mov r1, r1, lsl #0x10 + str r0, [r2, #0x184] + mov r7, r1, asr #0x10 +_02041950: + ldr r2, [r5] + ldrsh r3, [r2, #0x28] + cmp r7, r3 + blt _020418C0 + cmp r3, #1 + ble _020419A0 + add r0, r2, #0x2ac + str r0, [sp] + add r0, r2, #0x2c + str r0, [sp, #4] + add r4, r2, #0x2b4 + str r4, [sp, #8] + add r4, r2, #0x16c + ldr r0, _020419F8 ; =_0209C97C + ldr r1, _020419FC ; =0x00001013 + mov r2, #0 + str r4, [sp, #0xc] + bl CreateScrollBoxMulti + ldr r1, _020419F4 ; =_020AFE8C + b _020419D4 +_020419A0: + add r0, r2, #0x2c + str r0, [sp] + add r1, r2, #0x200 + ldrh r3, [r1, #0xb4] + add r2, r2, #0x16c + ldr r0, _020419F8 ; =_0209C97C + str r3, [sp, #4] + str r2, [sp, #8] + ldrh r3, [r1, #0xac] + ldr r1, _020419FC ; =0x00001013 + mov r2, #0 + bl CreateScrollBoxSingle + ldr r1, _020419F4 ; =_020AFE8C +_020419D4: + ldr r1, [r1] + strb r0, [r1] + ldr r0, _020419F4 ; =_020AFE8C + ldr r0, [r0] + ldrsb r0, [r0] + add sp, sp, #0x10 + ldmia sp!, {r4, r5, r6, r7, r8, pc} + .align 2, 0 +#ifdef JAPAN +_020419F0: .word 0x00001D2C +#else +_020419F0: .word 0x000008D4 +#endif +_020419F4: .word _020AFE8C +_020419F8: .word _0209C97C +_020419FC: .word 0x00001013 + arm_func_end sub_020418A4 + + arm_func_start sub_02041A00 +sub_02041A00: ; 0x02041A00 + ldr r0, _02041A10 ; =_020AFE8C + ldr ip, _02041A14 ; =MemFree + ldr r0, [r0] + bx ip + .align 2, 0 +_02041A10: .word _020AFE8C +_02041A14: .word MemFree + arm_func_end sub_02041A00 + + arm_func_start sub_02041A18 +sub_02041A18: ; 0x02041A18 + stmdb sp!, {r3, lr} + ldr r0, _02041A3C ; =_020AFE8C + ldr r0, [r0] + ldrsb r0, [r0] + bl IsScrollBoxActive + cmp r0, #0 + movne r0, #0 + moveq r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_02041A3C: .word _020AFE8C + arm_func_end sub_02041A18 + + arm_func_start PrintIqSkillsMenu +PrintIqSkillsMenu: ; 0x02041A40 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + sub sp, sp, #0xa0 + mov r7, r0 + mov r6, r1 + add r0, sp, #8 + mov r1, #0x98 + mov r5, r2 + mov r4, r3 + bl MemZero + mov r1, #0xd +#ifdef JAPAN + ldr r0, _02041ED4 ; =0x00001586 +#else + rsb r0, r1, #0xa80 +#endif + str r1, [sp, #0xc] + mov r1, #0 + str r1, [sp, #8] + mov r1, #0x10 + strh r0, [sp, #0x10] + str r1, [sp, #0x14] + mov r0, #0x840 + mov r1, #8 + bl MemAlloc + ldr r2, _02041B6C ; =_020AFE90 + mov r1, #0x840 + str r0, [r2, #4] + bl MemZero + ldr r3, _02041B6C ; =_020AFE90 + mov r1, r7 + ldr r0, [r3, #4] + mov r2, r5 + str r6, [r0, #0x790] + ldr r0, [r3, #4] + add r0, r0, #0x700 + strh r7, [r0, #0x94] + ldr r0, [r3, #4] + str r5, [r0, #0x798] + ldr r0, [r3, #4] + add r0, r0, #0x64 + bl GetLearnableIqSkills + ldr r3, _02041B6C ; =_020AFE90 + ldr r1, _02041B70 ; =0x80401C33 + ldr r2, [r3, #4] + mov r5, #8 + add r2, r2, #0x700 + strh r0, [r2, #0x8c] + ldr r2, [r3, #4] + ldr r0, _02041B74 ; =_0209C98C + add r2, r2, #0x700 + ldrsh r6, [r2, #0x8c] + ldr r3, _02041B78 ; =sub_0204213C + add r2, sp, #8 + str r6, [sp] + str r5, [sp, #4] + bl CreateAdvancedMenu + ldr r1, _02041B6C ; =_020AFE90 + mov r2, #0 + ldr r3, [r1, #4] + strb r0, [r3] + ldr r0, [r1, #4] + str r2, [r0, #0x6f0] + ldr r0, [r1, #4] + str r2, [r0, #0x6ec] + ldr r0, [r1, #4] + strb r4, [r0, #0x83c] + ldr r0, [r1, #4] + add r0, r0, #0x700 + strh r2, [r0, #0x8e] + ldr r0, [r1, #4] + add r0, r0, #0x14 + bl InitPreprocessorArgs + ldr r0, _02041B6C ; =_020AFE90 + ldr r1, [r0, #4] + add r0, r1, #0x34 + add r0, r0, #0x800 + str r0, [r1, #0x7fc] + add sp, sp, #0xa0 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +#ifdef JAPAN +_02041ED4: .word 0x00001586 +#endif +_02041B6C: .word _020AFE90 +_02041B70: .word 0x80401C33 +_02041B74: .word _0209C98C +_02041B78: .word sub_0204213C + arm_func_end PrintIqSkillsMenu + + arm_func_start sub_02041B7C +sub_02041B7C: ; 0x02041B7C + stmdb sp!, {r4, lr} + sub sp, sp, #0xf8 + ldr r1, _020420BC ; =_020AFE90 + ldr r3, [r1, #4] + ldr r0, [r3, #0x6f0] + cmp r0, #8 + addls pc, pc, r0, lsl #2 + b _020420B0 +_02041B9C: ; jump table + b _02041BC0 ; case 0 + b _02041DB0 ; case 1 + b _02041E40 ; case 2 + b _02041EBC ; case 3 + b _02041F30 ; case 4 + b _02041EE4 ; case 5 + b _02041FA4 ; case 6 + b _02041FE8 ; case 7 + b _020420A0 ; case 8 +_02041BC0: + ldrsb r0, [r3] + bl IsAdvancedMenuActive2 + cmp r0, #0 + bne _02041CF8 + ldr r0, _020420BC ; =_020AFE90 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl GetAdvancedMenuResult + ldr r2, _020420BC ; =_020AFE90 + mvn r1, #0 + ldr r3, [r2, #4] + str r0, [r3, #0x838] + ldr r2, [r2, #4] + ldr r0, [r2, #0x838] + cmp r0, r1 + moveq r0, #8 + streq r0, [r2, #0x6f0] + beq _020420B0 + mov r0, #0 + bl PlaySeVolumeWrapper + ldr r0, _020420BC ; =_020AFE90 + ldr r2, _020420C0 ; =_0209C9B0 + ldrsb r3, [r0] + ldr r1, [r0, #4] + ldr r2, [r2, r3, lsl #3] + str r2, [r1, #0x79c] + ldr r3, [r0, #4] + ldr r2, [r3, #0x838] + ldrb r1, [r3, #0x83c] + add r2, r3, r2 + ldrb r2, [r2, #0x64] + cmp r1, #0 + bne _02041C60 + cmp r2, #0x18 + cmpne r2, #0x1b + beq _02041C60 + add r1, r2, #0xc8 + and r1, r1, #0xff + cmp r1, #1 + bhi _02041C7C +_02041C60: + mov r1, #3 + ldr r0, _020420BC ; =_020AFE90 + strb r1, [r3, #0x834] + ldr r0, [r0, #4] + mov r1, #0 + strb r1, [r0, #0x835] + b _02041C8C +_02041C7C: + mov r1, #0 + strb r1, [r3, #0x834] + ldr r0, [r0, #4] + strb r1, [r0, #0x835] +_02041C8C: + ldr r0, _020420BC ; =_020AFE90 + mov r1, #0x98 + ldr r0, [r0, #4] + add r0, r0, #0x39c + add r0, r0, #0x400 + bl MemZero + ldr r2, _020420BC ; =_020AFE90 + ldr r3, _020420C4 ; =_0209C9AC + ldr r4, [r2, #4] + mov r1, #0 + add r0, r4, #0x34 + add r0, r0, #0x800 + str r0, [r4, #0x7fc] + str r3, [sp] + str r1, [sp, #4] + str r1, [sp, #8] + ldr r2, [r2, #4] + ldr r0, _020420C8 ; =_0209C99C + add r3, r2, #0x39c + ldr r2, _020420CC ; =0x80000233 + add r3, r3, #0x400 + bl sub_02046A20 + ldr r0, _020420BC ; =_020AFE90 + mov r1, #1 + ldr r0, [r0, #4] + str r1, [r0, #0x6f0] + b _020420B0 +_02041CF8: + add r1, sp, #0xc + mov r0, #0 + bl GetPressedButtons + ldrh r0, [sp, #0xc] + tst r0, #8 + beq _02041D54 + ldr r0, _020420D0 ; =0x00003F04 + bl sub_02017C80 + ldr r0, _020420BC ; =_020AFE90 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl sub_0202C1E4 + ldr r0, _020420BC ; =_020AFE90 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl GetAdvancedMenuResult + ldr r1, _020420BC ; =_020AFE90 + mov r2, #3 + ldr r3, [r1, #4] + str r0, [r3, #0x838] + ldr r0, [r1, #4] + str r2, [r0, #0x6f0] + b _020420B0 +_02041D54: + tst r0, #4 + beq _020420B0 + ldr r0, _020420BC ; =_020AFE90 + ldr r1, [r0, #4] + ldrb r0, [r1, #0x83c] + cmp r0, #0 + beq _02041D7C + ldr r0, _020420D4 ; =0x00003F03 + bl sub_02017C80 + b _020420B0 +_02041D7C: + ldrsb r0, [r1] + bl sub_0202C1E4 + ldr r0, _020420BC ; =_020AFE90 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl GetAdvancedMenuResult + ldr r1, _020420BC ; =_020AFE90 + mov r2, #2 + ldr r3, [r1, #4] + str r0, [r3, #0x838] + ldr r0, [r1, #4] + str r2, [r0, #0x6f0] + b _020420B0 +_02041DB0: + bl sub_02046B04 + mov r4, r0 + bl sub_02046BA0 + ldr r1, _020420BC ; =_020AFE90 + add r2, r4, #2 + strb r0, [r1] + cmp r2, #4 + addls pc, pc, r2, lsl #2 + b _020420B0 +_02041DD4: ; jump table + b _02041DF0 ; case 0 + b _020420B0 ; case 1 + b _02041E14 ; case 2 + b _02041E24 ; case 3 + b _02041DE8 ; case 4 +_02041DE8: + mov r0, #0 + bl PlaySeVolumeWrapper +_02041DF0: + ldr r0, _020420BC ; =_020AFE90 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl ResumeAdvancedMenu + ldr r0, _020420BC ; =_020AFE90 + mov r1, #0 + ldr r0, [r0, #4] + str r1, [r0, #0x6f0] + b _020420B0 +_02041E14: + ldr r0, [r1, #4] + mov r1, #2 + str r1, [r0, #0x6f0] + b _020420B0 +_02041E24: + mov r0, #0 + bl PlaySeVolumeWrapper + ldr r0, _020420BC ; =_020AFE90 + mov r1, #3 + ldr r0, [r0, #4] + str r1, [r0, #0x6f0] + b _020420B0 +_02041E40: + ldr r1, [r3, #0x838] + add r2, r3, #0x64 + ldrb r0, [r2, r1] + cmp r0, #0x18 + bne _02041E60 + mov r0, #2 + bl PlaySeVolumeWrapper + b _02041E98 +_02041E60: + cmp r0, #0x1b + beq _02041E78 + add r0, r0, #0xc8 + and r0, r0, #0xff + cmp r0, #1 + bhi _02041E84 +_02041E78: + mov r0, #2 + bl PlaySeVolumeWrapper + b _02041E98 +_02041E84: + ldrb r1, [r2, r1] + ldr r0, [r3, #0x790] + bl DisableIqSkill + ldr r0, _020420D8 ; =0x00003F07 + bl sub_02017C80 +_02041E98: + ldr r0, _020420BC ; =_020AFE90 + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl ResumeAdvancedMenu + ldr r0, _020420BC ; =_020AFE90 + mov r1, #0 + ldr r0, [r0, #4] + str r1, [r0, #0x6f0] + b _020420B0 +_02041EBC: + ldrsb r0, [r3] + bl sub_0202812C + ldr r1, _020420BC ; =_020AFE90 + mov r2, #5 + ldr r0, [r1, #4] + add r0, r0, #0x700 + strh r2, [r0, #0x8e] + ldr r0, [r1, #4] + str r2, [r0, #0x6f0] + b _020420B0 +_02041EE4: + add r0, r3, #0x700 + ldrsh r2, [r0, #0x8e] + sub r2, r2, #1 + strh r2, [r0, #0x8e] + ldr r2, [r1, #4] + add r0, r2, #0x700 + ldrsh r0, [r0, #0x8e] + cmp r0, #0 + bge _020420B0 + mov r0, #4 + str r0, [r2, #0x6f0] + ldr r0, [r1, #4] + ldrsb r0, [r0] + bl CloseAdvancedMenu + ldr r0, _020420BC ; =_020AFE90 + mvn r1, #1 + ldr r0, [r0, #4] + strb r1, [r0] + b _020420B0 +_02041F30: + add r0, sp, #0xa8 + bl InitPreprocessorArgs + ldr r0, _020420BC ; =_020AFE90 + add ip, sp, #0xa8 + ldr r3, [r0, #4] + ldr r0, _020420DC ; =_020AFE98 + ldr r2, [r3, #0x838] + ldr r1, _020420E0 ; =0x00001013 + add r2, r3, r2 + ldrb lr, [r2, #0x64] + ldr r3, _020420E4 ; =0x00000A77 + mov r2, #0 + str lr, [sp, #0xb8] + str ip, [sp] + ldr ip, [sp, #0xb8] +#if defined(EUROPE) + add ip, ip, #0x32c + add ip, ip, #0x2400 +#elif defined(JAPAN) + add ip, ip, #0x358 + add ip, ip, #0x3c00 +#else + add ip, ip, #0x2a + add ip, ip, #0x2700 +#endif + mov ip, ip, lsl #0x10 + mov ip, ip, lsr #0x10 + str ip, [sp, #4] + str r2, [sp, #8] + bl CreateScrollBoxSingle + ldr r1, _020420BC ; =_020AFE90 + mov r2, #6 + ldr r3, [r1, #4] + strb r0, [r3, #1] + ldr r0, [r1, #4] + str r2, [r0, #0x6f0] + b _020420B0 +_02041FA4: + ldrsb r0, [r3, #1] + bl IsScrollBoxActive + cmp r0, #0 + bne _020420B0 + ldr r0, _020420BC ; =_020AFE90 + ldr r0, [r0, #4] + ldrsb r0, [r0, #1] + bl CloseScrollBox + ldr r0, _020420BC ; =_020AFE90 + mov r3, #7 + ldr r2, [r0, #4] + mov r1, #8 + str r3, [r2, #0x6f0] + ldr r0, [r0, #4] + add r0, r0, #0x700 + strh r1, [r0, #0x8e] + b _020420B0 +_02041FE8: + add r0, r3, #0x700 + ldrsh r2, [r0, #0x8e] + sub r2, r2, #1 + strh r2, [r0, #0x8e] + ldr r0, [r1, #4] + add r0, r0, #0x700 + ldrsh r2, [r0, #0x8e] + cmp r2, #0 + bge _020420B0 + mov r3, #0 + strh r3, [r0, #0x8e] + ldr r2, [r1, #4] + mov r0, #0xd + str r3, [r2, #0x6f0] + ldr r3, [r1, #4] + str r0, [sp, #0x14] + ldr r2, [r3, #0x838] +#ifdef JAPAN + ldr r1, _02042454 ; =0x00001586 +#else + rsb r1, r0, #0xa80 +#endif + mov r0, #0x10 + str r0, [sp, #0x1c] + str r2, [sp, #0x10] + strh r1, [sp, #0x18] + add r0, r3, #0x700 + ldrsh r1, [r0, #0x94] + ldr r2, [r3, #0x798] + add r0, r3, #0x64 + bl GetLearnableIqSkills + ldr ip, _020420BC ; =_020AFE90 + ldr r1, _020420E8 ; =0x80401C33 + ldr r3, [ip, #4] + add r2, sp, #0x10 + add r3, r3, #0x700 + strh r0, [r3, #0x8c] + ldr r3, [ip, #4] + ldr r0, _020420EC ; =_0209C98C + add r3, r3, #0x700 + ldrsh lr, [r3, #0x8c] + ldr r3, _020420F0 ; =sub_0204213C + mov ip, #8 + str lr, [sp] + str ip, [sp, #4] + bl CreateAdvancedMenu + ldr r1, _020420BC ; =_020AFE90 + ldr r1, [r1, #4] + strb r0, [r1] + b _020420B0 +_020420A0: + mov r0, #9 + str r0, [r3, #0x6f0] + mov r0, #1 + b _020420B4 +_020420B0: + mov r0, #0 +_020420B4: + add sp, sp, #0xf8 + ldmia sp!, {r4, pc} + .align 2, 0 +_020420BC: .word _020AFE90 +_020420C0: .word _0209C9B0 +_020420C4: .word _0209C9AC +_020420C8: .word _0209C99C +_020420CC: .word 0x80000233 +_020420D0: .word 0x00003F04 +_020420D4: .word 0x00003F03 +_020420D8: .word 0x00003F07 +_020420DC: .word _020AFE98 +_020420E0: .word 0x00001013 +#ifdef JAPAN +_020420E4: .word 0x0000158A +_02042454: .word 0x00001586 +#else +_020420E4: .word 0x00000A77 +#endif +_020420E8: .word 0x80401C33 +_020420EC: .word _0209C98C +_020420F0: .word sub_0204213C + arm_func_end sub_02041B7C + + arm_func_start sub_020420F4 +sub_020420F4: ; 0x020420F4 + stmdb sp!, {r3, lr} + ldr r0, _02042138 ; =_020AFE90 + ldr r0, [r0, #4] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0] + mvn r1, #1 + cmp r0, r1 + beq _0204211C + bl CloseAdvancedMenu +_0204211C: + ldr r0, _02042138 ; =_020AFE90 + ldr r0, [r0, #4] + bl MemFree + ldr r0, _02042138 ; =_020AFE90 + mov r1, #0 + str r1, [r0, #4] + ldmia sp!, {r3, pc} + .align 2, 0 +_02042138: .word _020AFE90 + arm_func_end sub_020420F4 + + arm_func_start sub_0204213C +sub_0204213C: ; 0x0204213C + stmdb sp!, {r3, r4, r5, r6, lr} + sub sp, sp, #0x84 + ldr r2, _02042248 ; =_020AFE90 + mov r4, r0 + ldr r2, [r2, #4] + mov r6, #0 + add r0, r2, r1 + ldrb r5, [r0, #0x64] + ldr r0, [r2, #0x790] + cmp r5, #0x18 + bne _02042174 + mov r0, #3 + bl GetPerformanceFlagWithChecks + b _0204217C +_02042174: + mov r1, r5 + bl IqSkillFlagTest +_0204217C: + cmp r0, #0 + movne r6, #1 + cmp r6, #0 + beq _020421DC + cmp r5, #0x38 + bgt _020421B4 + bge _020421BC + cmp r5, #0x1b + bgt _020421CC + cmp r5, #0x18 + blt _020421CC + cmpne r5, #0x1b + beq _020421BC + b _020421CC +_020421B4: + cmp r5, #0x39 + bne _020421CC +_020421BC: + ldr r1, _0204224C ; =_0209C9CC + add r0, sp, #0x44 + bl strcpy + b _020421E8 +_020421CC: + ldr r1, _02042250 ; =_0209C9D4 + add r0, sp, #0x44 + bl strcpy + b _020421E8 +_020421DC: + ldr r1, _02042254 ; =_0209C9DC + add r0, sp, #0x44 + bl strcpy +_020421E8: + ldr r1, _02042248 ; =_020AFE90 + mov r0, r5 + ldr r1, [r1, #4] + str r5, [r1, #0x24] + bl GetIqSkillStringId + mov r1, r0 + add r0, sp, #4 + mov r2, #0x40 + bl CopyNStringFromId + add r0, sp, #0x44 + add r1, sp, #4 + bl strcat + ldr r1, _02042248 ; =_020AFE90 + mov r0, r4 + ldr r2, [r1, #4] + mov r1, #0x40 + add r2, r2, #0x14 + str r2, [sp] + add r2, sp, #0x44 + mov r3, #0 + bl PreprocessString + mov r0, r4 + add sp, sp, #0x84 + ldmia sp!, {r3, r4, r5, r6, pc} + .align 2, 0 +_02042248: .word _020AFE90 +_0204224C: .word _0209C9CC +_02042250: .word _0209C9D4 +_02042254: .word _0209C9DC + arm_func_end sub_0204213C + + arm_func_start sub_02042258 +sub_02042258: ; 0x02042258 + stmdb sp!, {r3, r4, r5, r6, lr} + sub sp, sp, #0xc + mov r6, r0 + mov r0, #0xa0 + mov r1, #8 + mov r5, r2 + mov r4, r3 + bl MemAlloc + ldr r1, _020423B4 ; =_020AFEA8 + str r0, [r1, #4] + str r6, [r0] + bl RemoveEmptyItemsInBag + mov r0, #0x14 + bl Arm9LoadUnkFieldNa0x2029EC8 + ldr r1, _020423B4 ; =_020AFEA8 + cmp r4, #0 + ldr r3, [r1, #4] + ldrne r4, _020423B8 ; =sub_020423D8 + str r0, [r3, #8] + ldr r2, _020423BC ; =0x0000032F + ldr r0, [r1, #4] + mov ip, #0x10 + strh r2, [r0, #0x10] + ldr r0, [r1, #4] + mov r3, #0xd + str ip, [r0, #0x14] + ldr r0, [r1, #4] + ldr r2, _020423C0 ; =sub_0204261C + str r3, [r0, #0xc] + ldr r0, [r1, #4] + moveq r4, #0 + str r2, [r0, #0x7c] + bl GetNbItemsInBag + str r4, [sp] + str r0, [sp, #4] + ldr r0, _020423B4 ; =_020AFEA8 + str r5, [sp, #8] + ldr r2, [r0, #4] + ldr r0, _020423C4 ; =_0209C9E4 + ldr r1, _020423C8 ; =0x00443C33 + ldr r3, _020423CC ; =sub_02042760 + add r2, r2, #8 + bl CreateCollectionMenu + ldr r2, _020423B4 ; =_020AFEA8 + ldr r1, _020423D0 ; =sub_0204262C + ldr r3, [r2, #4] + strb r0, [r3, #4] + ldr r0, [r2, #4] + ldrsb r0, [r0, #4] + bl sub_0202D068 + ldr r0, _020423B4 ; =_020AFEA8 + ldr r1, _020423D4 ; =sub_0204263C + ldr r0, [r0, #4] + ldrsb r0, [r0, #4] + bl SetCollectionMenuVoidFn + ldr r0, _020423B4 ; =_020AFEA8 + mov r1, #0xd + ldr r0, [r0, #4] + ldrsb r0, [r0, #4] + bl SetCollectionMenuField0x1BC + ldr r0, _020423B4 ; =_020AFEA8 + ldr r1, [r0, #4] + ldr r0, [r1] + cmp r0, #3 + beq _02042368 + cmp r0, #4 + beq _0204237C + b _020423A0 +_02042368: +#ifdef EUROPE + ldrsb r0, [r1, #4] + mov r1, #9 + bl SetCollectionMenuField0x1BC +#endif + mov r0, #0 + bl sub_0204440C + mov r0, #2 + bl sub_0204426C + b _020423A0 +_0204237C: + ldrsb r0, [r1, #4] +#ifdef EUROPE + mov r1, #9 + bl SetCollectionMenuField0x1BC + ldr r0, _020423B4 ; =_020AFEA8 +#endif + mov r1, #0x76 +#ifdef EUROPE + ldr r0, [r0, #4] + ldrsb r0, [r0, #4] +#endif + bl SetCollectionMenuWidth + mov r0, #0 + bl sub_0204440C + mov r0, #0 + bl sub_0204426C + mov r0, #0 + bl sub_02044568 +_020423A0: + ldr r0, _020423B4 ; =_020AFEA8 + ldr r0, [r0, #4] + ldrsb r0, [r0, #4] + add sp, sp, #0xc + ldmia sp!, {r3, r4, r5, r6, pc} + .align 2, 0 +_020423B4: .word _020AFEA8 +_020423B8: .word sub_020423D8 +#ifdef JAPAN +_020423BC: .word 0x000031F4 +#else +_020423BC: .word 0x0000032F +#endif +_020423C0: .word sub_0204261C +_020423C4: .word _0209C9E4 +_020423C8: .word 0x00443C33 +_020423CC: .word sub_02042760 +_020423D0: .word sub_0204262C +_020423D4: .word sub_0204263C + arm_func_end sub_02042258 + + arm_func_start sub_020423D8 +sub_020423D8: ; 0x020423D8 + stmdb sp!, {r4, r5, r6, r7, r8, lr} + ldr r1, _02042618 ; =_020AFEA8 + mov r5, #0 + ldr r2, [r1, #4] + ldr r1, [r2] + cmp r1, #3 + bne _02042498 + tst r0, #0x800 + beq _02042498 + bl sub_02042B20 + cmp r0, #0 + ble _0204241C + bl sub_02042AF8 + mov r0, #6 + bl PlaySeVolumeWrapper + mov r5, #1 + b _020425D8 +_0204241C: + bl sub_0200FD48 + mov r4, r0 + bl CountNbOfItemsInStorage + sub r7, r4, r0 + mov r8, r5 + mov r6, #1 + ldr r4, _02042618 ; =_020AFEA8 + b _02042470 +_0204243C: + cmp r7, #0 + ble _02042478 + mov r0, r8, lsl #0x10 + mov r0, r0, asr #0x10 + bl GetItemAtIdx + ldrsh r0, [r0, #4] + bl IsStorableItem + cmp r0, #0 + ldrne r0, [r4, #8] + movne r5, r6 + strne r6, [r0, r8, lsl #2] + subne r7, r7, #1 + add r8, r8, #1 +_02042470: + cmp r8, #0x32 + blt _0204243C +_02042478: + cmp r5, #0 + beq _0204248C + mov r0, #6 + bl PlaySeVolumeWrapper + b _020425D8 +_0204248C: + mov r0, #2 + bl PlaySeVolumeWrapper + b _020425D8 +_02042498: + tst r0, #0x400 + beq _020425D8 + ldrsb r0, [r2, #4] + bl sub_0202D0EC + ldr r1, _02042618 ; =_020AFEA8 + mov r4, r0 + ldr r0, [r1, #4] + ldr r0, [r0] + cmp r0, #3 + beq _020424CC + cmp r0, #4 + beq _02042570 + b _020425D8 +_020424CC: + mov r0, r4, lsl #0x10 + mov r0, r0, asr #0x10 + bl GetItemAtIdx + ldrsh r0, [r0, #4] + bl IsStorableItem + cmp r0, #0 + beq _02042560 + ldr r0, _02042618 ; =_020AFEA8 + ldr r2, [r0, #8] + ldr r0, [r2, r4, lsl #2] + tst r0, #1 + beq _02042514 + mov r1, #0 + mov r0, #6 + str r1, [r2, r4, lsl #2] + bl PlaySeVolumeWrapper + mov r5, #1 + b _020425D8 +_02042514: + bl CountNbOfItemsInStorage + mov r6, r0 + bl sub_02042B20 + mov r5, r0 + bl sub_0200FD48 + add r1, r6, r5 + cmp r1, r0 + bge _02042550 + mov r0, #6 + bl PlaySeVolumeWrapper + ldr r0, _02042618 ; =_020AFEA8 + mov r5, #1 + ldr r0, [r0, #8] + str r5, [r0, r4, lsl #2] + b _020425D8 +_02042550: + mov r0, #2 + bl PlaySeVolumeWrapper + mov r5, #0 + b _020425D8 +_02042560: + mov r0, #2 + bl PlaySeVolumeWrapper + mov r5, #0 + b _020425D8 +_02042570: + mov r0, r4, lsl #0x10 + mov r0, r0, asr #0x10 + bl GetItemAtIdx + ldrsh r0, [r0, #4] + bl IsShoppableItem + cmp r0, #0 + beq _020425CC + ldr r0, _02042618 ; =_020AFEA8 + mov r5, #1 + ldr r2, [r0, #8] + ldr r0, [r2, r4, lsl #2] + tst r0, #1 + mov r0, #6 + beq _020425B8 + mov r1, #0 + str r1, [r2, r4, lsl #2] + bl PlaySeVolumeWrapper + b _020425D8 +_020425B8: + bl PlaySeVolumeWrapper + ldr r0, _02042618 ; =_020AFEA8 + ldr r0, [r0, #8] + str r5, [r0, r4, lsl #2] + b _020425D8 +_020425CC: + mov r0, #2 + bl PlaySeVolumeWrapper + mov r5, #0 +_020425D8: + bl sub_02042B20 + cmp r0, #0 + beq _020425FC + ldr r0, _02042618 ; =_020AFEA8 + mov r1, #1 + ldr r0, [r0, #4] + ldrsb r0, [r0, #4] + bl sub_0202D16C + b _02042610 +_020425FC: + ldr r0, _02042618 ; =_020AFEA8 + mov r1, #0 + ldr r0, [r0, #4] + ldrsb r0, [r0, #4] + bl sub_0202D16C +_02042610: + mov r0, r5 + ldmia sp!, {r4, r5, r6, r7, r8, pc} + .align 2, 0 +_02042618: .word _020AFEA8 + arm_func_end sub_020423D8 + + arm_func_start sub_0204261C +sub_0204261C: ; 0x0204261C + stmdb sp!, {r3, lr} + bl sub_02042BE0 + bl sub_02044308 + ldmia sp!, {r3, pc} + arm_func_end sub_0204261C + + arm_func_start sub_0204262C +sub_0204262C: ; 0x0204262C + stmdb sp!, {r3, lr} + bl sub_02042BE0 + bl sub_02044308 + ldmia sp!, {r3, pc} + arm_func_end sub_0204262C + + arm_func_start sub_0204263C +sub_0204263C: ; 0x0204263C + ldr r2, _0204265C ; =BAG_ITEMS_PTR_MIRROR + mov r1, #6 + ldr r2, [r2] + ldr ip, _02042660 ; =sub_020444B0 + ldr r2, [r2, #0x384] + mla r1, r0, r1, r2 + ldrsh r0, [r1, #4] + bx ip + .align 2, 0 +_0204265C: .word BAG_ITEMS_PTR_MIRROR +_02042660: .word sub_020444B0 + arm_func_end sub_0204263C + + arm_func_start sub_02042664 +sub_02042664: ; 0x02042664 + stmdb sp!, {r3, lr} + ldr r0, _020426B0 ; =_020AFEA8 + ldr r0, [r0, #4] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + bl sub_02044474 + bl sub_020442CC + bl sub_020445C8 + ldr r0, _020426B0 ; =_020AFEA8 + ldr r0, [r0, #4] + ldrsb r0, [r0, #4] + bl CloseCollectionMenu + ldr r0, _020426B0 ; =_020AFEA8 + ldr r0, [r0, #4] + bl MemFree + ldr r0, _020426B0 ; =_020AFEA8 + mov r1, #0 + str r1, [r0, #4] + ldmia sp!, {r3, pc} + .align 2, 0 +_020426B0: .word _020AFEA8 + arm_func_end sub_02042664 + + arm_func_start sub_020426B4 +sub_020426B4: ; 0x020426B4 + stmdb sp!, {r3, lr} + ldr r0, _0204272C ; =_020AFEA8 + ldr r0, [r0, #4] + cmp r0, #0 + moveq r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0, #4] + bl IsCollectionMenuActive + cmp r0, #0 + bne _02042708 + ldr r0, _0204272C ; =_020AFEA8 + ldr r0, [r0, #4] + ldrsb r0, [r0, #4] + bl sub_0202C75C + mvn r1, #0 + cmp r0, r1 + ldrne r1, _0204272C ; =_020AFEA8 + moveq r0, #2 + strneh r0, [r1] + movne r0, #3 + ldmia sp!, {r3, pc} +_02042708: + ldr r0, _0204272C ; =_020AFEA8 + ldr r0, [r0, #4] + ldrsb r0, [r0, #4] + bl sub_0202C748 + and r1, r0, #0xff + mov r0, #0x14 + bl Arm9StoreUnkFieldNa0x2029ED8 + mov r0, #0 + ldmia sp!, {r3, pc} + .align 2, 0 +_0204272C: .word _020AFEA8 + arm_func_end sub_020426B4 + + arm_func_start sub_02042730 +sub_02042730: ; 0x02042730 + ldr r0, _02042740 ; =_020AFEA8 + mov r1, #0 + strh r1, [r0] + bx lr + .align 2, 0 +_02042740: .word _020AFEA8 + arm_func_end sub_02042730 + + arm_func_start sub_02042744 +sub_02042744: ; 0x02042744 + ldr r0, _02042758 ; =_020AFEA8 + ldr ip, _0204275C ; =sub_0202C620 + ldr r0, [r0, #4] + ldrsb r0, [r0, #4] + bx ip + .align 2, 0 +_02042758: .word _020AFEA8 +_0204275C: .word sub_0202C620 + arm_func_end sub_02042744 + + arm_func_start sub_02042760 +sub_02042760: ; 0x02042760 + stmdb sp!, {r4, r5, r6, r7, lr} + sub sp, sp, #0x64 + mov r5, r1 + mov r1, #6 + ldr r3, _02042A64 ; =BAG_ITEMS_PTR_MIRROR + mul r4, r5, r1 + ldr r1, [r3] + ldr r3, _02042A68 ; =_020AFEA8 + ldr r6, [r1, #0x384] + ldr r7, [r3, #4] + ldrh r1, [r6, r4] + add lr, r6, r4 + mov r4, r2 + strh r1, [sp] + ldrh ip, [lr, #2] + mov r6, r0 + add r1, sp, #0 + strh ip, [sp, #2] + ldrh r2, [lr, #4] + strh r2, [sp, #4] + ldr r2, [r7] + cmp r2, #5 + addls pc, pc, r2, lsl #2 + b _02042A3C +_020427C0: ; jump table + b _020427D8 ; case 0 + b _020427E4 ; case 1 + b _020427E4 ; case 2 + b _02042808 ; case 3 + b _020428D4 ; case 4 + b _020429E8 ; case 5 +_020427D8: + mov r2, #0 + bl sub_0200D670 + b _02042A3C +_020427E4: + mov r7, #0 + mov r3, #1 + add r2, sp, #8 + str r7, [sp, #8] + strb r7, [sp, #0xc] + strb r3, [sp, #0x10] + strb r3, [sp] + bl sub_0200D670 + b _02042A3C +_02042808: + mov r1, #0 + mov r0, #1 + str r1, [sp, #8] + strb r1, [sp, #0xc] + strb r0, [sp, #0x10] + strb r0, [sp] + ldr r0, [r3, #8] + ldr r0, [r0, r5, lsl #2] + tst r0, #1 + bne _0204284C + mov r0, r5, lsl #0x10 + mov r0, r0, asr #0x10 + bl GetItemAtIdx + ldrsh r0, [r0, #4] + bl IsStorableItem + cmp r0, #0 + beq _02042890 +_0204284C: + add r0, sp, #0x14 + add r1, sp, #0 + add r2, sp, #8 + bl sub_0200D670 + ldrb r2, [sp, #1] + cmp r2, #0 + beq _0204287C + ldr r1, _02042A6C ; =_0209C9F4 + add r3, sp, #0x14 + mov r0, r6 + bl SprintfStatic__02042A84 + b _02042A3C +_0204287C: + ldr r1, _02042A70 ; =_0209C9FC + add r2, sp, #0x14 + mov r0, r6 + bl SprintfStatic__02042A84 + b _02042A3C +_02042890: + add r0, sp, #0x14 + add r1, sp, #0 + add r2, sp, #8 + bl sub_0200D65C + ldrb r2, [sp, #1] + cmp r2, #0 + beq _020428C0 + ldr r1, _02042A74 ; =_0209CA08 + add r3, sp, #0x14 + mov r0, r6 + bl SprintfStatic__02042A84 + b _02042A3C +_020428C0: + ldr r1, _02042A78 ; =_0209CA18 + add r2, sp, #0x14 + mov r0, r6 + bl SprintfStatic__02042A84 + b _02042A3C +_020428D4: + ldrsh r0, [sp, #4] + bl IsShoppableItem + cmp r0, #0 + beq _020429A4 + mov r7, #3 + mov r3, #0 + mov r2, #0x6a + mov r1, #1 + add r0, sp, #0 + str r7, [sp, #8] + strb r3, [sp, #0xc] + strh r2, [sp, #0xe] + strb r1, [sp, #0x10] + strb r7, [sp] + bl GetActualSellPrice + mov r7, r0 + bl GetMoneyCarried + ldr r1, _02042A7C ; =0x0001869F + add r0, r7, r0 + cmp r0, r1 + add r0, sp, #0x14 + add r1, sp, #0 + add r2, sp, #8 + bgt _0204296C + bl sub_0200D670 + ldrb r2, [sp, #1] + cmp r2, #0 + beq _02042958 + ldr r1, _02042A6C ; =_0209C9F4 + add r3, sp, #0x14 + mov r0, r6 + bl SprintfStatic__02042A84 + b _02042A3C +_02042958: + ldr r1, _02042A70 ; =_0209C9FC + add r2, sp, #0x14 + mov r0, r6 + bl SprintfStatic__02042A84 + b _02042A3C +_0204296C: + bl sub_0200D65C + ldrb r2, [sp, #1] + cmp r2, #0 + beq _02042990 + ldr r1, _02042A74 ; =_0209CA08 + add r3, sp, #0x14 + mov r0, r6 + bl SprintfStatic__02042A84 + b _02042A3C +_02042990: + ldr r1, _02042A78 ; =_0209CA18 + add r2, sp, #0x14 + mov r0, r6 + bl SprintfStatic__02042A84 + b _02042A3C +_020429A4: + add r0, sp, #0x14 + add r1, sp, #0 + mov r2, #0 + bl sub_0200D65C + ldrb r2, [sp, #1] + cmp r2, #0 + beq _020429D4 + ldr r1, _02042A74 ; =_0209CA08 + add r3, sp, #0x14 + mov r0, r6 + bl SprintfStatic__02042A84 + b _02042A3C +_020429D4: + ldr r1, _02042A78 ; =_0209CA18 + add r2, sp, #0x14 + mov r0, r6 + bl SprintfStatic__02042A84 + b _02042A3C +_020429E8: + ldrsh r0, [sp, #4] + mov r2, #0 + mov r1, #1 + str r2, [sp, #8] + strb r2, [sp, #0xc] + strb r1, [sp, #0x10] + strb r1, [sp] + bl IsGummi + cmp r0, #0 + add r1, sp, #0 + add r2, sp, #8 + beq _02042A24 + mov r0, r6 + bl sub_0200D670 + b _02042A3C +_02042A24: + add r0, sp, #0x14 + bl sub_0200D65C + ldr r1, _02042A80 ; =_0209CA2C + add r2, sp, #0x14 + mov r0, r6 + bl SprintfStatic__02042A84 +_02042A3C: + ldr r0, _02042A68 ; =_020AFEA8 + ldr r0, [r0, #8] + ldr r0, [r0, r5, lsl #2] + tst r0, #1 + movne r0, #1 + moveq r0, #0 + str r0, [r4] + mov r0, r6 + add sp, sp, #0x64 + ldmia sp!, {r4, r5, r6, r7, pc} + .align 2, 0 +_02042A64: .word BAG_ITEMS_PTR_MIRROR +_02042A68: .word _020AFEA8 +_02042A6C: .word _0209C9F4 +_02042A70: .word _0209C9FC +_02042A74: .word _0209CA08 +_02042A78: .word _0209CA18 +_02042A7C: .word 0x0001869F +_02042A80: .word _0209CA2C + arm_func_end sub_02042760 + + arm_func_start SprintfStatic__02042A84 +SprintfStatic__02042A84: ; 0x02042A84 + stmdb sp!, {r0, r1, r2, r3} + stmdb sp!, {r3, lr} + add r2, sp, #0xc + bic r2, r2, #3 + ldr r1, [sp, #0xc] + add r2, r2, #4 + bl vsprintf + ldmia sp!, {r3, lr} + add sp, sp, #0x10 + bx lr + arm_func_end SprintfStatic__02042A84 + + arm_func_start sub_02042AAC +sub_02042AAC: ; 0x02042AAC + stmdb sp!, {r3, lr} + ldr r0, _02042AD8 ; =_020AFEA8 + ldr r0, [r0, #4] + cmp r0, #0 + ldrnesb r0, [r0, #4] + mvnne r1, #1 + cmpne r0, r1 + moveq r0, #0 + ldmeqia sp!, {r3, pc} + bl IsCollectionMenuState3 + ldmia sp!, {r3, pc} + .align 2, 0 +_02042AD8: .word _020AFEA8 + arm_func_end sub_02042AAC + + arm_func_start sub_02042ADC +sub_02042ADC: ; 0x02042ADC + ldr r0, _02042AF0 ; =_020AFEA8 + ldr ip, _02042AF4 ; =sub_0202D0EC + ldr r0, [r0, #4] + ldrsb r0, [r0, #4] + bx ip + .align 2, 0 +_02042AF0: .word _020AFEA8 +_02042AF4: .word sub_0202D0EC + arm_func_end sub_02042ADC + + arm_func_start sub_02042AF8 +sub_02042AF8: ; 0x02042AF8 + mov r3, #0 + ldr r0, _02042B1C ; =_020AFEA8 + mov r2, r3 +_02042B04: + ldr r1, [r0, #8] + str r2, [r1, r3, lsl #2] + add r3, r3, #1 + cmp r3, #0x32 + blt _02042B04 + bx lr + .align 2, 0 +_02042B1C: .word _020AFEA8 + arm_func_end sub_02042AF8 + + arm_func_start sub_02042B20 +sub_02042B20: ; 0x02042B20 + ldr r1, _02042B4C ; =_020AFEA8 + mov r0, #0 + ldr r3, [r1, #8] + mov r2, r0 +_02042B30: + ldr r1, [r3, r2, lsl #2] + add r2, r2, #1 + tst r1, #1 + addne r0, r0, #1 + cmp r2, #0x32 + blt _02042B30 + bx lr + .align 2, 0 +_02042B4C: .word _020AFEA8 + arm_func_end sub_02042B20 + + arm_func_start sub_02042B50 +sub_02042B50: ; 0x02042B50 + ldr r1, _02042B80 ; =_020AFEA8 + mov r0, #0 + ldr r2, [r1, #8] + b _02042B70 +_02042B60: + ldr r1, [r2, r0, lsl #2] + tst r1, #1 + bxne lr + add r0, r0, #1 +_02042B70: + cmp r0, #0x32 + blt _02042B60 + mvn r0, #0 + bx lr + .align 2, 0 +_02042B80: .word _020AFEA8 + arm_func_end sub_02042B50 + + arm_func_start sub_02042B84 +sub_02042B84: ; 0x02042B84 + ldr r1, _02042B94 ; =_020AFEA8 + ldr r1, [r1, #8] + ldr r0, [r1, r0, lsl #2] + bx lr + .align 2, 0 +_02042B94: .word _020AFEA8 + arm_func_end sub_02042B84 + + arm_func_start sub_02042B98 +sub_02042B98: ; 0x02042B98 + stmdb sp!, {r3, lr} + mov r0, #0xc8 + mov r1, #8 + bl MemAlloc + ldr r1, _02042BB8 ; =_020AFEA8 + str r0, [r1, #8] + bl sub_02042AF8 + ldmia sp!, {r3, pc} + .align 2, 0 +_02042BB8: .word _020AFEA8 + arm_func_end sub_02042B98 + + arm_func_start sub_02042BBC +sub_02042BBC: ; 0x02042BBC + stmdb sp!, {r3, lr} + ldr r0, _02042BDC ; =_020AFEA8 + ldr r0, [r0, #8] + bl MemFree + ldr r0, _02042BDC ; =_020AFEA8 + mov r1, #0 + str r1, [r0, #8] + ldmia sp!, {r3, pc} + .align 2, 0 +_02042BDC: .word _020AFEA8 + arm_func_end sub_02042BBC + + arm_func_start sub_02042BE0 +sub_02042BE0: ; 0x02042BE0 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + bl GetNbItemsInBag + mov r1, #6 + mov r4, r0 + mov r0, #0 + ldr ip, _02042CE8 ; =_020AFEA8 + ldr r3, _02042CEC ; =BAG_ITEMS_PTR_MIRROR + mov r2, r1 + b _02042C44 +_02042C04: + ldr r5, [ip, #8] + ldr r5, [r5, r0, lsl #2] + tst r5, #1 + muleq r6, r0, r1 + ldreq r5, [r3] + ldreq r7, [r5, #0x384] + ldreqb r5, [r7, r6] + biceq r5, r5, #0x80 + beq _02042C3C + mul r6, r0, r2 + ldr r5, [r3] + ldr r7, [r5, #0x384] + ldrb r5, [r7, r6] + orr r5, r5, #0x80 +_02042C3C: + strb r5, [r7, r6] + add r0, r0, #1 +_02042C44: + cmp r0, r4 + blt _02042C04 + bl SortItemsInBag + mov r2, #0 + mov r7, r2 + mov r0, #1 + mov r3, #6 + ldr lr, _02042CEC ; =BAG_ITEMS_PTR_MIRROR + ldr ip, _02042CE8 ; =_020AFEA8 + b _02042CA4 +_02042C6C: + mul r1, r2, r3 + ldr r5, [lr] + ldr r5, [r5, #0x384] + ldrb r5, [r5, r1] + tst r5, #0x80 + ldr r5, [ip, #8] + strne r0, [r5, r2, lsl #2] + streq r7, [r5, r2, lsl #2] + ldr r5, [lr] + add r2, r2, #1 + ldr r6, [r5, #0x384] + ldrb r5, [r6, r1] + bic r5, r5, #0x80 + strb r5, [r6, r1] +_02042CA4: + cmp r2, r4 + blt _02042C6C + ldr r1, _02042CE8 ; =_020AFEA8 + mvn r0, #1 + ldr r1, [r1, #4] + ldrsb r1, [r1, #4] + cmp r1, r0 + ldmeqia sp!, {r3, r4, r5, r6, r7, pc} + bl GetNbItemsInBag + ldr r2, _02042CE8 ; =_020AFEA8 + mov r1, r0 + ldr r0, [r2, #4] + mov r2, #8 + ldrsb r0, [r0, #4] + mov r3, #0 + bl sub_0202C654 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_02042CE8: .word _020AFEA8 +_02042CEC: .word BAG_ITEMS_PTR_MIRROR + arm_func_end sub_02042BE0 + + arm_func_start sub_02042CF0 +sub_02042CF0: ; 0x02042CF0 + stmdb sp!, {r4, r5, lr} + sub sp, sp, #0xc + mov r5, r0 + mov r0, #0x18c0 + mov r1, #8 + mov r4, r2 + bl MemAlloc + ldr r2, _02042F88 ; =_020AFEB4 + mvn r3, #1 + str r0, [r2, #4] + str r5, [r0] + ldr r0, [r2, #4] + mov r1, #0 + strb r3, [r0, #0x7d5] + ldr r0, [r2, #4] + strb r3, [r0, #0x7d6] + ldr r0, [r2, #4] + strb r3, [r0, #0x7d7] + ldr r0, [r2, #4] + strb r3, [r0, #0x7d8] + ldr r0, [r2, #4] + strb r3, [r0, #0x7d9] + ldr r0, [r2, #4] + str r1, [r0, #0x90c] + ldr r0, [r2, #4] + add r0, r0, #0x900 + strh r1, [r0, #0x10] + ldr r0, [r2, #0x10] + bl sub_02043BFC + ldr r2, _02042F88 ; =_020AFEB4 + ldr r1, [r2, #4] + add r1, r1, #0x900 + strh r0, [r1, #0x10] + ldr r0, [r2, #4] + add r0, r0, #0x900 + ldrsh r0, [r0, #0x10] + cmp r0, #0 + ble _02042DB4 + ldr r0, [r2, #0x10] + cmp r0, #5 + bne _02042DB4 + ldrsh r0, [r2] + cmp r0, #0 + beq _02042DB4 + bl sub_020440F8 + ldr r1, _02042F88 ; =_020AFEB4 + ldr r1, [r1, #4] + add r1, r1, #0x900 + strh r0, [r1, #0x10] +_02042DB4: + ldr r0, _02042F88 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x900 + ldrsh r0, [r0, #0x10] + cmp r0, #0 + bgt _02042DF0 + mov r0, #9 + mov r1, #0 + bl sub_02043BFC + ldr r2, _02042F88 ; =_020AFEB4 + mov r3, #9 + ldr r1, [r2, #4] + add r1, r1, #0x900 + strh r0, [r1, #0x10] + str r3, [r2, #0x10] +_02042DF0: + ldr r1, _02042F88 ; =_020AFEB4 + sub r2, r5, #2 + ldr r0, [r1, #4] + ldr r5, _02042F8C ; =0x000002F3 + add r0, r0, #0x1000 + str r4, [r0, #0x8bc] + ldrsh ip, [r1, #2] + ldr r0, [r1, #4] + mov r3, #0x10 + str ip, [r0, #0x7dc] + ldr r0, [r1, #4] + mov ip, #0xd + add r0, r0, #0x700 + strh r5, [r0, #0xe4] + ldr r0, [r1, #4] + ldr r5, _02042F90 ; =_0204357C + str r3, [r0, #0x7e8] + ldr r0, [r1, #4] + ldr r3, _02042F94 ; =_020441BC + str ip, [r0, #0x7e0] + ldr r0, [r1, #4] + cmp r2, #5 + str r5, [r0, #0x858] + ldr r0, [r1, #4] + mov r5, #0 + str r3, [r0, #0x850] + bhi _02042E6C + mov r0, #1 + mov r1, r0, lsl r2 + tst r1, #0x2b + movne r5, r0 +_02042E6C: + ldr r1, _02042F88 ; =_020AFEB4 + cmp r5, #0 + movne r2, #0 + ldr r3, [r1, #4] + ldreq r2, _02042F98 ; =sub_02042FB8 + ldr r0, _02042F9C ; =_0209CA58 + str r2, [sp] + add r2, r3, #0x900 + ldrsh r5, [r2, #0x10] + add r2, r3, #0x3dc + ldr r1, _02042FA0 ; =0x00447C33 + str r5, [sp, #4] + ldr r3, _02042FA4 ; =_020432B4 + add r2, r2, #0x400 + str r4, [sp, #8] + bl CreateCollectionMenu + ldr r2, _02042F88 ; =_020AFEB4 + ldr r1, _02042FA8 ; =sub_020430F4 + ldr r3, [r2, #4] + strb r0, [r3, #0x7d4] + ldr r0, [r2, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + bl sub_0202D068 + ldr r0, _02042F88 ; =_020AFEB4 + ldr r1, _02042FAC ; =sub_02043148 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + bl SetCollectionMenuVoidFn + ldr r0, _02042F88 ; =_020AFEB4 + ldr r0, [r0, #4] + ldr r0, [r0] + cmp r0, #7 + addls pc, pc, r0, lsl #2 + b _02042F70 +_02042EFC: ; jump table + b _02042F70 ; case 0 + b _02042F28 ; case 1 + b _02042F28 ; case 2 + b _02042F1C ; case 3 + b _02042F28 ; case 4 + b _02042F60 ; case 5 + b _02042F3C ; case 6 + b _02042F60 ; case 7 +_02042F1C: + mov r0, #0 + bl sub_0204440C + b _02042F70 +_02042F28: + mov r0, #0 + bl sub_0204440C + mov r0, #2 + bl sub_0204426C + b _02042F70 +_02042F3C: + ldr r0, _02042FB0 ; =_0209CA48 + ldr r1, _02042FB4 ; =sub_02044210 + bl CreateTextBox + ldr r1, _02042F88 ; =_020AFEB4 + ldr r1, [r1, #4] + strb r0, [r1, #0x7d5] + mov r0, #1 + bl sub_0204426C + b _02042F70 +_02042F60: + mov r0, #0 + bl sub_0204440C + mov r0, #1 + bl sub_0204426C +_02042F70: + ldr r0, _02042F88 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + add sp, sp, #0xc + ldmia sp!, {r4, r5, pc} + .align 2, 0 +_02042F88: .word _020AFEB4 +#ifdef JAPAN +_02042F8C: .word 0x0000239B +#else +_02042F8C: .word 0x000002F3 +#endif +_02042F90: .word sub_0204357C +_02042F94: .word sub_020441BC +_02042F98: .word sub_02042FB8 +_02042F9C: .word _0209CA58 +_02042FA0: .word 0x00447C33 +_02042FA4: .word sub_020432B4 +_02042FA8: .word sub_020430F4 +_02042FAC: .word sub_02043148 +_02042FB0: .word _0209CA48 +_02042FB4: .word sub_02044210 + arm_func_end sub_02042CF0 + + arm_func_start sub_02042FB8 +sub_02042FB8: ; 0x02042FB8 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + tst r0, #0x400 + mov r4, #0 + beq _020430A8 + ldr r0, _020430F0 ; =_020AFEB4 + ldr r0, [r0, #4] + ldr r0, [r0] + cmp r0, #1 + cmpne r0, #4 + cmpne r0, #6 + bne _020430A8 + bl sub_02043468 + ldr r1, _020430F0 ; =_020AFEB4 + mov r5, r0 + ldr r0, [r1, #8] + ldrb r0, [r0, r5] + tst r0, #1 + movne r4, #1 + bne _0204303C + ldr r0, [r1, #4] + ldr r0, [r0] + cmp r0, #1 + bne _02043038 + bl GetNbItemsInBag + mov r7, r0 + bl sub_020434FC + mov r6, r0 + bl GetCurrentBagCapacity + add r1, r7, r6 + cmp r1, r0 + movlt r4, #1 + b _0204303C +_02043038: + mov r4, #1 +_0204303C: + cmp r4, #0 + beq _020430A0 + mov r0, #6 + bl PlaySeVolumeWrapper + ldr r0, _020430F0 ; =_020AFEB4 + mvn r1, #1 + ldr r3, [r0, #8] + ldrb r2, [r3, r5] + eor r2, r2, #1 + strb r2, [r3, r5] + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd6] + cmp r0, r1 + beq _0204307C + bl sub_0202F9B8 +_0204307C: + ldr r0, _020430F0 ; =_020AFEB4 + ldr r1, [r0, #4] + ldr r0, [r1] + cmp r0, #6 + bne _020430A8 + add r0, r1, #0x700 + ldrsb r0, [r0, #0xd5] + bl sub_0202F9B8 + b _020430A8 +_020430A0: + mov r0, #2 + bl PlaySeVolumeWrapper +_020430A8: + bl sub_020434FC + cmp r0, #0 + ble _020430D0 + ldr r0, _020430F0 ; =_020AFEB4 + mov r1, #1 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + bl sub_0202D16C + b _020430E8 +_020430D0: + ldr r0, _020430F0 ; =_020AFEB4 + mov r1, #0 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + bl sub_0202D16C +_020430E8: + mov r0, r4 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_020430F0: .word _020AFEB4 + arm_func_end sub_02042FB8 + + arm_func_start sub_020430F4 +sub_020430F4: ; 0x020430F4 + stmdb sp!, {r3, lr} + ldr r0, _02043144 ; =_020AFEB4 + mov r1, #1 + ldr r0, [r0, #0x10] + bl sub_02043BFC + ldr r2, _02043144 ; =_020AFEB4 + mov r3, #0 + ldr r1, [r2, #4] + add r1, r1, #0x900 + strh r0, [r1, #0x10] + ldr r2, [r2, #4] + add r0, r2, #0x700 + add r1, r2, #0x900 + add r2, r2, #0x1000 + ldrsb r0, [r0, #0xd4] + ldrsh r1, [r1, #0x10] + ldr r2, [r2, #0x8bc] + bl sub_0202C654 + bl sub_02044308 + ldmia sp!, {r3, pc} + .align 2, 0 +_02043144: .word _020AFEB4 + arm_func_end sub_020430F4 + + arm_func_start sub_02043148 +sub_02043148: ; 0x02043148 + stmdb sp!, {r3, lr} + ldr r1, _02043168 ; =_020AFEB4 + ldr r1, [r1, #4] + add r0, r1, r0, lsl #1 + ldrsh r0, [r0, #4] + bl sub_02010044 + bl sub_020444B0 + ldmia sp!, {r3, pc} + .align 2, 0 +_02043168: .word _020AFEB4 + arm_func_end sub_02043148 + + arm_func_start sub_0204316C +sub_0204316C: ; 0x0204316C + cmp r0, #0 + movne r0, #5 + moveq r0, #7 + bx lr + arm_func_end sub_0204316C + + arm_func_start sub_0204317C +sub_0204317C: ; 0x0204317C + stmdb sp!, {r3, lr} + ldr r0, _02043214 ; =_020AFEB4 + ldr r0, [r0, #4] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + bl sub_02044474 + bl sub_020442CC + bl sub_020445C8 + ldr r0, _02043214 ; =_020AFEB4 + ldr r1, [r0, #4] + ldr r0, [r1] + cmp r0, #6 + bne _020431BC + add r0, r1, #0x700 + ldrsb r0, [r0, #0xd5] + bl CloseTextBox +_020431BC: + ldr r0, _02043214 ; =_020AFEB4 + mvn r1, #1 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd6] + cmp r0, r1 + beq _020431DC + bl CloseTextBox +_020431DC: + ldr r1, _02043214 ; =_020AFEB4 + ldr r0, [r1, #4] + ldr r2, [r0] + add r0, r0, #0x700 + str r2, [r1, #0xc] + ldrsb r0, [r0, #0xd4] + bl CloseCollectionMenu + ldr r0, _02043214 ; =_020AFEB4 + ldr r0, [r0, #4] + bl MemFree + ldr r0, _02043214 ; =_020AFEB4 + mov r1, #0 + str r1, [r0, #4] + ldmia sp!, {r3, pc} + .align 2, 0 +_02043214: .word _020AFEB4 + arm_func_end sub_0204317C + + arm_func_start sub_02043218 +sub_02043218: ; 0x02043218 + ldr r0, _02043228 ; =_020AFEB4 + mov r1, #0 + strh r1, [r0, #2] + bx lr + .align 2, 0 +_02043228: .word _020AFEB4 + arm_func_end sub_02043218 + + arm_func_start sub_0204322C +sub_0204322C: ; 0x0204322C + ldr r1, _02043238 ; =_020AFEB4 + strh r0, [r1, #2] + bx lr + .align 2, 0 +_02043238: .word _020AFEB4 + arm_func_end sub_0204322C + + arm_func_start sub_0204323C +sub_0204323C: ; 0x0204323C + stmdb sp!, {r3, lr} + bl sub_02043254 + ldr r1, _02043250 ; =_020AFEB4 + strh r0, [r1, #2] + ldmia sp!, {r3, pc} + .align 2, 0 +_02043250: .word _020AFEB4 + arm_func_end sub_0204323C + + arm_func_start sub_02043254 +sub_02043254: ; 0x02043254 + ldr r1, _02043298 ; =_020AFEB4 + mov r3, #0 + ldr ip, [r1, #4] + mvn r1, #0 + b _02043278 +_02043268: + cmp r0, r2 + moveq r0, r3 + bxeq lr + add r3, r3, #1 +_02043278: + cmp r3, #0x3e8 + bge _02043290 + add r2, ip, r3, lsl #1 + ldrsh r2, [r2, #4] + cmp r2, r1 + bne _02043268 +_02043290: + mov r0, #0 + bx lr + .align 2, 0 +_02043298: .word _020AFEB4 + arm_func_end sub_02043254 + + arm_func_start sub_0204329C +sub_0204329C: ; 0x0204329C + ldr r1, _020432B0 ; =_020AFEB4 + ldr r1, [r1, #4] + add r0, r1, r0, lsl #1 + ldrsh r0, [r0, #4] + bx lr + .align 2, 0 +_020432B0: .word _020AFEB4 + arm_func_end sub_0204329C + + arm_func_start sub_020432B4 +sub_020432B4: ; 0x020432B4 + stmdb sp!, {r4, r5, r6, lr} + sub sp, sp, #8 + ldr r3, _02043318 ; =_020AFEB4 + mov r5, r0 + ldr r0, [r3, #4] + mov r4, r2 + add r0, r0, r1, lsl #1 + ldrsh r6, [r0, #4] + add r1, sp, #0 + mov r0, r6 + bl ConvertStorageItemAtIdxToItem + ldr r2, _0204331C ; =_0209CA3C + add r1, sp, #0 + mov r0, r5 + bl sub_0200D670 + ldr r0, _02043318 ; =_020AFEB4 + ldr r0, [r0, #8] + ldrb r0, [r0, r6] + tst r0, #1 + movne r0, #1 + moveq r0, #0 + str r0, [r4] + mov r0, r5 + add sp, sp, #8 + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_02043318: .word _020AFEB4 +_0204331C: .word _0209CA3C + arm_func_end sub_020432B4 + + arm_func_start sub_02043320 +sub_02043320: ; 0x02043320 + stmdb sp!, {r3, lr} + cmp r0, #7 + bne _02043344 + bl CountNbOfValidItemsInTimeDarknessInStorage + cmp r0, #0 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + ldmia sp!, {r3, pc} +_02043344: + sub r0, r0, #5 + cmp r0, #1 + bhi _02043368 + bl CountNbOfValidItemsInStorage + cmp r0, #0 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + ldmia sp!, {r3, pc} +_02043368: + bl CountNbOfItemsInStorage + cmp r0, #0 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + ldmia sp!, {r3, pc} + arm_func_end sub_02043320 + + arm_func_start sub_02043380 +sub_02043380: ; 0x02043380 + stmdb sp!, {r3, lr} + cmp r0, #8 + moveq r0, #0 + ldmeqia sp!, {r3, pc} + bl IsStorageFull + ldmia sp!, {r3, pc} + arm_func_end sub_02043380 + + arm_func_start sub_02043398 +sub_02043398: ; 0x02043398 + stmdb sp!, {r3, lr} + ldr r0, _020433BC ; =_020AFEB4 + ldr r0, [r0, #4] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + bl sub_0202D134 + ldmia sp!, {r3, pc} + .align 2, 0 +_020433BC: .word _020AFEB4 + arm_func_end sub_02043398 + + arm_func_start sub_020433C0 +sub_020433C0: ; 0x020433C0 + ldr r0, _020433D8 ; =_020AFEB4 + ldr ip, _020433DC ; =sub_0202C620 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + bx ip + .align 2, 0 +_020433D8: .word _020AFEB4 +_020433DC: .word sub_0202C620 + arm_func_end sub_020433C0 + + arm_func_start sub_020433E0 +sub_020433E0: ; 0x020433E0 + ldr r0, _020433FC ; =_020AFEB4 + ldr r0, [r0, #4] + cmp r0, #0 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_020433FC: .word _020AFEB4 + arm_func_end sub_020433E0 + + arm_func_start sub_02043400 +sub_02043400: ; 0x02043400 + stmdb sp!, {r3, lr} + ldr r0, _02043430 ; =_020AFEB4 + ldr r0, [r0, #4] + cmp r0, #0 + addne r0, r0, #0x700 + ldrnesb r0, [r0, #0xd4] + mvnne r1, #1 + cmpne r0, r1 + moveq r0, #0 + ldmeqia sp!, {r3, pc} + bl IsCollectionMenuActive + ldmia sp!, {r3, pc} + .align 2, 0 +_02043430: .word _020AFEB4 + arm_func_end sub_02043400 + + arm_func_start sub_02043434 +sub_02043434: ; 0x02043434 + stmdb sp!, {r3, lr} + ldr r0, _02043464 ; =_020AFEB4 + ldr r0, [r0, #4] + cmp r0, #0 + addne r0, r0, #0x700 + ldrnesb r0, [r0, #0xd4] + mvnne r1, #1 + cmpne r0, r1 + moveq r0, #0 + ldmeqia sp!, {r3, pc} + bl IsCollectionMenuState3 + ldmia sp!, {r3, pc} + .align 2, 0 +_02043464: .word _020AFEB4 + arm_func_end sub_02043434 + + arm_func_start sub_02043468 +sub_02043468: ; 0x02043468 + stmdb sp!, {r3, lr} + ldr r0, _020434D0 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + bl IsCollectionMenuActive + cmp r0, #0 + beq _020434A0 + ldr r0, _020434D0 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + bl sub_0202C748 + b _020434B4 +_020434A0: + ldr r0, _020434D0 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + bl sub_0202C75C +_020434B4: + cmp r0, #0 + ldrge r1, _020434D0 ; =_020AFEB4 + mvnlt r0, #0 + ldrge r1, [r1, #4] + addge r0, r1, r0, lsl #1 + ldrgesh r0, [r0, #4] + ldmia sp!, {r3, pc} + .align 2, 0 +_020434D0: .word _020AFEB4 + arm_func_end sub_02043468 + + arm_func_start sub_020434D4 +sub_020434D4: ; 0x020434D4 + mov r3, #0 + ldr r0, _020434F8 ; =_020AFEB4 + mov r2, r3 +_020434E0: + ldr r1, [r0, #8] + strb r2, [r1, r3] + add r3, r3, #1 + cmp r3, #0x3e8 + blt _020434E0 + bx lr + .align 2, 0 +_020434F8: .word _020AFEB4 + arm_func_end sub_020434D4 + + arm_func_start sub_020434FC +sub_020434FC: ; 0x020434FC + ldr r1, _02043528 ; =_020AFEB4 + mov r0, #0 + ldr r3, [r1, #8] + mov r2, r0 +_0204350C: + ldrb r1, [r3, r2] + add r2, r2, #1 + tst r1, #1 + addne r0, r0, #1 + cmp r2, #0x3e8 + blt _0204350C + bx lr + .align 2, 0 +_02043528: .word _020AFEB4 + arm_func_end sub_020434FC + + arm_func_start sub_0204352C +sub_0204352C: ; 0x0204352C + ldr r0, _02043564 ; =_020AFEB4 + mov r1, #0 + ldr r2, [r0, #8] + b _02043554 +_0204353C: + ldrb r0, [r2, r1] + tst r0, #1 + movne r0, r1, lsl #0x10 + movne r0, r0, asr #0x10 + bxne lr + add r1, r1, #1 +_02043554: + cmp r1, #0x3e8 + blt _0204353C + mvn r0, #0 + bx lr + .align 2, 0 +_02043564: .word _020AFEB4 + arm_func_end sub_0204352C + + arm_func_start sub_02043568 +sub_02043568: ; 0x02043568 + ldr r1, _02043578 ; =_020AFEB4 + ldr r1, [r1, #8] + ldrb r0, [r1, r0] + bx lr + .align 2, 0 +_02043578: .word _020AFEB4 + arm_func_end sub_02043568 + + arm_func_start sub_0204357C +sub_0204357C: ; 0x0204357C + stmdb sp!, {r3, r4, lr} + sub sp, sp, #0x1c + ldr r4, _020435C4 ; =_0209CA98 + add lr, sp, #0 + ldmia r4!, {r0, r1, r2, r3} + mov ip, lr + stmia lr!, {r0, r1, r2, r3} + ldmia r4, {r0, r1, r2} + ldr r3, _020435C8 ; =_020AFEB4 + stmia lr, {r0, r1, r2} + ldr r0, [r3, #4] + ldr r0, [r0, #0x90c] + cmp r0, #7 + bge _020435BC + ldr r0, [ip, r0, lsl #2] + blx r0 +_020435BC: + add sp, sp, #0x1c + ldmia sp!, {r3, r4, pc} + .align 2, 0 +_020435C4: .word _0209CA98 +_020435C8: .word _020AFEB4 + arm_func_end sub_0204357C + + arm_func_start sub_020435CC +sub_020435CC: ; 0x020435CC + stmdb sp!, {r3, r4, lr} + sub sp, sp, #4 + ldr r0, _02043760 ; =_020AFEB4 + mvn r1, #1 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd8] + cmp r0, r1 + bne _0204361C + ldr r0, _02043764 ; =_0209CA68 + mov r4, #0xa + ldr r3, _02043768 ; =_0209CAB4 + mov r1, #0x13 + mov r2, #0 + str r4, [sp] + bl CreateSimpleMenuFromStringIds + ldr r1, _02043760 ; =_020AFEB4 + ldr r1, [r1, #4] + strb r0, [r1, #0x7d8] + b _02043758 +_0204361C: + bl IsSimpleMenuActive + cmp r0, #0 + bne _02043758 + ldr r0, _02043760 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd8] + bl GetSimpleMenuResult + ldr r1, _02043760 ; =_020AFEB4 + mov r4, r0 + ldr r0, [r1, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd8] + bl CloseSimpleMenu + ldr r0, _02043760 ; =_020AFEB4 + mvn r2, #1 + ldr r1, [r0, #4] + cmp r4, #8 + strb r2, [r1, #0x7d8] + ldreq r0, [r0, #4] + mov r1, #0 + streq r1, [r0, #0x90c] + beq _02043744 + mov r0, r4 + bl sub_02043BFC + mvn r1, #0 + cmp r0, r1 + bne _020436F4 + ldr r0, _02043760 ; =_020AFEB4 + sub r1, r1, #1 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd5] + cmp r0, r1 + beq _020436AC + bl sub_0202812C +_020436AC: + ldr r0, _02043760 ; =_020AFEB4 + mvn r1, #1 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd6] + cmp r0, r1 + beq _020436CC + bl sub_0202812C +_020436CC: + ldr r0, _02043760 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + bl sub_0202812C + ldr r0, _02043760 ; =_020AFEB4 + mov r1, #1 + ldr r0, [r0, #4] + str r1, [r0, #0x90c] + b _02043758 +_020436F4: + ldr r2, _02043760 ; =_020AFEB4 + ldr r1, [r2, #4] + add r1, r1, #0x900 + strh r0, [r1, #0x10] + ldr r1, [r2, #4] + add r0, r1, #0x700 + add r1, r1, #0x900 + ldrsb r0, [r0, #0xd4] + ldrsh r1, [r1, #0x10] + bl sub_0202C6D4 + cmp r4, #5 + ldreq r0, _02043760 ; =_020AFEB4 + moveq r1, #4 + ldreq r0, [r0, #4] + streq r1, [r0, #0x90c] + beq _02043758 + ldr r0, _02043760 ; =_020AFEB4 + mov r1, #0 + ldr r0, [r0, #4] + str r1, [r0, #0x90c] +_02043744: + ldr r0, _02043760 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + bl sub_0202C620 +_02043758: + add sp, sp, #4 + ldmia sp!, {r3, r4, pc} + .align 2, 0 +_02043760: .word _020AFEB4 +_02043764: .word _0209CA68 +_02043768: .word _0209CAB4 + arm_func_end sub_020435CC + + arm_func_start sub_0204376C +sub_0204376C: ; 0x0204376C + stmdb sp!, {r3, lr} + ldr r0, _020437B4 ; =_0209CA88 + bl CreateDialogueBox + ldr r3, _020437B8 ; =_020AFEB4 + ldr r1, _020437BC ; =0x00000418 + ldr ip, [r3, #4] + ldr r2, _020437C0 ; =0x000002FF + strb r0, [ip, #0x7d7] + ldr r0, [r3, #4] + mov r3, #0 + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd7] + bl ShowStringIdInDialogueBox + ldr r0, _020437B8 ; =_020AFEB4 + mov r1, #2 + ldr r0, [r0, #4] + str r1, [r0, #0x90c] + ldmia sp!, {r3, pc} + .align 2, 0 +_020437B4: .word _0209CA88 +_020437B8: .word _020AFEB4 +_020437BC: .word 0x00000418 +#ifdef JAPAN +_020437C0: .word 0x000023A7 +#else +_020437C0: .word 0x000002FF +#endif + arm_func_end sub_0204376C + + arm_func_start sub_020437C4 +sub_020437C4: ; 0x020437C4 + stmdb sp!, {r3, lr} + ldr r0, _02043840 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd7] + bl IsDialogueBoxActive + cmp r0, #0 + ldmneia sp!, {r3, pc} + mov r0, #9 + mov r1, #0 + bl sub_02043BFC + ldr r2, _02043840 ; =_020AFEB4 + ldr r1, [r2, #4] + add r1, r1, #0x900 + strh r0, [r1, #0x10] + ldr r1, [r2, #4] + add r0, r1, #0x700 + add r1, r1, #0x900 + ldrsb r0, [r0, #0xd4] + ldrsh r1, [r1, #0x10] + bl sub_0202C6D4 + ldr r0, _02043840 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd7] + bl sub_0202F2C4 + ldr r0, _02043840 ; =_020AFEB4 + mov r1, #3 + ldr r0, [r0, #4] + str r1, [r0, #0x90c] + ldmia sp!, {r3, pc} + .align 2, 0 +_02043840: .word _020AFEB4 + arm_func_end sub_020437C4 + + arm_func_start sub_02043844 +sub_02043844: ; 0x02043844 + stmdb sp!, {r3, lr} + ldr r0, _02043940 ; =_020AFEB4 + mvn r1, #1 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd7] + cmp r0, r1 + ldmeqia sp!, {r3, pc} + bl CloseDialogueBox + ldr r0, _02043940 ; =_020AFEB4 + mvn r2, #1 + ldr r1, [r0, #4] + strb r2, [r1, #0x7d7] + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd5] + cmp r0, r2 + beq _020438AC + bl sub_02028354 + cmp r0, #3 + bne _020438AC + ldr r0, _02043940 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd5] + bl sub_0202810C +_020438AC: + ldr r0, _02043940 ; =_020AFEB4 + mvn r1, #1 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd6] + cmp r0, r1 + beq _020438E8 + bl sub_02028354 + cmp r0, #3 + bne _020438E8 + ldr r0, _02043940 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd6] + bl sub_0202810C +_020438E8: + ldr r0, _02043940 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + bl sub_02028354 + cmp r0, #3 + bne _02043918 + ldr r0, _02043940 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + bl sub_0202810C +_02043918: + ldr r0, _02043940 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + bl sub_0202C620 + ldr r0, _02043940 ; =_020AFEB4 + mov r1, #0 + ldr r0, [r0, #4] + str r1, [r0, #0x90c] + ldmia sp!, {r3, pc} + .align 2, 0 +_02043940: .word _020AFEB4 + arm_func_end sub_02043844 + + arm_func_start sub_02043944 +sub_02043944: ; 0x02043944 + stmdb sp!, {r3, lr} + sub sp, sp, #8 + ldr r0, _020439E8 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0xb4 + add r0, r0, #0x1800 + bl sub_020547C8 + ldr r0, _020439E8 ; =_020AFEB4 + mov r1, #0 + ldr r0, [r0, #4] + add r0, r0, #0xb4 + add r0, r0, #0x1800 + bl sub_02054804 + ldr r1, _020439E8 ; =_020AFEB4 + ldr r2, _020439EC ; =0x000002FE + ldr r0, [r1, #4] + mov r3, #0x10 + add r0, r0, #0x800 + strh r2, [r0, #0x7c] + ldr r2, [r1, #4] + ldr r0, _020439F0 ; =_0209CA78 + str r3, [r2, #0x880] + ldr r3, [r1, #4] + ldr r1, _020439F4 ; =0x00481813 + add r2, r3, #0x1800 + ldrsh ip, [r2, #0xb4] + add r2, r3, #0x74 + ldr r3, _020439F8 ; =sub_02043BAC + str ip, [sp] + mov ip, #9 + add r2, r2, #0x800 + str ip, [sp, #4] + bl CreateAdvancedMenu + ldr r1, _020439E8 ; =_020AFEB4 + mov r2, #5 + ldr r3, [r1, #4] + strb r0, [r3, #0x7d9] + ldr r0, [r1, #4] + str r2, [r0, #0x90c] + add sp, sp, #8 + ldmia sp!, {r3, pc} + .align 2, 0 +_020439E8: .word _020AFEB4 +#ifdef JAPAN +_020439EC: .word 0x000023A6 +#else +_020439EC: .word 0x000002FE +#endif +_020439F0: .word _0209CA78 +_020439F4: .word 0x00481813 +_020439F8: .word sub_02043BAC + arm_func_end sub_02043944 + + arm_func_start sub_020439FC +sub_020439FC: ; 0x020439FC + stmdb sp!, {r3, r4, r5, lr} + ldr r0, _02043B78 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd9] + bl IsAdvancedMenuActive2 + cmp r0, #0 + ldmneia sp!, {r3, r4, r5, pc} + ldr r0, _02043B78 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd9] + bl GetAdvancedMenuCurrentOption + ldr r1, _02043B78 ; =_020AFEB4 + mov r4, r0, lsl #0x10 + ldr r0, [r1, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd9] + bl GetAdvancedMenuResult + ldr r1, _02043B78 ; =_020AFEB4 + mov r5, r0, lsl #0x10 + ldr r0, [r1, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd9] + bl CloseAdvancedMenu + ldr r0, _02043B78 ; =_020AFEB4 + mvn r3, #1 + ldr r1, [r0, #4] + mov r2, r4, asr #0xf + strb r3, [r1, #0x7d9] + ldr r1, [r0, #4] + add r0, r1, #0x1000 + add r1, r1, #0xb4 + ldr r3, [r0, #0x8b8] + add r0, r1, #0x1800 + ldrsh r4, [r3, r2] + bl sub_020547D8 + mvn r0, #0 + cmp r0, r5, asr #16 + bne _02043AB8 + ldr r0, _02043B78 ; =_020AFEB4 + mov r1, #0 + strh r1, [r0] + ldr r0, [r0, #4] + mov r1, #6 + str r1, [r0, #0x90c] + ldmia sp!, {r3, r4, r5, pc} +_02043AB8: + mov r0, r4 + bl sub_020440F8 + cmp r0, #0 + bgt _02043B38 + ldr r0, _02043B78 ; =_020AFEB4 + mov r1, #0 + strh r1, [r0] + ldr r0, [r0, #4] + sub r1, r1, #2 + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd5] + cmp r0, r1 + beq _02043AF0 + bl sub_0202812C +_02043AF0: + ldr r0, _02043B78 ; =_020AFEB4 + mvn r1, #1 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd6] + cmp r0, r1 + beq _02043B10 + bl sub_0202812C +_02043B10: + ldr r0, _02043B78 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + bl sub_0202812C + ldr r0, _02043B78 ; =_020AFEB4 + mov r1, #1 + ldr r0, [r0, #4] + str r1, [r0, #0x90c] + ldmia sp!, {r3, r4, r5, pc} +_02043B38: + ldr r2, _02043B78 ; =_020AFEB4 + strh r4, [r2] + ldr r1, [r2, #4] + add r1, r1, #0x900 + strh r0, [r1, #0x10] + ldr r1, [r2, #4] + add r0, r1, #0x700 + add r1, r1, #0x900 + ldrsb r0, [r0, #0xd4] + ldrsh r1, [r1, #0x10] + bl sub_0202C6D4 + ldr r0, _02043B78 ; =_020AFEB4 + mov r1, #6 + ldr r0, [r0, #4] + str r1, [r0, #0x90c] + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_02043B78: .word _020AFEB4 + arm_func_end sub_020439FC + + arm_func_start sub_02043B7C +sub_02043B7C: ; 0x02043B7C + stmdb sp!, {r3, lr} + ldr r0, _02043BA8 ; =_020AFEB4 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd4] + bl sub_0202C620 + ldr r0, _02043BA8 ; =_020AFEB4 + mov r1, #0 + ldr r0, [r0, #4] + str r1, [r0, #0x90c] + ldmia sp!, {r3, pc} + .align 2, 0 +_02043BA8: .word _020AFEB4 + arm_func_end sub_02043B7C + + arm_func_start sub_02043BAC +sub_02043BAC: ; 0x02043BAC + stmdb sp!, {r4, lr} + mov r4, r0 + cmp r1, #0 + blt _02043BD4 + ldr r2, _02043BF8 ; =_020AFEB4 + ldr r3, [r2, #4] + add r2, r3, #0x1800 + ldrsh r2, [r2, #0xb4] + cmp r1, r2 + blt _02043BDC +_02043BD4: + mov r0, #0 + ldmia sp!, {r4, pc} +_02043BDC: + add r2, r3, #0x1000 + ldr r2, [r2, #0x8b8] + mov r1, r1, lsl #1 + ldrsh r1, [r2, r1] + bl GetNameRaw + mov r0, r4 + ldmia sp!, {r4, pc} + .align 2, 0 +_02043BF8: .word _020AFEB4 + arm_func_end sub_02043BAC + + arm_func_start sub_02043BFC +sub_02043BFC: ; 0x02043BFC + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + ldr r2, _0204408C ; =_020AFEB4 + mov sb, r0 + ldr r0, [r2, #4] + mov r4, r1 + ldr r6, [r0] + bl sub_0200FD48 + sub r1, r6, #5 + mov r5, r0 + cmp r1, #2 + mov r7, #0 + movls r0, #1 + movhi r0, r7 + cmp r4, #0 + and r4, r0, #0xff + beq _02043D0C + mov r0, #0x3e8 + mov r1, #8 + bl MemAlloc + mov r8, r0 + mov sl, #0 + ldr r0, _0204408C ; =_020AFEB4 + mov r1, sl + mov r2, #1 +_02043C5C: + ldr r3, [r0, #8] + ldrb r3, [r3, sl] + cmp r3, #1 + moveq r3, r2 + movne r3, r1 + strb r3, [r8, sl] + add sl, sl, #1 + cmp sl, #0x3e8 + blt _02043C5C + bl sub_0200FD48 + mov r1, r0 + mov r0, r8 + bl SortItemsInStorage + mov sl, #0 + ldr r0, _0204408C ; =_020AFEB4 + mov r2, sl + mov r3, #1 +_02043CA0: + ldrb r1, [r8, sl] + cmp r1, #0 + movne fp, r3 + ldr r1, [r0, #8] + moveq fp, r2 + strb fp, [r1, sl] + add sl, sl, #1 + cmp sl, #0x3e8 + blt _02043CA0 + mov r0, r8 + bl MemFree + ldr r0, _0204408C ; =_020AFEB4 + mvn r1, #1 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd5] + cmp r0, r1 + beq _02043CEC + bl sub_0202F9B8 +_02043CEC: + ldr r0, _0204408C ; =_020AFEB4 + mvn r1, #1 + ldr r0, [r0, #4] + add r0, r0, #0x700 + ldrsb r0, [r0, #0xd6] + cmp r0, r1 + beq _02043D0C + bl sub_0202F9B8 +_02043D0C: + mov r8, #0 + b _02043DE4 +_02043D14: + ldr r0, _02044090 ; =BAG_ITEMS_PTR_MIRROR + ldr r0, [r0] + add r0, r0, r8, lsl #1 + add r0, r0, #0x300 + ldrsh r1, [r0, #0x8a] + cmp r1, #0 + beq _02043DEC + cmp r4, #0 + beq _02043D48 + ldrsh r0, [r0, #0x8a] + bl IsItemValidVeneer + cmp r0, #0 + beq _02043DD8 +_02043D48: + cmp r6, #7 + bne _02043DBC + ldr r0, _02044090 ; =BAG_ITEMS_PTR_MIRROR + ldr r0, [r0] + add r1, r0, r8, lsl #1 + add r0, r1, #0x300 + ldrsh sl, [r0, #0x8a] + add r0, r1, #0xb00 + ldrh fp, [r0, #0x5a] + mov r0, sl + bl IsItemInTimeDarkness + cmp r0, #0 + beq _02043DB0 + mov r0, sl + bl IsTreasureBox + cmp r0, #0 + beq _02043DA8 + mov r0, fp, lsl #0x10 + mov r0, r0, asr #0x10 + bl IsItemInTimeDarkness + cmp r0, #0 + beq _02043DB0 + mov r0, #1 + b _02043DB4 +_02043DA8: + mov r0, #1 + b _02043DB4 +_02043DB0: + mov r0, #0 +_02043DB4: + cmp r0, #0 + beq _02043DD8 +_02043DBC: + ldr r0, _0204408C ; =_020AFEB4 + add r2, r7, #1 + ldr r0, [r0, #4] + add r1, r0, r7, lsl #1 + mov r0, r2, lsl #0x10 + strh r8, [r1, #4] + mov r7, r0, asr #0x10 +_02043DD8: + add r0, r8, #1 + mov r0, r0, lsl #0x10 + mov r8, r0, asr #0x10 +_02043DE4: + cmp r8, r5 + blt _02043D14 +_02043DEC: + mov r4, r7 + mvn r3, #0 + ldr r1, _0204408C ; =_020AFEB4 + b _02043E14 +_02043DFC: + ldr r2, [r1, #4] + add r0, r4, #1 + add r2, r2, r4, lsl #1 + mov r0, r0, lsl #0x10 + strh r3, [r2, #4] + mov r4, r0, asr #0x10 +_02043E14: + cmp r4, r5 + blt _02043DFC + mov r0, r7, lsl #0x10 + ldr r4, _0204408C ; =_020AFEB4 + mov r5, r0, asr #0x10 + cmp r5, #0 + str sb, [r4, #0x10] + movle r0, #9 + strle r0, [r4, #0x10] + suble r0, r0, #0xa + ldmleia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + cmp sb, #9 + moveq r0, r5 + ldmeqia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + mov r8, #0 + mov r7, r8 + mov fp, #1 + ldr sl, _02044090 ; =BAG_ITEMS_PTR_MIRROR + b _02044070 +_02043E60: + ldr r1, [r4, #4] + ldr r0, [sl] + add r1, r1, r7, lsl #1 + ldrsh r6, [r1, #4] + add r0, r0, r6, lsl #1 + add r0, r0, #0x300 + ldrsh r0, [r0, #0x8a] + bl GetItemCategoryVeneer + ldr r1, [sl] + add r1, r1, r6, lsl #1 + add r1, r1, #0x300 + ldrsh r1, [r1, #0x8a] + cmp r1, #0x5c + bgt _02043EA0 + beq _02043F20 + b _02043F24 +_02043EA0: + sub r1, r1, #0x190 + cmp r1, #0x1b + addls pc, pc, r1, lsl #2 + b _02043F24 +_02043EB0: ; jump table + b _02043F20 ; case 0 + b _02043F20 ; case 1 + b _02043F20 ; case 2 + b _02043F20 ; case 3 + b _02043F20 ; case 4 + b _02043F20 ; case 5 + b _02043F20 ; case 6 + b _02043F20 ; case 7 + b _02043F20 ; case 8 + b _02043F20 ; case 9 + b _02043F20 ; case 10 + b _02043F20 ; case 11 + b _02043F20 ; case 12 + b _02043F20 ; case 13 + b _02043F20 ; case 14 + b _02043F20 ; case 15 + b _02043F20 ; case 16 + b _02043F20 ; case 17 + b _02043F20 ; case 18 + b _02043F20 ; case 19 + b _02043F20 ; case 20 + b _02043F20 ; case 21 + b _02043F20 ; case 22 + b _02043F20 ; case 23 + b _02043F20 ; case 24 + b _02043F20 ; case 25 + b _02043F20 ; case 26 + b _02043F20 ; case 27 +_02043F20: + mov r0, #7 +_02043F24: + cmp sb, #9 + addls pc, pc, sb, lsl #2 + b _0204402C +_02043F30: ; jump table + b _02043F58 ; case 0 + b _02043F70 ; case 1 + b _02043F88 ; case 2 + b _02043F9C ; case 3 + b _02043FB4 ; case 4 + b _02043FC8 ; case 5 + b _02043FDC ; case 6 + b _02043FF8 ; case 7 + b _0204402C ; case 8 + b _0204402C ; case 9 +_02043F58: + cmp r0, #0 + cmpne r0, #1 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + b _02044030 +_02043F70: + cmp r0, #2 + cmpne r0, #3 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + b _02044030 +_02043F88: + cmp r0, #4 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + b _02044030 +_02043F9C: + cmp r0, #5 + cmpne r0, #0xb + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + b _02044030 +_02043FB4: + cmp r0, #9 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + b _02044030 +_02043FC8: + cmp r0, #0xf + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + b _02044030 +_02043FDC: + add r0, r0, #0xf4 + and r0, r0, #0xff + cmp r0, #2 + movls r0, #1 + movhi r0, #0 + and r0, r0, #0xff + b _02044030 +_02043FF8: + add r0, r0, #0xfa + and r0, r0, #0xff + cmp r0, #4 + mov r1, #0 + bhi _02044018 + mov r0, fp, lsl r0 + tst r0, #0x17 + movne r1, fp +_02044018: + cmp r1, #0 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + b _02044030 +_0204402C: + mov r0, #1 +_02044030: + cmp r0, #0 + beq _02044064 + ldr r0, [r4, #4] + add r1, r8, #1 + mov r1, r1, lsl #0x10 + add r2, r0, r8, lsl #1 + ldrsh r2, [r2, #4] + add r0, r0, r7, lsl #1 + strh r2, [r0, #4] + ldr r0, [r4, #4] + add r0, r0, r8, lsl #1 + strh r6, [r0, #4] + mov r8, r1, asr #0x10 +_02044064: + add r0, r7, #1 + mov r0, r0, lsl #0x10 + mov r7, r0, asr #0x10 +_02044070: + cmp r7, r5 + blt _02043E60 + cmp r8, #0 + mvnle r8, #0 + mov r0, r8, lsl #0x10 + mov r0, r0, asr #0x10 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_0204408C: .word _020AFEB4 +_02044090: .word BAG_ITEMS_PTR_MIRROR + arm_func_end sub_02043BFC + + arm_func_start sub_02044094 +sub_02044094: ; 0x02044094 + stmdb sp!, {r3, lr} + mov r0, #0x3e8 + mov r1, #8 + bl MemAlloc + ldr r1, _020440B4 ; =_020AFEB4 + str r0, [r1, #8] + bl sub_020434D4 + ldmia sp!, {r3, pc} + .align 2, 0 +_020440B4: .word _020AFEB4 + arm_func_end sub_02044094 + + arm_func_start sub_020440B8 +sub_020440B8: ; 0x020440B8 + stmdb sp!, {r3, lr} + ldr r0, _020440D8 ; =_020AFEB4 + ldr r0, [r0, #8] + bl MemFree + ldr r0, _020440D8 ; =_020AFEB4 + mov r1, #0 + str r1, [r0, #8] + ldmia sp!, {r3, pc} + .align 2, 0 +_020440D8: .word _020AFEB4 + arm_func_end sub_020440B8 + + arm_func_start sub_020440DC +sub_020440DC: ; 0x020440DC + ldr r0, _020440F4 ; =_020AFEB4 + mov r1, #9 + str r1, [r0, #0x10] + mov r1, #0 + strh r1, [r0] + bx lr + .align 2, 0 +_020440F4: .word _020AFEB4 + arm_func_end sub_020440DC + + arm_func_start sub_020440F8 +sub_020440F8: ; 0x020440F8 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + mov sb, #0 + mov sl, r0 + mov r1, sb + bl GetType + mov r6, r0 + mov r0, sl + mov r1, #1 + bl GetType + mov r7, r0 + mov r8, sb + ldr r4, _020441B4 ; =_020AFEB4 + ldr fp, _020441B8 ; =BAG_ITEMS_PTR_MIRROR + b _02044198 +_02044130: + add r0, r1, r8, lsl #1 + ldrsh r5, [r0, #4] + ldr r0, [fp] + mov r1, sl + add r0, r0, r5, lsl #1 + add r0, r0, #0x300 + ldrsh r0, [r0, #0x8a] + mov r2, r6 + mov r3, r7 + bl IsExclusiveItemIdForMonster + cmp r0, #0 + beq _0204418C + ldr r3, [r4, #4] + add r0, sb, #1 + add r1, r3, sb, lsl #1 + ldrsh r2, [r1, #4] + add r1, r3, r8, lsl #1 + mov r0, r0, lsl #0x10 + strh r2, [r1, #4] + ldr r1, [r4, #4] + add r1, r1, sb, lsl #1 + strh r5, [r1, #4] + mov sb, r0, asr #0x10 +_0204418C: + add r0, r8, #1 + mov r0, r0, lsl #0x10 + mov r8, r0, asr #0x10 +_02044198: + ldr r1, [r4, #4] + add r0, r1, #0x900 + ldrsh r0, [r0, #0x10] + cmp r8, r0 + blt _02044130 + mov r0, sb + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_020441B4: .word _020AFEB4 +_020441B8: .word BAG_ITEMS_PTR_MIRROR + arm_func_end sub_020440F8 + + arm_func_start sub_020441BC +sub_020441BC: ; 0x020441BC + stmdb sp!, {r3, lr} + ldr r0, _0204420C ; =_020AFEB4 + mov r1, #1 + ldr r0, [r0, #0x10] + bl sub_02043BFC + ldr r2, _0204420C ; =_020AFEB4 + mov r3, #0 + ldr r1, [r2, #4] + add r1, r1, #0x900 + strh r0, [r1, #0x10] + ldr r2, [r2, #4] + add r0, r2, #0x700 + add r1, r2, #0x900 + add r2, r2, #0x1000 + ldrsb r0, [r0, #0xd4] + ldrsh r1, [r1, #0x10] + ldr r2, [r2, #0x8bc] + bl sub_0202C654 + bl sub_02044308 + ldmia sp!, {r3, pc} + .align 2, 0 +_0204420C: .word _020AFEB4 + arm_func_end sub_020441BC + + arm_func_start sub_02044210 +sub_02044210: ; 0x02044210 + stmdb sp!, {r3, r4, lr} + sub sp, sp, #0x54 + mov r4, r0 + bl sub_02027B1C +#ifdef JAPAN + ldr r3, _020445D8 ; =0x000023A8 +#endif + mov r0, r4 + mov r1, #0xa + mov r2, #2 +#ifndef JAPAN + mov r3, #0x300 +#endif + bl sub_02026268 + bl sub_020434FC + str r0, [sp, #0x28] + add r1, sp, #4 + str r1, [sp] + ldr r3, _02044268 ; =0x00000301 + mov r0, r4 + mov r1, #0x66 + mov r2, #2 + bl sub_020262E0 + mov r0, r4 + bl UpdateWindow + add sp, sp, #0x54 + ldmia sp!, {r3, r4, pc} + .align 2, 0 +#ifdef JAPAN +_020445D8: .word 0x000023A8 +_02044268: .word 0x000023A9 +#else +_02044268: .word 0x00000301 +#endif + arm_func_end sub_02044210 + + arm_func_start sub_0204426C +sub_0204426C: ; 0x0204426C + stmdb sp!, {r4, lr} + mov r4, r0 + mov r0, #8 + mov r1, r0 + bl MemAlloc + ldr r1, _020442C0 ; =_020AFEC8 + mov r3, #1 + str r0, [r1] + str r4, [r0] + ldr r0, [r1] + ldr r2, _020442C4 ; =_0209CB0C + strb r3, [r0, #4] + ldr r0, [r1] + ldr r1, _020442C8 ; =sub_02044338 + ldr r0, [r0] + add r0, r2, r0, lsl #4 + bl CreateTextBox + ldr r1, _020442C0 ; =_020AFEC8 + ldr r1, [r1] + strb r0, [r1, #5] + ldmia sp!, {r4, pc} + .align 2, 0 +_020442C0: .word _020AFEC8 +_020442C4: .word _0209CB0C +_020442C8: .word sub_02044338 + arm_func_end sub_0204426C + + arm_func_start sub_020442CC +sub_020442CC: ; 0x020442CC + stmdb sp!, {r3, lr} + ldr r0, _02044304 ; =_020AFEC8 + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0, #5] + bl CloseTextBox2 + ldr r0, _02044304 ; =_020AFEC8 + ldr r0, [r0] + bl MemFree + ldr r0, _02044304 ; =_020AFEC8 + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_02044304: .word _020AFEC8 + arm_func_end sub_020442CC + + arm_func_start sub_02044308 +sub_02044308: ; 0x02044308 + stmdb sp!, {r3, lr} + ldr r0, _02044334 ; =_020AFEC8 + ldr r2, [r0] + cmp r2, #0 + ldmeqia sp!, {r3, pc} + mov r1, #1 + strb r1, [r2, #4] + ldr r0, [r0] + ldrsb r0, [r0, #5] + bl sub_0202F9B8 + ldmia sp!, {r3, pc} + .align 2, 0 +_02044334: .word _020AFEC8 + arm_func_end sub_02044308 + + arm_func_start sub_02044338 +sub_02044338: ; 0x02044338 + stmdb sp!, {r4, r5, lr} + sub sp, sp, #0x54 + ldr r1, _02044404 ; =_020AFEC8 + mov r5, r0 + ldr r2, [r1] + ldrb r1, [r2, #4] + cmp r1, #0 + beq _020443FC + mov r1, #0 + strb r1, [r2, #4] + mov r4, #2 + bl sub_02027B1C + ldr r0, _02044404 ; =_020AFEC8 + ldr r0, [r0] + ldr r0, [r0] + cmp r0, #0 + cmpne r0, #2 + bne _020443B0 + bl GetNbItemsInBag + str r0, [sp, #0x28] + bl GetCurrentBagCapacity +#ifdef JAPAN + str r0, [sp, #0x2c] + add r2, sp, #4 + str r2, [sp] + ldr r3, _0204477C ; =0x000031F7 + mov r0, r5 + mov r1, #0 + mov r2, #2 +#else + mov r2, #2 + str r0, [sp, #0x2c] + add r1, sp, #4 + str r1, [sp] + mov r0, r5 + add r3, r2, #0x330 + mov r1, #0 +#endif + bl sub_020262E0 + add r4, r4, #0x10 +_020443B0: + ldr r0, _02044404 ; =_020AFEC8 + ldr r0, [r0] + ldr r0, [r0] + sub r0, r0, #1 + cmp r0, #1 + bhi _020443F4 + bl CountNbOfItemsInStorage + str r0, [sp, #0x28] + bl sub_0200FD48 + str r0, [sp, #0x2c] + add ip, sp, #4 + ldr r3, _02044408 ; =0x00000333 + mov r0, r5 + mov r2, r4 + mov r1, #0 + str ip, [sp] + bl sub_020262E0 +_020443F4: + mov r0, r5 + bl UpdateWindow +_020443FC: + add sp, sp, #0x54 + ldmia sp!, {r4, r5, pc} + .align 2, 0 +_02044404: .word _020AFEC8 +#ifdef JAPAN +_0204477C: .word 0x000031F7 +_02044408: .word 0x000031F8 +#else +_02044408: .word 0x00000333 +#endif + arm_func_end sub_02044338 + + arm_func_start sub_0204440C +sub_0204440C: ; 0x0204440C + stmdb sp!, {r4, lr} + mov r4, r0 + mov r0, #0xc + mov r1, #8 + bl MemAlloc + ldr r2, _02044468 ; =_020AFECC + mov ip, #0 + str r0, [r2] + str r4, [r0] + ldr r1, [r2] + ldr r0, _0204446C ; =_0209CB3C + strh ip, [r1, #6] + ldr r3, [r2] + ldr r1, _02044470 ; =sub_020444F0 + strh ip, [r3, #8] + ldr r2, [r2] + mov r3, #1 + strb r3, [r2, #4] + bl CreateTextBox + ldr r1, _02044468 ; =_020AFECC + ldr r1, [r1] + strb r0, [r1, #0xa] + ldmia sp!, {r4, pc} + .align 2, 0 +_02044468: .word _020AFECC +_0204446C: .word _0209CB3C +_02044470: .word sub_020444F0 + arm_func_end sub_0204440C + + arm_func_start sub_02044474 +sub_02044474: ; 0x02044474 + stmdb sp!, {r3, lr} + ldr r0, _020444AC ; =_020AFECC + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0, #0xa] + bl CloseTextBox2 + ldr r0, _020444AC ; =_020AFECC + ldr r0, [r0] + bl MemFree + ldr r0, _020444AC ; =_020AFECC + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_020444AC: .word _020AFECC + arm_func_end sub_02044474 + + arm_func_start sub_020444B0 +sub_020444B0: ; 0x020444B0 + stmdb sp!, {r3, lr} + ldr r1, _020444EC ; =_020AFECC + ldr r3, [r1] + cmp r3, #0 + ldrnesh r2, [r3, #6] + cmpne r2, r0 + ldmeqia sp!, {r3, pc} + strh r0, [r3, #6] + ldr r0, [r1] + mov r2, #1 + strb r2, [r0, #4] + ldr r0, [r1] + ldrsb r0, [r0, #0xa] + bl sub_0202F9B8 + ldmia sp!, {r3, pc} + .align 2, 0 +_020444EC: .word _020AFECC + arm_func_end sub_020444B0 + + arm_func_start sub_020444F0 +sub_020444F0: ; 0x020444F0 + stmdb sp!, {r4, lr} + ldr r1, _02044564 ; =_020AFECC + mov r4, r0 + ldr r2, [r1] + ldrb r1, [r2, #4] + cmp r1, #0 + ldmeqia sp!, {r4, pc} + mov r1, #0 + strb r1, [r2, #4] + bl sub_02027B1C + ldr r0, _02044564 ; =_020AFECC + ldr r2, [r0] + ldrsh r1, [r2, #6] + strh r1, [r2, #8] + ldr r0, [r0] + ldrsh r0, [r0, #8] + cmp r0, #0 + beq _02044558 +#if defined(EUROPE) + add r0, r0, #0x4b + add r0, r0, #0x2f00 +#elif defined(JAPAN) + add r0, r0, #0x41 + add r0, r0, #0x1d00 +#else + add r0, r0, #0x49 + add r0, r0, #0x2f00 +#endif + mov r3, r0, lsl #0x10 + mov r1, #2 + mov r0, r4 + mov r2, r1 + mov r3, r3, lsr #0x10 + bl sub_02026268 +_02044558: + mov r0, r4 + bl UpdateWindow + ldmia sp!, {r4, pc} + .align 2, 0 +_02044564: .word _020AFECC + arm_func_end sub_020444F0 + + arm_func_start sub_02044568 +sub_02044568: ; 0x02044568 + stmdb sp!, {r4, lr} + mov r4, r0 + mov r0, #8 + mov r1, r0 + bl MemAlloc + ldr r1, _020445BC ; =_020AFED0 + mov r3, #1 + str r0, [r1] + str r4, [r0] + ldr r0, [r1] + ldr r2, _020445C0 ; =_0209CB4C + strb r3, [r0, #4] + ldr r0, [r1] + ldr r1, _020445C4 ; =sub_02044604 + ldr r0, [r0] + add r0, r2, r0, lsl #4 + bl CreateTextBox + ldr r1, _020445BC ; =_020AFED0 + ldr r1, [r1] + strb r0, [r1, #5] + ldmia sp!, {r4, pc} + .align 2, 0 +_020445BC: .word _020AFED0 +_020445C0: .word _0209CB4C +_020445C4: .word sub_02044604 + arm_func_end sub_02044568 + + arm_func_start sub_020445C8 +sub_020445C8: ; 0x020445C8 + stmdb sp!, {r3, lr} + ldr r0, _02044600 ; =_020AFED0 + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0, #5] + bl CloseTextBox2 + ldr r0, _02044600 ; =_020AFED0 + ldr r0, [r0] + bl MemFree + ldr r0, _02044600 ; =_020AFED0 + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_02044600: .word _020AFED0 + arm_func_end sub_020445C8 + + arm_func_start sub_02044604 +sub_02044604: ; 0x02044604 + stmdb sp!, {r3, r4, lr} + sub sp, sp, #0x54 + ldr r1, _02044680 ; =_020AFED0 + mov r4, r0 + ldr r2, [r1] + ldrb r1, [r2, #4] + cmp r1, #0 + beq _02044678 + mov r1, #0 + strb r1, [r2, #4] + bl sub_02027B1C +#ifdef JAPAN + ldr r3, _020449FC ; =0x000031F9 +#endif + mov r0, r4 + mov r1, #4 + mov r2, #0 +#ifndef JAPAN + mov r3, #0x334 +#endif + bl sub_02026268 + bl GetMoneyCarried + mov r1, #0x18 + str r1, [sp, #0x2c] + str r0, [sp, #0x28] + add r1, sp, #4 + str r1, [sp] + ldr r3, _02044684 ; =0x00000335 + mov r0, r4 + mov r1, #0x10 + mov r2, #0xc + bl sub_020262E0 + mov r0, r4 + bl UpdateWindow +_02044678: + add sp, sp, #0x54 + ldmia sp!, {r3, r4, pc} + .align 2, 0 +_02044680: .word _020AFED0 +#ifdef JAPAN +_020449FC: .word 0x000031F9 +_02044684: .word 0x000031FA +#else +_02044684: .word 0x00000335 +#endif + arm_func_end sub_02044604 + + arm_func_start sub_02044688 +sub_02044688: ; 0x02044688 + stmdb sp!, {r3, r4, r5, r6, r7, r8, lr} + sub sp, sp, #0xa4 + mov r6, r0 + mov r5, r1 + ldr r0, _020447E8 ; =0x00000944 + mov r1, #8 + mov r8, r2 + mov r7, r3 + bl MemAlloc + ldr r1, _020447E8 ; =0x00000944 + mov r4, r0 + bl MemZero + mov r1, r8 + mov r2, r7 + mov r3, #0 + strb r3, [r4, #0x72e] + strb r3, [r4, #0x82e] + str r3, [r4, #0x940] + sub r0, r3, #1 + str r0, [r4, #0x930] + str r3, [r4, #0x940] + ldr r3, [sp, #0xc4] + add r0, r4, #4 + str r3, [sp] + ldrb r3, [sp, #0xc0] + bl sub_02044BF8 + ldr r0, _020447EC ; =_0209CB78 + ldr r1, _020447F0 ; =sub_02044964 + mov r2, r4 + bl CreateTextBoxWithArg + strb r0, [r4, #0x72c] + cmp r5, #3 + mov r0, #0x10 + str r0, [sp, #0x18] + ldr r1, _020447F4 ; =0x00000A36 + add r0, r4, #0x2e + add r0, r0, #0x700 + str r0, [sp, #0x54] + strh r1, [sp, #0x14] + bne _02044760 + add r1, r1, #3 + add r0, r4, #0x900 + strh r1, [r0, #0x2e] + str r4, [sp] + mov r1, #0 + str r1, [sp, #4] + str r1, [sp, #8] + ldr r0, _020447F8 ; =_0209CB88 + ldr r3, _020447FC ; =sub_02044990 + add r2, sp, #0xc + mov r1, #0x800 + bl CreateAdvancedTextBoxWithArg + strb r0, [r4, #0x72d] + b _020447A8 +_02044760: + cmp r5, #2 + addne r1, r1, #3 + addne r0, r4, #0x900 + strneh r1, [r0, #0x2e] + bne _020447A8 + add r1, r1, #2 + add r0, r4, #0x900 + strh r1, [r0, #0x2e] + str r4, [sp] + mov r1, #0 + str r1, [sp, #4] + str r1, [sp, #8] + ldr r0, _020447F8 ; =_0209CB88 + ldr r3, _020447FC ; =sub_02044990 + add r2, sp, #0xc + mov r1, #0x800 + bl CreateAdvancedTextBoxWithArg + strb r0, [r4, #0x72d] +_020447A8: + mov r0, r6 + str r6, [r4, #0x934] + bl GetItemAtIdx + ldrh r2, [r0] + add r1, r4, #0x900 + strh r2, [r1, #0x38] + ldrh r2, [r0, #2] + strh r2, [r1, #0x3a] + ldrh r2, [r0, #4] + mov r0, r4 + strh r2, [r1, #0x3c] + str r5, [r4] + bl sub_02044AEC + mov r0, r4 + add sp, sp, #0xa4 + ldmia sp!, {r3, r4, r5, r6, r7, r8, pc} + .align 2, 0 +_020447E8: .word 0x00000944 +_020447EC: .word _0209CB78 +_020447F0: .word sub_02044964 +#ifdef JAPAN +_020447F4: .word 0x00000871 +#else +_020447F4: .word 0x00000A36 +#endif +_020447F8: .word _0209CB88 +_020447FC: .word sub_02044990 + arm_func_end sub_02044688 + + arm_func_start sub_02044800 +sub_02044800: ; 0x02044800 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + ldr r0, [r5, #0x940] + cmp r0, #3 + addls pc, pc, r0, lsl #2 + b _020448E4 +_02044818: ; jump table + b _02044828 ; case 0 + b _02044830 ; case 1 + b _020448B8 ; case 2 + b _020448DC ; case 3 +_02044828: + mov r0, #1 + str r0, [r5, #0x940] +_02044830: + add r0, r5, #4 + bl sub_020451D8 + mov r4, r0 + mov r0, r5 + bl sub_02044AEC + cmp r4, #0 + beq _020448E4 + mov r0, #2 + str r0, [r5, #0x940] + cmp r4, #2 + bne _020448E4 + add r0, r5, #4 + bl sub_020452A0 + cmp r0, #3 + addls pc, pc, r0, lsl #2 + b _020448A0 +_02044870: ; jump table + b _02044880 ; case 0 + b _02044888 ; case 1 + b _02044890 ; case 2 + b _02044898 ; case 3 +_02044880: + mov r1, #1 + b _020448A4 +_02044888: + mov r1, #2 + b _020448A4 +_02044890: + mov r1, #3 + b _020448A4 +_02044898: + mov r1, #4 + b _020448A4 +_020448A0: + mov r1, #0 +_020448A4: + ldr r0, [r5, #0x934] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02058460 + b _020448E4 +_020448B8: + add r0, r5, #4 + bl sub_020452B8 + cmp r0, #0 + beq _020448E4 + mov r0, r5 + bl sub_02044918 + mov r0, #3 + str r0, [r5, #0x940] + b _020448E4 +_020448DC: + mov r0, #1 + ldmia sp!, {r3, r4, r5, pc} +_020448E4: + mov r0, #0 + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_02044800 + + arm_func_start sub_020448EC +sub_020448EC: ; 0x020448EC + stmdb sp!, {r4, lr} + mov r4, r0 + ldr r0, [r4] + cmp r0, #0 + ldmeqia sp!, {r4, pc} + bl sub_02044918 + ldr r0, [r4] + bl MemFree + mov r0, #0 + str r0, [r4] + ldmia sp!, {r4, pc} + arm_func_end sub_020448EC + + arm_func_start sub_02044918 +sub_02044918: ; 0x02044918 + stmdb sp!, {r4, lr} + mov r4, r0 + add r0, r4, #0x700 + ldrsb r0, [r0, #0x2d] + mvn r1, #1 + cmp r0, r1 + beq _02044940 + bl CloseAdvancedTextBox + mvn r0, #1 + strb r0, [r4, #0x72d] +_02044940: + add r0, r4, #0x700 + ldrsb r0, [r0, #0x2c] + mvn r1, #1 + cmp r0, r1 + ldmeqia sp!, {r4, pc} + bl CloseTextBox + mvn r0, #1 + strb r0, [r4, #0x72c] + ldmia sp!, {r4, pc} + arm_func_end sub_02044918 + + arm_func_start sub_02044964 +sub_02044964: ; 0x02044964 + stmdb sp!, {r4, lr} + add r1, r1, #0x900 + mov r4, r0 + ldrh r0, [r1, #0x2e] + bl StringFromId + mov r1, #2 + mov r3, r0 + mov r0, r4 + mov r2, r1 + bl DrawTextInWindow + ldmia sp!, {r4, pc} + arm_func_end sub_02044964 + + arm_func_start sub_02044990 +sub_02044990: ; 0x02044990 + ldr ip, _020449A8 ; =DrawTextInWindow + add r1, r1, #0x2e + add r3, r1, #0x800 + mov r1, #2 + mov r2, #0x10 + bx ip + .align 2, 0 +_020449A8: .word DrawTextInWindow + arm_func_end sub_02044990 + + arm_func_start sub_020449AC +sub_020449AC: ; 0x020449AC + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r6, r0 + add r0, r6, #4 + mov r5, r1 + mov r4, #0 + bl sub_02045298 + cmp r0, #0 +#ifdef JAPAN + beq _02044A30 +#else + bne _020449E8 + mov r0, r5 + bl sub_02045330 + add r2, r6, #0x2e + mov r1, r0 + add r0, r2, #0x700 + bl sub_020584FC + b _02044A30 +_020449E8: +#endif + ldr r1, _02044ADC ; =DUNGEON_PTR + add r0, r6, #0x2e + ldr r1, [r1] + add r0, r0, #0x700 + add r1, r1, r5, lsl #2 + add r1, r1, #0x12000 +#ifdef JAPAN + ldr r1, [r1, #0xa84] +#else + ldr r1, [r1, #0xb28] +#endif + mov r2, r4 + ldr r7, [r1, #0xb4] + bl ov29_022E2A78 + ldrb r0, [r7, #0xbc] + cmp r0, #7 + beq _02044A2C + mov r0, r7 + bl IsExperienceLocked + cmp r0, #0 + beq _02044A30 +_02044A2C: + mov r4, #1 +_02044A30: + cmp r4, #0 + beq _02044A4C + add r0, r6, #0x2e + ldr r1, _02044AE0 ; =0x00000A3D + add r0, r0, #0x800 + bl GetStringFromFileVeneer + b _02044ACC +_02044A4C: + add r0, r6, #4 + bl sub_02045298 + cmp r0, #0 + bne _02044A70 + mov r0, r5 + bl sub_02045330 + bl GetActiveTeamMember + add r1, r0, #0x3e + b _02044A8C +_02044A70: + ldr r0, _02044ADC ; =DUNGEON_PTR + ldr r0, [r0] + add r0, r0, r5, lsl #2 + add r0, r0, #0x12000 +#ifdef JAPAN + ldr r0, [r0, #0xa84] +#else + ldr r0, [r0, #0xb28] +#endif + ldr r0, [r0, #0xb4] + add r1, r0, #0x62 +_02044A8C: + ldrb r0, [r1] + tst r0, #1 + movne r0, #1 + moveq r0, #0 + tst r0, #0xff + add r0, r6, #0x2e + bne _02044AB8 + ldr r1, _02044AE4 ; =0x00000A37 + add r0, r0, #0x800 + bl GetStringFromFileVeneer + b _02044ACC +_02044AB8: + ldr r2, _02044AE8 ; =_0209CB6C + mov r3, #1 + add r0, r0, #0x800 + str r3, [sp] + bl sub_0200D310 +_02044ACC: + add r0, r6, #0x700 + ldrsb r0, [r0, #0x2d] + bl SetAdvancedTextBoxField0x1C2 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_02044ADC: .word DUNGEON_PTR +#ifdef JAPAN +_02044AE0: .word 0x00000878 +_02044AE4: .word 0x00000872 +#else +_02044AE0: .word 0x00000A3D +_02044AE4: .word 0x00000A37 +#endif +_02044AE8: .word _0209CB6C + arm_func_end sub_020449AC + + arm_func_start sub_02044AEC +sub_02044AEC: ; 0x02044AEC + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r7, r0 + add r0, r7, #4 + bl sub_020452A0 + mov r4, r0 + mvn r0, #0 + cmp r4, r0 + ldrne r0, [r7, #0x930] + ldr r5, [r7] + cmpne r0, r4 + ldmeqia sp!, {r3, r4, r5, r6, r7, pc} + add r0, r7, #4 + bl sub_02045298 + cmp r0, #0 + bne _02044B5C + cmp r5, #1 + addne r0, r7, #0x700 + ldrnesb r1, [r0, #0x2d] + mvnne r0, #1 + cmpne r1, r0 + beq _02044BEC + sub r0, r5, #2 + cmp r0, #1 + bhi _02044BEC + mov r0, r7 + mov r1, r4 + bl sub_020449AC + b _02044BEC +_02044B5C: + ldr r0, _02044BF4 ; =DUNGEON_PTR + ldr r0, [r0] + add r0, r0, r4, lsl #2 + add r0, r0, #0x12000 +#ifdef JAPAN + ldr r6, [r0, #0xa84] +#else + ldr r6, [r0, #0xb28] +#endif + cmp r6, #0 + moveq r0, #0 + beq _02044B90 + ldr r0, [r6] + cmp r0, #0 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff +_02044B90: + cmp r0, #0 + cmpne r5, #1 + beq _02044BC8 + sub r0, r5, #2 + cmp r0, #1 + bhi _02044BC8 + add r0, r7, #0x700 + ldrsb r1, [r0, #0x2d] + mvn r0, #1 + cmp r1, r0 + beq _02044BC8 + mov r0, r7 + mov r1, r4 + bl sub_020449AC +_02044BC8: + mov r0, r6 + mov r1, #0 + mov r2, #1 + bl TryPointCameraToMonster + mov r2, #1 + mov r3, r2 + add r0, r6, #4 + mov r1, #0 + bl DrawTileGrid +_02044BEC: + str r4, [r7, #0x930] + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_02044BF4: .word DUNGEON_PTR + arm_func_end sub_02044AEC + + arm_func_start sub_02044BF8 +sub_02044BF8: ; 0x02044BF8 +#ifdef JAPAN +#define SUB_02044BF8_LOAD_OFFSET #0xa84 +#else +#define SUB_02044BF8_LOAD_OFFSET #0xb28 +#endif + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0xbc + mov fp, r1 + str r2, [sp, #4] + ldr r1, _0204519C ; =0x00000728 + mov sl, r0 + str r3, [sp, #8] + bl MemZero + ldr sb, [sp, #0xe0] + add r0, sl, #0x20c + mov r4, #0 + str r4, [sl] + cmp sb, #0 + add r7, r0, #0x400 + bne _02044CD8 + mov r8, r4 + mov fp, r4 + mov r6, #1 + mov r5, r4 +_02044C44: + mov r0, r8 + bl GetActiveTeamMember + ldrb r0, [r0] + tst r0, #1 + movne r1, r6 + moveq r1, fp + tst r1, #0xff + beq _02044C88 + tst r0, #2 + movne r0, #1 + moveq r0, #0 + tst r0, #0xff + addne r1, r7, r4, lsl #2 + addne r0, r7, r4 + strne r8, [r1, #8] + strneb r5, [r0, #0x18] + addne r4, r4, #1 +_02044C88: + add r0, r8, #1 + mov r0, r0, lsl #0x10 + mov r8, r0, asr #0x10 + cmp r8, #4 + blt _02044C44 + mov r0, r4, lsl #0x10 + mov r5, r0, asr #0x10 + mvn r3, #0 + mov r2, #0 + b _02044CCC +_02044CB0: + add r1, r7, r5, lsl #2 + add r0, r5, #1 + str r3, [r1, #8] + add r1, r7, r5 + mov r0, r0, lsl #0x10 + strb r2, [r1, #0x18] + mov r5, r0, asr #0x10 +_02044CCC: + cmp r5, #4 + blt _02044CB0 + b _02044D78 +_02044CD8: + mov r5, r4 +_02044CDC: + ldr r0, _020451A0 ; =DUNGEON_PTR + ldr r0, [r0] + add r0, r0, r5, lsl #2 + add r0, r0, #0x12000 + ldr r6, [r0, SUB_02044BF8_LOAD_OFFSET] + mov r0, r6 + bl sub_0204533C + cmp r0, #0 + beq _02044D40 + cmp fp, #0 + beq _02044D18 + mov r0, r6 + ldr r8, [r6, #0xb4] + bl ov29_02347100 +#ifdef JAPAN + strb r0, [r8, #0x15d] +#else + strb r0, [r8, #0x161] +#endif +_02044D18: + add r0, r7, r4, lsl #2 + str r5, [r0, #8] + ldr r0, [r6, #0xb4] +#ifdef JAPAN + ldrb r0, [r0, #0x15d] +#else + ldrb r0, [r0, #0x161] +#endif + cmp r0, #0 + movne r1, #0 + add r0, r7, r4 + moveq r1, #3 + strb r1, [r0, #0x18] + add r4, r4, #1 +_02044D40: + add r5, r5, #1 + cmp r5, #4 + blt _02044CDC + mov r5, r4 + mvn r3, #0 + mov r1, #0 + b _02044D70 +_02044D5C: + add r2, r7, r5, lsl #2 + add r0, r7, r5 + str r3, [r2, #8] + strb r1, [r0, #0x18] + add r5, r5, #1 +_02044D70: + cmp r5, #4 + blt _02044D5C +_02044D78: + ldr r0, [sp, #0xe0] + str r4, [r7, #0x1c] + str r0, [r7] + cmp sb, #0 + moveq r0, #0 + beq _02044D98 + mov r0, #0xb + bl Arm9LoadUnkFieldNa0x2029EC8 +_02044D98: + str r0, [sl, #0x6e8] + str r4, [sl, #0x6ec] + str r4, [sl, #0x6f0] + mov sb, #0 + str sb, [sl, #0x6f4] + str sb, [sl, #0x6f8] + add r0, sl, #0x18c + str sb, [sl, #0x6dc] + add r2, sl, #0x20c + add r0, r0, #0x400 + mov r1, #0x40 + str sb, [sl, #0x6e0] + add r5, r2, #0x400 + bl MemZero + add r0, sl, #0x1cc + add r0, r0, #0x400 + mov r1, #0x40 + bl MemZero + add r0, sl, #0x18c + add r0, r0, #0x400 + str r0, [sp, #0x14] + add r0, sl, #0x3c + add r1, sl, #0x1cc + add r2, sl, #0x13c + str r0, [sp, #0x10] + add r0, r2, #0x400 + str r0, [sp, #0x18] + ldr r0, _020451A4 ; =0x000003E7 + mov r6, sb + sub r0, r0, #0x3e8 + str r0, [sp, #0x20] + ldr r0, _020451A4 ; =0x000003E7 + add r4, r1, #0x400 + sub r0, r0, #0x3e8 + str r0, [sp, #0x1c] + b _020450F8 +_02044E28: + mov r0, r5 + mov r1, r6 + bl sub_02045360 + mov fp, r0 + ldr r0, [sp, #0x1c] + cmp fp, r0 + beq _020450F4 + ldr r0, [sp, #0x10] + mov r1, r6 + add r0, r0, sb, lsl #8 + str r0, [sp, #0xc] + mov r0, r5 + bl sub_02045360 + mov r1, r0 + ldr r0, [sp, #0x20] + cmp r1, r0 + beq _02044EC4 + ldr r0, [r5] + cmp r0, #0 + bne _02044E8C + mov r0, r1, lsl #0x10 + mov r1, r0, asr #0x10 + ldr r0, [sp, #0x14] + bl sub_020584FC + b _02044EC4 +_02044E8C: + ldr r3, _020451A0 ; =DUNGEON_PTR + add r0, r5, r6 + ldr r3, [r3] + ldrb r0, [r0, #0x18] + add r1, r3, r1, lsl #2 + add r1, r1, #0x12000 + cmp r0, #0 + movne r0, #0x57 + ldr r1, [r1, SUB_02044BF8_LOAD_OFFSET] + moveq r0, #0x44 + and r2, r0, #0xff + ldr r0, [sp, #0x14] + ldr r1, [r1, #0xb4] + bl ov29_023002F0 +_02044EC4: + ldr r0, [sp, #0x14] + str r0, [sl, #0x574] + ldr r0, [r5] + cmp r0, #0 + bne _02044EE8 + ldr r1, _020451A8 ; =_0209CBA8 + mov r0, r4 + bl strcpy + b _020450A8 +_02044EE8: + ldr r0, _020451A0 ; =DUNGEON_PTR + ldr r0, [r0] + add r0, r0, fp, lsl #2 + add r0, r0, #0x12000 + ldr r0, [r0, SUB_02044BF8_LOAD_OFFSET] + bl sub_0204533C + cmp r0, #0 + beq _020450F4 + ldr r0, _020451A0 ; =DUNGEON_PTR + ldr r2, [r0] + ldr r0, _020451AC ; =TEAM_MEMBER_TABLE_PTR + ldr r1, [r0] + add r0, r2, fp, lsl #2 + add r0, r0, #0x12000 + ldr r2, [r0, SUB_02044BF8_LOAD_OFFSET] + add r0, r1, #0x9000 + ldr r8, [r2, #0xb4] + ldr r2, [r0, #0x84c] + ldrsh r1, [r8, #0xc] + mov r0, #0x68 + smlabb r0, r1, r0, r2 + ldrsh r0, [r0, #8] + bl sub_02056228 + cmp r0, #0 + ldrsh r1, [r8, #0x12] + ldrsh r0, [r8, #0x16] + beq _02045000 + add r1, r1, r0 + ldr r0, _020451A4 ; =0x000003E7 + cmp r1, r0 + movgt r3, r0 + movle r3, r1 + mov r2, r3, asr #1 + ldrsh r0, [r8, #0x10] + add r2, r3, r2, lsr #30 + cmp r0, r2, asr #2 + bgt _02044F8C + ldr r1, _020451B0 ; =_0209CBB0 + mov r0, r4 + bl strcpy + b _020450A8 +_02044F8C: + ldr r2, _020451A4 ; =0x000003E7 + cmp r1, r2 + movgt r3, r2 + movle r3, r1 + mov r2, r3, asr #1 + add r2, r3, r2, lsr #30 + mov r2, r2, asr #2 + cmp r0, r2, lsl #1 + bgt _02044FC0 + ldr r1, _020451B4 ; =_0209CBB8 + mov r0, r4 + bl strcpy + b _020450A8 +_02044FC0: + ldr r2, _020451A4 ; =0x000003E7 + cmp r1, r2 + movgt r1, r2 + mov r2, r1, asr #1 + add r1, r1, r2, lsr #30 + mov r1, r1, asr #2 + add r1, r1, r1, lsl #1 + cmp r0, r1 + mov r0, r4 + bgt _02044FF4 + ldr r1, _020451B8 ; =_0209CBC0 + bl strcpy + b _020450A8 +_02044FF4: + ldr r1, _020451BC ; =_0209CBC8 + bl strcpy + b _020450A8 +_02045000: + add r1, r1, r0 + ldr r0, _020451A4 ; =0x000003E7 + cmp r1, r0 + movgt r3, r0 + movle r3, r1 + mov r2, r3, asr #1 + ldrsh r0, [r8, #0x10] + add r2, r3, r2, lsr #30 + cmp r0, r2, asr #2 + bgt _02045038 + ldr r1, _020451C0 ; =_0209CBD0 + mov r0, r4 + bl strcpy + b _020450A8 +_02045038: + ldr r2, _020451A4 ; =0x000003E7 + cmp r1, r2 + movgt r3, r2 + movle r3, r1 + mov r2, r3, asr #1 + add r2, r3, r2, lsr #30 + mov r2, r2, asr #2 + cmp r0, r2, lsl #1 + bgt _0204506C + ldr r1, _020451C4 ; =_0209CBD8 + mov r0, r4 + bl strcpy + b _020450A8 +_0204506C: + ldr r2, _020451A4 ; =0x000003E7 + cmp r1, r2 + movgt r1, r2 + mov r2, r1, asr #1 + add r1, r1, r2, lsr #30 + mov r1, r1, asr #2 + add r1, r1, r1, lsl #1 + cmp r0, r1 + mov r0, r4 + bgt _020450A0 + ldr r1, _020451C8 ; =_0209CBE0 + bl strcpy + b _020450A8 +_020450A0: + ldr r1, _020451A8 ; =_0209CBA8 + bl strcpy +_020450A8: + str r4, [sl, #0x578] + ldr r0, [r5] + cmp r0, #0 + bne _020450C4 + mov r0, fp, lsl #0x10 + mov r0, r0, asr #0x10 + bl GetActiveTeamMember +_020450C4: + ldr r0, [sp, #0x18] + ldr r2, _020451CC ; =_0209CBE8 + str r0, [sp] + ldr r0, [sp, #0xc] + mov r1, #0x100 + mov r3, #0 + bl PreprocessString + add r1, sl, sb, lsl #3 + ldr r0, [sp, #0xc] + add sb, sb, #1 + str r0, [r1, #0xc] + str sb, [r1, #0x10] +_020450F4: + add r6, r6, #1 +_020450F8: + ldr r0, [r5, #0x1c] + cmp r6, r0 + blt _02044E28 + mov r0, #0 + add r1, sl, sb, lsl #3 + str r0, [r1, #0xc] + sub r0, r0, #1 + str r0, [r1, #0x10] + ldr r0, [sp, #4] + add r2, sp, #0x24 + cmp r0, #0 + ldrne r1, _020451D0 ; =0x00000A3A + movne r0, #0x10 + strne r0, [sp, #0x30] + strneh r1, [sp, #0x2c] + ldr r1, [sl, #0x6e8] + add r0, r7, #0x18 + add r1, r1, #1 + str r1, [sp, #0x24] + str r0, [sp, #0x84] + ldr r0, [sp, #4] + add r3, sl, #0xc + cmp r0, #0 + movne r1, #0x800 + ldr r0, [sp, #8] + moveq r1, #0 + cmp r0, #0 + movne r0, #0x400000 + moveq r0, #0 + orr r0, r0, #0x33 + orr r1, r0, r1 + ldr r0, _020451D4 ; =_0209CB98 + orr r1, r1, #0x1200 + bl CreateParentMenu + ldr r1, [sp, #0xe0] + strb r0, [sl, #8] + cmp r1, #1 + bne _02045194 + bl ov29_022EA62C +_02045194: + add sp, sp, #0xbc + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_0204519C: .word 0x00000728 +_020451A0: .word DUNGEON_PTR +_020451A4: .word 0x000003E7 +_020451A8: .word _0209CBA8 +_020451AC: .word TEAM_MEMBER_TABLE_PTR +_020451B0: .word _0209CBB0 +_020451B4: .word _0209CBB8 +_020451B8: .word _0209CBC0 +_020451BC: .word _0209CBC8 +_020451C0: .word _0209CBD0 +_020451C4: .word _0209CBD8 +_020451C8: .word _0209CBE0 +_020451CC: .word _0209CBE8 +#ifdef JAPAN +_020451D0: .word 0x00000875 +#else +_020451D0: .word 0x00000A3A +#endif +_020451D4: .word _0209CB98 + arm_func_end sub_02044BF8 + + arm_func_start sub_020451D8 +sub_020451D8: ; 0x020451D8 + stmdb sp!, {r3, r4, r5, lr} + mov r4, r0 + ldr r1, [r4] + add r0, r4, #0x20c + cmp r1, #0 + add r5, r0, #0x400 + beq _02045208 + cmp r1, #1 + beq _02045220 + cmp r1, #2 + beq _02045288 + b _02045290 +_02045208: + ldrsb r0, [r4, #8] + bl IsParentMenuActive + cmp r0, #0 + beq _02045290 + mov r0, #1 + str r0, [r4] +_02045220: + ldrsb r0, [r4, #8] + bl IsParentMenuActive + cmp r0, #0 + bne _02045278 + mov r0, #2 + str r0, [r4] + ldrsb r0, [r4, #8] + bl sub_0202ABB0 + subs r0, r0, #1 + bmi _0204526C + str r0, [r4, #0x6e8] + add r0, r5, r0 + ldrb r0, [r0, #0x18] + cmp r0, #0 + moveq r0, #2 + streq r0, [r4, #0x724] + movne r0, #1 + strne r0, [r4, #0x724] + b _02045290 +_0204526C: + mov r0, #1 + str r0, [r4, #0x724] + b _02045290 +_02045278: + ldrsb r0, [r4, #8] + bl sub_0202AB80 + str r0, [r4, #0x6e8] + b _02045290 +_02045288: + ldr r0, [r4, #0x724] + ldmia sp!, {r3, r4, r5, pc} +_02045290: + mov r0, #0 + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_020451D8 + + arm_func_start sub_02045298 +sub_02045298: ; 0x02045298 + ldr r0, [r0, #0x60c] + bx lr + arm_func_end sub_02045298 + + arm_func_start sub_020452A0 +sub_020452A0: ; 0x020452A0 + ldr ip, _020452B4 ; =sub_02045360 + add r2, r0, #0x20c + ldr r1, [r0, #0x6e8] + add r0, r2, #0x400 + bx ip + .align 2, 0 +_020452B4: .word sub_02045360 + arm_func_end sub_020452A0 + + arm_func_start sub_020452B8 +sub_020452B8: ; 0x020452B8 + stmdb sp!, {r4, lr} + movs r4, r0 + ldrnesb r0, [r4, #8] + mvnne r1, #1 + cmpne r0, r1 + moveq r0, #1 + ldmeqia sp!, {r4, pc} + bl sub_0202AAE8 + cmp r0, #0 + ldrsb r0, [r4, #8] + beq _02045310 + bl sub_020282F4 + add r0, r0, #5 + cmp r0, #1 + movhi r0, #0 + bhi _02045320 + ldrsb r0, [r4, #8] + bl CloseParentMenu + mvn r0, #1 + strb r0, [r4, #8] + mov r0, #1 + b _02045320 +_02045310: + bl CloseParentMenu + mvn r0, #1 + strb r0, [r4, #8] + mov r0, #1 +_02045320: + cmp r0, #0 + movne r0, #2 + moveq r0, #0 + ldmia sp!, {r4, pc} + arm_func_end sub_020452B8 + + arm_func_start sub_02045330 +sub_02045330: ; 0x02045330 + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bx lr + arm_func_end sub_02045330 + + arm_func_start sub_0204533C +sub_0204533C: ; 0x0204533C + cmp r0, #0 + moveq r0, #0 + bxeq lr + ldr r0, [r0] + cmp r0, #0 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + arm_func_end sub_0204533C + + arm_func_start sub_02045360 +sub_02045360: ; 0x02045360 + stmdb sp!, {r4, lr} + add r1, r0, r1, lsl #2 + ldr r4, [r1, #8] + mvn r1, #0 + cmp r4, r1 + moveq r0, r1 + ldmeqia sp!, {r4, pc} + ldr r0, [r0] + cmp r0, #0 + bne _020453C8 + mov r0, r4, lsl #0x10 + mov r0, r0, asr #0x10 + bl GetActiveTeamMember + ldrb r0, [r0] + tst r0, #1 + movne r1, #1 + moveq r1, #0 + tst r1, #0xff + beq _020453C0 + tst r0, #2 + movne r0, #1 + moveq r0, #0 + tst r0, #0xff + bne _020453EC +_020453C0: + mvn r0, #0 + ldmia sp!, {r4, pc} +_020453C8: + ldr r0, _020453F4 ; =DUNGEON_PTR + ldr r0, [r0] + add r0, r0, r4, lsl #2 + add r0, r0, #0x12000 +#ifdef JAPAN + ldr r0, [r0, #0xa84] +#else + ldr r0, [r0, #0xb28] +#endif + bl sub_0204533C + cmp r0, #0 + mvneq r0, #0 + ldmeqia sp!, {r4, pc} +_020453EC: + mov r0, r4 + ldmia sp!, {r4, pc} + .align 2, 0 +_020453F4: .word DUNGEON_PTR + arm_func_end sub_02045360 + + arm_func_start sub_020453F8 +sub_020453F8: ; 0x020453F8 + stmdb sp!, {r3, r4, r5, lr} + ldr r2, _020454DC ; =_020AFED4 + mov r5, r0 + ldr r0, [r2] + mov r4, r1 + cmp r0, #0 + bne _02045428 + mov r0, #0x410 + mov r1, #8 + bl MemAlloc + ldr r1, _020454DC ; =_020AFED4 + str r0, [r1] +_02045428: + bl sub_02044094 + bl sub_020440DC + ldr r1, _020454DC ; =_020AFED4 + mov r2, #0 + ldr r0, [r1] + strb r4, [r0, #0x386] + ldr r0, [r1] + add r0, r0, #0x300 + strh r2, [r0, #0x88] + ldr r0, [r1] + str r2, [r0, #0x38c] + ldr r0, [r1] + add r0, r0, #0x1c + bl InitPreprocessorArgs + ldr r1, _020454DC ; =_020AFED4 + mov r0, #0 + ldr r2, [r1] + sub r3, r0, #2 + str r0, [r2, #0x68] + ldr r2, [r1] + cmp r4, #0 + str r0, [r2, #0x1c] + ldr r2, [r1] + str r0, [r2, #0x18] + ldr r2, [r1] + strb r3, [r2, #0x14] + ldr r2, [r1] + strb r3, [r2, #0x16] + ldr r2, [r1] + strb r3, [r2, #0x15] + ldr r2, [r1] + strb r3, [r2, #0x17] + ldr r3, [r1] + ldrh r2, [r5] + add r1, r3, #0x300 + strh r2, [r1, #0x80] + ldrh r2, [r5, #2] + strh r2, [r1, #0x82] + ldrh r2, [r5, #4] + strh r2, [r1, #0x84] + str r0, [r3, #0x6c] + moveq r0, #0x13 + bl sub_020454E0 + mov r0, #1 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_020454DC: .word _020AFED4 + arm_func_end sub_020453F8 + + arm_func_start sub_020454E0 +sub_020454E0: ; 0x020454E0 + stmdb sp!, {r4, r5, lr} + sub sp, sp, #0x194 + ldr r1, _02045A1C ; =_020AFED4 + ldr r2, [r1] + str r0, [r2, #4] + ldr r4, [r1] + ldr r0, [r4, #4] + cmp r0, #0x13 + addls pc, pc, r0, lsl #2 + b _02045A14 +_02045508: ; jump table + b _02045558 ; case 0 + b _02045584 ; case 1 + b _020455CC ; case 2 + b _02045A14 ; case 3 + b _02045A14 ; case 4 + b _02045A14 ; case 5 + b _020458C0 ; case 6 + b _02045914 ; case 7 + b _02045844 ; case 8 + b _02045948 ; case 9 + b _02045984 ; case 10 + b _020459C0 ; case 11 + b _02045A14 ; case 12 + b _02045A14 ; case 13 + b _02045958 ; case 14 + b _02045798 ; case 15 + b _02045688 ; case 16 + b _02045764 ; case 17 + b _02045A14 ; case 18 + b _020459E0 ; case 19 +_02045558: + mov r0, #2 + str r0, [r4, #8] + bl sub_02046624 + ldr r0, _02045A1C ; =_020AFED4 + ldr r2, _02045A20 ; =0x000002CD + ldr r3, [r0] + mov r1, #8 + ldrsb r0, [r3, #0x14] + add r3, r3, #0x1c + bl ShowStringIdInDialogueBox + b _02045A14 +_02045584: + mov r0, #2 + str r0, [r4, #8] + bl sub_02046624 + ldr r0, _02045A1C ; =_020AFED4 + ldr r0, [r0] + ldrsb r0, [r0, #0x14] + bl ShowDialogueBox + ldr r0, _02045A1C ; =_020AFED4 + mov r3, #2 + ldr r1, [r0] + ldr r2, _02045A24 ; =0x000002D5 + str r3, [r1, #8] + ldr r3, [r0] + mov r1, #8 + ldrsb r0, [r3, #0x14] + add r3, r3, #0x1c + bl ShowStringIdInDialogueBox + b _02045A14 +_020455CC: + ldr r1, _02045A28 ; =0x000002CE + add r0, r4, #0x70 + bl GetStringFromFileVeneer + mov r1, #2 + add r0, sp, #0x14 + str r1, [r4, #0x170] + bl InitPreprocessorArgs + ldr r0, _02045A1C ; =_020AFED4 + ldr r2, _02045A2C ; =_0209CC0C + ldr r1, [r0] + add r0, r1, #0x390 + add r1, r1, #0x380 + bl sub_0200D670 + ldr r0, _02045A1C ; =_020AFED4 + ldr r2, _02045A30 ; =0x000002CF + ldr r5, [r0] + add ip, sp, #0x14 + add r3, r5, #0x300 + ldrsh lr, [r3, #0x84] + add r0, r4, #0x174 + mov r1, #0x100 + orr lr, lr, #0x10000 + str lr, [sp, #0x24] + ldrh lr, [r3, #0x82] + mov r3, #0 + str lr, [sp, #0x38] + ldrb lr, [r5, #0x380] + str lr, [sp, #0x3c] + str ip, [sp] + bl PreprocessStringFromId + mov r1, #3 + str r1, [r4, #0x274] + mov r2, #0 + strb r2, [r4, #0x278] + mov r0, #1 + str r0, [r4, #0x378] + str r1, [sp] + ldr r3, _02045A1C ; =_020AFED4 + ldr r0, _02045A34 ; =_0209CC38 + ldr r3, [r3] + ldr r1, _02045A38 ; =0x00300011 + add r3, r3, #0x70 + bl CreateSimpleMenu + ldr r1, _02045A1C ; =_020AFED4 + ldr r1, [r1] + strb r0, [r1, #0x16] + b _02045A14 +_02045688: + mov r0, #0x11 + str r0, [r4, #8] + ldr r0, [r1] + ldr r0, [r0] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02010044 + ldr r2, _02045A1C ; =_020AFED4 + ldr r1, [r2] + add r1, r1, #0x300 + strh r0, [r1, #0x88] + ldr r1, [r2] + add r0, r1, #0x300 + ldrsh r0, [r0, #0x88] + strh r0, [sp, #0x10] + ldr r0, [r1] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02010060 + ldr r3, _02045A1C ; =_020AFED4 + ldr r2, _02045A2C ; =_0209CC0C + ldr r4, [r3] + add r1, sp, #0xc + str r0, [r4, #0x38c] + ldr r0, [r3] + mov r3, #0 + ldr r4, [r0, #0x38c] + add r0, r0, #0x390 + strh r4, [sp, #0xe] + strb r3, [sp, #0xc] + bl sub_0200D670 + ldr r0, _02045A1C ; =_020AFED4 + ldr r2, [r0] + add r1, r2, #0x390 + str r1, [r2, #0x54] + ldr r1, [r0] + add r0, r1, #0x300 + ldrsh r0, [r0, #0x88] + str r0, [r1, #0x2c] + bl sub_02046624 + ldr r0, _02045A1C ; =_020AFED4 + ldr r0, [r0] + ldrsb r0, [r0, #0x14] + bl ShowDialogueBox + ldr r0, _02045A1C ; =_020AFED4 + mov r4, #0x11 + ldr r3, [r0] +#ifdef JAPAN + ldr r2, _02045D9C ; =0x00002FC5 + str r4, [r3, #8] + ldr r3, [r0] + mov r1, #8 +#else + mov r1, #8 + str r4, [r3, #8] + ldr r3, [r0] + add r2, r4, #0x2c0 +#endif + ldrsb r0, [r3, #0x14] + add r3, r3, #0x1c + bl ShowStringIdInDialogueBox + b _02045A14 +_02045764: + mov r4, #3 + str r4, [sp, #0x64] + mov r4, #2 + ldr r0, _02045A34 ; =_0209CC38 + ldr r1, _02045A3C ; =0x00300033 + ldr r3, _02045A40 ; =_0209CC48 + add r2, sp, #0x64 + str r4, [sp] + bl CreateSimpleMenuFromStringIds + ldr r1, _02045A1C ; =_020AFED4 + ldr r1, [r1] + strb r0, [r1, #0x16] + b _02045A14 +_02045798: + ldr r0, [r4] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02010044 + ldr r2, _02045A1C ; =_020AFED4 + ldr r1, [r2] + add r1, r1, #0x300 + strh r0, [r1, #0x88] + ldr r0, [r2] + ldr r0, [r0] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02010060 + ldr r4, _02045A1C ; =_020AFED4 + ldr r1, _02045A44 ; =0x00001013 + ldr r2, [r4] + ldr r3, _02045A48 ; =0x000008E4 + str r0, [r2, #0x38c] + ldr lr, [r4] + ldr r0, _02045A4C ; =_0209CC28 + add r2, lr, #0x300 + ldrsh ip, [r2, #0x88] + mov r2, #0 + str ip, [lr, #0x2c] + ldr lr, [r4] + ldr ip, [lr, #0x38c] + add ip, ip, #0xbc + str ip, [lr, #0x34] + ldr r4, [r4] + add ip, r4, #0x1c + add r4, r4, #0x300 + str ip, [sp] + ldrsh r4, [r4, #0x88] +#if defined(EUROPE) + add r4, r4, #0xd3 + add r4, r4, #0x2900 +#elif defined(JAPAN) + add r4, r4, #0xce + add r4, r4, #0x4100 +#else + add r4, r4, #0xd1 + add r4, r4, #0x2900 +#endif + mov r4, r4, lsl #0x10 + mov r4, r4, lsr #0x10 + stmib sp, {r4, ip} + bl CreateScrollBoxSingle + ldr r1, _02045A1C ; =_020AFED4 + ldr r1, [r1] + strb r0, [r1, #0x17] + b _02045A14 +_02045844: + ldr r0, [r4] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02010044 + ldr r2, _02045A1C ; =_020AFED4 + ldr r1, [r2] + add r1, r1, #0x300 + strh r0, [r1, #0x88] + ldr r0, [r2] + ldr r0, [r0] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02010060 + ldr r1, _02045A1C ; =_020AFED4 + mov r2, #3 + ldr r3, [r1] + str r0, [r3, #0x38c] + ldr r3, [r1] + add r0, r3, #0x300 + ldrsh r0, [r0, #0x88] + str r0, [r3, #0x2c] + ldr r0, [r1] + str r2, [r0, #4] + bl sub_02045A5C + ldr r0, _02045A1C ; =_020AFED4 + ldr r0, [r0] + ldr r0, [r0] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02010154 + b _02045A14 +_020458C0: + add r0, r4, #0x390 + str r0, [r4, #0x5c] + ldr r0, [r1] + mov r1, #7 + str r1, [r0, #8] + bl sub_02046624 + ldr r0, _02045A1C ; =_020AFED4 + ldr r0, [r0] + ldrsb r0, [r0, #0x14] + bl ShowDialogueBox + ldr r0, _02045A1C ; =_020AFED4 + mov r3, #7 + ldr r1, [r0] + ldr r2, _02045A50 ; =0x000002D6 + str r3, [r1, #8] + ldr r3, [r0] + mov r1, #8 + ldrsb r0, [r3, #0x14] + add r3, r3, #0x1c + bl ShowStringIdInDialogueBox + b _02045A14 +_02045914: + mov r4, #3 + str r4, [sp, #0xfc] + mov r4, #2 + ldr r0, _02045A34 ; =_0209CC38 + ldr r1, _02045A3C ; =0x00300033 + ldr r3, _02045A40 ; =_0209CC48 + add r2, sp, #0xfc + str r4, [sp] + bl CreateSimpleMenuFromStringIds + ldr r1, _02045A1C ; =_020AFED4 + ldr r1, [r1] + strb r0, [r1, #0x16] + b _02045A14 +_02045948: + mov r0, #4 + str r0, [r4, #4] + bl sub_02045A5C + b _02045A14 +_02045958: + ldr r0, _02045A54 ; =_0209CC18 + mov r4, #3 + ldr r3, _02045A58 ; =_0209CC60 + mov r1, #0x13 + mov r2, #0 + str r4, [sp] + bl CreateSimpleMenuFromStringIds + ldr r1, _02045A1C ; =_020AFED4 + ldr r1, [r1] + strb r0, [r1, #0x16] + b _02045A14 +_02045984: + ldrsb r0, [r4, #0x14] + bl CloseDialogueBox + ldr r0, _02045A1C ; =_020AFED4 + mvn r1, #1 + ldr r0, [r0] + strb r1, [r0, #0x14] + bl sub_02043218 + mov r0, #2 + mov r1, #0 + mov r2, #8 + bl sub_02042CF0 + ldr r1, _02045A1C ; =_020AFED4 + ldr r1, [r1] + strb r0, [r1, #0x15] + b _02045A14 +_020459C0: + mov r0, #2 + mov r1, #0 + mov r2, #8 + bl sub_02042CF0 + ldr r1, _02045A1C ; =_020AFED4 + ldr r1, [r1] + strb r0, [r1, #0x15] + b _02045A14 +_020459E0: + mov r0, #0xa + str r0, [r4, #8] + ldr r0, [r1] + mov r1, #0x12 + str r1, [r0, #4] + bl sub_02046624 + ldr r0, _02045A1C ; =_020AFED4 +#ifdef JAPAN + ldr r2, _02045DC0 ; =0x00002FC4 + ldr r3, [r0] + mov r1, #0x18 +#else + mov r1, #0x18 + ldr r3, [r0] + mov r2, #0x2d0 +#endif + ldrsb r0, [r3, #0x14] + add r3, r3, #0x1c + bl ShowStringIdInDialogueBox +_02045A14: + add sp, sp, #0x194 + ldmia sp!, {r4, r5, pc} + .align 2, 0 +#ifdef JAPAN +#define SUB_020454E0_OFFSET 0x2CF4 +#else +#define SUB_020454E0_OFFSET 0 +#endif +_02045A1C: .word _020AFED4 +_02045A20: .word 0x000002CD + SUB_020454E0_OFFSET +_02045A24: .word 0x000002D5 + SUB_020454E0_OFFSET +_02045A28: .word 0x000002CE + SUB_020454E0_OFFSET +_02045A2C: .word _0209CC0C +_02045A30: .word 0x000002CF + SUB_020454E0_OFFSET +_02045A34: .word _0209CC38 +_02045A38: .word 0x00300011 +#ifdef JAPAN +_02045D9C: .word 0x00002FC5 +#endif +_02045A3C: .word 0x00300033 +_02045A40: .word _0209CC48 +_02045A44: .word 0x00001013 +#ifdef JAPAN +_02045A48: .word 0x00001D3C +#else +_02045A48: .word 0x000008E4 +#endif +_02045A4C: .word _0209CC28 +_02045A50: .word 0x000002D6 + SUB_020454E0_OFFSET +_02045A54: .word _0209CC18 +_02045A58: .word _0209CC60 +#ifdef JAPAN +_02045DC0: .word 0x00002FC4 +#endif + arm_func_end sub_020454E0 + + arm_func_start sub_02045A5C +sub_02045A5C: ; 0x02045A5C + stmdb sp!, {r4, r5, lr} + sub sp, sp, #0x194 + ldr r0, _02045F90 ; =_020AFED4 + ldr r4, [r0] + ldr r1, [r4, #4] + cmp r1, #0x13 + addls pc, pc, r1, lsl #2 + b _02045F88 +_02045A7C: ; jump table + b _02045ACC ; case 0 + b _02045AF8 ; case 1 + b _02045B40 ; case 2 + b _02045F88 ; case 3 + b _02045F88 ; case 4 + b _02045F88 ; case 5 + b _02045E34 ; case 6 + b _02045E88 ; case 7 + b _02045DB8 ; case 8 + b _02045EBC ; case 9 + b _02045EF8 ; case 10 + b _02045F34 ; case 11 + b _02045F88 ; case 12 + b _02045F88 ; case 13 + b _02045ECC ; case 14 + b _02045D0C ; case 15 + b _02045BFC ; case 16 + b _02045CD8 ; case 17 + b _02045F88 ; case 18 + b _02045F54 ; case 19 +_02045ACC: + mov r0, #2 + str r0, [r4, #8] + bl sub_02046624 + ldr r0, _02045F90 ; =_020AFED4 + ldr r2, _02045F94 ; =0x000002CD + ldr r3, [r0] + mov r1, #8 + ldrsb r0, [r3, #0x14] + add r3, r3, #0x1c + bl ShowStringIdInDialogueBox + b _02045F88 +_02045AF8: + mov r0, #2 + str r0, [r4, #8] + bl sub_02046624 + ldr r0, _02045F90 ; =_020AFED4 + ldr r0, [r0] + ldrsb r0, [r0, #0x14] + bl ShowDialogueBox + ldr r0, _02045F90 ; =_020AFED4 + mov r3, #2 + ldr r1, [r0] + ldr r2, _02045F98 ; =0x000002D5 + str r3, [r1, #8] + ldr r3, [r0] + mov r1, #8 + ldrsb r0, [r3, #0x14] + add r3, r3, #0x1c + bl ShowStringIdInDialogueBox + b _02045F88 +_02045B40: + ldr r1, _02045F9C ; =0x000002CE + add r0, r4, #0x70 + bl GetStringFromFileVeneer + mov r1, #2 + add r0, sp, #0x144 + str r1, [r4, #0x170] + bl InitPreprocessorArgs + ldr r0, _02045F90 ; =_020AFED4 + ldr r2, _02045FA0 ; =_0209CC0C + ldr r1, [r0] + add r0, r1, #0x390 + add r1, r1, #0x380 + bl sub_0200D670 + ldr r0, _02045F90 ; =_020AFED4 + ldr r2, _02045FA4 ; =0x000002CF + ldr r5, [r0] + add ip, sp, #0x144 + add r3, r5, #0x300 + ldrsh lr, [r3, #0x84] + add r0, r4, #0x174 + mov r1, #0x100 + orr lr, lr, #0x10000 + str lr, [sp, #0x154] + ldrh lr, [r3, #0x82] + mov r3, #0 + str lr, [sp, #0x168] + ldrb lr, [r5, #0x380] + str lr, [sp, #0x16c] + str ip, [sp] + bl PreprocessStringFromId + mov r1, #3 + str r1, [r4, #0x274] + mov r2, #0 + strb r2, [r4, #0x278] + mov r0, #1 + str r0, [r4, #0x378] + str r1, [sp] + ldr r3, _02045F90 ; =_020AFED4 + ldr r0, _02045FA8 ; =_0209CC38 + ldr r3, [r3] + ldr r1, _02045FAC ; =0x00300011 + add r3, r3, #0x70 + bl CreateSimpleMenu + ldr r1, _02045F90 ; =_020AFED4 + ldr r1, [r1] + strb r0, [r1, #0x16] + b _02045F88 +_02045BFC: + mov r1, #0x11 + str r1, [r4, #8] + ldr r0, [r0] + ldr r0, [r0] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02010044 + ldr r2, _02045F90 ; =_020AFED4 + ldr r1, [r2] + add r1, r1, #0x300 + strh r0, [r1, #0x88] + ldr r1, [r2] + add r0, r1, #0x300 + ldrsh r0, [r0, #0x88] + strh r0, [sp, #0x10] + ldr r0, [r1] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02010060 + ldr r3, _02045F90 ; =_020AFED4 + ldr r2, _02045FA0 ; =_0209CC0C + ldr r4, [r3] + add r1, sp, #0xc + str r0, [r4, #0x38c] + ldr r0, [r3] + mov r3, #0 + ldr r4, [r0, #0x38c] + add r0, r0, #0x390 + strh r4, [sp, #0xe] + strb r3, [sp, #0xc] + bl sub_0200D670 + ldr r0, _02045F90 ; =_020AFED4 + ldr r2, [r0] + add r1, r2, #0x390 + str r1, [r2, #0x54] + ldr r1, [r0] + add r0, r1, #0x300 + ldrsh r0, [r0, #0x88] + str r0, [r1, #0x2c] + bl sub_02046624 + ldr r0, _02045F90 ; =_020AFED4 + ldr r0, [r0] + ldrsb r0, [r0, #0x14] + bl ShowDialogueBox + ldr r0, _02045F90 ; =_020AFED4 + mov r4, #0x11 + ldr r3, [r0] +#ifdef JAPAN + ldr r2, _02046318 ; =0x00002FC5 + str r4, [r3, #8] + ldr r3, [r0] + mov r1, #8 +#else + mov r1, #8 + str r4, [r3, #8] + ldr r3, [r0] + add r2, r4, #0x2c0 +#endif + ldrsb r0, [r3, #0x14] + add r3, r3, #0x1c + bl ShowStringIdInDialogueBox + b _02045F88 +_02045CD8: + mov r4, #3 + str r4, [sp, #0xac] + mov r4, #2 + ldr r0, _02045FA8 ; =_0209CC38 + ldr r1, _02045FB0 ; =0x00300033 + ldr r3, _02045FB4 ; =_0209CC48 + add r2, sp, #0xac + str r4, [sp] + bl CreateSimpleMenuFromStringIds + ldr r1, _02045F90 ; =_020AFED4 + ldr r1, [r1] + strb r0, [r1, #0x16] + b _02045F88 +_02045D0C: + ldr r0, [r4] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02010044 + ldr r2, _02045F90 ; =_020AFED4 + ldr r1, [r2] + add r1, r1, #0x300 + strh r0, [r1, #0x88] + ldr r0, [r2] + ldr r0, [r0] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02010060 + ldr r4, _02045F90 ; =_020AFED4 + ldr r1, _02045FB8 ; =0x00001013 + ldr r2, [r4] + ldr r3, _02045FBC ; =0x000008E4 + str r0, [r2, #0x38c] + ldr lr, [r4] + ldr r0, _02045FC0 ; =_0209CC28 + add r2, lr, #0x300 + ldrsh ip, [r2, #0x88] + mov r2, #0 + str ip, [lr, #0x2c] + ldr lr, [r4] + ldr ip, [lr, #0x38c] + add ip, ip, #0xbc + str ip, [lr, #0x34] + ldr r4, [r4] + add ip, r4, #0x1c + add r4, r4, #0x300 + str ip, [sp] + ldrsh r4, [r4, #0x88] +#if defined(EUROPE) + add r4, r4, #0xd3 + add r4, r4, #0x2900 +#elif defined(JAPAN) + add r4, r4, #0xce + add r4, r4, #0x4100 +#else + add r4, r4, #0xd1 + add r4, r4, #0x2900 +#endif + mov r4, r4, lsl #0x10 + mov r4, r4, lsr #0x10 + stmib sp, {r4, ip} + bl CreateScrollBoxSingle + ldr r1, _02045F90 ; =_020AFED4 + ldr r1, [r1] + strb r0, [r1, #0x17] + b _02045F88 +_02045DB8: + ldr r0, [r4] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02010044 + ldr r2, _02045F90 ; =_020AFED4 + ldr r1, [r2] + add r1, r1, #0x300 + strh r0, [r1, #0x88] + ldr r0, [r2] + ldr r0, [r0] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02010060 + ldr r1, _02045F90 ; =_020AFED4 + mov r2, #3 + ldr r3, [r1] + str r0, [r3, #0x38c] + ldr r3, [r1] + add r0, r3, #0x300 + ldrsh r0, [r0, #0x88] + str r0, [r3, #0x2c] + ldr r0, [r1] + str r2, [r0, #4] + bl sub_02045A5C + ldr r0, _02045F90 ; =_020AFED4 + ldr r0, [r0] + ldr r0, [r0] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02010154 + b _02045F88 +_02045E34: + add r1, r4, #0x390 + str r1, [r4, #0x5c] + ldr r0, [r0] + mov r1, #7 + str r1, [r0, #8] + bl sub_02046624 + ldr r0, _02045F90 ; =_020AFED4 + ldr r0, [r0] + ldrsb r0, [r0, #0x14] + bl ShowDialogueBox + ldr r0, _02045F90 ; =_020AFED4 + mov r3, #7 + ldr r1, [r0] + ldr r2, _02045FC4 ; =0x000002D6 + str r3, [r1, #8] + ldr r3, [r0] + mov r1, #8 + ldrsb r0, [r3, #0x14] + add r3, r3, #0x1c + bl ShowStringIdInDialogueBox + b _02045F88 +_02045E88: + mov r4, #3 + str r4, [sp, #0x14] + mov r4, #2 + ldr r0, _02045FA8 ; =_0209CC38 + ldr r1, _02045FB0 ; =0x00300033 + ldr r3, _02045FB4 ; =_0209CC48 + add r2, sp, #0x14 + str r4, [sp] + bl CreateSimpleMenuFromStringIds + ldr r1, _02045F90 ; =_020AFED4 + ldr r1, [r1] + strb r0, [r1, #0x16] + b _02045F88 +_02045EBC: + mov r0, #4 + str r0, [r4, #4] + bl sub_02045A5C + b _02045F88 +_02045ECC: + ldr r0, _02045FC8 ; =_0209CC18 + mov r4, #3 + ldr r3, _02045FCC ; =_0209CC60 + mov r1, #0x13 + mov r2, #0 + str r4, [sp] + bl CreateSimpleMenuFromStringIds + ldr r1, _02045F90 ; =_020AFED4 + ldr r1, [r1] + strb r0, [r1, #0x16] + b _02045F88 +_02045EF8: + ldrsb r0, [r4, #0x14] + bl CloseDialogueBox + ldr r0, _02045F90 ; =_020AFED4 + mvn r1, #1 + ldr r0, [r0] + strb r1, [r0, #0x14] + bl sub_02043218 + mov r0, #2 + mov r1, #0 + mov r2, #8 + bl sub_02042CF0 + ldr r1, _02045F90 ; =_020AFED4 + ldr r1, [r1] + strb r0, [r1, #0x15] + b _02045F88 +_02045F34: + mov r0, #2 + mov r1, #0 + mov r2, #8 + bl sub_02042CF0 + ldr r1, _02045F90 ; =_020AFED4 + ldr r1, [r1] + strb r0, [r1, #0x15] + b _02045F88 +_02045F54: + mov r1, #0xa + str r1, [r4, #8] + ldr r0, [r0] + mov r1, #0x12 + str r1, [r0, #4] + bl sub_02046624 + ldr r0, _02045F90 ; =_020AFED4 +#ifdef JAPAN + ldr r2, _0204633C ; =0x00002FC4 + ldr r3, [r0] + mov r1, #0x18 +#else + mov r1, #0x18 + ldr r3, [r0] + mov r2, #0x2d0 +#endif + ldrsb r0, [r3, #0x14] + add r3, r3, #0x1c + bl ShowStringIdInDialogueBox +_02045F88: + add sp, sp, #0x194 + ldmia sp!, {r4, r5, pc} + .align 2, 0 +#ifdef JAPAN +#define SUB_02045A5C_OFFSET 0x2CF4 +#else +#define SUB_02045A5C_OFFSET 0 +#endif +_02045F90: .word _020AFED4 +_02045F94: .word 0x000002CD + SUB_02045A5C_OFFSET +_02045F98: .word 0x000002D5 + SUB_02045A5C_OFFSET +_02045F9C: .word 0x000002CE + SUB_02045A5C_OFFSET +_02045FA0: .word _0209CC0C +_02045FA4: .word 0x000002CF + SUB_02045A5C_OFFSET +_02045FA8: .word _0209CC38 +_02045FAC: .word 0x00300011 +#ifdef JAPAN +_02046318: .word 0x00002FC5 +#endif +_02045FB0: .word 0x00300033 +_02045FB4: .word _0209CC48 +_02045FB8: .word 0x00001013 +#ifdef JAPAN +_02045FBC: .word 0x00001D3C +#else +_02045FBC: .word 0x000008E4 +#endif +_02045FC0: .word _0209CC28 +_02045FC4: .word 0x000002D6 + SUB_02045A5C_OFFSET +_02045FC8: .word _0209CC18 +_02045FCC: .word _0209CC60 +#ifdef JAPAN +_0204633C: .word 0x00002FC4 +#endif + arm_func_end sub_02045A5C + + arm_func_start sub_02045FD0 +sub_02045FD0: ; 0x02045FD0 + stmdb sp!, {r3, lr} + ldr r2, _02046024 ; =_020AFED4 + ldr r1, [r2] + cmp r1, #0 + moveq r1, #0 + streqh r1, [r0, #4] + ldmeqia sp!, {r3, pc} + add r1, r1, #0x300 + ldrsh r1, [r1, #0x88] + strh r1, [r0, #4] + ldr r1, [r2] + ldr r1, [r1, #0x38c] + strh r1, [r0, #2] + bl sub_020440B8 + ldr r0, _02046024 ; =_020AFED4 + ldr r0, [r0] + bl MemFree + ldr r0, _02046024 ; =_020AFED4 + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_02046024: .word _020AFED4 + arm_func_end sub_02045FD0 + + arm_func_start sub_02046028 +sub_02046028: ; 0x02046028 + stmdb sp!, {r3, r4, lr} + sub sp, sp, #4 + ldr r0, _020465D8 ; =_020AFED4 + ldr r2, [r0] + ldr r1, [r2, #0x18] + cmp r1, #3 + addls pc, pc, r1, lsl #2 + b _020465CC +_02046048: ; jump table + b _02046058 ; case 0 + b _02046064 ; case 1 + b _02046590 ; case 2 + b _020465C4 ; case 3 +_02046058: + mov r0, #1 + str r0, [r2, #0x18] + b _020465CC +_02046064: + ldr r1, [r2, #4] + cmp r1, #0x12 + addls pc, pc, r1, lsl #2 + b _0204650C +_02046074: ; jump table + b _0204650C ; case 0 + b _0204650C ; case 1 + b _020460C0 ; case 2 + b _020464B4 ; case 3 + b _020464BC ; case 4 + b _020464C4 ; case 5 + b _0204650C ; case 6 + b _02046168 ; case 7 + b _0204650C ; case 8 + b _0204650C ; case 9 + b _020461BC ; case 10 + b _020461BC ; case 11 + b _02046334 ; case 12 + b _02046364 ; case 13 + b _020463B4 ; case 14 + b _02046478 ; case 15 + b _0204650C ; case 16 + b _02046114 ; case 17 + b _020464CC ; case 18 +_020460C0: + ldrsb r0, [r2, #0x16] + bl GetSimpleMenuResult + cmp r0, #1 + ldrne r1, _020465D8 ; =_020AFED4 + ldrne r1, [r1] + strne r0, [r1, #0x10] + cmp r0, #1 + beq _02046104 + cmp r0, #2 + beq _020460F4 + cmp r0, #3 + beq _02046104 + b _0204653C +_020460F4: + bl sub_020465DC + mov r0, #0x13 + bl sub_020454E0 + b _0204653C +_02046104: + bl sub_020465DC + mov r0, #6 + bl sub_020454E0 + b _0204653C +_02046114: + ldrsb r0, [r2, #0x16] + bl GetSimpleMenuResult + cmp r0, #1 + ldrne r1, _020465D8 ; =_020AFED4 + ldrne r1, [r1] + strne r0, [r1, #0x10] + cmp r0, #1 + beq _02046158 + cmp r0, #2 + beq _02046148 + cmp r0, #3 + beq _02046158 + b _0204653C +_02046148: + bl sub_020465DC + mov r0, #8 + bl sub_020454E0 + b _0204653C +_02046158: + bl sub_020465DC + mov r0, #0x13 + bl sub_020454E0 + b _0204653C +_02046168: + ldrsb r0, [r2, #0x16] + bl GetSimpleMenuResult + cmp r0, #1 + ldrne r1, _020465D8 ; =_020AFED4 + ldrne r1, [r1] + strne r0, [r1, #0x10] + cmp r0, #1 + beq _020461AC + cmp r0, #2 + beq _0204619C + cmp r0, #3 + beq _020461AC + b _0204653C +_0204619C: + bl sub_020465DC + mov r0, #9 + bl sub_020454E0 + b _0204653C +_020461AC: + bl sub_020465DC + mov r0, #0 + bl sub_020454E0 + b _0204653C +_020461BC: + bl sub_02043468 + mov r4, r0 + bl sub_02043400 + cmp r0, #0 + bne _02046234 + mvn r0, #0 + cmp r4, r0 + bne _02046214 + bl sub_0204317C + ldr r0, _020465D8 ; =_020AFED4 + mvn r2, #1 + ldr r1, [r0] + mov r3, #2 + strb r2, [r1, #0x15] + ldr r1, [r0] + mov r2, #1 + str r3, [r1, #0xc] + ldr r1, [r0] + mov r0, #0xc + str r2, [r1, #8] + bl sub_020454E0 + b _0204653C +_02046214: + ldr r1, _020465D8 ; =_020AFED4 + mov r0, r4 + ldr r1, [r1] + str r4, [r1] + bl sub_0204323C + mov r0, #0xe + bl sub_020454E0 + b _0204653C +_02046234: + bl sub_02043434 + cmp r0, #0 + beq _0204653C + add r1, sp, #0 + mov r0, #0 + bl GetPressedButtons + ldrh r0, [sp] + tst r0, #8 + beq _020462F4 + mov r0, #0 + bl PlaySeVolumeWrapper + ldr r1, _020465D8 ; =_020AFED4 + mov r0, r4 + ldr r1, [r1] + str r4, [r1] + bl sub_0204323C + ldr r0, _020465D8 ; =_020AFED4 + ldr r0, [r0] + ldr r0, [r0] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02010044 + ldr r2, _020465D8 ; =_020AFED4 + ldr r1, [r2] + add r1, r1, #0x300 + strh r0, [r1, #0x88] + ldr r0, [r2] + ldr r0, [r0] + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl sub_02010060 + ldr r1, _020465D8 ; =_020AFED4 + ldr r1, [r1] + str r0, [r1, #0x38c] + bl sub_020465DC + bl sub_0204317C + ldr r0, _020465D8 ; =_020AFED4 + mvn r2, #1 + ldr r1, [r0] + mov r3, #2 + strb r2, [r1, #0x15] + ldr r1, [r0] + mov r2, #0xf + str r3, [r1, #0xc] + ldr r1, [r0] + mov r0, #0xc + str r2, [r1, #8] + bl sub_020454E0 +_020462F4: + bl CountNbOfItemsInStorage + mov r4, r0 + bl sub_0200FD48 + cmp r4, r0 + bge _0204653C + bl sub_02043398 + ldr r0, _020465D8 ; =_020AFED4 + mov r3, #0xa + ldr r1, [r0] + mov r2, #5 + str r3, [r1, #0xc] + ldr r1, [r0] + mov r0, #0xd + str r2, [r1, #8] + bl sub_020454E0 + b _0204653C +_02046334: + mvn r1, #1 + strb r1, [r2, #0x15] + ldr r3, [r0] + ldr r2, [r3, #0xc] + sub r1, r2, #1 + str r1, [r3, #0xc] + cmp r2, #0 + bne _0204653C + ldr r0, [r0] + ldr r0, [r0, #8] + bl sub_020454E0 + b _0204653C +_02046364: + ldr r1, [r2, #0xc] + sub r1, r1, #1 + str r1, [r2, #0xc] + ldr r0, [r0] + ldr r0, [r0, #0xc] + cmp r0, #1 + bgt _02046394 + bl sub_0204317C + ldr r0, _020465D8 ; =_020AFED4 + mvn r1, #1 + ldr r0, [r0] + strb r1, [r0, #0x15] +_02046394: + ldr r0, _020465D8 ; =_020AFED4 + ldr r1, [r0] + ldr r0, [r1, #0xc] + cmp r0, #0 + bgt _0204653C + ldr r0, [r1, #8] + bl sub_020454E0 + b _0204653C +_020463B4: + ldrsb r0, [r2, #0x16] + bl GetSimpleMenuResult + cmp r0, #6 + addls pc, pc, r0, lsl #2 + b _0204653C +_020463C8: ; jump table + b _0204653C ; case 0 + b _0204645C ; case 1 + b _0204653C ; case 2 + b _0204653C ; case 3 + b _020463E4 ; case 4 + b _02046420 ; case 5 + b _0204645C ; case 6 +_020463E4: + bl sub_020465DC + bl sub_0204317C + ldr r0, _020465D8 ; =_020AFED4 + mvn r2, #1 + ldr r1, [r0] + mov r3, #2 + strb r2, [r1, #0x15] + ldr r1, [r0] + mov r2, #0x10 + str r3, [r1, #0xc] + ldr r1, [r0] + mov r0, #0xc + str r2, [r1, #8] + bl sub_020454E0 + b _0204653C +_02046420: + bl sub_020465DC + bl sub_0204317C + ldr r0, _020465D8 ; =_020AFED4 + mvn r2, #1 + ldr r1, [r0] + mov r3, #2 + strb r2, [r1, #0x15] + ldr r1, [r0] + mov r2, #0xf + str r3, [r1, #0xc] + ldr r1, [r0] + mov r0, #0xc + str r2, [r1, #8] + bl sub_020454E0 + b _0204653C +_0204645C: + bl sub_020465DC + bl sub_020433C0 + ldr r0, _020465D8 ; =_020AFED4 + mov r1, #0xa + ldr r0, [r0] + str r1, [r0, #4] + b _0204653C +_02046478: + ldrsb r0, [r2, #0x17] + bl IsScrollBoxActive + cmp r0, #0 + bne _0204653C + ldr r0, _020465D8 ; =_020AFED4 + ldr r0, [r0] + ldrsb r0, [r0, #0x17] + bl CloseScrollBox + ldr r0, _020465D8 ; =_020AFED4 + mvn r2, #1 + ldr r1, [r0] + mov r0, #0xb + strb r2, [r1, #0x17] + bl sub_020454E0 + b _0204653C +_020464B4: + mov r2, #2 + b _02046540 +_020464BC: + mov r2, #4 + b _02046540 +_020464C4: + mov r2, #3 + b _02046540 +_020464CC: + ldrsb r0, [r2, #0x14] + bl IsDialogueBoxActive + cmp r0, #0 + bne _0204653C + ldr r0, _020465D8 ; =_020AFED4 + ldr r0, [r0] + ldrsb r0, [r0, #0x14] + bl ShowDialogueBox + ldr r0, _020465D8 ; =_020AFED4 + mov r2, #0x14 + ldr r1, [r0] + str r2, [r1, #4] + ldr r0, [r0] + ldrsb r0, [r0, #0x14] + bl sub_0202F2C4 + b _0204653C +_0204650C: + ldrsb r0, [r2, #0x14] + bl IsDialogueBoxActive + cmp r0, #0 + bne _0204653C + ldr r0, _020465D8 ; =_020AFED4 + ldr r0, [r0] + ldrsb r0, [r0, #0x14] + bl ShowDialogueBox + ldr r0, _020465D8 ; =_020AFED4 + ldr r0, [r0] + ldr r0, [r0, #8] + bl sub_020454E0 +_0204653C: + mov r2, #1 +_02046540: + ldr r0, _020465D8 ; =_020AFED4 + ldr r1, [r0] + str r2, [r1, #0x6c] + ldr r2, [r0] + ldr r1, [r2, #0x6c] + cmp r1, #1 + beq _020465CC + mov r1, #2 + str r1, [r2, #0x18] + ldr r0, [r0] + sub r1, r1, #4 + ldrsb r0, [r0, #0x14] + cmp r0, r1 + beq _020465CC + bl sub_0202836C + ldr r0, _020465D8 ; =_020AFED4 + ldr r0, [r0] + ldrsb r0, [r0, #0x14] + bl sub_0202F2C4 + b _020465CC +_02046590: + mov r1, #3 + str r1, [r2, #0x18] + ldr r0, [r0] + sub r1, r1, #5 + ldrsb r0, [r0, #0x14] + cmp r0, r1 + beq _020465CC + bl CloseDialogueBox + ldr r0, _020465D8 ; =_020AFED4 + mvn r1, #1 + ldr r0, [r0] + strb r1, [r0, #0x14] + b _020465CC +_020465C4: + ldr r0, [r2, #0x6c] + b _020465D0 +_020465CC: + mov r0, #1 +_020465D0: + add sp, sp, #4 + ldmia sp!, {r3, r4, pc} + .align 2, 0 +_020465D8: .word _020AFED4 + arm_func_end sub_02046028 + + arm_func_start sub_020465DC +sub_020465DC: ; 0x020465DC + stmdb sp!, {r3, lr} + ldr r0, _02046620 ; =_020AFED4 + mvn r1, #1 + ldr r0, [r0] + ldrsb r0, [r0, #0x16] + cmp r0, r1 + ldmeqia sp!, {r3, pc} + bl sub_0202836C + ldr r0, _02046620 ; =_020AFED4 + ldr r0, [r0] + ldrsb r0, [r0, #0x16] + bl CloseSimpleMenu + ldr r0, _02046620 ; =_020AFED4 + mvn r1, #1 + ldr r0, [r0] + strb r1, [r0, #0x16] + ldmia sp!, {r3, pc} + .align 2, 0 +_02046620: .word _020AFED4 + arm_func_end sub_020465DC + + arm_func_start sub_02046624 +sub_02046624: ; 0x02046624 + stmdb sp!, {r3, lr} + ldr r1, _02046658 ; =_020AFED4 + mvn r0, #1 + ldr r1, [r1] + ldrsb r1, [r1, #0x14] + cmp r1, r0 + ldmneia sp!, {r3, pc} + mov r0, #0 + bl CreateDialogueBox + ldr r1, _02046658 ; =_020AFED4 + ldr r1, [r1] + strb r0, [r1, #0x14] + ldmia sp!, {r3, pc} + .align 2, 0 +_02046658: .word _020AFED4 + arm_func_end sub_02046624 + + arm_func_start sub_0204665C +sub_0204665C: ; 0x0204665C + stmdb sp!, {r3, lr} + ldr r0, _02046694 ; =_020AFED8 + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0] + bl CloseAdvancedTextBox + ldr r0, _02046694 ; =_020AFED8 + ldr r0, [r0] + bl MemFree + ldr r0, _02046694 ; =_020AFED8 + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_02046694: .word _020AFED8 + arm_func_end sub_0204665C + + arm_func_start sub_02046698 +sub_02046698: ; 0x02046698 + stmdb sp!, {r4, lr} + sub sp, sp, #0xa0 + mov r4, r0 + mov r0, #0xec + mov r1, #0 + bl MemAlloc + ldr r2, _0204672C ; =_020AFED8 + mov r1, #0xec + str r0, [r2] + bl MemZero + ldr r0, _0204672C ; =_020AFED8 + mov ip, #0xe + ldr r0, [r0] + add lr, r0, #4 +_020466D0: + ldmia r4!, {r0, r1, r2, r3} + stmia lr!, {r0, r1, r2, r3} + subs ip, ip, #1 + bne _020466D0 + ldmia r4, {r0, r1} + stmia lr, {r0, r1} + ldr r1, _02046730 ; =0x00000A43 + mov r0, #0x10 + strh r1, [sp, #0x10] + str r0, [sp, #0x14] + mov ip, #0 + str ip, [sp] + ldr r0, _02046734 ; =_0209CC80 + ldr r1, _02046738 ; =0x00001815 + ldr r3, _0204673C ; =sub_02046798 + add r2, sp, #8 + str ip, [sp, #4] + bl CreateAdvancedTextBox + ldr r1, _0204672C ; =_020AFED8 + ldr r1, [r1] + strb r0, [r1] + add sp, sp, #0xa0 + ldmia sp!, {r4, pc} + .align 2, 0 +_0204672C: .word _020AFED8 +#ifdef JAPAN +_02046730: .word 0x00000B8A +#else +_02046730: .word 0x00000A43 +#endif +_02046734: .word _0209CC80 +_02046738: .word 0x00001815 +_0204673C: .word sub_02046798 + arm_func_end sub_02046698 + + arm_func_start sub_02046740 +sub_02046740: ; 0x02046740 + stmdb sp!, {r3, lr} + ldr r1, _02046774 ; =_020AFED8 + ldr r0, _02046778 ; =0x00000279 + ldr r1, [r1] + ldrsh r1, [r1, #0x5e] + cmp r1, r0 + blt _02046768 + mov r0, #0x14 + bl PlayBgmByIdVeneer + ldmia sp!, {r3, pc} +_02046768: + mov r0, #0x13 + bl PlayBgmByIdVeneer + ldmia sp!, {r3, pc} + .align 2, 0 +_02046774: .word _020AFED8 +_02046778: .word 0x00000279 + arm_func_end sub_02046740 + + arm_func_start sub_0204677C +sub_0204677C: ; 0x0204677C + ldr r0, _02046790 ; =_020AFED8 + ldr ip, _02046794 ; =IsAdvancedTextBoxActive + ldr r0, [r0] + ldrsb r0, [r0] + bx ip + .align 2, 0 +_02046790: .word _020AFED8 +_02046794: .word IsAdvancedTextBoxActive + arm_func_end sub_0204677C + + arm_func_start sub_02046798 +sub_02046798: ; 0x02046798 + ldr r1, _020467AC ; =_020AFED8 + ldr ip, _020467B0 ; =sub_0200C5DC + ldr r1, [r1] + add r1, r1, #4 + bx ip + .align 2, 0 +_020467AC: .word _020AFED8 +_020467B0: .word sub_0200C5DC + arm_func_end sub_02046798 + + arm_func_start sub_020467B4 +sub_020467B4: ; 0x020467B4 + stmdb sp!, {r3, r4, lr} + sub sp, sp, #0x24 + mov r4, r0 + bl sub_0204AE60 + cmp r0, #0 + moveq r0, #0 + beq _020467E8 + add r0, sp, #0 + bl GetReleasedStylus + add r0, sp, #0 + mov r2, r4 + mov r1, #2 + bl sub_02006C8C +_020467E8: + add sp, sp, #0x24 + ldmia sp!, {r3, r4, pc} + arm_func_end sub_020467B4 + + arm_func_start sub_020467F0 +sub_020467F0: ; 0x020467F0 + ldr ip, _020467FC ; =sub_020467B4 + ldr r0, _02046800 ; =_0209CC90 + bx ip + .align 2, 0 +_020467FC: .word sub_020467B4 +_02046800: .word _0209CC90 + arm_func_end sub_020467F0 + + arm_func_start sub_02046804 +sub_02046804: ; 0x02046804 + stmdb sp!, {r4, lr} + mov r4, r0 + ldr r0, _02046824 ; =_0209CCA0 + bl sub_02034974 + cmp r0, #0 + ldrne r0, _02046828 ; =_022AAE64 + strneh r4, [r0] + ldmia sp!, {r4, pc} + .align 2, 0 +_02046824: .word _0209CCA0 +_02046828: .word _022AAE64 + arm_func_end sub_02046804 + + arm_func_start sub_0204682C +sub_0204682C: ; 0x0204682C + stmdb sp!, {r3, lr} + mov r0, #0xa8 + mov r1, #8 + bl MemAlloc + ldr r1, _02046890 ; =_020AFEDC + str r0, [r1] + add r0, r0, #0x10 + bl sub_02034A38 + ldr r2, _02046890 ; =_020AFEDC + ldr r1, _02046894 ; =_022AAE64 + ldr r3, [r2] + str r0, [r3, #0xc] + ldrh r3, [r1] + ldr r1, [r2] + mov r0, #0 + strh r3, [r1, #8] + bl CreateDialogueBox + ldr r1, _02046890 ; =_020AFEDC + mov r2, #0 + ldr r3, [r1] + strb r0, [r3] + ldr r1, [r1] + mov r0, #1 + str r2, [r1, #4] + ldmia sp!, {r3, pc} + .align 2, 0 +_02046890: .word _020AFEDC +_02046894: .word _022AAE64 + arm_func_end sub_0204682C + + arm_func_start sub_02046898 +sub_02046898: ; 0x02046898 + stmdb sp!, {r3, lr} + ldr r0, _020468D0 ; =_020AFEDC + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0] + bl CloseDialogueBox + ldr r0, _020468D0 ; =_020AFEDC + ldr r0, [r0] + bl MemFree + ldr r0, _020468D0 ; =_020AFEDC + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_020468D0: .word _020AFEDC + arm_func_end sub_02046898 + + arm_func_start sub_020468D4 +sub_020468D4: ; 0x020468D4 + stmdb sp!, {r3, lr} + ldr r0, _020469B4 ; =_020AFEDC + ldr r2, [r0] + ldr r1, [r2, #4] + cmp r1, #3 + addls pc, pc, r1, lsl #2 + b _020469AC +_020468F0: ; jump table + b _02046900 ; case 0 + b _02046928 ; case 1 + b _0204695C ; case 2 + b _0204697C ; case 3 +_02046900: + ldrsb r0, [r2] + ldrh r2, [r2, #8] + ldr r1, _020469B8 ; =0x00000618 + mov r3, #0 + bl ShowStringIdInDialogueBox + ldr r0, _020469B4 ; =_020AFEDC + mov r1, #1 + ldr r0, [r0] + str r1, [r0, #4] + b _020469AC +_02046928: + ldrsb r0, [r2] + bl IsDialogueBoxActive + cmp r0, #0 + bne _020469AC + ldr r0, _020469B4 ; =_020AFEDC + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_0202F334 + ldr r0, _020469B4 ; =_020AFEDC + mov r1, #2 + ldr r0, [r0] + str r1, [r0, #4] + b _020469AC +_0204695C: + ldrsb r0, [r2] + bl IsDialogueBoxActive + cmp r0, #0 + ldreq r0, _020469B4 ; =_020AFEDC + moveq r1, #3 + ldreq r0, [r0] + streq r1, [r0, #4] + b _020469AC +_0204697C: + mov r1, #4 + str r1, [r2, #4] + ldr r1, [r0] + ldr r0, [r1, #0xc] + tst r0, #0x100 + beq _020469A4 + ldr r0, [r1, #0x98] + ldr r2, [r1, #0x94] + mov r1, #0 + blx r2 +_020469A4: + mov r0, #4 + ldmia sp!, {r3, pc} +_020469AC: + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_020469B4: .word _020AFEDC +_020469B8: .word 0x00000618 + arm_func_end sub_020468D4 + + arm_func_start sub_020469BC +sub_020469BC: ; 0x020469BC + stmdb sp!, {r3, lr} + mov r0, #0x2c + mov r1, #8 + bl MemAlloc + ldr r2, _020469E4 ; =_020AFEE0 + mov r1, #0x2c + str r0, [r2] + bl MemZero + bl sub_020471AC + ldmia sp!, {r3, pc} + .align 2, 0 +_020469E4: .word _020AFEE0 + arm_func_end sub_020469BC + + arm_func_start sub_020469E8 +sub_020469E8: ; 0x020469E8 + stmdb sp!, {r3, lr} + ldr r0, _02046A1C ; =_020AFEE0 + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + bl sub_020471E8 + ldr r0, _02046A1C ; =_020AFEE0 + ldr r0, [r0] + bl MemFree + ldr r0, _02046A1C ; =_020AFEE0 + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_02046A1C: .word _020AFEE0 + arm_func_end sub_020469E8 + + arm_func_start sub_02046A20 +sub_02046A20: ; 0x02046A20 + stmdb sp!, {r4, r5, r6, r7, r8, lr} + sub sp, sp, #0x10 + ldr r4, _02046A98 ; =_020AFEE0 + mov r6, r1 + ldr r4, [r4] + mov r7, r0 + mov r0, r4 + mov r1, #0x2c + mov r5, r2 + mov r8, r3 + bl MemZero + ldr r0, [sp, #0x28] + str r8, [sp] + ldrh r1, [sp, #0x2c] + str r0, [sp, #4] + ldr r0, [sp, #0x30] + str r1, [sp, #8] + mov r1, r7 + mov r2, r6 + mov r3, r5 + str r0, [sp, #0xc] + add r0, r4, #0x10 + bl sub_02046D50 + mov r0, #1 + str r0, [r4, #0x14] + str r5, [r4, #0x24] + mov r0, #0 + str r0, [r4, #0x28] + add sp, sp, #0x10 + ldmia sp!, {r4, r5, r6, r7, r8, pc} + .align 2, 0 +_02046A98: .word _020AFEE0 + arm_func_end sub_02046A20 + + arm_func_start sub_02046A9C +sub_02046A9C: ; 0x02046A9C + stmdb sp!, {r4, r5, r6, r7, lr} + sub sp, sp, #0xa4 + mov r7, r0 + mov r6, r1 + add r0, sp, #0xc + mov r1, #0x98 + mov r5, r2 + mov r4, r3 + bl MemZero + ldrsb r0, [sp, #0xb8] + add r3, sp, #0xc + mov r1, r6 + cmp r0, #0 + addge r0, r5, r0, lsl #3 + ldrge r0, [r0, #4] + mov ip, #0 + movlt r0, #0 + str r0, [sp, #0xc] + str r5, [sp] + str r4, [sp, #4] + mov r0, r7 + mov r2, #0x33 + str ip, [sp, #8] + bl sub_02046A20 + add sp, sp, #0xa4 + ldmia sp!, {r4, r5, r6, r7, pc} + arm_func_end sub_02046A9C + + arm_func_start sub_02046B04 +sub_02046B04: ; 0x02046B04 + stmdb sp!, {r3, r4, r5, lr} + ldr r0, _02046B9C ; =_020AFEE0 + ldr r5, [r0] + ldr r0, [r5, #0x14] + cmp r0, #0 + beq _02046B94 + cmp r0, #1 + beq _02046B30 + cmp r0, #9 + beq _02046B64 + b _02046B94 +_02046B30: + ldr r0, [r5, #0x10] + bl sub_02046F40 + ldr r0, [r5, #0x10] + bl sub_02047030 + mov r4, r0 + ldr r0, [r5, #0x10] + bl sub_02047038 + mvn r1, #0 + str r0, [r5, #0x28] + cmp r4, r1 + movne r0, #9 + strne r0, [r5, #0x14] + b _02046B94 +_02046B64: + ldr r0, [r5, #0x10] + bl sub_02047030 + str r0, [r5, #0x20] + ldr r0, [r5, #0x24] + tst r0, #0x400000 + bne _02046B8C + add r0, r5, #0x10 + bl sub_02047040 + mov r0, #0 + str r0, [r5, #0x14] +_02046B8C: + ldr r0, [r5, #0x20] + ldmia sp!, {r3, r4, r5, pc} +_02046B94: + mvn r0, #0 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_02046B9C: .word _020AFEE0 + arm_func_end sub_02046B04 + + arm_func_start sub_02046BA0 +sub_02046BA0: ; 0x02046BA0 + ldr r0, _02046BB0 ; =_020AFEE0 + ldr r0, [r0] + ldr r0, [r0, #0x28] + bx lr + .align 2, 0 +_02046BB0: .word _020AFEE0 + arm_func_end sub_02046BA0 + + arm_func_start sub_02046BB4 +sub_02046BB4: ; 0x02046BB4 + stmdb sp!, {r4, lr} + ldr r0, _02046BE4 ; =_020AFEE0 + ldr r4, [r0] + add r0, r4, #0x10 + bl sub_02047040 + mov r1, #0 + ldr r0, _02046BE4 ; =_020AFEE0 + str r1, [r4, #0x14] + ldr r0, [r0] + sub r1, r1, #2 + str r1, [r0, #0x20] + ldmia sp!, {r4, pc} + .align 2, 0 +_02046BE4: .word _020AFEE0 + arm_func_end sub_02046BB4 + + arm_func_start sub_02046BE8 +sub_02046BE8: ; 0x02046BE8 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + ldr r3, _02046C2C ; =_020AFEE0 + mov r6, r1 + ldr r4, [r3] + mov r7, r0 + mov r5, r2 + mov r0, r4 + mov r1, #0x2c + bl MemZero + mov r0, r7 + mov r1, r6 + mov r2, r5 + bl sub_020472A4 + mov r0, #1 + str r0, [r4, #0x14] + strh r7, [r4, #0x18] + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_02046C2C: .word _020AFEE0 + arm_func_end sub_02046BE8 + + arm_func_start sub_02046C30 +sub_02046C30: ; 0x02046C30 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + ldr r3, _02046C74 ; =_020AFEE0 + mov r6, r1 + ldr r4, [r3] + mov r7, r0 + mov r5, r2 + mov r0, r4 + mov r1, #0x2c + bl MemZero + mov r0, r7 + mov r1, r6 + mov r2, r5 + bl sub_02047358 + mov r0, #1 + str r0, [r4, #0x14] + strh r7, [r4, #0x18] + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_02046C74: .word _020AFEE0 + arm_func_end sub_02046C30 + + arm_func_start sub_02046C78 +sub_02046C78: ; 0x02046C78 + stmdb sp!, {r4, lr} + ldr r0, _02046D1C ; =_020AFEE0 + ldr r4, [r0] + ldr r0, [r4, #0x14] + cmp r0, #9 + bgt _02046CB4 + bge _02046CF0 + cmp r0, #1 + bgt _02046D14 + cmp r0, #0 + blt _02046D14 + beq _02046D14 + cmp r0, #1 + beq _02046CC0 + b _02046D14 +_02046CB4: + cmp r0, #0xa + beq _02046D00 + b _02046D14 +_02046CC0: + bl sub_020473FC + cmp r0, #2 + bne _02046D14 + ldrh r0, [r4, #0x18] + tst r0, #0x400 + movne r0, #0xa + strne r0, [r4, #0x14] + movne r0, #0x3c + strne r0, [r4, #0x1c] + moveq r0, #9 + streq r0, [r4, #0x14] + b _02046D14 +_02046CF0: + mov r0, #0 + str r0, [r4, #0x14] + mov r0, #1 + ldmia sp!, {r4, pc} +_02046D00: + ldr r0, [r4, #0x1c] + subs r0, r0, #1 + str r0, [r4, #0x1c] + movmi r0, #9 + strmi r0, [r4, #0x14] +_02046D14: + mov r0, #0 + ldmia sp!, {r4, pc} + .align 2, 0 +_02046D1C: .word _020AFEE0 + arm_func_end sub_02046C78 + + arm_func_start sub_02046D20 +sub_02046D20: ; 0x02046D20 + ldr ip, _02046D28 ; =sub_020473A4 + bx ip + .align 2, 0 +_02046D28: .word sub_020473A4 + arm_func_end sub_02046D20 + + arm_func_start sub_02046D2C +sub_02046D2C: ; 0x02046D2C + ldr r1, _02046D40 ; =_020AFEE0 + ldr r2, [r1] + str r0, [r1] + mov r0, r2 + bx lr + .align 2, 0 +_02046D40: .word _020AFEE0 + arm_func_end sub_02046D2C + + arm_func_start sub_02046D44 +sub_02046D44: ; 0x02046D44 + ldr ip, _02046D4C ; =sub_020474B8 + bx ip + .align 2, 0 +_02046D4C: .word sub_020474B8 + arm_func_end sub_02046D44 + + arm_func_start sub_02046D50 +sub_02046D50: ; 0x02046D50 + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, lr} + sub sp, sp, #0x410 + mov r4, r0 + mov r5, r1 + mov r0, #0xcc + mov r1, #8 + mov sb, r2 + mov r8, r3 + ldr r7, [sp, #0x434] + bl MemAlloc + mov r1, #0xcc + mov r6, r0 + str r0, [r4] + bl MemZero + cmp r5, #0 + bne _02046E48 + mov r5, #0 + sub r0, r5, #1 + str r5, [sp] + strb r0, [sp, #9] + cmp r7, #0 + beq _02046E54 + mov r4, r5 + add sl, sp, #0x10 + b _02046DE0 +_02046DB4: + mov r0, r4, lsl #3 + ldrh r1, [r7, r0] + cmp r1, #0 + beq _02046DE8 + mov r0, sl + bl GetStringFromFileVeneer + mov r0, sl + bl sub_020265A8 + cmp r0, r5 + movgt r5, r0 + add r4, r4, #1 +_02046DE0: + cmp r4, #0x64 + blt _02046DB4 +_02046DE8: + mov r0, #0xe + mul r1, r4, r0 + add r3, r5, #7 + mov r0, r3, asr #2 + add r2, r1, #7 + add r0, r3, r0, lsr #29 + mov r0, r0, asr #3 + add r3, r0, #2 + mov r1, r2, asr #2 + add r0, r2, r1, lsr #29 + mov r5, r0, asr #3 + rsb r4, r3, #0x1e + rsb r2, r5, #0xf + mov r1, #0 + strb r4, [sp, #4] + add r0, sp, #0 + strb r5, [sp, #7] + add r4, r6, #4 + strb r2, [sp, #5] + strb r3, [sp, #6] + str r1, [sp, #0xc] + ldmia r0, {r0, r1, r2, r3} + stmia r4, {r0, r1, r2, r3} + b _02046E54 +_02046E48: + add r4, r6, #4 + ldmia r5, {r0, r1, r2, r3} + stmia r4, {r0, r1, r2, r3} +_02046E54: + add r0, sp, #0x420 + ldrh r1, [r0, #0x18] + ldr ip, [sp, #0x430] + ldr r0, [sp, #0x43c] + strh r1, [r6, #0x20] + strh sb, [r6, #0x22] + str r0, [r6, #0x24] + str r7, [r6, #0x1c] + mvn r0, #0 + str r0, [r6, #0x14] + str r8, [r6, #0x28] + mov r0, #0 + str r0, [r6, #0x18] + cmp ip, #0 + streqb r0, [r6, #0xc4] + beq _02046EBC + add r5, r6, #0x2c + mov r4, #9 +_02046E9C: + ldmia ip!, {r0, r1, r2, r3} + stmia r5!, {r0, r1, r2, r3} + subs r4, r4, #1 + bne _02046E9C + ldmia ip, {r0, r1} + stmia r5, {r0, r1} + mov r0, #1 + strb r0, [r6, #0xc4] +_02046EBC: + mvn r0, #1 + strb r0, [r6] + ldrh r0, [r6, #0x20] + cmp r0, #0 + moveq r0, #0 + beq _02046EF8 + bl sub_020473FC + cmp r0, #1 + bne _02046EE4 + bl sub_02047220 +_02046EE4: + ldrh r0, [r6, #0x22] + ldrh r1, [r6, #0x20] + ldr r2, [r6, #0x24] + bl sub_02047244 + mov r0, #1 +_02046EF8: + cmp r0, #0 + bne _02046F2C + ldrb r0, [r6, #0xc4] + ldr r1, [r6, #0x28] + ldr r3, [r6, #0x1c] + cmp r0, #0 + addne r2, r6, #0x2c + moveq r2, #0 + add r0, r6, #4 + bl CreateParentMenuFromStringIds + strb r0, [r6] + mov r0, #1 + b _02046F30 +_02046F2C: + mov r0, #6 +_02046F30: + str r0, [r6, #0xc8] + mov r0, #1 + add sp, sp, #0x410 + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, pc} + arm_func_end sub_02046D50 + + arm_func_start sub_02046F40 +sub_02046F40: ; 0x02046F40 + stmdb sp!, {r3, r4, r5, lr} + mov r4, r0 + ldr r0, [r4, #0xc8] + cmp r0, #9 + addls pc, pc, r0, lsl #2 + ldmia sp!, {r3, r4, r5, pc} +_02046F58: ; jump table + ldmia sp!, {r3, r4, r5, pc} ; case 0 + b _02046FBC ; case 1 + ldmia sp!, {r3, r4, r5, pc} ; case 2 + ldmia sp!, {r3, r4, r5, pc} ; case 3 + ldmia sp!, {r3, r4, r5, pc} ; case 4 + ldmia sp!, {r3, r4, r5, pc} ; case 5 + b _02046F80 ; case 6 + ldmia sp!, {r3, r4, r5, pc} ; case 7 + ldmia sp!, {r3, r4, r5, pc} ; case 8 + b _02047024 ; case 9 +_02046F80: + bl sub_020473FC + cmp r0, #2 + ldmneia sp!, {r3, r4, r5, pc} + ldrb r0, [r4, #0xc4] + ldr r1, [r4, #0x28] + ldr r3, [r4, #0x1c] + cmp r0, #0 + addne r2, r4, #0x2c + moveq r2, #0 + add r0, r4, #4 + bl CreateParentMenuFromStringIds + strb r0, [r4] + mov r0, #1 + str r0, [r4, #0xc8] + ldmia sp!, {r3, r4, r5, pc} +_02046FBC: + ldrsb r0, [r4] + bl sub_020282F4 + mov r5, r0 + ldrsb r0, [r4] + bl sub_0202AB80 + str r0, [r4, #0x18] + ldrsb r0, [r4] + bl IsParentMenuActive + cmp r0, #0 + ldmneia sp!, {r3, r4, r5, pc} + mvn r1, #3 + cmp r5, r1 + bne _02047008 + ldrsb r0, [r4] + bl sub_0202ABB0 + str r0, [r4, #0x14] + mov r0, #9 + str r0, [r4, #0xc8] + ldmia sp!, {r3, r4, r5, pc} +_02047008: + sub r0, r1, #1 + cmp r5, r0 + addeq r0, r1, #2 + streq r0, [r4, #0x14] + moveq r0, #9 + streq r0, [r4, #0xc8] + ldmia sp!, {r3, r4, r5, pc} +_02047024: + mov r0, #0xa + str r0, [r4, #0xc8] + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_02046F40 + + arm_func_start sub_02047030 +sub_02047030: ; 0x02047030 + ldr r0, [r0, #0x14] + bx lr + arm_func_end sub_02047030 + + arm_func_start sub_02047038 +sub_02047038: ; 0x02047038 + ldr r0, [r0, #0x18] + bx lr + arm_func_end sub_02047038 + + arm_func_start sub_02047040 +sub_02047040: ; 0x02047040 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + ldr r4, [r5] + cmp r4, #0 + ldmeqia sp!, {r3, r4, r5, pc} + ldrsb r0, [r4] + mvn r1, #1 + cmp r0, r1 + beq _02047068 + bl CloseParentMenu +_02047068: + mov r0, r4 + bl MemFree + mov r0, #0 + str r0, [r5] + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_02047040 + + arm_func_start sub_0204707C +sub_0204707C: ; 0x0204707C + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r7, r0 + mov r6, r1 + mov r0, #0xc + mov r1, #8 + mov r5, r2 + bl MemAlloc + mov r1, #0xc + mov r4, r0 + str r0, [r7] + bl MemZero + mov r0, r6 + mov r1, r5 + bl CreateTextBox + strb r0, [r4] + mov r0, #3 + str r0, [r4, #8] + sub r0, r0, #4 + str r0, [r4, #4] + mov r0, #1 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end sub_0204707C + + arm_func_start sub_020470D0 +sub_020470D0: ; 0x020470D0 + stmdb sp!, {r4, lr} + mov r4, r0 + ldr r0, [r4, #8] + cmp r0, #0 + beq _020470FC + cmp r0, #3 + beq _02047108 + cmp r0, #4 + moveq r0, #8 + streq r0, [r4, #8] + ldmia sp!, {r4, pc} +_020470FC: + mov r0, #3 + str r0, [r4, #8] + ldmia sp!, {r4, pc} +_02047108: + ldrsb r0, [r4] + bl sub_020282F4 + mvn r2, #3 + cmp r0, r2 + addeq r0, r2, #1 + streq r0, [r4, #4] + moveq r0, #4 + streq r0, [r4, #8] + ldmeqia sp!, {r4, pc} + sub r1, r2, #1 + cmp r0, r1 + addeq r0, r2, #2 + streq r0, [r4, #4] + moveq r0, #4 + streq r0, [r4, #8] + ldmia sp!, {r4, pc} + arm_func_end sub_020470D0 + + arm_func_start sub_02047148 +sub_02047148: ; 0x02047148 + ldr r0, [r0, #4] + bx lr + arm_func_end sub_02047148 + + arm_func_start sub_02047150 +sub_02047150: ; 0x02047150 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + ldr r4, [r5] + cmp r4, #0 + ldmeqia sp!, {r3, r4, r5, pc} + ldrsb r0, [r4] + bl sub_0202812C + ldrsb r0, [r4] + bl CloseTextBox2 + mov r0, r4 + bl MemFree + mov r0, #0 + str r0, [r5] + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_02047150 + + arm_func_start sub_02047188 +sub_02047188: ; 0x02047188 + stmdb sp!, {r4, lr} + ldr r4, [r0] + cmp r4, #0 + ldmeqia sp!, {r4, pc} + ldrsb r0, [r4] + bl sub_02027B1C + ldrsb r0, [r4] + bl sub_0202F9B8 + ldmia sp!, {r4, pc} + arm_func_end sub_02047188 + + arm_func_start sub_020471AC +sub_020471AC: ; 0x020471AC + stmdb sp!, {r3, lr} + mov r0, #0x70 + mov r1, #8 + bl MemAlloc + ldr r2, _020471E4 ; =_020AFEE4 + mov r1, #0x70 + str r0, [r2] + bl MemZero + ldr r0, _020471E4 ; =_020AFEE4 + mvn r2, #1 + ldr r1, [r0] + mov r0, #1 + strb r2, [r1] + ldmia sp!, {r3, pc} + .align 2, 0 +_020471E4: .word _020AFEE4 + arm_func_end sub_020471AC + + arm_func_start sub_020471E8 +sub_020471E8: ; 0x020471E8 + stmdb sp!, {r3, lr} + ldr r0, _0204721C ; =_020AFEE4 + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + bl sub_020473A4 + ldr r0, _0204721C ; =_020AFEE4 + ldr r0, [r0] + bl MemFree + ldr r0, _0204721C ; =_020AFEE4 + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_0204721C: .word _020AFEE4 + arm_func_end sub_020471E8 + + arm_func_start sub_02047220 +sub_02047220: ; 0x02047220 + stmdb sp!, {r3, lr} + mov r0, #0 + bl CreateDialogueBox + ldr r1, _02047240 ; =_020AFEE4 + ldr r1, [r1] + strb r0, [r1] + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_02047240: .word _020AFEE4 + arm_func_end sub_02047220 + + arm_func_start sub_02047244 +sub_02047244: ; 0x02047244 + stmdb sp!, {r4, lr} + ldr r3, _020472A0 ; =_020AFEE4 + mov r4, r2 + ldr r2, [r3] + strh r1, [r2, #0x14] + ldr r1, [r3] + strh r0, [r1, #0x68] + ldr r0, [r3] + ldrsb r0, [r0] + bl sub_020288DC + ldr r0, _020472A0 ; =_020AFEE4 + ldr r0, [r0] + ldrsb r0, [r0] + bl ShowDialogueBox + ldr r0, _020472A0 ; =_020AFEE4 + mov r3, r4 + ldr r2, [r0] + ldrsb r0, [r2] + ldrh r1, [r2, #0x68] + ldrh r2, [r2, #0x14] + bl ShowStringIdInDialogueBox + mov r0, #1 + ldmia sp!, {r4, pc} + .align 2, 0 +_020472A0: .word _020AFEE4 + arm_func_end sub_02047244 + + arm_func_start sub_020472A4 +sub_020472A4: ; 0x020472A4 + stmdb sp!, {r4, r5, r6, lr} + mov r6, r0 + mov r5, r1 + mov r4, r2 + bl sub_020473FC + cmp r0, #1 + bne _020472D4 + mov r0, #0 + bl CreateDialogueBox + ldr r1, _020472EC ; =_020AFEE4 + ldr r1, [r1] + strb r0, [r1] +_020472D4: + mov r0, r6 + mov r1, r5 + mov r2, r4 + bl sub_02047244 + mov r0, #1 + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_020472EC: .word _020AFEE4 + arm_func_end sub_020472A4 + + arm_func_start sub_020472F0 +sub_020472F0: ; 0x020472F0 + stmdb sp!, {r3, r4, r5, lr} + ldr r3, _02047354 ; =_020AFEE4 + mov ip, #0 + ldr r4, [r3] + mov r5, r1 + strh ip, [r4, #0x14] + ldr r1, [r3] + mov r4, r2 + strh r0, [r1, #0x68] + ldr r0, [r3] + ldrsb r0, [r0] + bl sub_020288DC + ldr r0, _02047354 ; =_020AFEE4 + ldr r0, [r0] + ldrsb r0, [r0] + bl ShowDialogueBox + ldr r0, _02047354 ; =_020AFEE4 + mov r2, r5 + ldr r1, [r0] + mov r3, r4 + ldrsb r0, [r1] + ldrh r1, [r1, #0x68] + bl ShowStringInDialogueBox + mov r0, #1 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_02047354: .word _020AFEE4 + arm_func_end sub_020472F0 + + arm_func_start sub_02047358 +sub_02047358: ; 0x02047358 + stmdb sp!, {r4, r5, r6, lr} + mov r6, r0 + mov r5, r1 + mov r4, r2 + bl sub_020473FC + cmp r0, #1 + bne _02047388 + mov r0, #0 + bl CreateDialogueBox + ldr r1, _020473A0 ; =_020AFEE4 + ldr r1, [r1] + strb r0, [r1] +_02047388: + mov r0, r6 + mov r1, r5 + mov r2, r4 + bl sub_020472F0 + mov r0, #1 + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_020473A0: .word _020AFEE4 + arm_func_end sub_02047358 + + arm_func_start sub_020473A4 +sub_020473A4: ; 0x020473A4 + stmdb sp!, {r3, lr} + ldr r0, _020473F8 ; =_020AFEE4 + mvn r1, #1 + ldr r0, [r0] + ldrsb r0, [r0] + cmp r0, r1 + ldmeqia sp!, {r3, pc} + bl sub_0202836C + ldr r0, _020473F8 ; =_020AFEE4 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_0202F2C4 + ldr r0, _020473F8 ; =_020AFEE4 + ldr r0, [r0] + ldrsb r0, [r0] + bl CloseDialogueBox + ldr r0, _020473F8 ; =_020AFEE4 + mvn r1, #1 + ldr r0, [r0] + strb r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_020473F8: .word _020AFEE4 + arm_func_end sub_020473A4 + + arm_func_start sub_020473FC +sub_020473FC: ; 0x020473FC + stmdb sp!, {r4, lr} + ldr r0, _0204749C ; =_020AFEE4 + mov r4, #0 + ldr r0, [r0] + sub r1, r4, #2 + ldrsb r0, [r0] + cmp r0, r1 + moveq r0, #1 + ldmeqia sp!, {r4, pc} + bl IsDialogueBoxActive + cmp r0, #0 + movne r0, #4 + bne _02047440 + ldr r0, _0204749C ; =_020AFEE4 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_0202F16C +_02047440: + cmp r0, #0xa + addls pc, pc, r0, lsl #2 + b _02047494 +_0204744C: ; jump table + b _02047494 ; case 0 + b _02047490 ; case 1 + b _02047494 ; case 2 + b _02047494 ; case 3 + b _02047488 ; case 4 + b _02047494 ; case 5 + b _02047494 ; case 6 + b _02047494 ; case 7 + b _02047478 ; case 8 + b _02047478 ; case 9 + b _02047480 ; case 10 +_02047478: + mov r4, #4 + b _02047494 +_02047480: + mov r4, #5 + b _02047494 +_02047488: + mov r4, #3 + b _02047494 +_02047490: + mov r4, #2 +_02047494: + mov r0, r4 + ldmia sp!, {r4, pc} + .align 2, 0 +_0204749C: .word _020AFEE4 + arm_func_end sub_020473FC + + arm_func_start sub_020474A0 +sub_020474A0: ; 0x020474A0 + ldr r1, _020474B4 ; =_020AFEE4 + ldr r2, [r1] + str r0, [r1] + mov r0, r2 + bx lr + .align 2, 0 +_020474B4: .word _020AFEE4 + arm_func_end sub_020474A0 + + arm_func_start sub_020474B8 +sub_020474B8: ; 0x020474B8 + ldr r2, _020474D8 ; =_020AFEE4 + mov r3, r0 + ldr r0, [r2] + ldr ip, _020474DC ; =ReadStringFromDialogueBox + mov r2, r1 + ldrsb r0, [r0] + mov r1, r3 + bx ip + .align 2, 0 +_020474D8: .word _020AFEE4 +_020474DC: .word ReadStringFromDialogueBox + arm_func_end sub_020474B8 + + arm_func_start sub_020474E0 +sub_020474E0: ; 0x020474E0 + stmdb sp!, {r3, lr} + ldr r0, _02047574 ; =_022AAE68 + ldr r2, [r0] + cmp r2, #0 + beq _0204756C + ldr r1, [r2, #0x10] + cmp r1, #2 + bgt _02047520 + cmp r1, #0 + blt _0204756C + beq _02047528 + cmp r1, #1 + beq _02047534 + cmp r1, #2 + beq _02047554 + b _0204756C +_02047520: + cmp r1, #0xff + b _0204756C +_02047528: + add r0, r1, #1 + str r0, [r2, #0x10] + b _0204756C +_02047534: + mov r0, #0 + bl sub_02047C40 + cmp r0, #0 + ldrne r0, _02047574 ; =_022AAE68 + movne r1, #2 + ldrne r0, [r0] + strne r1, [r0, #0x10] + b _0204756C +_02047554: + mov r1, #1 + str r1, [r0, #4] + mov r0, #0xff + str r0, [r2, #0x10] + mov r0, #4 + ldmia sp!, {r3, pc} +_0204756C: + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_02047574: .word _022AAE68 + arm_func_end sub_020474E0 + + arm_func_start sub_02047578 +sub_02047578: ; 0x02047578 + stmdb sp!, {r3, lr} + ldr r0, _020475B0 ; =_022AAE68 + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + mov r0, #0 + bl sub_02047EF4 + ldr r0, _020475B0 ; =_022AAE68 + ldr r0, [r0] + bl MemFree + ldr r0, _020475B0 ; =_022AAE68 + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_020475B0: .word _022AAE68 + arm_func_end sub_02047578 + + arm_func_start sub_020475B4 +sub_020475B4: ; 0x020475B4 + stmdb sp!, {r3, r4, r5, r6, lr} + sub sp, sp, #4 + mov r6, r0 + ldr r3, _02047658 ; =_022AAE68 + mov ip, #0 + ldr r0, _0204765C ; =_0209CCB0 + mov r5, r1 + mov r4, r2 + str ip, [r3, #4] + bl sub_020348E4 + cmp r0, #0 + beq _02047650 + mov r0, #0x14 + mov r1, #8 + bl MemAlloc + ldr r2, _02047658 ; =_022AAE68 + mov r1, #0x14 + str r0, [r2] + bl MemZero + ldr r2, _02047658 ; =_022AAE68 + mov r1, #0 + str r1, [r2, #4] + ldr r3, [r2] + mov r0, r5 + str r6, [r3, #4] + ldr r3, [r2] + strh r1, [r3, #0xa] + ldr r2, [r2] + strh r5, [r2, #0xc] + bl sub_02047760 + ldr r0, _02047658 ; =_022AAE68 + mov r2, #0 + ldr r5, [r0] + mov r1, r4 + str r2, [sp] + ldrsh r3, [r5, #0xc] + ldr r0, [r5, #4] + add r2, r5, #0xa + bl sub_02047F38 +_02047650: + add sp, sp, #4 + ldmia sp!, {r3, r4, r5, r6, pc} + .align 2, 0 +_02047658: .word _022AAE68 +_0204765C: .word _0209CCB0 + arm_func_end sub_020475B4 + + arm_func_start sub_02047660 +sub_02047660: ; 0x02047660 + ldr r0, _0204766C ; =_022AAE68 + ldr r0, [r0, #4] + bx lr + .align 2, 0 +_0204766C: .word _022AAE68 + arm_func_end sub_02047660 + + arm_func_start sub_02047670 +sub_02047670: ; 0x02047670 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + mov r4, r1 + mov r0, #0x60 + mov r1, #8 + bl MemAlloc + ldr r2, _020476E8 ; =_020AFEE8 + mov r1, #0x60 + str r0, [r2] + bl MemZero + ldr r0, _020476E8 ; =_020AFEE8 + ldr r0, [r0] + bl InitPreprocessorArgs + ldr r1, _020476E8 ; =_020AFEE8 + mov r0, r4 + ldr r2, [r1] + mov r3, #0 + mov r1, #1 + str r3, [r2, #0x4c] + bl sub_02047760 + ldr r1, _020476E8 ; =_020AFEE8 + mov r3, #0 + ldr r2, [r1] + mov r0, #1 + strh r3, [r2, #0x58] + ldr r2, [r1] + strh r4, [r2, #0x56] + ldr r1, [r1] + str r5, [r1, #0x50] + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_020476E8: .word _020AFEE8 + arm_func_end sub_02047670 + + arm_func_start sub_020476EC +sub_020476EC: ; 0x020476EC + stmdb sp!, {r3, lr} + ldr r1, _02047718 ; =_020AFEE8 + mov r2, #1 + ldr ip, [r1] + mov r1, r0 + str r2, [sp] + ldrsh r3, [ip, #0x56] + ldr r0, [ip, #0x50] + add r2, ip, #0x58 + bl sub_02047F38 + ldmia sp!, {r3, pc} + .align 2, 0 +_02047718: .word _020AFEE8 + arm_func_end sub_020476EC + + arm_func_start sub_0204771C +sub_0204771C: ; 0x0204771C + stmdb sp!, {r3, lr} + ldr r0, _0204775C ; =_020AFEE8 + ldr r0, [r0] + cmp r0, #0 + moveq r0, #0 + ldmeqia sp!, {r3, pc} + mov r0, #1 + bl sub_02047EF4 + ldr r0, _0204775C ; =_020AFEE8 + ldr r0, [r0] + bl MemFree + ldr r0, _0204775C ; =_020AFEE8 + mov r1, #0 + str r1, [r0] + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_0204775C: .word _020AFEE8 + arm_func_end sub_0204771C + + arm_func_start sub_02047760 +sub_02047760: ; 0x02047760 + stmdb sp!, {r4, r5, r6, lr} + sub sp, sp, #0x18 + ldr r2, _02047920 ; =_020AFEEC + mov r5, r1 + ldr r1, [r2, r5, lsl #2] + mov r6, r0 + cmp r1, #0 + movne r0, #0 + bne _02047918 + ldr r0, _02047924 ; =0x00002020 + mov r1, #8 + bl MemAlloc + ldr r1, _02047924 ; =0x00002020 + mov r4, r0 + bl MemZero + cmp r5, #0 + bne _02047850 + ldr r0, _02047928 ; =_0209CCC0 + add lr, sp, #8 + ldmia r0, {r0, r1, r2, r3} + stmia lr, {r0, r1, r2, r3} + mov ip, #0 + add r2, r4, #0x384 + str ip, [sp, #8] + str r4, [sp, #0x14] + strb ip, [sp, #0x10] + add r0, r4, #0x1000 +#ifdef JAPAN + mov r1, #0x10 + str r1, [r0, #0xf90] + add r0, r4, #0x1f00 + mov r1, #0x1540 +#else + mov r3, #0x10 + str r3, [r0, #0xf90] + ldr r1, _0204792C ; =0x00000A44 + add r0, r4, #0x1f00 +#endif + strh r1, [r0, #0x8c] + str ip, [sp] + ldr r1, _02047930 ; =0x0040180A + ldr r3, _02047934 ; =sub_02047AB4 + mov r0, lr + add r2, r2, #0x1c00 + str ip, [sp, #4] + bl CreateAdvancedTextBox + add r1, r4, #0x100 + strb r0, [r4, #0x120] + ldrsb r0, [r1, #0x20] + mov r1, #1 + bl SetAdvancedTextBoxPartialMenu + add r0, r4, #0x100 + ldrsb r0, [r0, #0x20] + mov r1, #1 + bl sub_02030AAC + add r0, r4, #0x1f00 + mov r1, #0x14 + strh r1, [r0, #0x80] + add r0, r4, #0x100 + ldrsb r0, [r0, #0x20] + mov r1, #0x20000000 + bl sub_02030A90 + add r0, r4, #0x100 + ldrsb r0, [r0, #0x20] + mov r1, #0x40000000 + bl sub_02030A74 + b _020478A0 +_02047850: + ldr r0, _02047938 ; =_0209CCD0 + add ip, sp, #8 + ldmia r0, {r0, r1, r2, r3} + stmia ip, {r0, r1, r2, r3} + mov r1, #0 + mov r0, #1 + add r2, r4, #0x384 + strb r0, [sp, #0x10] + str r1, [sp, #8] + str r4, [sp, #0x14] + str r1, [sp] + ldr r3, _02047934 ; =sub_02047AB4 + mov r0, ip + add r2, r2, #0x1c00 + str r1, [sp, #4] + bl CreateAdvancedTextBox + strb r0, [r4, #0x120] + add r0, r4, #0x1f00 + mov r1, #8 + strh r1, [r0, #0x80] +_020478A0: + add r0, r4, #0x1000 + strb r5, [r0, #0xf7c] + add r0, r4, #0x100 + ldrsb r1, [r0, #0x20] + mov r0, r4 + bl sub_02025E84 + mov ip, #0 + str ip, [r4, #0x11c] + add r2, r4, #0x1f00 + strh r6, [r2, #0x72] + strb ip, [r4, #0x128] + ldrb r1, [sp, #0xe] + mov r3, #0x3c + add r0, r4, #0x2000 + mov r1, r1, lsl #3 + strh r1, [r2, #0x78] + strb ip, [r0, #0x1c] + add r0, r4, #0x1000 + mov r1, #0x80 + str r1, [r0, #0xf6c] + add r0, r4, #0x12c + add r1, r3, #0x1e00 + strh r3, [r2, #0x68] + bl MemZero + add r0, r4, #0x1000 + mov r2, #0 + ldr r1, _02047920 ; =_020AFEEC + strb r2, [r0, #0xf82] + str r4, [r1, r5, lsl #2] + mov r0, #1 +_02047918: + add sp, sp, #0x18 + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_02047920: .word _020AFEEC +_02047924: .word 0x00002020 +_02047928: .word _0209CCC0 +#ifndef JAPAN +_0204792C: .word 0x00000A44 +#endif +_02047930: .word 0x0040180A +_02047934: .word sub_02047AB4 +_02047938: .word _0209CCD0 + arm_func_end sub_02047760 + + arm_func_start sub_0204793C +sub_0204793C: ; 0x0204793C + ldr r1, _0204795C ; =_020AFEEC + mov r2, #0 + ldr r3, [r1, r0, lsl #2] + mov r1, #1 + add r0, r3, #0x1f00 + strh r2, [r0, #0x70] + strb r1, [r3, #0x128] + bx lr + .align 2, 0 +_0204795C: .word _020AFEEC + arm_func_end sub_0204793C + + arm_func_start sub_02047960 +sub_02047960: ; 0x02047960 + stmdb sp!, {r3, r4, r5, lr} + ldr r1, _02047A0C ; =_020AFEEC + mov r5, r0 + ldr r4, [r1, r5, lsl #2] + add r0, r4, #0x1f00 + ldrsh r1, [r0, #0x70] + cmp r1, #0 + addle r0, r4, #0x2000 + movle r1, #1 + strleb r1, [r0, #0x1c] + movle r2, #0 + ble _020479B0 + ldrsh r0, [r0, #0x72] + sub r0, r1, r0 + mov r0, r0, lsl #0x10 + movs r2, r0, asr #0x10 + addmi r0, r4, #0x2000 + movmi r1, #1 + strmib r1, [r0, #0x1c] + movmi r2, #0 +_020479B0: + add r0, r4, #0x1f00 + strh r2, [r0, #0x74] + mov r1, #0 + strb r1, [r4, #0x128] + strh r2, [r0, #0x7e] + add r0, r4, #0x100 + ldrsb r0, [r0, #0x20] + bl SetAdvancedTextBoxField0x1C2 + cmp r5, #0 + ldmneia sp!, {r3, r4, r5, pc} + add r0, r4, #0x2000 + ldrb r0, [r0, #0x1c] + cmp r0, #0 + ldmeqia sp!, {r3, r4, r5, pc} + add r0, r4, #0x100 + ldrsb r0, [r0, #0x20] + mov r1, #0x20000000 + bl sub_02030A74 + add r0, r4, #0x100 + ldrsb r0, [r0, #0x20] + mov r1, #0x40000000 + bl sub_02030A74 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_02047A0C: .word _020AFEEC + arm_func_end sub_02047960 + + arm_func_start sub_02047A10 +sub_02047A10: ; 0x02047A10 + stmdb sp!, {r3, r4, r5, r6, lr} + sub sp, sp, #4 + ldr r4, _02047AB0 ; =_020AFEEC + mov r6, r0 + ldr r4, [r4, r3, lsl #2] + mov r5, r2 + ldrb r0, [r4, #0x128] + cmp r0, #0 + beq _02047AA8 + add r0, r4, #0x1f00 + ldrsh r3, [r0, #0x70] + ldrsh r2, [r0, #0x68] + cmp r3, r2 + bge _02047AA8 + add r2, r3, r3, lsl #7 + add r2, r4, r2 + strb r1, [r2, #0x1ac] + ldrsh r0, [r0, #0x70] + add r2, r4, #0x12c + mov r1, r6 + add r0, r0, r0, lsl #7 + add r0, r2, r0 + bl strcpy + str r5, [sp] + add r0, r4, #0x1f00 + ldrsh r1, [r0, #0x70] + add r0, r4, #0x1000 + add r5, r4, #0x12c + add r3, r1, r1, lsl #7 + ldr r1, [r0, #0xf6c] + mov r2, r6 + add r0, r5, r3 + mov r3, #0x400 + bl PreprocessString + add r0, r4, #0x1f00 + ldrsh r1, [r0, #0x70] + add r1, r1, #1 + strh r1, [r0, #0x70] +_02047AA8: + add sp, sp, #4 + ldmia sp!, {r3, r4, r5, r6, pc} + .align 2, 0 +_02047AB0: .word _020AFEEC + arm_func_end sub_02047A10 + + arm_func_start sub_02047AB4 +sub_02047AB4: ; 0x02047AB4 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #8 + mov sl, r0 + bl sub_02028324 + cmp r0, #0 + moveq r1, #0 + beq _02047ADC + cmp r0, #1 + moveq r1, #1 + bne _02047C34 +_02047ADC: + ldr r0, _02047C3C ; =_020AFEEC + ldr r5, [r0, r1, lsl #2] + add r0, r5, #0x100 + ldrsb r0, [r0, #0x20] + bl sub_02027B1C + ldr r0, [r5, #0x11c] + cmp r0, #2 + beq _02047B0C + mov r0, r5 + bl sub_0202613C + mov r0, #1 + str r0, [r5, #0x11c] +_02047B0C: + add r4, r5, #0x1f00 + ldrsh r0, [r4, #0x70] + ldrsh r7, [r4, #0x7e] + cmp r7, r0 + bge _02047C34 + ldr r1, [r5, #0x18] + ldr r2, [r5, #4] + mov r1, r1, lsl #0x10 + mov r2, r2, lsl #0x10 + mov r8, r1, asr #0x10 + mov r1, r2, asr #0x10 + str r1, [sp, #4] + mov r6, #0 + add fp, r5, #0x12c + b _02047BBC +_02047B48: + add sb, r7, r7, lsl #7 + add r0, r5, sb + ldrb r0, [r0, #0x1ac] + cmp r0, #0 + beq _02047B80 + mov r0, #0x17 + str r0, [sp] + ldrsh r1, [r4, #0x80] + ldrsh r3, [r4, #0x78] + mov r0, sl + mla r1, r6, r8, r1 + sub r2, r1, #2 + mov r1, #0 + bl sub_02025D50 +_02047B80: + ldrsh r2, [r4, #0x80] + ldr r1, [sp, #4] + mov r0, sl + mla r2, r6, r8, r2 + add r3, fp, sb + bl sub_020264A4 + add r0, r7, #1 + mov r1, r0, lsl #0x10 + ldrsh r0, [r4, #0x70] + mov r7, r1, asr #0x10 + cmp r0, r1, asr #16 + ble _02047BC8 + add r1, r6, #1 + mov r1, r1, lsl #0x10 + mov r6, r1, asr #0x10 +_02047BBC: + ldrsh r1, [r4, #0x72] + cmp r6, r1 + blt _02047B48 +_02047BC8: + add r1, r5, #0x1f00 + ldrsh r2, [r1, #0x72] + cmp r0, r2 + ble _02047C18 + sub r0, r0, r2 + sub r0, r0, #1 + ldrsh r1, [r1, #0x74] + mov r0, r0, lsl #0x10 + cmp r1, r0, asr #16 + addeq r0, r5, #0x1000 + moveq r1, #1 + streqb r1, [r0, #0xf82] + beq _02047C2C + cmp r1, #0 + add r0, r5, #0x1000 + moveq r1, #2 + streqb r1, [r0, #0xf82] + movne r1, #3 + strneb r1, [r0, #0xf82] + b _02047C2C +_02047C18: + add r0, r5, #0x1000 + mov r1, #0 + strb r1, [r0, #0xf82] + strb r1, [r0, #0xf7a] + strb r1, [r0, #0xf7b] +_02047C2C: + mov r0, sl + bl UpdateWindow +_02047C34: + add sp, sp, #8 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_02047C3C: .word _020AFEEC + arm_func_end sub_02047AB4 + + arm_func_start sub_02047C40 +sub_02047C40: ; 0x02047C40 + stmdb sp!, {r3, r4, r5, r6, r7, r8, lr} + sub sp, sp, #4 + ldr r1, _02047EF0 ; =_020AFEEC + mov r6, #0 + ldr r5, [r1, r0, lsl #2] + add r1, sp, #0 + mov r0, r6 + bl sub_020063F4 + add r0, r5, #0x100 + ldrsb r0, [r0, #0x20] + bl GetAdvancedTextBoxFlags2 + ldr r1, [r5, #0x11c] + mov r4, r0 + cmp r1, #4 + addls pc, pc, r1, lsl #2 + b _02047EE4 +_02047C80: ; jump table + b _02047C94 ; case 0 + b _02047CAC ; case 1 + b _02047CB8 ; case 2 + b _02047EC0 ; case 3 + b _02047ECC ; case 4 +_02047C94: + mov r0, r5 + bl sub_020261D4 + cmp r0, #0 + beq _02047EE4 + mov r0, #1 + str r0, [r5, #0x11c] +_02047CAC: + mov r0, #2 + str r0, [r5, #0x11c] + b _02047EE4 +_02047CB8: + mov r0, r5 + bl sub_02026204 + add r1, r5, #0x1000 + ldrb r1, [r1, #0xf7c] + mov r7, r0 + cmp r1, #1 + beq _02047EE4 + add r0, r5, #0x100 + ldrsb r0, [r0, #0x20] + bl IsAdvancedTextBoxActive + cmp r0, #0 + beq _02047CF0 + ands r8, r4, #2 + beq _02047D0C +_02047CF0: + mov r0, #1 + bl PlaySeVolumeWrapper + mov r0, #3 + str r0, [r5, #0x11c] + mov r0, #1 + str r0, [r5, #0x124] + b _02047EE4 +_02047D0C: + add r0, r5, #0x1f00 + ldrsh r3, [r0, #0x72] + ldrsh ip, [r0, #0x70] + cmp ip, r3 + ble _02047E9C + ldrh r0, [sp] + tst r0, #0x40 + bne _02047D34 + tst r4, #0x40000 + beq _02047D7C +_02047D34: + add r0, r5, #0x1f00 + ldrsh r1, [r0, #0x74] + sub r1, r1, #1 + strh r1, [r0, #0x74] + ldrsh r1, [r0, #0x74] + cmp r1, #0 + bge _02047D6C + mov r1, #0 + strh r1, [r0, #0x74] + add r0, r5, #0x100 + ldrsb r0, [r0, #0x20] + mov r1, #0x20000000 + bl sub_02030A74 + b _02047D74 +_02047D6C: + mov r0, #3 + bl PlaySeVolumeWrapper +_02047D74: + mov r6, #1 + b _02047DC4 +_02047D7C: + tst r0, #0x80 + bne _02047D8C + tst r4, #0x80000 + beq _02047DC4 +_02047D8C: + add r1, r5, #0x1f00 + ldrsh r2, [r1, #0x74] + sub r0, ip, r3 + mov r0, r0, lsl #0x10 + add r2, r2, #1 + strh r2, [r1, #0x74] + ldrsh r2, [r1, #0x74] + mov r3, r0, asr #0x10 + cmp r2, r0, asr #16 + strgth r3, [r1, #0x74] + bgt _02047DC0 + mov r0, #3 + bl PlaySeVolumeWrapper +_02047DC0: + mov r6, #1 +_02047DC4: + add r0, r5, #0x1f00 + ldrsh r2, [r0, #0x74] + cmp r2, #1 + blt _02047E0C + ldrsh r1, [r0, #0x70] + ldrsh r0, [r0, #0x72] + sub r0, r1, r0 + cmp r2, r0 + bge _02047E0C + add r0, r5, #0x100 + ldrsb r0, [r0, #0x20] + mov r1, #0x20000000 + bl sub_02030A90 + add r0, r5, #0x100 + ldrsb r0, [r0, #0x20] + mov r1, #0x40000000 + bl sub_02030A90 + b _02047E70 +_02047E0C: + cmp r2, #0 + bne _02047E38 + add r0, r5, #0x100 + ldrsb r0, [r0, #0x20] + mov r1, #0x20000000 + bl sub_02030A74 + add r0, r5, #0x100 + ldrsb r0, [r0, #0x20] + mov r1, #0x40000000 + bl sub_02030A90 + b _02047E70 +_02047E38: + add r0, r5, #0x1f00 + ldrsh r1, [r0, #0x70] + ldrsh r0, [r0, #0x72] + sub r0, r1, r0 + cmp r2, r0 + bne _02047E70 + add r0, r5, #0x100 + ldrsb r0, [r0, #0x20] + mov r1, #0x20000000 + bl sub_02030A90 + add r0, r5, #0x100 + ldrsb r0, [r0, #0x20] + mov r1, #0x40000000 + bl sub_02030A74 +_02047E70: + ldrb r0, [r5, #0x129] + cmp r0, #0 + bne _02047E9C + cmp r6, #0 + beq _02047E9C + add r0, r5, #0x1f00 + ldrsh r2, [r0, #0x74] + add r1, r5, #0x100 + strh r2, [r0, #0x7e] + ldrsb r0, [r1, #0x20] + bl SetAdvancedTextBoxField0x1C2 +_02047E9C: + cmp r8, #0 + bne _02047EAC + cmp r7, #0x10 + bne _02047EE4 +_02047EAC: + mov r1, #3 + mov r0, #1 + str r1, [r5, #0x11c] + bl PlaySeVolumeWrapper + b _02047EE4 +_02047EC0: + mov r0, #4 + str r0, [r5, #0x11c] + b _02047EE4 +_02047ECC: + mov r1, r6 + mov r0, r5 + str r1, [r5, #0x11c] + bl sub_0202613C + mov r0, #1 + b _02047EE8 +_02047EE4: + mov r0, #0 +_02047EE8: + add sp, sp, #4 + ldmia sp!, {r3, r4, r5, r6, r7, r8, pc} + .align 2, 0 +_02047EF0: .word _020AFEEC + arm_func_end sub_02047C40 + + arm_func_start sub_02047EF4 +sub_02047EF4: ; 0x02047EF4 + stmdb sp!, {r4, lr} + ldr r1, _02047F34 ; =_020AFEEC + mov r4, r0 + ldr r0, [r1, r4, lsl #2] + cmp r0, #0 + ldmeqia sp!, {r4, pc} + add r0, r0, #0x100 + ldrsb r0, [r0, #0x20] + bl CloseAdvancedTextBox2 + ldr r0, _02047F34 ; =_020AFEEC + ldr r0, [r0, r4, lsl #2] + bl MemFree + ldr r0, _02047F34 ; =_020AFEEC + mov r1, #0 + str r1, [r0, r4, lsl #2] + ldmia sp!, {r4, pc} + .align 2, 0 +_02047F34: .word _020AFEEC + arm_func_end sub_02047EF4 + + arm_func_start sub_02047F38 +sub_02047F38: ; 0x02047F38 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + mov sb, r1 + mov sl, r0 + ldr r6, [sp, #0x28] + mov r0, sb + mov r1, #0x3c + mov r8, r2 + mov r7, r3 + bl _s32_div_f + mov r1, r1, lsl #0x10 + mov r2, #0 + mov r0, r6 + strh r2, [r8] + mov sb, r1, asr #0x10 + bl sub_0204793C + mov r5, #0 + mov fp, #0x3c + mov r4, #0xd4 +_02047F80: + smulbb r1, sb, r4 + ldrb r0, [sl, r1] + add r2, sl, r1 + cmp r0, #0 + beq _02047FB4 + ldrb r1, [r2, #1] + mov r3, r6 + add r0, r2, #3 + add r2, r2, #0x84 + bl sub_02047A10 + ldrsh r0, [r8] + add r0, r0, #1 + strh r0, [r8] +_02047FB4: + add r0, sb, #1 + mov r0, r0, lsl #0x10 + mov r1, fp + mov r0, r0, asr #0x10 + bl _s32_div_f + add r0, r5, #1 + mov r2, r0, lsl #0x10 + mov r0, r1, lsl #0x10 + mov r5, r2, asr #0x10 + cmp r5, #0x3c + mov sb, r0, asr #0x10 + blt _02047F80 + ldrsh r0, [r8] + cmp r0, r7 + mov r0, r6 + strlth r7, [r8] + bl sub_02047960 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + arm_func_end sub_02047F38 + + arm_func_start sub_02047FFC +sub_02047FFC: ; 0x02047FFC + stmdb sp!, {r4, lr} + mov r4, r0 + mov r0, #0x39c0 + mov r1, #0 + bl MemAlloc + ldr r2, _02048048 ; =_020AFEF4 + mov r1, #0x39c0 + str r0, [r2] + bl MemZero + ldr r1, _02048048 ; =_020AFEF4 + mov r2, #1 + ldr r0, [r1] + add r0, r0, #0x3000 + str r4, [r0, #0x1bc] + ldr r0, [r1] + add r0, r0, #0x3000 + strb r2, [r0, #0x1b3] + bl sub_020480CC + ldmia sp!, {r4, pc} + .align 2, 0 +_02048048: .word _020AFEF4 + arm_func_end sub_02047FFC + + arm_func_start sub_0204804C +sub_0204804C: ; 0x0204804C + stmdb sp!, {r3, lr} + ldr r0, _02048074 ; =_020AFEF4 + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + bl MemFree + ldr r0, _02048074 ; =_020AFEF4 + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_02048074: .word _020AFEF4 + arm_func_end sub_0204804C + + arm_func_start sub_02048078 +sub_02048078: ; 0x02048078 + ldr r1, _0204809C ; =_020AFEF4 + ldr r1, [r1] + cmp r1, #0 + movne r2, #1 + moveq r2, #0 + tst r2, #0xff + addne r1, r1, #0x3000 + strneb r0, [r1, #0x1b3] + bx lr + .align 2, 0 +_0204809C: .word _020AFEF4 + arm_func_end sub_02048078 + + arm_func_start sub_020480A0 +sub_020480A0: ; 0x020480A0 + ldr r0, _020480C8 ; =_020AFEF4 + ldr r0, [r0] + cmp r0, #0 + movne r1, #1 + moveq r1, #0 + tst r1, #0xff + addne r0, r0, #0x3000 + ldrneb r0, [r0, #0x1b3] + moveq r0, #0 + bx lr + .align 2, 0 +_020480C8: .word _020AFEF4 + arm_func_end sub_020480A0 + + arm_func_start sub_020480CC +sub_020480CC: ; 0x020480CC + stmdb sp!, {r4, r5, r6, r7, r8, lr} + ldr r6, _02048130 ; =_020AFEF4 + mov r7, #0xd4 + ldr r0, [r6] + mov r4, #0 + add r0, r0, #0x3100 + strh r4, [r0, #0xb8] + ldr r0, [r6] + mov r1, #1 + add r0, r0, #0x3000 + strb r1, [r0, #0x1b0] + mov r5, r7 +_020480FC: + mul r8, r4, r5 + ldr r0, [r6] + mov r1, r7 + add r0, r0, r8 + bl MemZero + ldr r0, [r6] + add r0, r0, r8 + add r0, r0, #0x84 + bl InitPreprocessorArgs + add r4, r4, #1 + cmp r4, #0x3c + blt _020480FC + ldmia sp!, {r4, r5, r6, r7, r8, pc} + .align 2, 0 +_02048130: .word _020AFEF4 + arm_func_end sub_020480CC + + arm_func_start sub_02048134 +sub_02048134: ; 0x02048134 + ldr r0, _0204814C ; =_020AFEF4 + mov r1, #1 + ldr r0, [r0] + add r0, r0, #0x3000 + strb r1, [r0, #0x1b0] + bx lr + .align 2, 0 +_0204814C: .word _020AFEF4 + arm_func_end sub_02048134 + + arm_func_start sub_02048150 +sub_02048150: ; 0x02048150 + stmdb sp!, {r4, r5, r6, lr} + mov r6, r0 + mov r5, r1 + mov r4, r2 + bl sub_020480A0 + cmp r0, #0 + ldmeqia sp!, {r4, r5, r6, pc} + ldr r2, _0204823C ; =_020AFEF4 + mov r1, #0xd4 + ldr lr, [r2] + mov r3, #1 + add r0, lr, #0x3100 + ldrsh r0, [r0, #0xb8] + smulbb ip, r0, r1 + strb r3, [lr, ip] + ldr r0, [r2] + add r1, lr, ip + add r0, r0, ip + strb r5, [r0, #1] + ldr r0, [r2] + add r2, r1, #3 + add r0, r0, ip + strb r4, [r0, #2] + add r1, r1, #0x82 +_020481B0: + ldrb r0, [r6] + cmp r0, #0 + cmpne r0, #0xd + beq _020481D0 + cmp r2, r1 + strlob r0, [r2], #1 + add r6, r6, #1 + b _020481B0 +_020481D0: + mov r3, #0 + ldr r1, _0204823C ; =_020AFEF4 + strb r3, [r2] + ldr r0, [r1] + add r0, r0, #0x3100 + ldrsh r2, [r0, #0xb8] + add r2, r2, #1 + strh r2, [r0, #0xb8] + ldr r0, [r1] + mov r2, #1 + add r0, r0, #0x3100 + ldrsh r1, [r0, #0xb8] + cmp r1, #0x3c + ldr r1, _0204823C ; =_020AFEF4 + strgeh r3, [r0, #0xb8] + ldr r0, [r1] + add r0, r0, #0x3000 + strb r2, [r0, #0x1b0] + ldr r1, [r1] + add r0, r1, #0x3000 + ldrb r0, [r0, #0x1b2] + cmp r0, #0 + ldmeqia sp!, {r4, r5, r6, pc} + add r0, r1, #0x3100 + ldrsh r0, [r0, #0xb8] + bl sub_020476EC + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_0204823C: .word _020AFEF4 + arm_func_end sub_02048150 + + arm_func_start sub_02048240 +sub_02048240: ; 0x02048240 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + ldr r2, _02048334 ; =_020AFEF4 + mov r1, r0 + ldr r0, [r2] + cmp r0, #0 + movne r2, #1 + moveq r2, #0 + tst r2, #0xff + ldmeqia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + add r0, r0, #0x31c0 + mov r8, #0 + bl strcpy + ldr r4, _02048334 ; =_020AFEF4 + mov r7, r8 + mov r6, #0x400 + mov fp, #0x440 + mov r5, r8 +_02048284: + ldr sb, [r4] + add r0, sb, r8 + add r0, r0, #0x3000 + ldrb r0, [r0, #0x1c0] + cmp r0, #0 + ldmeqia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + add r2, sb, #0x31c0 + mov r1, r6 + mov r3, fp + str r7, [sp] + add r0, sb, #0x35c0 + add r2, r2, r8 + bl PreprocessString + ldr r1, [r4] + add r8, r8, r0 + add r0, r1, r0 + add r0, r0, #0x3000 + strb r5, [r0, #0x5c0] + ldr sl, [r4] + add r0, sl, r8 + add r0, r0, #0x3000 + ldrb sb, [r0, #0x1c0] + cmp sb, #0 + beq _0204831C + add r0, sl, #0x31c0 + ldr r1, _02048338 ; =_0209CCE0 + mov r2, #3 + add r0, r0, r8 + bl strncmp + cmp r0, #0 + bne _02048310 + ldr r0, _02048338 ; =_0209CCE0 + bl strlen + add r8, r8, r0 + b _0204831C +_02048310: + cmp sb, #0xd + cmpne sb, #0xa + addeq r8, r8, #1 +_0204831C: + mov r1, #0 + mov r2, r1 + add r0, sl, #0x35c0 + bl sub_02048150 + b _02048284 +_02048330: + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_02048334: .word _020AFEF4 +_02048338: .word _0209CCE0 + arm_func_end sub_02048240 + + arm_func_start sub_0204833C +sub_0204833C: ; 0x0204833C + ldr r0, _02048358 ; =_020AFEF4 + ldr ip, _0204835C ; =sub_020475B4 + ldr r0, [r0] + mov r1, #9 + add r2, r0, #0x3100 + ldrsh r2, [r2, #0xb8] + bx ip + .align 2, 0 +_02048358: .word _020AFEF4 +_0204835C: .word sub_020475B4 + arm_func_end sub_0204833C + + arm_func_start sub_02048360 +sub_02048360: ; 0x02048360 + stmdb sp!, {r3, lr} + bl sub_02047660 + cmp r0, #1 + moveq r0, #1 + ldmeqia sp!, {r3, pc} + cmp r0, #2 + moveq r0, #2 + movne r0, #0 + ldmia sp!, {r3, pc} + arm_func_end sub_02048360 + + arm_func_start sub_02048384 +sub_02048384: ; 0x02048384 + stmdb sp!, {r3, lr} + ldr r0, _020483B4 ; =_020AFEF4 + mov r1, #0xb + ldr r0, [r0] + bl sub_02047670 + cmp r0, #0 + ldrne r1, _020483B4 ; =_020AFEF4 + movne r2, #1 + ldrne r1, [r1] + addne r1, r1, #0x3000 + strneb r2, [r1, #0x1b2] + ldmia sp!, {r3, pc} + .align 2, 0 +_020483B4: .word _020AFEF4 + arm_func_end sub_02048384 + + arm_func_start sub_020483B8 +sub_020483B8: ; 0x020483B8 + ldr r0, _020483D0 ; =_020AFEF4 + ldr ip, _020483D4 ; =sub_020476EC + ldr r0, [r0] + add r0, r0, #0x3100 + ldrsh r0, [r0, #0xb8] + bx ip + .align 2, 0 +_020483D0: .word _020AFEF4 +_020483D4: .word sub_020476EC + arm_func_end sub_020483B8 + + arm_func_start sub_020483D8 +sub_020483D8: ; 0x020483D8 + stmdb sp!, {r3, lr} + bl sub_0204771C + cmp r0, #0 + ldrne r1, _020483FC ; =_020AFEF4 + movne r2, #0 + ldrne r1, [r1] + addne r1, r1, #0x3000 + strneb r2, [r1, #0x1b2] + ldmia sp!, {r3, pc} + .align 2, 0 +_020483FC: .word _020AFEF4 + arm_func_end sub_020483D8 + + arm_func_start sub_02048400 +sub_02048400: ; 0x02048400 + ldr r0, _0204841C ; =_020AFEF4 + ldr r0, [r0] + cmp r0, #0 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_0204841C: .word _020AFEF4 + arm_func_end sub_02048400 + + arm_func_start sub_02048420 +sub_02048420: ; 0x02048420 + stmdb sp!, {r3, lr} + bl sub_0204B028 + bl sub_02048B74 + ldmia sp!, {r3, pc} + arm_func_end sub_02048420 + + arm_func_start sub_02048430 +sub_02048430: ; 0x02048430 + stmdb sp!, {r3, lr} + bl sub_0206637C + mov r0, #0 + bl sub_02048C0C + mvn r0, #0 + bl sub_02048C4C + bl sub_0204F9B8 + bl sub_02048B48 + ldmia sp!, {r3, pc} + arm_func_end sub_02048430 + + arm_func_start sub_02048454 +sub_02048454: ; 0x02048454 + stmdb sp!, {r3, lr} + bl ClearAdventureLogStruct + bl sub_0206637C + mov r0, #0 + bl sub_02048C0C + mvn r0, #0 + bl sub_02048C4C + bl sub_0204F9B8 + bl sub_02048B48 + bl sub_02048C5C + ldmia sp!, {r3, pc} + arm_func_end sub_02048454 + + arm_func_start sub_02048480 +sub_02048480: ; 0x02048480 + stmdb sp!, {r3, lr} + bl sub_02048C3C + mvn r1, #0 + cmp r0, r1 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + ldmia sp!, {r3, pc} + arm_func_end sub_02048480 + + arm_func_start GetNotifyNote +GetNotifyNote: ; 0x020484A0 + ldr r0, _020484AC ; =NOTIFY_NOTE + ldrb r0, [r0] + bx lr + .align 2, 0 +_020484AC: .word NOTIFY_NOTE + arm_func_end GetNotifyNote + + arm_func_start SetNotifyNote +SetNotifyNote: ; 0x020484B0 + ldr r1, _020484BC ; =NOTIFY_NOTE + strb r0, [r1] + bx lr + .align 2, 0 +_020484BC: .word NOTIFY_NOTE + arm_func_end SetNotifyNote + + arm_func_start sub_020484C0 +sub_020484C0: ; 0x020484C0 + stmdb sp!, {r3, lr} + bl sub_0206637C + mov r0, #0 + bl sub_02048C0C + mvn r0, #0 + bl sub_02048C4C + bl sub_0204F9B8 + bl sub_02048B48 + bl sub_02048C5C + ldmia sp!, {r3, pc} + arm_func_end sub_020484C0 + + arm_func_start InitSpecialEpisodeHero +InitSpecialEpisodeHero: ; 0x020484E8 + stmdb sp!, {r4, lr} + bl GetSpecialEpisodeType + mov r4, r0 + bl sub_02052CD8 + bl sub_0200CAD4 + bl sub_0204CDB8 + mov r0, r4 + mov r1, #1 + bl sub_0204C9F4 + cmp r4, #4 + addls pc, pc, r4, lsl #2 + b _02048578 +_02048518: ; jump table + b _0204852C ; case 0 + b _0204853C ; case 1 + b _0204854C ; case 2 + b _0204855C ; case 3 + b _0204856C ; case 4 +_0204852C: + ldr r1, _020485AC ; =_020A2830 + mov r0, #2 + bl sub_02048AC4 + b _02048578 +_0204853C: + ldr r1, _020485B0 ; =_020A2808 + mov r0, #2 + bl sub_02048AC4 + b _02048578 +_0204854C: + ldr r1, _020485B4 ; =_020A2844 + mov r0, #2 + bl sub_02048AC4 + b _02048578 +_0204855C: + ldr r1, _020485B8 ; =_020A2880 + mov r0, #2 + bl sub_02048AC4 + b _02048578 +_0204856C: + ldr r1, _020485BC ; =_020A2894 + mov r0, #2 + bl sub_02048AC4 +_02048578: + mov r0, #2 + bl GetTeamMember + mov r4, r0 + mov r0, #2 + bl GetTeamMember + ldr r1, _020485C0 ; =FORBIDDEN_FORGOT_MOVE_LIST + bl sub_02053628 + mov r1, r0 + mov r0, r4 + mov r2, #1 + bl sub_02053660 + bl SetTeamSetupHeroAndPartnerOnly + ldmia sp!, {r4, pc} + .align 2, 0 +_020485AC: .word _020A2830 +_020485B0: .word _020A2808 +_020485B4: .word _020A2844 +_020485B8: .word _020A2880 +_020485BC: .word _020A2894 +_020485C0: .word FORBIDDEN_FORGOT_MOVE_LIST + arm_func_end InitSpecialEpisodeHero + + arm_func_start sub_020485C4 +sub_020485C4: ; 0x020485C4 + stmdb sp!, {r3, lr} + bl sub_02052CE8 + bl sub_0200CAE4 + bl sub_02056B58 + ldmia sp!, {r3, pc} + arm_func_end sub_020485C4 + + arm_func_start sub_020485D8 +sub_020485D8: ; 0x020485D8 + stmdb sp!, {r3, lr} + bl sub_02052CE8 + bl sub_0200CAE4 + bl sub_02056BD4 + ldmia sp!, {r3, pc} + arm_func_end sub_020485D8 + + arm_func_start sub_020485EC +sub_020485EC: ; 0x020485EC + stmdb sp!, {r3, lr} + bl sub_0206637C + mov r0, #0 + bl sub_02048C0C + mvn r0, #0 + bl sub_02048C4C + bl sub_0204F9B8 + bl sub_02048B48 + bl sub_02048C5C + ldmia sp!, {r3, pc} + arm_func_end sub_020485EC + + arm_func_start sub_02048614 +sub_02048614: ; 0x02048614 + stmdb sp!, {r3, lr} + bl sub_02048B48 + bl InitMainTeamAfterQuiz + ldmia sp!, {r3, pc} + arm_func_end sub_02048614 + + arm_func_start sub_02048624 +sub_02048624: ; 0x02048624 + stmdb sp!, {r3, lr} + mov r0, #0 + bl SetActiveInventory + mov r0, #0 + bl SetActiveKecleonShop + mov r0, #0 + bl SetActiveTeam + ldmia sp!, {r3, pc} + arm_func_end sub_02048624 + + arm_func_start sub_02048644 +sub_02048644: ; 0x02048644 + stmdb sp!, {r4, lr} + bl GetGameMode + mov r4, r0 + bl EventFlagResume + cmp r4, #4 + bne _02048678 + mov r0, #2 + bl SetActiveInventory + mov r0, #0 + bl SetActiveKecleonShop + mov r0, #2 + bl SetActiveTeam + b _020486D8 +_02048678: + cmp r4, #5 + bne _0204869C + mov r0, #2 + bl SetActiveInventory + mov r0, #0 + bl SetActiveKecleonShop + mov r0, #2 + bl SetActiveTeam + b _020486D8 +_0204869C: + cmp r4, #3 + bne _020486C0 + mov r0, #1 + bl SetActiveInventory + mov r0, #1 + bl SetActiveKecleonShop + mov r0, #1 + bl SetActiveTeam + b _020486D8 +_020486C0: + mov r0, #0 + bl SetActiveInventory + mov r0, #0 + bl SetActiveKecleonShop + mov r0, #0 + bl SetActiveTeam +_020486D8: + cmp r4, #3 + bne _020486EC + mov r0, #2 + bl SetBothScreensWindowsColor + ldmia sp!, {r4, pc} +_020486EC: + bl GetHeroMemberIdx + mvn r1, #0 + cmp r0, r1 + beq _02048720 + mov r0, #0 + mov r1, #0x42 + bl LoadScriptVariableValue + cmp r0, #5 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + bl SetBothScreensWindowsColor + ldmia sp!, {r4, pc} +_02048720: + mov r0, #2 + bl SetBothScreensWindowsColor + ldmia sp!, {r4, pc} + arm_func_end sub_02048644 + + arm_func_start sub_0204872C +sub_0204872C: ; 0x0204872C + stmdb sp!, {r3, lr} + bl EventFlagBackup + mov r0, #2 + bl SetBothScreensWindowsColor + mov r0, #0 + bl SetActiveInventory + mov r0, #0 + bl SetActiveKecleonShop + mov r0, #0 + bl SetActiveTeam + ldmia sp!, {r3, pc} + arm_func_end sub_0204872C + + arm_func_start EventFlagBackupVeneer +EventFlagBackupVeneer: ; 0x02048758 + ldr ip, _02048760 ; =EventFlagBackup + bx ip + .align 2, 0 +_02048760: .word EventFlagBackup + arm_func_end EventFlagBackupVeneer + + arm_func_start sub_02048764 +sub_02048764: ; 0x02048764 + stmdb sp!, {r4, lr} + ldr lr, _02048790 ; =DEFAULT_HERO_ID + mov r4, r0 + mov ip, #3 +_02048774: + ldmia lr!, {r0, r1, r2, r3} + stmia r4!, {r0, r1, r2, r3} + subs ip, ip, #1 + bne _02048774 + ldmia lr, {r0, r1, r2} + stmia r4, {r0, r1, r2} + ldmia sp!, {r4, pc} + .align 2, 0 +_02048790: .word DEFAULT_HERO_ID + arm_func_end sub_02048764 + + arm_func_start sub_02048794 +sub_02048794: ; 0x02048794 + stmdb sp!, {r4, lr} + ldr lr, _020487C0 ; =DEFAULT_HERO_ID + mov r4, r0 + mov ip, #3 +_020487A4: + ldmia r4!, {r0, r1, r2, r3} + stmia lr!, {r0, r1, r2, r3} + subs ip, ip, #1 + bne _020487A4 + ldmia r4, {r0, r1, r2} + stmia lr, {r0, r1, r2} + ldmia sp!, {r4, pc} + .align 2, 0 +_020487C0: .word DEFAULT_HERO_ID + arm_func_end sub_02048794 + + arm_func_start InitMainTeamAfterQuiz +InitMainTeamAfterQuiz: ; 0x020487C4 + stmdb sp!, {r3, r4, lr} + sub sp, sp, #0x14 + ldr r0, _020489F4 ; =NOTIFY_NOTE + mov r4, #0 + ldrb r0, [r0, #8] + cmp r0, #0 + bne _020487FC + ldr r1, _020489F8 ; =0x00000232 + add r0, sp, #0 + bl GetStringFromFileVeneer + ldr r0, _020489FC ; =_020AFF00 + add r1, sp, #0 + mov r2, #0xa + bl StrncpyName +_020487FC: + ldr r0, _020489F4 ; =NOTIFY_NOTE + ldrb r0, [r0, #0x1c] + cmp r0, #0 + bne _02048828 + ldr r1, _02048A00 ; =0x00000233 + add r0, sp, #0 + bl GetStringFromFileVeneer + ldr r0, _02048A04 ; =_020AFF14 + add r1, sp, #0 + mov r2, #0xa + bl StrncpyName +_02048828: + bl GetHeroMemberIdx + mvn r1, #0 + cmp r0, r1 + bne _02048898 + ldr r0, _020489F4 ; =NOTIFY_NOTE + ldr r3, _020489FC ; =_020AFF00 + ldrsh r1, [r0, #4] + mov r0, #0 + mov r2, #0xd6 + bl sub_02055B78 + bl GetHero + ldr r1, _020489F4 ; =NOTIFY_NOTE + mov r4, r0 + ldrsh r2, [r1, #4] + mov r0, #0 + mov r1, #0x3e + bl SaveScriptVariableValue + add r1, r4, #0x3a + mov r0, #0x3f + mov r2, #0xa + bl SaveScriptVariableValueBytes + mov r0, r4 + mov r1, #5 + mov r2, #0 + bl sub_020544C8 + mov r0, r4 + bl sub_02053568 + mov r4, #1 +_02048898: + bl GetPartnerMemberIdx + mvn r1, #0 + cmp r0, r1 + bne _02048908 + ldr r0, _020489F4 ; =NOTIFY_NOTE + ldr r3, _02048A04 ; =_020AFF14 + ldrsh r1, [r0, #6] + mov r0, #1 + mov r2, #0xd7 + bl sub_02055B78 + bl GetPartner + ldr r1, _020489F4 ; =NOTIFY_NOTE + mov r4, r0 + ldrsh r2, [r1, #6] + mov r0, #0 + mov r1, #0x40 + bl SaveScriptVariableValue + add r1, r4, #0x3a + mov r0, #0x41 + mov r2, #0xa + bl SaveScriptVariableValueBytes + mov r0, r4 + mov r1, #5 + mov r2, #0 + bl sub_020544C8 + mov r0, r4 + bl sub_02053568 + mov r4, #1 +_02048908: + cmp r4, #0 + beq _02048914 + bl SetTeamSetupHeroAndPartnerOnly +_02048914: + ldr r0, _020489F4 ; =NOTIFY_NOTE + ldrsh r0, [r0, #4] + cmp r0, #0 + beq _02048940 + bl GetMonsterGenderVeneer + cmp r0, #2 + moveq r2, #5 + movne r2, #4 + mov r0, #0 + mov r1, #0x42 + bl SaveScriptVariableValue +_02048940: + ldr r0, _020489F4 ; =NOTIFY_NOTE + ldrsh r1, [r0, #6] + cmp r1, #0 + beq _02048980 + ldr r0, _02048A08 ; =PARTNER_TALK_KIND_TABLE + b _02048964 +_02048958: + cmp r1, r2 + beq _02048970 + add r0, r0, #8 +_02048964: + ldrsh r2, [r0, #4] + cmp r2, #0 + bne _02048958 +_02048970: + ldr r2, [r0] + mov r0, #0 + mov r1, #0x43 + bl SaveScriptVariableValue +_02048980: + ldr r1, _020489F4 ; =NOTIFY_NOTE + mov r0, #0 + ldr r2, [r1, #0x30] + mov r1, #0x45 + bl SaveScriptVariableValue + mov r0, #1 + bl sub_02048C0C + bl sub_02048C3C + mvn r1, #0 + cmp r0, r1 + bne _020489B4 + bl Rand32Bit + bl sub_02048C4C +_020489B4: + bl GetGameMode + cmp r0, #1 + bhi _020489CC + mov r0, #2 + bl SetBothScreensWindowsColor + b _020489EC +_020489CC: + mov r0, #0 + mov r1, #0x42 + bl LoadScriptVariableValue + cmp r0, #5 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + bl SetBothScreensWindowsColor +_020489EC: + add sp, sp, #0x14 + ldmia sp!, {r3, r4, pc} + .align 2, 0 +_020489F4: .word NOTIFY_NOTE +#ifdef JAPAN +_020489F8: .word 0x000004C3 +_020489FC: .word _020AFF00 +_02048A00: .word 0x000004C4 +#else +_020489F8: .word 0x00000232 +_020489FC: .word _020AFF00 +_02048A00: .word 0x00000233 +#endif +_02048A04: .word _020AFF14 +_02048A08: .word PARTNER_TALK_KIND_TABLE + arm_func_end InitMainTeamAfterQuiz + + arm_func_start InitSpecialEpisodePartners +InitSpecialEpisodePartners: ; 0x02048A0C + stmdb sp!, {r3, lr} + bl GetExecuteSpecialEpisodeType + cmp r0, #4 + addls pc, pc, r0, lsl #2 + b _02048A6C +_02048A20: ; jump table + b _02048A6C ; case 0 + b _02048A34 ; case 1 + b _02048A6C ; case 2 + b _02048A44 ; case 3 + b _02048A60 ; case 4 +_02048A34: + ldr r1, _02048A74 ; =_020A28A8 + mov r0, #3 + bl sub_02048AC4 + b _02048A6C +_02048A44: + ldr r1, _02048A78 ; =_020A2858 + mov r0, #3 + bl sub_02048AC4 + ldr r1, _02048A7C ; =_020A281C + mov r0, #4 + bl sub_02048AC4 + b _02048A6C +_02048A60: + ldr r1, _02048A80 ; =_020A286C + mov r0, #3 + bl sub_02048AC4 +_02048A6C: + bl SetTeamSetupHeroAndPartnerOnly + ldmia sp!, {r3, pc} + .align 2, 0 +_02048A74: .word _020A28A8 +_02048A78: .word _020A2858 +_02048A7C: .word _020A281C +_02048A80: .word _020A286C + arm_func_end InitSpecialEpisodePartners + + arm_func_start InitSpecialEpisodeExtraPartner +InitSpecialEpisodeExtraPartner: ; 0x02048A84 + stmdb sp!, {r3, lr} + bl GetExecuteSpecialEpisodeType + cmp r0, #4 + addls pc, pc, r0, lsl #2 + b _02048AB8 +_02048A98: ; jump table + b _02048AB8 ; case 0 + b _02048AB8 ; case 1 + b _02048AB8 ; case 2 + b _02048AB8 ; case 3 + b _02048AAC ; case 4 +_02048AAC: + ldr r1, _02048AC0 ; =SPECIAL_EPISODE_MAIN_CHARACTERS + mov r0, #4 + bl sub_02048AC4 +_02048AB8: + bl SetTeamSetupHeroAndPartnerOnly + ldmia sp!, {r3, pc} + .align 2, 0 +_02048AC0: .word SPECIAL_EPISODE_MAIN_CHARACTERS + arm_func_end InitSpecialEpisodeExtraPartner + + arm_func_start sub_02048AC4 +sub_02048AC4: ; 0x02048AC4 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r1 + ldrsh r1, [r5] + ldrb r2, [r5, #2] + mov r4, r0 + mov r3, #0 + bl sub_02055B78 + mov r0, r4 + bl GetTeamMember + ldrsh r1, [r5, #0xe] + ldrb r2, [r5, #0xc] + mov r4, r0 + bl sub_020544C8 + ldrsh r0, [r5, #0x12] + cmp r0, #0 + strneh r0, [r4, #0xa] + ldrsh r2, [r5, #0x10] + add r0, r4, #0x14 + strh r2, [r4, #8] + ldrsh r1, [r4, #4] + bl EnableAllLearnableIqSkills + ldrh r0, [r5, #4] + cmp r0, #0 + ldmeqia sp!, {r3, r4, r5, pc} + ldrb r0, [r5, #0xc] + add r1, r5, #4 + cmp r0, #0 + add r0, r4, #0x22 + beq _02048B40 + bl LearnMoves + ldmia sp!, {r3, r4, r5, pc} +_02048B40: + bl GetInfoGroundMoveset + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_02048AC4 + + arm_func_start sub_02048B48 +sub_02048B48: ; 0x02048B48 + stmdb sp!, {r3, lr} + bl sub_0204AB24 + bl InitScriptVariableValues + bl sub_02052C74 + bl sub_0200CABC + bl StoreDefaultTeamData + bl ResetGlobalProgress + bl sub_0205B478 + bl sub_0205C75C + bl sub_02012AB8 + ldmia sp!, {r3, pc} + arm_func_end sub_02048B48 + + arm_func_start sub_02048B74 +sub_02048B74: ; 0x02048B74 + stmdb sp!, {r3, lr} + ldr r1, _02048BA8 ; =_020AFF38 + ldr r0, _02048BAC ; =_0209CD4C + ldr r1, [r1, #4] + mov r2, #0 + bl Debug_Print0 + mov r3, #0 + ldr r1, _02048BA8 ; =_020AFF38 + ldr r0, _02048BB0 ; =_022AAE70 + sub r2, r3, #1 + str r3, [r1, #4] + str r2, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_02048BA8: .word _020AFF38 +_02048BAC: .word _0209CD4C +_02048BB0: .word _022AAE70 + arm_func_end sub_02048B74 + + arm_func_start ReadStringSave +ReadStringSave: ; 0x02048BB4 + ldr r1, _02048BC8 ; =_020AFF38 + ldr ip, _02048BCC ; =strncpy + mov r2, #0x20 + ldr r1, [r1] + bx ip + .align 2, 0 +_02048BC8: .word _020AFF38 +_02048BCC: .word strncpy + arm_func_end ReadStringSave + + arm_func_start CheckStringSave +CheckStringSave: ; 0x02048BD0 + stmdb sp!, {r3, lr} + ldr r1, _02048BF8 ; =_020AFF38 + mov r2, #0x20 + ldr r1, [r1] + bl strncmp + cmp r0, #0 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + ldmia sp!, {r3, pc} + .align 2, 0 +_02048BF8: .word _020AFF38 + arm_func_end CheckStringSave + + arm_func_start sub_02048BFC +sub_02048BFC: ; 0x02048BFC + ldr r0, _02048C08 ; =_020AFF38 + ldr r0, [r0, #4] + bx lr + .align 2, 0 +_02048C08: .word _020AFF38 + arm_func_end sub_02048BFC + + arm_func_start sub_02048C0C +sub_02048C0C: ; 0x02048C0C + stmdb sp!, {r4, lr} + ldr r1, _02048C34 ; =_020AFF38 + mov r4, r0 + ldr r1, [r1, #4] + ldr r0, _02048C38 ; =_0209CD4C + mov r2, r4 + bl Debug_Print0 + ldr r0, _02048C34 ; =_020AFF38 + str r4, [r0, #4] + ldmia sp!, {r4, pc} + .align 2, 0 +_02048C34: .word _020AFF38 +_02048C38: .word _0209CD4C + arm_func_end sub_02048C0C + + arm_func_start sub_02048C3C +sub_02048C3C: ; 0x02048C3C + ldr r0, _02048C48 ; =_022AAE70 + ldr r0, [r0] + bx lr + .align 2, 0 +_02048C48: .word _022AAE70 + arm_func_end sub_02048C3C + + arm_func_start sub_02048C4C +sub_02048C4C: ; 0x02048C4C + ldr r1, _02048C58 ; =_022AAE70 + str r0, [r1] + bx lr + .align 2, 0 +_02048C58: .word _022AAE70 + arm_func_end sub_02048C4C + + arm_func_start sub_02048C5C +sub_02048C5C: ; 0x02048C5C + stmdb sp!, {r3, lr} + ldr r0, _02048CA4 ; =_022AAE74 + mov r1, #0 + mov r2, #0x30 + bl MemsetSimple + ldr r2, _02048CA8 ; =0x09011416 + ldr r1, _02048CAC ; =_022AAE74 + ldr r0, _02048CB0 ; =_022AAE78 + str r2, [r1, #0x24] + bl ReadStringSave + ldr r2, _02048CB4 ; =0x000F1206 + ldr r0, _02048CAC ; =_022AAE74 + mov r1, #0xff + str r2, [r0, #0x28] + strb r1, [r0, #0x2c] + mov r1, #0 + strb r1, [r0, #0x2d] + ldmia sp!, {r3, pc} + .align 2, 0 +_02048CA4: .word _022AAE74 +_02048CA8: .word 0x09011416 +_02048CAC: .word _022AAE74 +_02048CB0: .word _022AAE78 +_02048CB4: .word 0x000F1206 + arm_func_end sub_02048C5C + + arm_func_start sub_02048CB8 +sub_02048CB8: ; 0x02048CB8 + stmdb sp!, {r3, lr} + mov r0, #9 + bl Debug_GetDebugFlag + cmp r0, #0 + beq _02048CE4 + ldr r1, _02048CF0 ; =_022AAE74 + ldr r0, _02048CF4 ; =0x000F1208 + ldr r1, [r1, #0x28] + cmp r1, r0 + subeq r0, r0, #1 + ldmeqia sp!, {r3, pc} +_02048CE4: + ldr r0, _02048CF0 ; =_022AAE74 + ldr r0, [r0, #0x28] + ldmia sp!, {r3, pc} + .align 2, 0 +_02048CF0: .word _022AAE74 +_02048CF4: .word 0x000F1208 + arm_func_end sub_02048CB8 + + arm_func_start sub_02048CF8 +sub_02048CF8: ; 0x02048CF8 + stmdb sp!, {r3, r4, r5, lr} + mov r0, #0x100 + mov r1, #5 + bl MemAlloc + mov r4, r0 + ldr r3, _02048DB0 ; =0x000001EA + add r0, sp, #0 + mov r1, r4 + mov r2, #0x100 + str r3, [sp] + bl ReadSaveFile + movs r5, r0 + cmpne r5, #2 + bne _02048D54 + add r0, r4, #4 + bl CheckStringSave + cmp r0, #0 + moveq r5, #5 + beq _02048D54 + ldr r1, [r4, #0x24] + ldr r0, _02048DB4 ; =0x09011416 + cmp r1, r0 + movne r5, #4 +_02048D54: + bl sub_02048C5C + cmp r5, #0 + bne _02048D80 + ldr r1, [r4, #0x28] + ldr r0, _02048DB8 ; =_022AAE74 + str r1, [r0, #0x28] + ldrb r1, [r4, #0x2c] + strb r1, [r0, #0x2c] + ldrb r1, [r4, #0x2d] + strb r1, [r0, #0x2d] + b _02048DA0 +_02048D80: + sub r0, r5, #4 + cmp r0, #1 + ldrls r1, _02048DBC ; =0x000F1206 + ldrls r0, _02048DB8 ; =_022AAE74 + strls r1, [r0, #0x28] + ldrhi r1, _02048DC0 ; =0x000F1209 + ldrhi r0, _02048DB8 ; =_022AAE74 + strhi r1, [r0, #0x28] +_02048DA0: + mov r0, r4 + bl MemFree + bl sub_02048CB8 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_02048DB0: .word 0x000001EA +_02048DB4: .word 0x09011416 +_02048DB8: .word _022AAE74 +_02048DBC: .word 0x000F1206 +_02048DC0: .word 0x000F1209 + arm_func_end sub_02048CF8 + + arm_func_start sub_02048DC4 +sub_02048DC4: ; 0x02048DC4 + stmdb sp!, {r3, r4, r5, r6, lr} + sub sp, sp, #4 + mov r6, r0 + mov r0, #0x100 + mov r1, #5 + bl MemAlloc + mov r4, r0 + bl sub_02048C5C + ldr r5, _02048E68 ; =_022AAE74 + mov lr, r4 + mov ip, #3 +_02048DF0: + ldmia r5!, {r0, r1, r2, r3} + stmia lr!, {r0, r1, r2, r3} + subs ip, ip, #1 + bne _02048DF0 + str r6, [r4, #0x28] + bl GetAdventureLogDungeonFloor + ldrb r2, [r0] + ldr r3, _02048E6C ; =0x000001EA + mov r1, r4 + strb r2, [r4, #0x2c] + ldrb ip, [r0, #1] + add r0, sp, #0 + mov r2, #0x100 + strb ip, [r4, #0x2d] + str r3, [sp] + bl WriteSaveFile + movs r5, r0 + bne _02048E54 + ldr r1, [r4, #0x28] + ldr r0, _02048E70 ; =_022AAE74 + str r1, [r0, #0x28] + ldrb r1, [r4, #0x2c] + strb r1, [r0, #0x2c] + ldrb r1, [r4, #0x2d] + strb r1, [r0, #0x2d] +_02048E54: + mov r0, r4 + bl MemFree + mov r0, r5 + add sp, sp, #4 + ldmia sp!, {r3, r4, r5, r6, pc} + .align 2, 0 +_02048E68: .word _022AAE74 +_02048E6C: .word 0x000001EA +_02048E70: .word _022AAE74 + arm_func_end sub_02048DC4 + + arm_func_start WriteSaveFile +WriteSaveFile: ; 0x02048E74 + stmdb sp!, {r4, r5, r6, lr} + mov r5, r2 + add r3, r5, #0xff + mov r2, r3, asr #7 + ldr r4, [r0] + add r2, r3, r2, lsr #24 + mov r6, r1 + add r1, r4, r2, asr #8 + str r1, [r0] + mov r0, r6 + mov r1, r5 + bl CalcChecksum + mov r0, r4 + mov r1, r6 + mov r2, r5 + bl sub_0204A9C8 + cmp r0, #4 + moveq r0, #1 + ldmeqia sp!, {r4, r5, r6, pc} + cmp r0, #0 + movne r0, #2 + moveq r0, #0 + ldmia sp!, {r4, r5, r6, pc} + arm_func_end WriteSaveFile + + arm_func_start ReadSaveFile +ReadSaveFile: ; 0x02048ED0 + stmdb sp!, {r3, r4, r5, lr} + mov r4, r2 + add ip, r4, #0xff + mov r3, ip, asr #7 + ldr lr, [r0] + add r3, ip, r3, lsr #24 + add r3, lr, r3, asr #8 + str r3, [r0] + mov r0, lr + mov r5, r1 + bl sub_0204A8E0 + cmp r0, #0 + movne r0, #1 + ldmneia sp!, {r3, r4, r5, pc} + mov r0, r5 + mov r1, r4 + bl CheckChecksumInvalid + cmp r0, #0 + movne r0, #2 + moveq r0, #0 + ldmia sp!, {r3, r4, r5, pc} + arm_func_end ReadSaveFile + + arm_func_start CalcChecksum +CalcChecksum: ; 0x02048F24 + mov r3, #0 + mov ip, #1 + b _02048F3C +_02048F30: + ldr r2, [r0, ip, lsl #2] + add ip, ip, #1 + add r3, r3, r2 +_02048F3C: + cmp ip, r1, lsr #2 + blt _02048F30 + str r3, [r0] + bx lr + arm_func_end CalcChecksum + + arm_func_start CheckChecksumInvalid +CheckChecksumInvalid: ; 0x02048F4C + mov r3, #0 + mov ip, #1 + b _02048F64 +_02048F58: + ldr r2, [r0, ip, lsl #2] + add ip, ip, #1 + add r3, r3, r2 +_02048F64: + cmp ip, r1, lsr #2 + blt _02048F58 + ldr r0, [r0] + cmp r0, r3 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + arm_func_end CheckChecksumInvalid + + arm_func_start NoteSaveBase +NoteSaveBase: ; 0x02048F84 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr} + mov sb, r0 + ldr r0, _02049218 ; =0x0000B65C + mov r1, #5 + bl MemAlloc + mov r4, r0 + add r0, r4, #0x64 + add r5, r0, #0x400 + bl sub_02048BFC + mov r2, r0 + ldr r0, _0204921C ; =_0209CD6C + mov r1, sb + bl Debug_Print0 + mov r0, #0 + bl SetNotifyNote + bl GetTime + mov r7, r0 + bl EventFlagBackupVeneer + cmp sb, #3 + bne _02048FE0 + bl sub_02048BFC + mov sb, r0 + b _02048FE8 +_02048FE0: + mov r0, sb + bl sub_02048C0C +_02048FE8: + str sb, [r4, #0x2c] + bl sub_02048C3C + str r0, [r4, #0x28] + bl GetRngSeed + str r0, [r4, #0x30] + cmp sb, #0 + mvneq r0, #0 + beq _0204900C + bl GetLanguageType +_0204900C: + ldr r1, _02049220 ; =0x09011416 + strb r0, [r4, #0x34] + add r0, r4, #4 + str r1, [r4, #0x24] + bl ReadStringSave + add r0, r4, #0x38 + bl DumpScriptVariableValues + ldr r1, _02049224 ; =0x00007F6B + mov r0, r5 + bl WriteMonsterInfoToSave + str r0, [r4, #0x438] + add r0, r5, #0x6b + ldr r1, _02049228 ; =0x000005DC + add r0, r0, #0x7f00 + bl sub_020597B0 + str r0, [r4, #0x43c] + add r0, r5, #0x47 + ldr r1, _0204922C ; =0x000001F7 + add r0, r0, #0x8500 + bl CopyProgressInfoFromScratchTo + str r0, [r4, #0x440] + add r0, r5, #0x3e + ldr r1, _02049230 ; =0x00000DAC + add r0, r0, #0x8700 + bl WriteItemsToSave + str r0, [r4, #0x444] + add r0, r5, #0xea + add r0, r0, #0x9400 + mov r1, #0x10 + bl sub_02050CF8 + str r0, [r4, #0x448] + add r0, r5, #0xfa + add r0, r0, #0x9400 + mov r1, #0x340 + bl sub_0204E154 + str r0, [r4, #0x450] + add r0, r5, #0x3a + ldr r1, _02049234 ; =0x000015A0 + add r0, r0, #0x9800 + bl sub_0205BFB0 + str r0, [r4, #0x454] + add r0, r5, #0xda + ldr r1, _02049238 ; =0x00000237 + add r0, r0, #0xad00 + bl sub_0205FC20 + str r0, [r4, #0x458] + add r0, r5, #0x11 + add r0, r0, #0xb000 + mov r1, #0xb + bl sub_020131F0 + add r1, r5, #0x1c + str r0, [r4, #0x45c] + add r0, r1, #0xb000 +#ifdef JAPAN + mov r1, #0x18c +#else + mov r1, #0x1dc +#endif + bl sub_0204A3E4 + str r0, [r4, #0x460] + bl GetTime + mov r1, r7 + mov r7, r0 + bl _fsub + bl _f2d + mov r3, r0 + mov r2, r1 + ldr r0, _0204923C ; =_0209CD84 + mov r1, r3 + bl Debug_Print0 + cmp sb, #2 + moveq r5, #0 + beq _0204912C + ldr r0, _02049240 ; =0x000F1206 + bl sub_02048DC4 + mov r5, r0 +_0204912C: + cmp r5, #0 + bne _020491C4 + bl sub_02049350 + cmp r0, #1 + add r0, sp, #0 + ldr r2, _02049218 ; =0x0000B65C + bne _02049188 + mov r3, #0 + mov r1, r4 + str r3, [sp] + bl WriteSaveFile + movs r6, r0 + bne _02049168 + mov r0, #0 + bl sub_02049360 +_02049168: + ldr r2, _02049218 ; =0x0000B65C + mov r3, #0xc8 + add r0, sp, #0 + mov r1, r4 + str r3, [sp] + bl WriteSaveFile + mov r8, r0 + b _020491C4 +_02049188: + mov r3, #0xc8 + mov r1, r4 + str r3, [sp] + bl WriteSaveFile + movs r8, r0 + bne _020491A8 + mov r0, #1 + bl sub_02049360 +_020491A8: + ldr r2, _02049218 ; =0x0000B65C + mov r3, #0 + add r0, sp, #0 + mov r1, r4 + str r3, [sp] + bl WriteSaveFile + mov r6, r0 +_020491C4: + bl GetTime + mov r1, r7 + bl _fsub + bl _f2d + mov r3, r0 + mov r2, r1 + ldr r0, _02049244 ; =_0209CD94 + mov r1, r3 + bl Debug_Print0 + mov r0, r4 + bl MemFree + cmp r5, #0 + movne r0, r5 + ldmneia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + cmp r6, #0 + movne r0, r6 + ldmneia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + cmp r8, #0 + moveq r8, #0 + mov r0, r8 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + .align 2, 0 +#ifdef JAPAN +_02049218: .word 0x0000B60C +#else +_02049218: .word 0x0000B65C +#endif +_0204921C: .word _0209CD6C +_02049220: .word 0x09011416 +_02049224: .word 0x00007F6B +_02049228: .word 0x000005DC +_0204922C: .word 0x000001F7 +_02049230: .word 0x00000DAC +_02049234: .word 0x000015A0 +_02049238: .word 0x00000237 +_0204923C: .word _0209CD84 +_02049240: .word 0x000F1206 +_02049244: .word _0209CD94 + arm_func_end NoteSaveBase + + arm_func_start WriteQuickSaveInfo +WriteQuickSaveInfo: ; 0x02049248 + stmdb sp!, {r3, lr} + mov ip, r0 + mov r2, r1 + mov r3, #0x190 + add r0, sp, #0 + mov r1, ip + str r3, [sp] + bl WriteSaveFile + ldmia sp!, {r3, pc} + arm_func_end WriteQuickSaveInfo + + arm_func_start ReadSaveHeader +ReadSaveHeader: ; 0x0204926C + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + ldr r0, _0204932C ; =0x0000B65C + mov r1, #5 + bl MemAlloc + mov r4, r0 + ldr r3, _02049330 ; =_020AFF40 + mov r0, #0 + mov r1, r4 + mov r2, #0x38 + str r0, [r3] + bl sub_0204A8E0 + cmp r0, #0 + beq _020492B4 + mov r1, r4 + mov r0, #0xc8 + mov r2, #0x38 + bl sub_0204A8E0 +_020492B4: + cmp r0, #0 + ldrne r0, _02049330 ; =_020AFF40 + movne r1, #1 + strne r1, [r0, #4] + bne _02049310 + add r0, r4, #4 + bl CheckStringSave + cmp r0, #0 + ldreq r0, _02049330 ; =_020AFF40 + moveq r1, #5 + streq r1, [r0, #4] + beq _02049310 + ldr r1, [r4, #0x24] + ldr r0, _02049334 ; =0x09011416 + cmp r1, r0 + ldrne r0, _02049330 ; =_020AFF40 + movne r1, #4 + strne r1, [r0, #4] +#ifdef EUROPE + bne _02049310 + ldr r1, [r4, #0x2c] + ldr r0, _02049330 ; =_020AFF40 + mov r2, #0 + stmia r0, {r1, r2} + ldr r1, [r4, #0x28] + sub r0, r2, #1 + cmp r1, r0 + beq _02049310 + ldrsb r0, [r4, #0x34] + bl sub_020205C0 + bl sub_0202059C +#else + ldreq r2, [r4, #0x2c] + ldreq r0, _02049330 ; =_020AFF40 + moveq r1, #0 + streq r2, [r0] + streq r1, [r0, #4] +#endif +_02049310: + mov r0, r4 + bl MemFree + ldr r0, _02049330 ; =_020AFF40 + ldr r1, [r0] + str r1, [r5] + ldr r0, [r0, #4] + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +#ifdef JAPAN +_0204932C: .word 0x0000B60C +#else +_0204932C: .word 0x0000B65C +#endif +_02049330: .word _020AFF40 +_02049334: .word 0x09011416 + arm_func_end ReadSaveHeader + + arm_func_start sub_02049338 +sub_02049338: ; 0x02049338 + ldr r1, _0204934C ; =_020AFF40 + ldr r2, [r1] + str r2, [r0] + ldr r0, [r1, #4] + bx lr + .align 2, 0 +_0204934C: .word _020AFF40 + arm_func_end sub_02049338 + + arm_func_start sub_02049350 +sub_02049350: ; 0x02049350 + ldr r0, _0204935C ; =_020AFF40 + ldr r0, [r0, #8] + bx lr + .align 2, 0 +_0204935C: .word _020AFF40 + arm_func_end sub_02049350 + + arm_func_start sub_02049360 +sub_02049360: ; 0x02049360 + ldr r1, _0204936C ; =_020AFF40 + str r0, [r1, #8] + bx lr + .align 2, 0 +_0204936C: .word _020AFF40 + arm_func_end sub_02049360 + + arm_func_start NoteLoadBase +NoteLoadBase: ; 0x02049370 + stmdb sp!, {r3, r4, r5, r6, lr} + sub sp, sp, #4 + ldr r0, _020495FC ; =0x0000B65C + mov r1, #5 + bl MemAlloc + mov r4, r0 + add r0, r4, #0x64 + add r6, r0, #0x400 + bl sub_02048BFC + mov r1, r0 + ldr r0, _02049600 ; =_0209CDA4 + bl Debug_Print0 + mov r0, #0 + bl SetNotifyNote + mov r0, #0 + str r0, [sp] + ldr r2, _020495FC ; =0x0000B65C + add r0, sp, #0 + mov r1, r4 + bl ReadSaveFile + movs r5, r0 + beq _02049400 + ldr r2, _020495FC ; =0x0000B65C + mov r3, #0xc8 + add r0, sp, #0 + mov r1, r4 + str r3, [sp] + bl ReadSaveFile + movs r5, r0 + ldrne r0, _02049604 ; =_020AFF40 + mvnne r1, #0 + strne r1, [r0, #8] + ldreq r0, _02049604 ; =_020AFF40 + moveq r1, #1 + streq r1, [r0, #8] + b _0204940C +_02049400: + ldr r0, _02049604 ; =_020AFF40 + mov r1, #0 + str r1, [r0, #8] +_0204940C: + cmp r5, #0 + cmpne r5, #2 + bne _0204943C + add r0, r4, #4 + bl CheckStringSave + cmp r0, #0 + moveq r5, #5 + beq _0204943C + ldr r1, [r4, #0x24] + ldr r0, _02049608 ; =0x09011416 + cmp r1, r0 + movne r5, #4 +_0204943C: + cmp r5, #0 + bne _020494A0 + ldr r1, [r4, #0x2c] + ldr r0, _0204960C ; =_0209CDB8 + bl Debug_Print0 + ldr r0, [r4, #0x2c] + bl sub_02048C0C + ldr r0, [r4, #0x28] + bl sub_02048C4C + ldr r0, [r4, #0x30] + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + bl SetRngSeed + ldr r0, [r4, #0x2c] + cmp r0, #0 + mvneq r0, #0 + streqb r0, [r4, #0x34] + beq _020494A0 + ldr r1, [r4, #0x28] + mvn r0, #0 + cmp r1, r0 + beq _020494A0 + ldrsb r0, [r4, #0x34] + bl sub_020205C0 + bl sub_0202059C +_020494A0: + cmp r5, #0 + bne _020494B8 + add r0, r4, #0x38 + bl RestoreScriptVariableValues + cmp r0, #0 + moveq r5, #4 +_020494B8: + cmp r5, #0 + bne _020495D4 + ldr r1, _02049610 ; =0x00007F6B + mov r0, r6 + bl ReadMonsterInfoFromSave + ldr r1, [r4, #0x438] + cmp r0, r1 + add r0, r6, #0x6b + ldr r1, _02049614 ; =0x000005DC + add r0, r0, #0x7f00 + movne r5, #3 + bl sub_02059A74 + ldr r1, [r4, #0x43c] + cmp r0, r1 + add r0, r6, #0x47 + ldr r1, _02049618 ; =0x000001F7 + add r0, r0, #0x8500 + movne r5, #3 + bl CopyProgressInfoFromScratchFrom + ldr r1, [r4, #0x440] + cmp r0, r1 + add r0, r6, #0x3e + ldr r1, _0204961C ; =0x00000DAC + add r0, r0, #0x8700 + movne r5, #3 + bl ReadItemsFromSave + ldr r1, [r4, #0x444] + cmp r0, r1 + add r0, r6, #0xea + add r0, r0, #0x9400 + mov r1, #0x10 + movne r5, #3 + bl sub_02050D84 + ldr r1, [r4, #0x448] + cmp r0, r1 + add r0, r6, #0xfa + add r0, r0, #0x9400 + mov r1, #0x340 + movne r5, #3 + bl sub_0204E19C + ldr r1, [r4, #0x450] + cmp r0, r1 + add r0, r6, #0x3a + ldr r1, _02049620 ; =0x000015A0 + add r0, r0, #0x9800 + movne r5, #3 + bl sub_0205BD9C + ldr r1, [r4, #0x454] + cmp r0, r1 + add r0, r6, #0xda + ldr r1, _02049624 ; =0x00000237 + add r0, r0, #0xad00 + movne r5, #3 + bl sub_0205FAB0 + ldr r1, [r4, #0x458] + cmp r0, r1 + add r0, r6, #0x11 + add r0, r0, #0xb000 + mov r1, #0xb + movne r5, #3 + bl sub_02013190 + ldr r1, [r4, #0x45c] + cmp r0, r1 + add r0, r6, #0x1c + add r0, r0, #0xb000 +#ifdef JAPAN + mov r1, #0x18c +#else + mov r1, #0x1dc +#endif + movne r5, #3 + bl sub_0204A1DC + ldr r1, [r4, #0x460] + cmp r0, r1 + movne r5, #3 +_020495D4: + cmp r5, #0 + bne _020495E4 + bl sub_02048CF8 + b _020495E8 +_020495E4: + bl sub_02048C5C +_020495E8: + mov r0, r4 + bl MemFree + mov r0, r5 + add sp, sp, #4 + ldmia sp!, {r3, r4, r5, r6, pc} + .align 2, 0 +#ifdef JAPAN +_020495FC: .word 0x0000B60C +#else +_020495FC: .word 0x0000B65C +#endif +_02049600: .word _0209CDA4 +_02049604: .word _020AFF40 +_02049608: .word 0x09011416 +_0204960C: .word _0209CDB8 +_02049610: .word 0x00007F6B +_02049614: .word 0x000005DC +_02049618: .word 0x000001F7 +_0204961C: .word 0x00000DAC +_02049620: .word 0x000015A0 +_02049624: .word 0x00000237 + arm_func_end NoteLoadBase + + arm_func_start ReadQuickSaveInfo +ReadQuickSaveInfo: ; 0x02049628 + stmdb sp!, {r3, lr} + mov ip, r0 + mov r2, r1 + mov r3, #0x190 + add r0, sp, #0 + mov r1, ip + str r3, [sp] + bl ReadSaveFile + ldmia sp!, {r3, pc} + arm_func_end ReadQuickSaveInfo + + arm_func_start sub_0204964C +sub_0204964C: ; 0x0204964C + stmdb sp!, {r4, lr} + mov r4, r0 + ldr r0, _02049678 ; =_0209CDD0 + bl sub_02034974 + cmp r0, #0 + ldrne r1, _0204967C ; =_022AAEA4 + ldrne r0, _02049680 ; =_020AFF4C + movne r2, #0 + strne r4, [r1] + strne r2, [r0, #4] + ldmia sp!, {r4, pc} + .align 2, 0 +_02049678: .word _0209CDD0 +_0204967C: .word _022AAEA4 +_02049680: .word _020AFF4C + arm_func_end sub_0204964C + + arm_func_start sub_02049684 +sub_02049684: ; 0x02049684 + stmdb sp!, {r3, lr} + mov r0, #0xb4 + mov r1, #8 + bl MemAlloc + ldr r1, _020496EC ; =_020AFF4C + str r0, [r1] + add r0, r0, #0x1c + bl sub_02034A38 + ldr r2, _020496EC ; =_020AFF4C + ldr r1, _020496F0 ; =_022AAEA4 + ldr r3, [r2] + str r0, [r3, #0x18] + ldr r3, [r1] + ldr r1, [r2] + mov r0, #0 + str r3, [r1, #8] + bl CreateDialogueBox + ldr r1, _020496EC ; =_020AFF4C + mov r3, #0 + ldr r2, [r1] + strb r0, [r2] + ldr r2, [r1] + mov r0, #1 + str r3, [r2, #4] + str r3, [r1, #4] + ldmia sp!, {r3, pc} + .align 2, 0 +_020496EC: .word _020AFF4C +_020496F0: .word _022AAEA4 + arm_func_end sub_02049684 + + arm_func_start sub_020496F4 +sub_020496F4: ; 0x020496F4 + stmdb sp!, {r3, lr} + ldr r0, _0204972C ; =_020AFF4C + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0] + bl CloseDialogueBox + ldr r0, _0204972C ; =_020AFF4C + ldr r0, [r0] + bl MemFree + ldr r0, _0204972C ; =_020AFF4C + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_0204972C: .word _020AFF4C + arm_func_end sub_020496F4 + + arm_func_start sub_02049730 +sub_02049730: ; 0x02049730 + stmdb sp!, {r3, lr} + ldr r1, _02049A18 ; =_020AFF4C + ldr r3, [r1] + ldr r0, [r3, #4] + cmp r0, #8 + addls pc, pc, r0, lsl #2 + b _02049A10 +_0204974C: ; jump table + b _02049770 ; case 0 + b _020497A4 ; case 1 + b _020497C4 ; case 2 + b _020497E8 ; case 3 + b _020498C8 ; case 4 + b _0204996C ; case 5 + b _020499A0 ; case 6 + b _020499CC ; case 7 + b _020499FC ; case 8 +_02049770: + ldr r0, [r3, #8] + ldr r1, _02049A1C ; =_0209CDE0 + mov r2, r0, lsl #1 + ldrsb r0, [r3] + ldrh r2, [r1, r2] + ldr r1, _02049A20 ; =0x00000408 + mov r3, #0 + bl ShowStringIdInDialogueBox + ldr r0, _02049A18 ; =_020AFF4C + mov r1, #1 + ldr r0, [r0] + str r1, [r0, #4] + b _02049A10 +_020497A4: + ldrsb r0, [r3] + bl IsDialogueBoxActive + cmp r0, #0 + ldreq r0, _02049A18 ; =_020AFF4C + moveq r1, #2 + ldreq r0, [r0] + streq r1, [r0, #4] + b _02049A10 +_020497C4: + mov r0, #0xe0 + mov r1, #0x88 + mov r2, #1 + bl sub_02029F88 + ldr r0, _02049A18 ; =_020AFF4C + mov r1, #3 + ldr r0, [r0] + str r1, [r0, #4] + b _02049A10 +_020497E8: + bl sub_02003B94 + ldr r0, _02049A18 ; =_020AFF4C + ldr r1, _02049A24 ; =_0209CE10 + ldr r3, [r0] + ldr r2, [r3, #8] + ldr r1, [r1, r2, lsl #2] + str r1, [r3, #0x10] + ldr r0, [r0] + ldr r0, [r0, #0x10] + cmp r0, #4 + bne _02049834 + ldr r0, _02049A28 ; =0x000F120A + bl sub_02048DC4 + mov r0, #2 + bl NoteSaveBase + ldr r1, _02049A18 ; =_020AFF4C + ldr r1, [r1] + str r0, [r1, #0xc] + b _020498B0 +_02049834: + cmp r0, #2 + bne _020498A0 + bl sub_02048CB8 + ldr r2, _02049A18 ; =_020AFF4C + ldr r1, _02049A2C ; =0x000F1207 + ldr r3, [r2] + str r0, [r3, #0x14] + ldr r0, [r2] + ldr r0, [r0, #0x14] + cmp r0, r1 + bne _02049868 + add r0, r1, #1 + bl sub_02048DC4 +_02049868: + mov r0, #2 + bl NoteSaveBase + ldr r1, _02049A18 ; =_020AFF4C + ldr r2, [r1] + str r0, [r2, #0xc] + ldr r1, [r1] + ldr r0, [r1, #0xc] + cmp r0, #0 + ldreq r0, [r1, #0x14] + ldreq r1, _02049A2C ; =0x000F1207 + cmpeq r0, r1 + bne _020498B0 + bl sub_02048DC4 + b _020498B0 +_020498A0: + bl NoteSaveBase + ldr r1, _02049A18 ; =_020AFF4C + ldr r1, [r1] + str r0, [r1, #0xc] +_020498B0: + bl sub_02003BC8 + ldr r0, _02049A18 ; =_020AFF4C + mov r1, #4 + ldr r0, [r0] + str r1, [r0, #4] + b _02049A10 +_020498C8: + bl sub_02029FBC + ldr r0, _02049A18 ; =_020AFF4C + ldr r3, [r0] + ldr r0, [r3, #0xc] + cmp r0, #1 + bne _02049908 +#ifdef JAPAN + ldr r1, _02049A30 ; =0x0000040C + ldrsb r0, [r3] + add r2, r1, #0xbd +#else + ldrsb r0, [r3] + ldr r1, _02049A30 ; =0x0000040C + mov r2, #0x238 +#endif + mov r3, #0 + bl ShowStringIdInDialogueBox + ldr r0, _02049A18 ; =_020AFF4C + mov r1, #8 + ldr r0, [r0] + str r1, [r0, #4] + b _02049A10 +_02049908: + cmp r0, #0 + bne _02049944 + ldr r0, [r3, #8] + ldr r1, _02049A34 ; =_0209CDF8 + mov r2, r0, lsl #1 + ldrsb r0, [r3] + ldrh r2, [r1, r2] + ldr r1, _02049A38 ; =0x0000061C + mov r3, #0 + bl ShowStringIdInDialogueBox + ldr r0, _02049A18 ; =_020AFF4C + mov r1, #5 + ldr r0, [r0] + str r1, [r0, #4] + b _02049A10 +_02049944: + ldrsb r0, [r3] + ldr r1, _02049A38 ; =0x0000061C + ldr r2, _02049A3C ; =0x00000239 + mov r3, #0 + bl ShowStringIdInDialogueBox + ldr r0, _02049A18 ; =_020AFF4C + mov r1, #5 + ldr r0, [r0] + str r1, [r0, #4] + b _02049A10 +_0204996C: + ldrsb r0, [r3] + bl IsDialogueBoxActive + cmp r0, #0 + bne _02049A10 + ldr r0, _02049A18 ; =_020AFF4C + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_0202F334 + ldr r0, _02049A18 ; =_020AFF4C + mov r1, #6 + ldr r0, [r0] + str r1, [r0, #4] + b _02049A10 +_020499A0: + ldrsb r0, [r3] + bl IsDialogueBoxActive + cmp r0, #0 + bne _02049A10 + ldr r0, _02049A18 ; =_020AFF4C + mov r1, #2 + str r1, [r0, #4] + ldr r0, [r0] + mov r1, #7 + str r1, [r0, #4] + b _02049A10 +_020499CC: + mov r0, #9 + str r0, [r3, #4] + ldr r2, [r1] + ldr r0, [r2, #0x18] + tst r0, #0x100 + beq _020499F4 + ldr r0, [r2, #0xa4] + ldr r1, [r1, #4] + ldr r2, [r2, #0xa0] + blx r2 +_020499F4: + mov r0, #4 + ldmia sp!, {r3, pc} +_020499FC: + ldrsb r0, [r3] + bl IsDialogueBoxActive + cmp r0, #0 + bne _02049A10 + bl CardBackupError +_02049A10: + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_02049A18: .word _020AFF4C +_02049A1C: .word _0209CDE0 +_02049A20: .word 0x00000408 +_02049A24: .word _0209CE10 +_02049A28: .word 0x000F120A +_02049A2C: .word 0x000F1207 +_02049A30: .word 0x0000040C +_02049A34: .word _0209CDF8 +_02049A38: .word 0x0000061C +#ifdef JAPAN +_02049A3C: .word 0x000004CA +#else +_02049A3C: .word 0x00000239 +#endif + arm_func_end sub_02049730 + + arm_func_start sub_02049A40 +sub_02049A40: ; 0x02049A40 + stmdb sp!, {r3, lr} + mov r3, r0 + mov r2, r1 + ldr r0, _02049A6C ; =_0209CE40 + mov r1, r3 + bl sub_02034974 + cmp r0, #0 + ldrne r0, _02049A70 ; =_020AFF54 + movne r1, #0 + strne r1, [r0, #4] + ldmia sp!, {r3, pc} + .align 2, 0 +_02049A6C: .word _0209CE40 +_02049A70: .word _020AFF54 + arm_func_end sub_02049A40 + + arm_func_start sub_02049A74 +sub_02049A74: ; 0x02049A74 + stmdb sp!, {r3, lr} + mov r0, #0xa8 + mov r1, #8 + bl MemAlloc + ldr r1, _02049ACC ; =_020AFF54 + str r0, [r1] + add r0, r0, #0x10 + bl sub_02034A38 + ldr r1, _02049ACC ; =_020AFF54 + ldr r1, [r1] + str r0, [r1, #0xc] + mov r0, #0 + bl CreateDialogueBox + ldr r1, _02049ACC ; =_020AFF54 + mov r3, #0 + ldr r2, [r1] + strb r0, [r2] + ldr r2, [r1] + mov r0, #1 + str r3, [r2, #4] + str r3, [r1, #4] + ldmia sp!, {r3, pc} + .align 2, 0 +_02049ACC: .word _020AFF54 + arm_func_end sub_02049A74 + + arm_func_start sub_02049AD0 +sub_02049AD0: ; 0x02049AD0 + stmdb sp!, {r3, lr} + ldr r0, _02049B08 ; =_020AFF54 + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0] + bl CloseDialogueBox + ldr r0, _02049B08 ; =_020AFF54 + ldr r0, [r0] + bl MemFree + ldr r0, _02049B08 ; =_020AFF54 + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_02049B08: .word _020AFF54 + arm_func_end sub_02049AD0 + + arm_func_start sub_02049B0C +sub_02049B0C: ; 0x02049B0C + stmdb sp!, {r3, lr} + ldr r0, _02049D34 ; =_020AFF54 + ldr r2, [r0] + ldr r0, [r2, #4] + cmp r0, #8 + addls pc, pc, r0, lsl #2 + b _02049D2C +_02049B28: ; jump table + b _02049B4C ; case 0 + b _02049B74 ; case 1 + b _02049B94 ; case 2 + b _02049BB8 ; case 3 + b _02049BEC ; case 4 + b _02049C74 ; case 5 + b _02049CA8 ; case 6 + b _02049CD4 ; case 7 + b _02049D18 ; case 8 +_02049B4C: + ldrsb r0, [r2] + ldr r1, _02049D38 ; =0x00000408 +#ifdef JAPAN + mov r2, #0x4e0 +#else + ldr r2, _02049D3C ; =0x0000024F +#endif + mov r3, #0 + bl ShowStringIdInDialogueBox + ldr r0, _02049D34 ; =_020AFF54 + mov r1, #1 + ldr r0, [r0] + str r1, [r0, #4] + b _02049D2C +_02049B74: + ldrsb r0, [r2] + bl IsDialogueBoxActive + cmp r0, #0 + ldreq r0, _02049D34 ; =_020AFF54 + moveq r1, #2 + ldreq r0, [r0] + streq r1, [r0, #4] + b _02049D2C +_02049B94: + mov r0, #0xe0 + mov r1, #0x88 + mov r2, #1 + bl sub_02029F88 + ldr r0, _02049D34 ; =_020AFF54 + mov r1, #3 + ldr r0, [r0] + str r1, [r0, #4] + b _02049D2C +_02049BB8: + bl sub_02003B94 + bl sub_02048454 + mov r0, #0 + bl NoteSaveBase + ldr r1, _02049D34 ; =_020AFF54 + ldr r1, [r1] + str r0, [r1, #8] + bl sub_02003BC8 + ldr r0, _02049D34 ; =_020AFF54 + mov r1, #4 + ldr r0, [r0] + str r1, [r0, #4] + b _02049D2C +_02049BEC: + bl sub_02029FBC + ldr r0, _02049D34 ; =_020AFF54 + mov r3, #0 +#ifdef JAPAN + ldr r2, [r0] + ldr r0, [r2, #8] + cmp r0, #1 + bne _02049C2C + ldr r1, _02049D40 ; =0x0000040C + ldrsb r0, [r2] + add r2, r1, #0xbd +#else + ldr r1, [r0] + ldr r0, [r1, #8] + cmp r0, #1 + bne _02049C2C + ldrsb r0, [r1] + ldr r1, _02049D40 ; =0x0000040C + mov r2, #0x238 +#endif + bl ShowStringIdInDialogueBox + ldr r0, _02049D34 ; =_020AFF54 + mov r1, #8 + ldr r0, [r0] + str r1, [r0, #4] + b _02049D2C +_02049C2C: + cmp r0, #0 +#ifdef JAPAN + ldrsb r0, [r2] + ldr r1, _02049D44 ; =0x0000061C + bne _02049C58 + ldr r2, _0204A0B0 ; =0x000004E1 +#else + ldrsb r0, [r1] + ldr r1, _02049D44 ; =0x0000061C + bne _02049C58 + mov r2, #0x250 +#endif + bl ShowStringIdInDialogueBox + ldr r0, _02049D34 ; =_020AFF54 + mov r1, #5 + ldr r0, [r0] + str r1, [r0, #4] + b _02049D2C +_02049C58: + ldr r2, _02049D48 ; =0x0000023A + bl ShowStringIdInDialogueBox + ldr r0, _02049D34 ; =_020AFF54 + mov r1, #5 + ldr r0, [r0] + str r1, [r0, #4] + b _02049D2C +_02049C74: + ldrsb r0, [r2] + bl IsDialogueBoxActive + cmp r0, #0 + bne _02049D2C + ldr r0, _02049D34 ; =_020AFF54 + ldr r0, [r0] + ldrsb r0, [r0] + bl sub_0202F334 + ldr r0, _02049D34 ; =_020AFF54 + mov r1, #6 + ldr r0, [r0] + str r1, [r0, #4] + b _02049D2C +_02049CA8: + ldrsb r0, [r2] + bl IsDialogueBoxActive + cmp r0, #0 + bne _02049D2C + ldr r0, _02049D34 ; =_020AFF54 + mov r1, #2 + str r1, [r0, #4] + ldr r0, [r0] + mov r1, #7 + str r1, [r0, #4] + b _02049D2C +_02049CD4: + mov r1, #9 + add r0, sp, #0 + str r1, [r2, #4] + bl sub_0204AF98 + ldrb r0, [sp] + bl sub_02027180 + ldr r0, _02049D34 ; =_020AFF54 + ldr r1, [r0] + ldr r0, [r1, #0xc] + tst r0, #0x100 + beq _02049D10 + ldr r0, [r1, #0x98] + ldr r2, [r1, #0x94] + mov r1, #8 + blx r2 +_02049D10: + mov r0, #4 + ldmia sp!, {r3, pc} +_02049D18: + ldrsb r0, [r2] + bl IsDialogueBoxActive + cmp r0, #0 + bne _02049D2C + bl CardBackupError +_02049D2C: + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_02049D34: .word _020AFF54 +_02049D38: .word 0x00000408 +#ifdef JAPAN +_02049D40: .word 0x0000040C +_02049D44: .word 0x0000061C +_0204A0B0: .word 0x000004E1 +_02049D48: .word 0x000004CB +#else +_02049D3C: .word 0x0000024F +_02049D40: .word 0x0000040C +_02049D44: .word 0x0000061C +_02049D48: .word 0x0000023A +#endif + arm_func_end sub_02049B0C + + arm_func_start sub_02049D4C +sub_02049D4C: ; 0x02049D4C + stmdb sp!, {r4, lr} + mov r4, r0 + ldr r0, _02049D78 ; =_0209CE58 + bl sub_02034974 + cmp r0, #0 + ldrne r1, _02049D7C ; =_022AAEA8 + ldrne r0, _02049D80 ; =_020AFF5C + movne r2, #0 + strne r4, [r1] + strne r2, [r0] + ldmia sp!, {r4, pc} + .align 2, 0 +_02049D78: .word _0209CE58 +_02049D7C: .word _022AAEA8 +_02049D80: .word _020AFF5C + arm_func_end sub_02049D4C + + arm_func_start sub_02049D84 +sub_02049D84: ; 0x02049D84 + stmdb sp!, {r3, lr} + mov r0, #0xa8 + mov r1, #8 + bl MemAlloc + ldr r1, _02049DEC ; =_020AFF5C + str r0, [r1, #4] + add r0, r0, #0x10 + bl sub_02034A38 + ldr r2, _02049DEC ; =_020AFF5C + ldr r1, _02049DF0 ; =_022AAEA8 + ldr r3, [r2, #4] + str r0, [r3, #0xc] + ldr r3, [r1] + ldr r1, [r2, #4] + mov r0, #0 + str r3, [r1, #8] + bl CreateDialogueBox + ldr r1, _02049DEC ; =_020AFF5C + mov r3, #0 + ldr r2, [r1, #4] + strb r0, [r2] + ldr r2, [r1, #4] + mov r0, #1 + str r3, [r2, #4] + str r3, [r1] + ldmia sp!, {r3, pc} + .align 2, 0 +_02049DEC: .word _020AFF5C +_02049DF0: .word _022AAEA8 + arm_func_end sub_02049D84 + + arm_func_start sub_02049DF4 +sub_02049DF4: ; 0x02049DF4 + stmdb sp!, {r3, lr} + ldr r0, _02049E2C ; =_020AFF5C + ldr r0, [r0, #4] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0] + bl CloseDialogueBox + ldr r0, _02049E2C ; =_020AFF5C + ldr r0, [r0, #4] + bl MemFree + ldr r0, _02049E2C ; =_020AFF5C + mov r1, #0 + str r1, [r0, #4] + ldmia sp!, {r3, pc} + .align 2, 0 +_02049E2C: .word _020AFF5C + arm_func_end sub_02049DF4 + + arm_func_start sub_02049E30 +sub_02049E30: ; 0x02049E30 + stmdb sp!, {r3, lr} + ldr r1, _0204A004 ; =_020AFF5C + ldr r3, [r1, #4] + ldr r0, [r3, #4] + cmp r0, #7 + addls pc, pc, r0, lsl #2 + b _02049FFC +_02049E4C: ; jump table + b _02049E6C ; case 0 + b _02049EA0 ; case 1 + b _02049EC0 ; case 2 + b _02049EE4 ; case 3 + b _02049F2C ; case 4 + b _02049F6C ; case 5 + b _02049FA0 ; case 6 + b _02049FCC ; case 7 +_02049E6C: + ldr r0, [r3, #8] + ldr r1, _0204A008 ; =_0209CE54 + mov r2, r0, lsl #1 + ldrsb r0, [r3] + ldrh r2, [r1, r2] + ldr r1, _0204A00C ; =0x00000408 + mov r3, #0 + bl ShowStringIdInDialogueBox + ldr r0, _0204A004 ; =_020AFF5C + mov r1, #1 + ldr r0, [r0, #4] + str r1, [r0, #4] + b _02049FFC +_02049EA0: + ldrsb r0, [r3] + bl IsDialogueBoxActive + cmp r0, #0 + ldreq r0, _0204A004 ; =_020AFF5C + moveq r1, #2 + ldreq r0, [r0, #4] + streq r1, [r0, #4] + b _02049FFC +_02049EC0: + mov r0, #0xe0 + mov r1, #0x88 + mov r2, #1 + bl sub_02029F88 + ldr r0, _0204A004 ; =_020AFF5C + mov r1, #3 + ldr r0, [r0, #4] + str r1, [r0, #4] + b _02049FFC +_02049EE4: + bl sub_02003B94 + ldr r0, _0204A004 ; =_020AFF5C + ldr r0, [r0, #4] + ldr r0, [r0, #8] + cmp r0, #0 + beq _02049F08 + cmp r0, #1 + beq _02049F10 + b _02049F14 +_02049F08: + bl sub_0204A624 + b _02049F14 +_02049F10: + bl sub_0204A72C +_02049F14: + bl sub_02003BC8 + ldr r0, _0204A004 ; =_020AFF5C + mov r1, #4 + ldr r0, [r0, #4] + str r1, [r0, #4] + b _02049FFC +_02049F2C: + bl sub_02029FBC + ldr r0, _0204A004 ; =_020AFF5C + ldr r2, _0204A010 ; =_0209CE50 + ldr r0, [r0, #4] + ldr r1, _0204A014 ; =0x0000061C + ldr r3, [r0, #8] + ldrsb r0, [r0] + mov r3, r3, lsl #1 + ldrh r2, [r2, r3] + mov r3, #0 + bl ShowStringIdInDialogueBox + ldr r0, _0204A004 ; =_020AFF5C + mov r1, #5 + ldr r0, [r0, #4] + str r1, [r0, #4] + b _02049FFC +_02049F6C: + ldrsb r0, [r3] + bl IsDialogueBoxActive + cmp r0, #0 + bne _02049FFC + ldr r0, _0204A004 ; =_020AFF5C + ldr r0, [r0, #4] + ldrsb r0, [r0] + bl sub_0202F334 + ldr r0, _0204A004 ; =_020AFF5C + mov r1, #6 + ldr r0, [r0, #4] + str r1, [r0, #4] + b _02049FFC +_02049FA0: + ldrsb r0, [r3] + bl IsDialogueBoxActive + cmp r0, #0 + bne _02049FFC + ldr r0, _0204A004 ; =_020AFF5C + mov r1, #2 + str r1, [r0] + ldr r0, [r0, #4] + mov r1, #7 + str r1, [r0, #4] + b _02049FFC +_02049FCC: + mov r0, #8 + str r0, [r3, #4] + ldr r2, [r1, #4] + ldr r0, [r2, #0xc] + tst r0, #0x100 + beq _02049FF4 + ldr r0, [r2, #0x98] + ldr r1, [r1] + ldr r2, [r2, #0x94] + blx r2 +_02049FF4: + mov r0, #4 + ldmia sp!, {r3, pc} +_02049FFC: + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_0204A004: .word _020AFF5C +_0204A008: .word _0209CE54 +_0204A00C: .word 0x00000408 +_0204A010: .word _0209CE50 +_0204A014: .word 0x0000061C + arm_func_end sub_02049E30 + + arm_func_start sub_0204A018 +sub_0204A018: ; 0x0204A018 + ldr ip, _0204A024 ; =sub_020348E4 + ldr r0, _0204A028 ; =_0209CE68 + bx ip + .align 2, 0 +_0204A024: .word sub_020348E4 +_0204A028: .word _0209CE68 + arm_func_end sub_0204A018 + + arm_func_start sub_0204A02C +sub_0204A02C: ; 0x0204A02C + stmdb sp!, {r3, lr} + mov r0, #1 + mov r1, #8 + bl MemAlloc + ldr r1, _0204A078 ; =_020AFF64 + str r0, [r1] + mov r0, #0 + bl CreateDialogueBox + ldr r3, _0204A078 ; =_020AFF64 + ldr r1, _0204A07C ; =0x00000408 + ldr ip, [r3] +#ifdef JAPAN + add r2, r1, #0xc1 +#else + mov r2, #0x238 +#endif + strb r0, [ip] + ldr r0, [r3] + mov r3, #0 + ldrsb r0, [r0] + bl ShowStringIdInDialogueBox + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_0204A078: .word _020AFF64 +_0204A07C: .word 0x00000408 + arm_func_end sub_0204A02C + + arm_func_start sub_0204A080 +sub_0204A080: ; 0x0204A080 + stmdb sp!, {r3, lr} + ldr r0, _0204A0B8 ; =_020AFF64 + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0] + bl CloseDialogueBox + ldr r0, _0204A0B8 ; =_020AFF64 + ldr r0, [r0] + bl MemFree + ldr r0, _0204A0B8 ; =_020AFF64 + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_0204A0B8: .word _020AFF64 + arm_func_end sub_0204A080 + + arm_func_start sub_0204A0BC +sub_0204A0BC: ; 0x0204A0BC + stmdb sp!, {r3, lr} + ldr r0, _0204A0E4 ; =_020AFF64 + ldr r0, [r0] + ldrsb r0, [r0] + bl IsDialogueBoxActive + cmp r0, #0 + bne _0204A0DC + bl CardBackupError +_0204A0DC: + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_0204A0E4: .word _020AFF64 + arm_func_end sub_0204A0BC + + arm_func_start sub_0204A0E8 +sub_0204A0E8: ; 0x0204A0E8 + ldr ip, _0204A0F4 ; =sub_020348E4 + ldr r0, _0204A0F8 ; =_0209CE78 + bx ip + .align 2, 0 +_0204A0F4: .word sub_020348E4 +_0204A0F8: .word _0209CE78 + arm_func_end sub_0204A0E8 + + arm_func_start sub_0204A0FC +sub_0204A0FC: ; 0x0204A0FC + stmdb sp!, {r3, lr} + mov r0, #1 + mov r1, #8 + bl MemAlloc + ldr r1, _0204A148 ; =_020AFF68 + str r0, [r1] + mov r0, #0 + bl CreateDialogueBox + ldr r3, _0204A148 ; =_020AFF68 + ldr r1, _0204A14C ; =0x00000408 + ldr ip, [r3] +#ifdef JAPAN + add r2, r1, #0xd0 +#else + ldr r2, _0204A150 ; =0x00000247 +#endif + strb r0, [ip] + ldr r0, [r3] + mov r3, #0 + ldrsb r0, [r0] + bl ShowStringIdInDialogueBox + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_0204A148: .word _020AFF68 +_0204A14C: .word 0x00000408 +#ifndef JAPAN +_0204A150: .word 0x00000247 +#endif + arm_func_end sub_0204A0FC + + arm_func_start sub_0204A154 +sub_0204A154: ; 0x0204A154 + stmdb sp!, {r3, lr} + ldr r0, _0204A18C ; =_020AFF68 + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldrsb r0, [r0] + bl CloseDialogueBox + ldr r0, _0204A18C ; =_020AFF68 + ldr r0, [r0] + bl MemFree + ldr r0, _0204A18C ; =_020AFF68 + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_0204A18C: .word _020AFF68 + arm_func_end sub_0204A154 + + arm_func_start sub_0204A190 +sub_0204A190: ; 0x0204A190 + mov r0, #1 + bx lr + arm_func_end sub_0204A190 + + arm_func_start sub_0204A198 +sub_0204A198: ; 0x0204A198 + ldr ip, _0204A1A0 ; =sub_0207B9EC + bx ip + .align 2, 0 +_0204A1A0: .word sub_0207B9EC + arm_func_end sub_0204A198 + + arm_func_start sub_0204A1A4 +sub_0204A1A4: ; 0x0204A1A4 + stmdb sp!, {r3, lr} + ldr r0, _0204A1C4 ; =_022AAEAC +#ifdef JAPAN + mov r1, #0x1a0 +#else + mov r1, #0x1f0 +#endif + bl MemZero + ldr r1, _0204A1C4 ; =_022AAEAC + ldr r0, _0204A1C8 ; =_020AFF6C + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_0204A1C4: .word _022AAEAC +_0204A1C8: .word _020AFF6C + arm_func_end sub_0204A1A4 + + arm_func_start sub_0204A1CC +sub_0204A1CC: ; 0x0204A1CC + ldr r0, _0204A1D8 ; =_020AFF6C + ldr r0, [r0] + bx lr + .align 2, 0 +_0204A1D8: .word _020AFF6C + arm_func_end sub_0204A1CC + + arm_func_start sub_0204A1DC +sub_0204A1DC: ; 0x0204A1DC +#ifdef JAPAN +#define SUB_0204A1DC_OFFSET -0x50 +#else +#define SUB_0204A1DC_OFFSET 0 +#endif + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, lr} + sub sp, sp, #0x14 + mov r3, r0 + mov r2, r1 + add r0, sp, #4 + mov r1, r3 + bl sub_02050974 + ldr r1, _0204A3E0 ; =_020AFF6C + add r0, sp, #4 + ldr r1, [r1] + mov r2, #0x200 + bl CopyBitsFrom +#ifdef JAPAN + ldr r4, _0204A3E0 ; =_020AFF6C + mov r7, #0 + add r6, sp, #4 + mov r5, #0x28 +_0204A220: + ldr r0, [r4] + add r1, r7, r7, lsl #2 + add r3, r0, #0x40 + mov r0, r6 + mov r2, r5 + add r1, r3, r1 + bl CopyBitsFrom + add r7, r7, #1 + cmp r7, #0x10 +#else + ldr r5, _0204A3E0 ; =_020AFF6C + mov r8, #0 + add r7, sp, #4 + mov r6, #0x50 + mov r4, #0xa +_0204A220: + ldr r1, [r5] + mov r0, r7 + add r1, r1, #0x40 + mla r1, r8, r4, r1 + mov r2, r6 + bl CopyBitsFrom + add r8, r8, #1 + cmp r8, #0x10 +#endif + blt _0204A220 + ldr r5, _0204A3E0 ; =_020AFF6C + mov r8, #0 + add r7, sp, #4 + mov r6, #0x60 + mov r4, #0xc +_0204A258: + ldr r1, [r5] + mov r0, r7 + add r1, r1, #0xe0 + SUB_0204A1DC_OFFSET + mla r1, r8, r4, r1 + mov r2, r6 + bl CopyBitsFrom + add r8, r8, #1 + cmp r8, #0x10 + blt _0204A258 + mov sb, #0 + mov r5, #1 + ldr sl, _0204A3E0 ; =_020AFF6C + mov r4, sb + add r8, sp, #4 + add r7, sp, #0 + mov r6, r5 +_0204A298: + mov r0, r8 + mov r1, r7 + mov r2, r6 + bl CopyBitsFrom + ldrb r0, [sp] + cmp r0, #0 + ldr r0, [sl] + movne r1, r5 + add r0, r0, sb + moveq r1, r4 + add sb, sb, #1 + strb r1, [r0, #0x1a0 + SUB_0204A1DC_OFFSET] + cmp sb, #0x10 + blt _0204A298 + ldr r1, _0204A3E0 ; =_020AFF6C + add r0, sp, #4 + ldr r1, [r1] + mov r2, #0x1b0 + add r1, r1, #0x1b0 + SUB_0204A1DC_OFFSET + bl CopyBitsFrom + ldr r1, _0204A3E0 ; =_020AFF6C + add r0, sp, #4 + ldr r1, [r1] + mov r2, #0xe + add r1, r1, #0xe6 + SUB_0204A1DC_OFFSET + add r1, r1, #0x100 + bl CopyBitsFrom + ldr r1, _0204A3E0 ; =_020AFF6C + add r0, sp, #4 + ldr r1, [r1] + mov r2, #0xe + add r1, r1, #0x1e8 + SUB_0204A1DC_OFFSET + bl CopyBitsFrom + add r0, sp, #4 + add r1, sp, #0 + mov r2, #1 + bl CopyBitsFrom + ldrb r0, [sp] + ldr r1, _0204A3E0 ; =_020AFF6C + cmp r0, #0 + movne r3, #1 + ldr r2, [r1] + moveq r3, #0 + strb r3, [r2, #0x1ea + SUB_0204A1DC_OFFSET] + add r0, sp, #4 + add r1, sp, #0 + mov r2, #1 + bl CopyBitsFrom + ldrb r0, [sp] + ldr r1, _0204A3E0 ; =_020AFF6C + cmp r0, #0 + movne r3, #1 + ldr r2, [r1] + moveq r3, #0 + strb r3, [r2, #0x1eb + SUB_0204A1DC_OFFSET] + add r0, sp, #4 + add r1, sp, #0 + mov r2, #1 + bl CopyBitsFrom + ldrb r0, [sp] + ldr r1, _0204A3E0 ; =_020AFF6C + cmp r0, #0 + movne r3, #1 + ldr r2, [r1] + moveq r3, #0 + strb r3, [r2, #0x1ec + SUB_0204A1DC_OFFSET] + add r0, sp, #4 + add r1, sp, #0 + mov r2, #1 + bl CopyBitsFrom + ldrb r0, [sp] + ldr r1, _0204A3E0 ; =_020AFF6C + cmp r0, #0 + movne r2, #1 + ldr r1, [r1] + moveq r2, #0 + add r0, sp, #4 + strb r2, [r1, #0x1ed + SUB_0204A1DC_OFFSET] + bl sub_020509BC + ldr r0, [sp, #0xc] + add sp, sp, #0x14 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, pc} + .align 2, 0 +_0204A3E0: .word _020AFF6C + arm_func_end sub_0204A1DC + + arm_func_start sub_0204A3E4 +sub_0204A3E4: ; 0x0204A3E4 +#ifdef JAPAN +#define SUB_0204A3E4_OFFSET -0x50 +#else +#define SUB_0204A3E4_OFFSET 0 +#endif + stmdb sp!, {r4, r5, r6, r7, r8, sb, lr} + sub sp, sp, #0x14 + mov r5, r0 + mov r2, r1 + mov r4, #0xff + mov r3, #0 + add r0, sp, #4 + mov r1, r5 + strb r4, [sp, #1] + strb r3, [sp] + bl sub_02050990 + ldr r1, _0204A5CC ; =_020AFF6C + add r0, sp, #4 + ldr r1, [r1] + mov r2, #0x200 + bl CopyBitsTo +#ifdef JAPAN + ldr r4, _0204A5CC ; =_020AFF6C + mov r7, #0 + add r6, sp, #4 + mov r5, #0x28 +_0204A438: + ldr r0, [r4] + add r1, r7, r7, lsl #2 + add r3, r0, #0x40 + mov r0, r6 + mov r2, r5 + add r1, r3, r1 + bl CopyBitsTo + add r7, r7, #1 + cmp r7, #0x10 +#else + ldr r5, _0204A5CC ; =_020AFF6C + mov r8, #0 + add r7, sp, #4 + mov r6, #0x50 + mov r4, #0xa +_0204A438: + ldr r1, [r5] + mov r0, r7 + add r1, r1, #0x40 + mla r1, r8, r4, r1 + mov r2, r6 + bl CopyBitsTo + add r8, r8, #1 + cmp r8, #0x10 +#endif + blt _0204A438 + ldr r5, _0204A5CC ; =_020AFF6C + mov r8, #0 + add r7, sp, #4 + mov r6, #0x60 + mov r4, #0xc +_0204A470: + ldr r1, [r5] + mov r0, r7 + add r1, r1, #0xe0 + SUB_0204A3E4_OFFSET + mla r1, r8, r4, r1 + mov r2, r6 + bl CopyBitsTo + add r8, r8, #1 + cmp r8, #0x10 + blt _0204A470 + ldr r5, _0204A5CC ; =_020AFF6C + mov r4, #0 + add r8, sp, #0 + add sb, sp, #1 + add r7, sp, #4 + mov r6, #1 +_0204A4AC: + ldr r0, [r5] + mov r2, r6 + add r0, r0, r4 + ldrb r0, [r0, #0x1a0 + SUB_0204A3E4_OFFSET] + cmp r0, #0 + movne r1, sb + moveq r1, r8 + mov r0, r7 + bl CopyBitsTo + add r4, r4, #1 + cmp r4, #0x10 + blt _0204A4AC + ldr r1, _0204A5CC ; =_020AFF6C + add r0, sp, #4 + ldr r1, [r1] + mov r2, #0x1b0 + add r1, r1, #0x1b0 + SUB_0204A3E4_OFFSET + bl CopyBitsTo + ldr r1, _0204A5CC ; =_020AFF6C + add r0, sp, #4 + ldr r1, [r1] + mov r2, #0xe + add r1, r1, #0xe6 + SUB_0204A3E4_OFFSET + add r1, r1, #0x100 + bl CopyBitsTo + ldr r1, _0204A5CC ; =_020AFF6C + add r0, sp, #4 + ldr r1, [r1] + mov r2, #0xe + add r1, r1, #0x1e8 + SUB_0204A3E4_OFFSET + bl CopyBitsTo + ldr r0, _0204A5CC ; =_020AFF6C + mov r2, #1 + ldr r0, [r0] + ldrb r0, [r0, #0x1ea + SUB_0204A3E4_OFFSET] + cmp r0, #0 + addne r1, sp, #1 + addeq r1, sp, #0 + add r0, sp, #4 + bl CopyBitsTo + ldr r0, _0204A5CC ; =_020AFF6C + mov r2, #1 + ldr r0, [r0] + ldrb r0, [r0, #0x1eb + SUB_0204A3E4_OFFSET] + cmp r0, #0 + addne r1, sp, #1 + addeq r1, sp, #0 + add r0, sp, #4 + bl CopyBitsTo + ldr r0, _0204A5CC ; =_020AFF6C + mov r2, #1 + ldr r0, [r0] + ldrb r0, [r0, #0x1ec + SUB_0204A3E4_OFFSET] + cmp r0, #0 + addne r1, sp, #1 + addeq r1, sp, #0 + add r0, sp, #4 + bl CopyBitsTo + ldr r0, _0204A5CC ; =_020AFF6C + mov r2, #1 + ldr r0, [r0] + ldrb r0, [r0, #0x1ed + SUB_0204A3E4_OFFSET] + cmp r0, #0 + addne r1, sp, #1 + addeq r1, sp, #0 + add r0, sp, #4 + bl CopyBitsTo + add r0, sp, #4 + bl sub_020509BC + ldr r0, [sp, #0xc] + add sp, sp, #0x14 + ldmia sp!, {r4, r5, r6, r7, r8, sb, pc} + .align 2, 0 +_0204A5CC: .word _020AFF6C + arm_func_end sub_0204A3E4 + + arm_func_start sub_0204A5D0 +sub_0204A5D0: ; 0x0204A5D0 + stmdb sp!, {r4, lr} + bl sub_02084304 + bl OS_GetLockID + mov r4, r0 + mov r0, r4, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_0208346C + ldr r0, _0204A61C ; =0x00001101 + bl sub_02083B3C + bl sub_02083B14 + ldr r2, _0204A620 ; =_022AB09C + mov r1, r4, lsl #0x10 + str r0, [r2] + mov r0, r1, lsr #0x10 + bl sub_0208347C + mov r0, r4, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_02079094 + ldmia sp!, {r4, pc} + .align 2, 0 +_0204A61C: .word 0x00001101 +_0204A620: .word _022AB09C + arm_func_end sub_0204A5D0 + + arm_func_start sub_0204A624 +sub_0204A624: ; 0x0204A624 + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0x14 + sub sp, sp, #0x400 + bl sub_02083B00 + and r0, r0, #0xff + cmp r0, #1 + bne _0204A720 + mov r1, #0 + mov r0, #0xff + add r8, sp, #0x14 +_0204A64C: + strb r0, [r8, r1] + add r1, r1, #1 + cmp r1, #0x400 + blt _0204A64C + mov r7, #0 + mov fp, r7 +_0204A664: + mov r6, #0 + mov sb, r7, lsl #8 + b _0204A70C +_0204A670: + bl OS_GetLockID + mov r5, r0 + bl sub_02002580 + mov r4, r0 + mov r0, r5, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_0208346C + mov r0, r4 + mov r1, #0x13 + bl sub_020027F8 + str fp, [sp] + mov sl, r0 + str fp, [sp, #4] + mov r1, #8 + str r1, [sp, #8] + mov r1, #0xa + str r1, [sp, #0xc] + mov r1, #2 + str r1, [sp, #0x10] + mov r0, r8 + mov r1, sb + mov r2, #0x400 + mov r3, fp + bl sub_02083A18 + mov r1, sl + mov sl, r0 + mov r0, r4 + bl sub_020027F8 + mov r0, r5, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_0208347C + mov r0, r5, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_02079094 + cmp sl, #0 + bne _0204A714 + mov r0, #0 + bl CardPullOutWithStatus + add r6, r6, #1 +_0204A70C: + cmp r6, #4 + blt _0204A670 +_0204A714: + add r7, r7, #1 + cmp r7, #0x100 + blt _0204A664 +_0204A720: + add sp, sp, #0x14 + add sp, sp, #0x400 + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc} + arm_func_end sub_0204A624 + + arm_func_start sub_0204A72C +sub_0204A72C: ; 0x0204A72C + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0x18 + sub sp, sp, #0x400 + mov r0, #0x400 + bl RandInt + str r0, [sp, #0x14] + bl sub_02083B00 + and r0, r0, #0xff + cmp r0, #1 + bne _0204A8D4 + mov r2, #0 + mov r1, #0xff +_0204A75C: + add r0, sp, #0x18 + strb r1, [r0, r2] + add r2, r2, #1 + cmp r2, #0x400 + blt _0204A75C + mov r5, #0 +_0204A774: + mov r1, r5, lsr #0x1f + rsb r0, r1, r5, lsl #22 + mov r8, r5, lsl #8 + add sb, r1, r0, ror #22 + mov r4, #0 + b _0204A8C0 +_0204A78C: + bl OS_GetLockID + mov r6, r0 + bl sub_02002580 + mov r7, r0 + mov r0, r6, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_0208346C + mov r0, r7 + mov r1, #0x13 + bl sub_020027F8 + mov r1, #0 + str r1, [sp] + str r1, [sp, #4] + mov r1, #6 + str r1, [sp, #8] + mov r1, #1 + str r1, [sp, #0xc] + mov r1, #0 + str r1, [sp, #0x10] + mov fp, r0 + mov r0, r8 + add r1, sp, #0x18 + mov r2, #0x400 + mov r3, #0 + bl sub_02083A18 + cmp r0, #0 + beq _0204A820 + mov r0, r7 + mov r1, fp + bl sub_020027F8 + mov r0, r6, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_0208347C + mov r0, r6, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_02079094 + b _0204A8C8 +_0204A820: + ldr r0, [sp, #0x14] + cmp sb, r0 + bne _0204A84C + mov sl, #0 +_0204A830: + mov r0, #0x100 + bl RandInt + add r1, sp, #0x18 + strb r0, [r1, sl] + add sl, sl, #1 + cmp sl, #0x400 + blt _0204A830 +_0204A84C: + mov r0, #0 + str r0, [sp] + str r0, [sp, #4] + mov r0, #8 + str r0, [sp, #8] + mov r0, #0xa + str r0, [sp, #0xc] + mov r0, #2 + str r0, [sp, #0x10] + add r0, sp, #0x18 + mov r1, r8 + mov r2, #0x400 + mov r3, #0 + bl sub_02083A18 + mov sl, r0 + mov r1, fp + mov r0, r7 + bl sub_020027F8 + mov r0, r6, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_0208347C + mov r0, r6, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_02079094 + cmp sl, #0 + bne _0204A8C8 + mov r0, #0 + bl CardPullOutWithStatus + add r4, r4, #1 +_0204A8C0: + cmp r4, #4 + blt _0204A78C +_0204A8C8: + add r5, r5, #1 + cmp r5, #0x100 + blt _0204A774 +_0204A8D4: + add sp, sp, #0x18 + add sp, sp, #0x400 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + arm_func_end sub_0204A72C + + arm_func_start sub_0204A8E0 +sub_0204A8E0: ; 0x0204A8E0 + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0x14 + mov r4, r0 + mov sb, r1 + mov r8, r2 + bl sub_02083B00 + and r0, r0, #0xff + cmp r0, #1 + movne r0, #3 + bne _0204A9C0 + mov r6, #0 + mov r7, r4, lsl #8 + mov fp, r6 + b _0204A9B4 +_0204A918: + bl OS_GetLockID + mov r5, r0 + bl sub_02002580 + mov r4, r0 + mov r0, r5, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_0208346C + mov r0, r4 + mov r1, #0x13 + bl sub_020027F8 + str fp, [sp] + mov sl, r0 + str fp, [sp, #4] + mov r1, #6 + str r1, [sp, #8] + mov r1, #1 + str r1, [sp, #0xc] + mov r0, r7 + mov r1, sb + mov r2, r8 + mov r3, fp + str fp, [sp, #0x10] + bl sub_02083A18 + mov r1, sl + mov sl, r0 + mov r0, r4 + bl sub_020027F8 + mov r0, r5, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_0208347C + mov r0, r5, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_02079094 + cmp sl, #0 + movne r0, #0 + bne _0204A9C0 + mov r0, #0 + bl CardPullOutWithStatus + add r6, r6, #1 +_0204A9B4: + cmp r6, #4 + blt _0204A918 + mov r0, #3 +_0204A9C0: + add sp, sp, #0x14 + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc} + arm_func_end sub_0204A8E0 + + arm_func_start sub_0204A9C8 +sub_0204A9C8: ; 0x0204A9C8 + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0x214 + mov r4, r0 + mov sb, r1 + mov r8, r2 + bl sub_02083B00 + and r0, r0, #0xff + cmp r0, #1 + movne r0, #3 + bne _0204AB10 + mov r7, r4, lsl #8 + mov r6, #0 + mov fp, #6 + b _0204AB04 +_0204AA00: + bl OS_GetLockID + mov r5, r0 + bl sub_02002580 + mov r1, #0x13 + mov r4, r0 + bl sub_020027F8 + mov sl, r0 + mov r0, r5, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_0208346C + mov r0, #0 + str r0, [sp] + stmib sp, {r0, fp} + mov r0, #1 + str r0, [sp, #0xc] + mov r0, #0 + str r0, [sp, #0x10] + mov r0, r7 + add r1, sp, #0x14 + mov r2, #0x80 + mov r3, #0 + bl sub_02083A18 + cmp r0, #0 + bne _0204AA8C + mov r0, r4 + mov r1, sl + bl sub_020027F8 + mov r0, r5, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_0208347C + mov r0, r5, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_02079094 + mov r0, #4 + b _0204AB10 +_0204AA8C: + mov r0, #0 + str r0, [sp] + str r0, [sp, #4] + mov r0, #8 + str r0, [sp, #8] + mov r0, #0xa + str r0, [sp, #0xc] + mov r0, #2 + str r0, [sp, #0x10] + mov r0, sb + mov r1, r7 + mov r2, r8 + mov r3, #0 + bl sub_02083A18 + mov r1, sl + mov sl, r0 + mov r0, r4 + bl sub_020027F8 + mov r0, r5, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_0208347C + mov r0, r5, lsl #0x10 + mov r0, r0, lsr #0x10 + bl sub_02079094 + cmp sl, #0 + movne r0, #0 + bne _0204AB10 + mov r0, #0 + bl CardPullOutWithStatus + add r6, r6, #1 +_0204AB04: + cmp r6, #4 + blt _0204AA00 + mov r0, #3 +_0204AB10: + add sp, sp, #0x214 + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc} + arm_func_end sub_0204A9C8 + + arm_func_start sub_0204AB18 +sub_0204AB18: ; 0x0204AB18 + ldr ip, _0204AB20 ; =sub_0204AB24 + bx ip + .align 2, 0 +_0204AB20: .word sub_0204AB24 + arm_func_end sub_0204AB18 + + arm_func_start sub_0204AB24 +sub_0204AB24: ; 0x0204AB24 + stmdb sp!, {r3} + sub sp, sp, #4 + ldr r0, _0204AB74 ; =_022AB0A0 + mov r1, #2 + mov r2, #0 + strb r1, [r0] + strb r2, [r0, #2] + mov r1, #1 + strb r1, [r0, #1] + strb r1, [r0, #3] + strb r2, [r0, #4] + strb r1, [r0, #5] + strb r1, [r0, #6] + strb r2, [r0, #7] + strb r2, [r0, #8] + strb r2, [sp] + strb r2, [r0, #9] + add sp, sp, #4 + ldmia sp!, {r3} + bx lr + .align 2, 0 +_0204AB74: .word _022AB0A0 + arm_func_end sub_0204AB24 + + arm_func_start sub_0204AB78 +sub_0204AB78: ; 0x0204AB78 + ldr r3, _0204AB94 ; =_022AB0A0 + mov r2, #0xa +_0204AB80: + ldrb r1, [r3], #1 + subs r2, r2, #1 + strb r1, [r0], #1 + bne _0204AB80 + bx lr + .align 2, 0 +_0204AB94: .word _022AB0A0 + arm_func_end sub_0204AB78 + + arm_func_start sub_0204AB98 +sub_0204AB98: ; 0x0204AB98 + ldr r3, _0204ABB4 ; =_022AB0A0 + mov r2, #0xa +_0204ABA0: + ldrb r1, [r0], #1 + subs r2, r2, #1 + strb r1, [r3], #1 + bne _0204ABA0 + bx lr + .align 2, 0 +_0204ABB4: .word _022AB0A0 + arm_func_end sub_0204AB98 + + arm_func_start sub_0204ABB8 +sub_0204ABB8: ; 0x0204ABB8 + stmdb sp!, {r4, lr} + ldr r1, _0204ACC0 ; =_022AB0A0 + mov r2, #2 + mov r4, r0 + bl CopyBitsTo + ldr r1, _0204ACC4 ; =_022AB0A2 + mov r0, r4 + mov r2, #3 + bl CopyBitsTo + ldr r1, _0204ACC8 ; =_022AB0A1 + mov r0, r4 + mov r2, #2 + bl CopyBitsTo + ldr r0, _0204ACCC ; =_022AB0A0 + mov r2, #1 + ldrb r0, [r0, #3] + cmp r0, #0 + ldrne r1, _0204ACD0 ; =_0209CE88 + mov r0, r4 + ldreq r1, _0204ACD4 ; =_0209CE89 + bl CopyBitsTo + ldr r0, _0204ACCC ; =_022AB0A0 + mov r2, #1 + ldrb r0, [r0, #4] + cmp r0, #0 + ldrne r1, _0204ACD0 ; =_0209CE88 + mov r0, r4 + ldreq r1, _0204ACD4 ; =_0209CE89 + bl CopyBitsTo + ldr r0, _0204ACCC ; =_022AB0A0 + mov r2, #1 + ldrb r0, [r0, #5] + cmp r0, #0 + ldrne r1, _0204ACD0 ; =_0209CE88 + mov r0, r4 + ldreq r1, _0204ACD4 ; =_0209CE89 + bl CopyBitsTo + ldr r0, _0204ACCC ; =_022AB0A0 + mov r2, #1 + ldrb r0, [r0, #6] + cmp r0, #0 + ldrne r1, _0204ACD0 ; =_0209CE88 + mov r0, r4 + ldreq r1, _0204ACD4 ; =_0209CE89 + bl CopyBitsTo + ldr r0, _0204ACCC ; =_022AB0A0 + mov r2, #1 + ldrb r0, [r0, #7] + cmp r0, #0 + ldrne r1, _0204ACD0 ; =_0209CE88 + mov r0, r4 + ldreq r1, _0204ACD4 ; =_0209CE89 + bl CopyBitsTo + ldr r0, _0204ACCC ; =_022AB0A0 + mov r2, #1 + ldrb r0, [r0, #8] + cmp r0, #0 + ldrne r1, _0204ACD0 ; =_0209CE88 + mov r0, r4 + ldreq r1, _0204ACD4 ; =_0209CE89 + bl CopyBitsTo + ldr r1, _0204ACD8 ; =_022AB0A9 + mov r0, r4 + mov r2, #3 + bl CopyBitsTo + ldmia sp!, {r4, pc} + .align 2, 0 +_0204ACC0: .word _022AB0A0 +_0204ACC4: .word _022AB0A2 +_0204ACC8: .word _022AB0A1 +_0204ACCC: .word _022AB0A0 +_0204ACD0: .word _0209CE88 +_0204ACD4: .word _0209CE89 +_0204ACD8: .word _022AB0A9 + arm_func_end sub_0204ABB8 + + arm_func_start sub_0204ACDC +sub_0204ACDC: ; 0x0204ACDC + stmdb sp!, {r3, r4, lr} + sub sp, sp, #4 + add r1, sp, #0 + mov r2, #2 + mov r4, r0 + bl CopyBitsFrom + ldrb r0, [sp] + ldr r3, _0204AE5C ; =_022AB0A0 + add r1, sp, #0 + and ip, r0, #3 + mov r0, r4 + mov r2, #3 + strb ip, [r3] + bl CopyBitsFrom + ldrb r0, [sp] + ldr r3, _0204AE5C ; =_022AB0A0 + add r1, sp, #0 + and ip, r0, #7 + mov r0, r4 + mov r2, #2 + strb ip, [r3, #2] + bl CopyBitsFrom + ldrb r0, [sp] + ldr r2, _0204AE5C ; =_022AB0A0 + add r1, sp, #0 + and r3, r0, #3 + strb r3, [r2, #1] + mov r0, r4 + mov r2, #1 + bl CopyBitsFrom + ldrb r0, [sp] + ldr r3, _0204AE5C ; =_022AB0A0 + add r1, sp, #0 + tst r0, #1 + movne ip, #1 + moveq ip, #0 + mov r0, r4 + mov r2, #1 + strb ip, [r3, #3] + bl CopyBitsFrom + ldrb r0, [sp] + ldr r3, _0204AE5C ; =_022AB0A0 + add r1, sp, #0 + tst r0, #1 + movne ip, #1 + moveq ip, #0 + mov r0, r4 + mov r2, #1 + strb ip, [r3, #4] + bl CopyBitsFrom + ldrb r0, [sp] + ldr r2, _0204AE5C ; =_022AB0A0 + add r1, sp, #0 + tst r0, #1 + movne r3, #1 + moveq r3, #0 + strb r3, [r2, #5] + mov r0, r4 + mov r2, #1 + bl CopyBitsFrom + ldrb r0, [sp] + ldr r2, _0204AE5C ; =_022AB0A0 + add r1, sp, #0 + tst r0, #1 + movne r3, #1 + moveq r3, #0 + strb r3, [r2, #6] + mov r0, r4 + mov r2, #1 + bl CopyBitsFrom + ldrb r0, [sp] + ldr r2, _0204AE5C ; =_022AB0A0 + add r1, sp, #0 + tst r0, #1 + movne r3, #1 + moveq r3, #0 + strb r3, [r2, #7] + mov r0, r4 + mov r2, #1 + bl CopyBitsFrom + ldrb r0, [sp] + ldr r2, _0204AE5C ; =_022AB0A0 + add r1, sp, #0 + tst r0, #1 + movne r3, #1 + moveq r3, #0 + strb r3, [r2, #8] + mov r0, r4 + mov r2, #3 + bl CopyBitsFrom + ldrb r1, [sp] + ldr r0, _0204AE5C ; =_022AB0A0 + and r1, r1, #7 + strb r1, [r0, #9] + add sp, sp, #4 + ldmia sp!, {r3, r4, pc} + .align 2, 0 +_0204AE5C: .word _022AB0A0 + arm_func_end sub_0204ACDC + + arm_func_start sub_0204AE60 +sub_0204AE60: ; 0x0204AE60 + ldr r0, _0204AE7C ; =_022AB0A0 + ldrb r0, [r0] + cmp r0, #1 + movhs r0, #1 + movlo r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_0204AE7C: .word _022AB0A0 + arm_func_end sub_0204AE60 + + arm_func_start sub_0204AE80 +sub_0204AE80: ; 0x0204AE80 + ldr r0, _0204AE9C ; =_022AB0A0 + ldrb r0, [r0] + cmp r0, #2 + movhs r0, #1 + movlo r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_0204AE9C: .word _022AB0A0 + arm_func_end sub_0204AE80 + + arm_func_start sub_0204AEA0 +sub_0204AEA0: ; 0x0204AEA0 + ldr r0, _0204AEAC ; =_022AB0A0 + ldrb r0, [r0, #2] + bx lr + .align 2, 0 +_0204AEAC: .word _022AB0A0 + arm_func_end sub_0204AEA0 + + arm_func_start sub_0204AEB0 +sub_0204AEB0: ; 0x0204AEB0 + ldr r1, _0204AEBC ; =_022AB0A0 + strb r0, [r1, #2] + bx lr + .align 2, 0 +_0204AEBC: .word _022AB0A0 + arm_func_end sub_0204AEB0 + + arm_func_start sub_0204AEC0 +sub_0204AEC0: ; 0x0204AEC0 + ldr r0, _0204AECC ; =_022AB0A0 + ldrb r0, [r0, #1] + bx lr + .align 2, 0 +_0204AECC: .word _022AB0A0 + arm_func_end sub_0204AEC0 + + arm_func_start sub_0204AED0 +sub_0204AED0: ; 0x0204AED0 + ldr r0, _0204AEDC ; =_022AB0A0 + ldrb r0, [r0, #3] + bx lr + .align 2, 0 +_0204AEDC: .word _022AB0A0 + arm_func_end sub_0204AED0 + + arm_func_start sub_0204AEE0 +sub_0204AEE0: ; 0x0204AEE0 + ldr r0, _0204AEEC ; =_022AB0A0 + ldrb r0, [r0, #4] + bx lr + .align 2, 0 +_0204AEEC: .word _022AB0A0 + arm_func_end sub_0204AEE0 + + arm_func_start sub_0204AEF0 +sub_0204AEF0: ; 0x0204AEF0 + ldr r0, _0204AEFC ; =_022AB0A0 + ldrb r0, [r0, #5] + bx lr + .align 2, 0 +_0204AEFC: .word _022AB0A0 + arm_func_end sub_0204AEF0 + + arm_func_start sub_0204AF00 +sub_0204AF00: ; 0x0204AF00 + ldr r0, _0204AF0C ; =_022AB0A0 + ldrb r0, [r0, #6] + bx lr + .align 2, 0 +_0204AF0C: .word _022AB0A0 + arm_func_end sub_0204AF00 + + arm_func_start sub_0204AF10 +sub_0204AF10: ; 0x0204AF10 + ldr r0, _0204AF1C ; =_022AB0A0 + ldrb r0, [r0, #7] + bx lr + .align 2, 0 +_0204AF1C: .word _022AB0A0 + arm_func_end sub_0204AF10 + + arm_func_start sub_0204AF20 +sub_0204AF20: ; 0x0204AF20 + ldr r0, _0204AF2C ; =_022AB0A0 + ldrb r0, [r0, #8] + bx lr + .align 2, 0 +_0204AF2C: .word _022AB0A0 + arm_func_end sub_0204AF20 + + arm_func_start sub_0204AF30 +sub_0204AF30: ; 0x0204AF30 + ldr r0, _0204AF54 ; =_022AB0A0 + ldrb r1, [r0, #1] + cmp r1, #1 + cmpne r1, #2 + ldrneb r0, [r0, #2] + cmpne r0, #3 + moveq r0, #1 + movne r0, #0 + bx lr + .align 2, 0 +_0204AF54: .word _022AB0A0 + arm_func_end sub_0204AF30 + + arm_func_start sub_0204AF58 +sub_0204AF58: ; 0x0204AF58 + ldr r0, _0204AF74 ; =_022AB0A0 + ldrb r0, [r0, #2] + cmp r0, #1 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_0204AF74: .word _022AB0A0 + arm_func_end sub_0204AF58 + + arm_func_start sub_0204AF78 +sub_0204AF78: ; 0x0204AF78 + ldr r0, _0204AF94 ; =_022AB0A0 + ldrb r0, [r0, #2] + cmp r0, #2 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_0204AF94: .word _022AB0A0 + arm_func_end sub_0204AF78 + + arm_func_start sub_0204AF98 +sub_0204AF98: ; 0x0204AF98 + ldr r1, _0204AFA8 ; =_022AB0A0 + ldrb r1, [r1, #9] + strb r1, [r0] + bx lr + .align 2, 0 +_0204AFA8: .word _022AB0A0 + arm_func_end sub_0204AF98 + + arm_func_start sub_0204AFAC +sub_0204AFAC: ; 0x0204AFAC + ldrb r1, [r0] + ldr r0, _0204AFBC ; =_022AB0A0 + strb r1, [r0, #9] + bx lr + .align 2, 0 +_0204AFBC: .word _022AB0A0 + arm_func_end sub_0204AFAC + + arm_func_start GetGameMode +GetGameMode: ; 0x0204AFC0 + ldr r0, _0204AFCC ; =GAME_MODE + ldrb r0, [r0] + bx lr + .align 2, 0 +_0204AFCC: .word GAME_MODE + arm_func_end GetGameMode + + arm_func_start sub_0204AFD0 +sub_0204AFD0: ; 0x0204AFD0 + ldr r0, _0204AFF4 ; =GAME_MODE + ldrb r0, [r0] + add r0, r0, #0xfe + and r0, r0, #0xff + cmp r0, #1 + movls r0, #1 + movhi r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_0204AFF4: .word GAME_MODE + arm_func_end sub_0204AFD0 + + arm_func_start sub_0204AFF8 +sub_0204AFF8: ; 0x0204AFF8 + ldr r0, _0204B014 ; =GAME_MODE + ldrb r0, [r0] + cmp r0, #4 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_0204B014: .word GAME_MODE + arm_func_end sub_0204AFF8 + + arm_func_start sub_0204B018 +sub_0204B018: ; 0x0204B018 + ldr r1, _0204B024 ; =GAME_MODE + strb r0, [r1] + bx lr + .align 2, 0 +_0204B024: .word GAME_MODE + arm_func_end sub_0204B018 + + arm_func_start sub_0204B028 +sub_0204B028: ; 0x0204B028 + ldr r1, _0204B040 ; =_0209DF70 + ldr ip, _0204B044 ; =Debug_Print0 + ldr r0, _0204B048 ; =_0209CF0C + ldrsh r1, [r1, #0x24] + mov r2, #0x400 + bx ip + .align 2, 0 +_0204B040: .word _0209DF70 +_0204B044: .word Debug_Print0 +_0204B048: .word _0209CF0C + arm_func_end sub_0204B028 + + arm_func_start InitScriptVariableValues +InitScriptVariableValues: ; 0x0204B04C + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + mov r1, #0 + ldr r0, _0204B2F8 ; =_022AB0AC + mov r7, r1 +_0204B05C: + strb r7, [r0, r1] + add r1, r1, #1 + cmp r1, #0x400 + blt _0204B05C + mov r4, #0 + ldr r6, _0204B2FC ; =SCRIPT_VARS + mov r5, r4 +_0204B078: + mov r0, r7, lsl #4 + ldrsh r0, [r6, r0] + add r8, r6, r7, lsl #4 + cmp r0, #0 + cmpne r0, #9 + beq _0204B0C4 + mov sb, r5 + b _0204B0B8 +_0204B098: + ldrsh r3, [r8, #0xa] + mov r0, r4 + mov r1, r7 + mov r2, sb + bl SaveScriptVariableValueAtIndex + add r0, sb, #1 + mov r0, r0, lsl #0x10 + mov sb, r0, lsr #0x10 +_0204B0B8: + ldrsh r0, [r8, #8] + cmp sb, r0 + blt _0204B098 +_0204B0C4: + add r0, r7, #1 + mov r0, r0, lsl #0x10 + mov r7, r0, asr #0x10 + cmp r7, #0x72 + blt _0204B078 + mov r0, #0 + mov r2, r0 + mov r1, #0x46 + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #1 + bl ZinitScriptVariable + bl InitEventFlagScriptVars + mov sl, #0 +#ifdef JAPAN + mov sb, sl + mov r8, #0x21 + mov r7, #0x13c + mov r6, sl + mov r5, #0x22 + mov fp, sl + mvn r4, #0 +#else + ldr r7, _0204B300 ; =0x00000137 + mov sb, sl +#ifdef EUROPE + sub r4, r7, #0x144 +#else + sub r4, r7, #0x138 +#endif + mov r8, #0x21 + mov r6, sl + mov r5, #0x22 + mov fp, sl +#endif +_0204B118: + mov r2, sl, lsl #0x10 + mov r0, sb + mov r1, r8 + mov r2, r2, lsr #0x10 + mov r3, r7 + bl SaveScriptVariableValueAtIndex + mov r2, sl, lsl #0x10 + mov r0, r6 + mov r1, r5 + mov r2, r2, lsr #0x10 + mov r3, r6 + bl SaveScriptVariableValueAtIndex + mov r2, sl, lsl #0x10 + mov r0, fp + mov r1, #0x23 + mov r2, r2, lsr #0x10 +#ifdef JAPAN + mov r3, #0x13c +#else + mov r3, r7 +#endif + bl SaveScriptVariableValueAtIndex + mov r2, sl, lsl #0x10 + mov r0, #0 + mov r1, #0x24 + mov r2, r2, lsr #0x10 + mov r3, r4 + bl SaveScriptVariableValueAtIndex + mov r2, sl, lsl #0x10 + mov r0, #0 + mov r1, #0x25 + mov r2, r2, lsr #0x10 + mov r3, #0xbb + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r2, sl, lsl #0x10 + mov r1, #0x2d + mov r2, r2, lsr #0x10 + mov r3, r0 + bl SaveScriptVariableValueAtIndex + mov r2, sl, lsl #0x10 + mov r0, #0 + mov r1, #0x2f + mov r2, r2, lsr #0x10 + mov r3, r4 + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r2, sl, lsl #0x10 + mov r1, #0x31 + mov r2, r2, lsr #0x10 + mov r3, r0 + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r2, sl, lsl #0x10 + mov r1, #0x32 + mov r2, r2, lsr #0x10 + mov r3, r0 + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r2, sl, lsl #0x10 + mov r1, #0x37 + mov r2, r2, lsr #0x10 + mov r3, r0 + bl SaveScriptVariableValueAtIndex + mov r2, sl, lsl #0x10 + mov r0, #0 + mov r1, #0x38 + mov r2, r2, lsr #0x10 + mov r3, #2 + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r2, sl, lsl #0x10 + mov r1, #0x39 + mov r2, r2, lsr #0x10 + mov r3, r0 + bl SaveScriptVariableValueAtIndex + add sl, sl, #1 + cmp sl, #4 + blt _0204B118 + mov r1, #0x26 + sub r2, r1, #0x27 + mov r0, #0 + bl SaveScriptVariableValue + mov r0, #0 + mov r2, r0 + mov r1, #0x33 + bl SaveScriptVariableValue + mov r0, #0 + mov r2, r0 + mov r1, #0x6e + bl SaveScriptVariableValue + mov r0, #0 + mov r2, r0 + mov r1, #0x3e + bl SaveScriptVariableValue + mov r0, #0 + mov r2, r0 + mov r1, #0x40 + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x42 + mov r2, #4 + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x43 + mov r2, #1 + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x4a + sub r2, r1, #0x4b + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x4b + bl ZinitScriptVariable + mov r0, #0 + mov r1, #0x4c + bl ZinitScriptVariable + mov r0, #0 + mov r1, #0x4d + bl ZinitScriptVariable + bl InitScenarioScriptVars + bl InitWorldMapScriptVars + bl InitDungeonListScriptVars + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_0204B2F8: .word _022AB0AC +_0204B2FC: .word SCRIPT_VARS +#if defined(EUROPE) +_0204B300: .word 0x00000143 +#elif !defined(JAPAN) +_0204B300: .word 0x00000137 +#endif + arm_func_end InitScriptVariableValues + + arm_func_start InitEventFlagScriptVars +InitEventFlagScriptVars: ; 0x0204B304 + stmdb sp!, {r3, lr} +#ifdef JAPAN + mov r0, #0 + mov r1, #0x1c + mov r2, #0x13c +#else + ldr r2, _0204B3CC ; =0x00000137 + mov r0, #0 + mov r1, #0x1c +#endif + bl SaveScriptVariableValue + mov r0, #0 + mov r2, r0 + mov r1, #0x1d + bl SaveScriptVariableValue +#ifdef JAPAN + mov r0, #0 + mov r1, #0x1e + mov r2, #0x13c +#else + ldr r2, _0204B3CC ; =0x00000137 + mov r0, #0 + mov r1, #0x1e +#endif + bl SaveScriptVariableValue + mov r1, #0x1f + sub r2, r1, #0x20 + mov r0, #0 + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x20 + mov r2, #0xbb + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x27 + mov r2, r0 + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x29 + sub r2, r1, #0x2a + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x2b + mov r2, r0 + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x2c + mov r2, r0 + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x34 + mov r2, r0 + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x35 + mov r2, #2 + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x36 + mov r2, r0 + bl SaveScriptVariableValue + ldmia sp!, {r3, pc} + .align 2, 0 +#if defined(EUROPE) +_0204B3CC: .word 0x00000143 +#elif !defined(JAPAN) +_0204B3CC: .word 0x00000137 +#endif + arm_func_end InitEventFlagScriptVars + + arm_func_start sub_0204B3D0 +sub_0204B3D0: ; 0x0204B3D0 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r4, r1 + cmp r4, #0x400 + mov r5, r0 + ldrlt r0, _0204B42C ; =SCRIPT_VARS + ldrge r1, _0204B430 ; =SCRIPT_VARS_LOCALS + addlt r7, r0, r4, lsl #4 + subge r0, r4, #0x400 + addge r7, r1, r0, lsl #4 + mov r6, #0 + b _0204B41C +_0204B3FC: + ldrsh r3, [r7, #0xa] + mov r0, r5 + mov r1, r4 + mov r2, r6 + bl SaveScriptVariableValueAtIndex + add r0, r6, #1 + mov r0, r0, lsl #0x10 + mov r6, r0, lsr #0x10 +_0204B41C: + ldrsh r0, [r7, #8] + cmp r6, r0 + blt _0204B3FC + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_0204B42C: .word SCRIPT_VARS +_0204B430: .word SCRIPT_VARS_LOCALS + arm_func_end sub_0204B3D0 + + arm_func_start ZinitScriptVariable +ZinitScriptVariable: ; 0x0204B434 + stmdb sp!, {r4, r5, r6, r7, r8, lr} + mov r5, r1 + cmp r5, #0x400 + mov r6, r0 + ldrlt r0, _0204B494 ; =SCRIPT_VARS + mov r8, #0 + addlt r4, r0, r5, lsl #4 + ldrge r1, _0204B498 ; =SCRIPT_VARS_LOCALS + subge r0, r5, #0x400 + addge r4, r1, r0, lsl #4 + mov r7, r8 + b _0204B484 +_0204B464: + mov r0, r6 + mov r1, r5 + mov r2, r8 + mov r3, r7 + bl SaveScriptVariableValueAtIndex + add r0, r8, #1 + mov r0, r0, lsl #0x10 + mov r8, r0, lsr #0x10 +_0204B484: + ldrsh r0, [r4, #8] + cmp r8, r0 + blt _0204B464 + ldmia sp!, {r4, r5, r6, r7, r8, pc} + .align 2, 0 +_0204B494: .word SCRIPT_VARS +_0204B498: .word SCRIPT_VARS_LOCALS + arm_func_end ZinitScriptVariable + + arm_func_start LoadScriptVariableRaw +LoadScriptVariableRaw: ; 0x0204B49C + cmp r2, #0x400 + bge _0204B4C0 + ldr r1, _0204B4E0 ; =SCRIPT_VARS + ldr r3, _0204B4E4 ; =_022AB0AC + add r1, r1, r2, lsl #4 + str r1, [r0] + ldrsh r1, [r1, #4] + add r1, r3, r1 + b _0204B4D8 +_0204B4C0: + ldr r3, _0204B4E8 ; =SCRIPT_VARS_LOCALS + sub r2, r2, #0x400 + add r2, r3, r2, lsl #4 + str r2, [r0] + ldrsh r2, [r2, #4] + add r1, r1, r2, lsl #2 +_0204B4D8: + str r1, [r0, #4] + bx lr + .align 2, 0 +_0204B4E0: .word SCRIPT_VARS +_0204B4E4: .word _022AB0AC +_0204B4E8: .word SCRIPT_VARS_LOCALS + arm_func_end LoadScriptVariableRaw + + arm_func_start LoadScriptVariableValue +LoadScriptVariableValue: ; 0x0204B4EC + stmdb sp!, {r4, lr} + sub sp, sp, #8 + mov r2, r0 + mov r4, r1 + mov r1, r2 + add r0, sp, #0 + mov r2, r4 + bl LoadScriptVariableRaw + ldr r1, [sp] + ldrsh r0, [r1] + cmp r0, #9 + addls pc, pc, r0, lsl #2 + b _0204B66C +_0204B520: ; jump table + b _0204B66C ; case 0 + b _0204B548 ; case 1 + b _0204B56C ; case 2 + b _0204B56C ; case 3 + b _0204B578 ; case 4 + b _0204B584 ; case 5 + b _0204B590 ; case 6 + b _0204B59C ; case 7 + b _0204B59C ; case 8 + b _0204B5A8 ; case 9 +_0204B548: + ldrsh r1, [r1, #6] + ldr r2, [sp, #4] + mov r0, #1 + mov r1, r0, lsl r1 + ldrb r2, [r2] + and r1, r1, #0xff + tst r2, r1 + moveq r0, #0 + b _0204B670 +_0204B56C: + ldr r0, [sp, #4] + ldrb r0, [r0] + b _0204B670 +_0204B578: + ldr r0, [sp, #4] + ldrsb r0, [r0] + b _0204B670 +_0204B584: + ldr r0, [sp, #4] + ldrh r0, [r0] + b _0204B670 +_0204B590: + ldr r0, [sp, #4] + ldrsh r0, [r0] + b _0204B670 +_0204B59C: + ldr r0, [sp, #4] + ldr r0, [r0] + b _0204B670 +_0204B5A8: + cmp r4, #0x48 + bgt _0204B5E4 + bge _0204B62C + cmp r4, #0x3d + bgt _0204B5D8 + subs r0, r4, #0x3a + addpl pc, pc, r0, lsl #2 + b _0204B66C +_0204B5C8: ; jump table + b _0204B600 ; case 0 + b _0204B608 ; case 1 + b _0204B614 ; case 2 + b _0204B61C ; case 3 +_0204B5D8: + cmp r4, #0x47 + beq _0204B624 + b _0204B66C +_0204B5E4: + cmp r4, #0x49 + bgt _0204B5F4 + beq _0204B634 + b _0204B66C +_0204B5F4: + cmp r4, #0x70 + beq _0204B664 + b _0204B66C +_0204B600: + mov r0, #1 + b _0204B670 +_0204B608: + mov r0, #0 + bl GetPartyMembers + b _0204B670 +_0204B614: + bl GetMoneyCarried + b _0204B670 +_0204B61C: + bl GetMoneyStored + b _0204B670 +_0204B624: + bl GetLanguageType + b _0204B670 +_0204B62C: + bl GetGameMode + b _0204B670 +_0204B634: + bl GetGameMode + cmp r0, #1 + beq _0204B64C + cmp r0, #3 + beq _0204B654 + b _0204B65C +_0204B64C: + bl sub_0204C918 + b _0204B670 +_0204B654: + bl GetSpecialEpisodeType + b _0204B670 +_0204B65C: + mvn r0, #0 + b _0204B670 +_0204B664: + bl GetNotifyNote + b _0204B670 +_0204B66C: + mov r0, #0 +_0204B670: + add sp, sp, #8 + ldmia sp!, {r4, pc} + arm_func_end LoadScriptVariableValue + + arm_func_start LoadScriptVariableValueAtIndex +LoadScriptVariableValueAtIndex: ; 0x0204B678 + stmdb sp!, {r3, r4, r5, lr} + sub sp, sp, #8 + mov r3, r0 + mov r5, r1 + mov r4, r2 + add r0, sp, #0 + mov r1, r3 + mov r2, r5 + bl LoadScriptVariableRaw + ldr r1, [sp] + ldrsh r0, [r1] + cmp r0, #9 + addls pc, pc, r0, lsl #2 + b _0204B814 +_0204B6B0: ; jump table + b _0204B814 ; case 0 + b _0204B6D8 ; case 1 + b _0204B70C ; case 2 + b _0204B70C ; case 3 + b _0204B718 ; case 4 + b _0204B724 ; case 5 + b _0204B734 ; case 6 + b _0204B744 ; case 7 + b _0204B744 ; case 8 + b _0204B750 ; case 9 +_0204B6D8: + ldrsh r1, [r1, #6] + ldr r2, [sp, #4] + mov r0, #1 + add r1, r4, r1 + mov r1, r1, lsl #0x10 + mov r3, r1, lsr #0x10 + and r1, r3, #7 + mov r1, r0, lsl r1 + ldrb r2, [r2, r3, lsr #3] + and r1, r1, #0xff + tst r2, r1 + moveq r0, #0 + b _0204B818 +_0204B70C: + ldr r0, [sp, #4] + ldrb r0, [r0, r4] + b _0204B818 +_0204B718: + ldr r0, [sp, #4] + ldrsb r0, [r0, r4] + b _0204B818 +_0204B724: + ldr r1, [sp, #4] + mov r0, r4, lsl #1 + ldrh r0, [r1, r0] + b _0204B818 +_0204B734: + ldr r1, [sp, #4] + mov r0, r4, lsl #1 + ldrsh r0, [r1, r0] + b _0204B818 +_0204B744: + ldr r0, [sp, #4] + ldr r0, [r0, r4, lsl #2] + b _0204B818 +_0204B750: + cmp r5, #0x48 + bgt _0204B78C + bge _0204B7D4 + cmp r5, #0x3d + bgt _0204B780 + subs r0, r5, #0x3a + addpl pc, pc, r0, lsl #2 + b _0204B814 +_0204B770: ; jump table + b _0204B7A8 ; case 0 + b _0204B7B0 ; case 1 + b _0204B7BC ; case 2 + b _0204B7C4 ; case 3 +_0204B780: + cmp r5, #0x47 + beq _0204B7CC + b _0204B814 +_0204B78C: + cmp r5, #0x49 + bgt _0204B79C + beq _0204B7DC + b _0204B814 +_0204B79C: + cmp r5, #0x70 + beq _0204B80C + b _0204B814 +_0204B7A8: + mov r0, #1 + b _0204B818 +_0204B7B0: + mov r0, #0 + bl GetPartyMembers + b _0204B818 +_0204B7BC: + bl GetMoneyCarried + b _0204B818 +_0204B7C4: + bl GetMoneyStored + b _0204B818 +_0204B7CC: + bl GetLanguageType + b _0204B818 +_0204B7D4: + bl GetGameMode + b _0204B818 +_0204B7DC: + bl GetGameMode + cmp r0, #1 + beq _0204B7F4 + cmp r0, #3 + beq _0204B7FC + b _0204B804 +_0204B7F4: + bl sub_0204C918 + b _0204B818 +_0204B7FC: + bl GetSpecialEpisodeType + b _0204B818 +_0204B804: + mvn r0, #0 + b _0204B818 +_0204B80C: + bl GetNotifyNote + b _0204B818 +_0204B814: + mov r0, #0 +_0204B818: + add sp, sp, #8 + ldmia sp!, {r3, r4, r5, pc} + arm_func_end LoadScriptVariableValueAtIndex + + arm_func_start SaveScriptVariableValue +SaveScriptVariableValue: ; 0x0204B820 + stmdb sp!, {r3, r4, r5, lr} + sub sp, sp, #8 + mov r3, r0 + mov r5, r1 + mov r4, r2 + add r0, sp, #0 + mov r1, r3 + mov r2, r5 + bl LoadScriptVariableRaw + ldr r1, [sp] + ldrsh r0, [r1] + cmp r0, #9 + addls pc, pc, r0, lsl #2 + b _0204B980 +_0204B858: ; jump table + b _0204B980 ; case 0 + b _0204B880 ; case 1 + b _0204B8C0 ; case 2 + b _0204B8C0 ; case 3 + b _0204B8CC ; case 4 + b _0204B8D8 ; case 5 + b _0204B8E4 ; case 6 + b _0204B8F0 ; case 7 + b _0204B8F0 ; case 8 + b _0204B8FC ; case 9 +_0204B880: + ldrsh r0, [r1, #6] + mov r1, #1 + cmp r4, #0 + mov r0, r1, lsl r0 + ldrne r1, [sp, #4] + and r2, r0, #0xff + ldrneb r0, [r1] + orrne r0, r0, r2 + strneb r0, [r1] + bne _0204B980 + ldr r1, [sp, #4] + ldrb r0, [r1] + orr r0, r0, r2 + eor r0, r2, r0 + strb r0, [r1] + b _0204B980 +_0204B8C0: + ldr r0, [sp, #4] + strb r4, [r0] + b _0204B980 +_0204B8CC: + ldr r0, [sp, #4] + strb r4, [r0] + b _0204B980 +_0204B8D8: + ldr r0, [sp, #4] + strh r4, [r0] + b _0204B980 +_0204B8E4: + ldr r0, [sp, #4] + strh r4, [r0] + b _0204B980 +_0204B8F0: + ldr r0, [sp, #4] + str r4, [r0] + b _0204B980 +_0204B8FC: + cmp r5, #0x49 + bgt _0204B928 + bge _0204B954 + cmp r5, #0x3d + bgt _0204B980 + cmp r5, #0x3c + blt _0204B980 + beq _0204B934 + cmp r5, #0x3d + beq _0204B948 + b _0204B980 +_0204B928: + cmp r5, #0x70 + beq _0204B96C + b _0204B980 +_0204B934: + mov r0, r4 + bl SetMoneyCarried + mov r0, #0 + bl AddMoneyCarried + b _0204B980 +_0204B948: + mov r0, r4 + bl SetMoneyStored + b _0204B980 +_0204B954: + bl GetGameMode + cmp r0, #1 + bne _0204B980 + mov r0, r4 + bl sub_0204C928 + b _0204B980 +_0204B96C: + cmp r4, #0 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bl SetNotifyNote +_0204B980: + add sp, sp, #8 + ldmia sp!, {r3, r4, r5, pc} + arm_func_end SaveScriptVariableValue + + arm_func_start SaveScriptVariableValueAtIndex +SaveScriptVariableValueAtIndex: ; 0x0204B988 + stmdb sp!, {r4, r5, r6, lr} + sub sp, sp, #8 + mov r4, r0 + mov r6, r1 + mov r5, r2 + mov r1, r4 + add r0, sp, #0 + mov r2, r6 + mov r4, r3 + bl LoadScriptVariableRaw + ldr r1, [sp] + ldrsh r0, [r1] + cmp r0, #9 + addls pc, pc, r0, lsl #2 + b _0204BAF8 +_0204B9C4: ; jump table + b _0204BAF8 ; case 0 + b _0204B9EC ; case 1 + b _0204BA30 ; case 2 + b _0204BA30 ; case 3 + b _0204BA3C ; case 4 + b _0204BA48 ; case 5 + b _0204BA58 ; case 6 + b _0204BA68 ; case 7 + b _0204BA68 ; case 8 + b _0204BA74 ; case 9 +_0204B9EC: + ldrsh r0, [r1, #6] + mov r1, #1 + ldr r2, [sp, #4] + add r0, r5, r0 + mov r0, r0, lsl #0x10 + mov r3, r0, lsr #0x10 + and r0, r3, #7 + mov r0, r1, lsl r0 + and r1, r0, #0xff + ldrb r0, [r2, r3, lsr #3] + cmp r4, #0 + orrne r0, r0, r1 + strneb r0, [r2, r3, lsr #3] + orreq r0, r0, r1 + eoreq r0, r1, r0 + streqb r0, [r2, r3, lsr #3] + b _0204BAF8 +_0204BA30: + ldr r0, [sp, #4] + strb r4, [r0, r5] + b _0204BAF8 +_0204BA3C: + ldr r0, [sp, #4] + strb r4, [r0, r5] + b _0204BAF8 +_0204BA48: + ldr r1, [sp, #4] + mov r0, r5, lsl #1 + strh r4, [r1, r0] + b _0204BAF8 +_0204BA58: + ldr r1, [sp, #4] + mov r0, r5, lsl #1 + strh r4, [r1, r0] + b _0204BAF8 +_0204BA68: + ldr r0, [sp, #4] + str r4, [r0, r5, lsl #2] + b _0204BAF8 +_0204BA74: + cmp r6, #0x49 + bgt _0204BAA0 + bge _0204BACC + cmp r6, #0x3d + bgt _0204BAF8 + cmp r6, #0x3c + blt _0204BAF8 + beq _0204BAAC + cmp r6, #0x3d + beq _0204BAC0 + b _0204BAF8 +_0204BAA0: + cmp r6, #0x70 + beq _0204BAE4 + b _0204BAF8 +_0204BAAC: + mov r0, r4 + bl SetMoneyCarried + mov r0, #0 + bl AddMoneyCarried + b _0204BAF8 +_0204BAC0: + mov r0, r4 + bl SetMoneyStored + b _0204BAF8 +_0204BACC: + bl GetGameMode + cmp r0, #1 + bne _0204BAF8 + mov r0, r4 + bl sub_0204C928 + b _0204BAF8 +_0204BAE4: + cmp r4, #0 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bl SetNotifyNote +_0204BAF8: + add sp, sp, #8 + ldmia sp!, {r4, r5, r6, pc} + arm_func_end SaveScriptVariableValueAtIndex + + arm_func_start LoadScriptVariableValueSum +LoadScriptVariableValueSum: ; 0x0204BB00 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + sub sp, sp, #8 + mov r6, r1 + mov r4, #0 + mov r7, r0 + add r0, sp, #0 + mov r1, r4 + mov r2, r6 + bl LoadScriptVariableRaw + mov r5, r4 + b _0204BB48 +_0204BB2C: + mov r2, r5, lsl #0x10 + mov r0, r7 + mov r1, r6 + mov r2, r2, lsr #0x10 + bl LoadScriptVariableValueAtIndex + add r4, r4, r0 + add r5, r5, #1 +_0204BB48: + ldr r0, [sp] + ldrsh r0, [r0, #8] + cmp r5, r0 + blt _0204BB2C + mov r0, r4 + add sp, sp, #8 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end LoadScriptVariableValueSum + + arm_func_start LoadScriptVariableValueBytes +LoadScriptVariableValueBytes: ; 0x0204BB64 + stmdb sp!, {r3, r4, r5, lr} + sub sp, sp, #8 + mov r3, r0 + mov r5, r1 + mov r4, r2 + add r0, sp, #0 + mov r2, r3 + mov r1, #0 + bl LoadScriptVariableRaw + ldr r2, [sp, #4] + mov r1, #0 + b _0204BBA0 +_0204BB94: + ldrb r0, [r2], #1 + add r1, r1, #1 + strb r0, [r5], #1 +_0204BBA0: + cmp r1, r4 + blt _0204BB94 + add sp, sp, #8 + ldmia sp!, {r3, r4, r5, pc} + arm_func_end LoadScriptVariableValueBytes + + arm_func_start sub_0204BBB0 +sub_0204BBB0: ; 0x0204BBB0 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r1 + mov r4, r2 + bl LoadScriptVariableValueBytes + mov r0, #0 + strb r0, [r5, r4] + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_0204BBB0 + + arm_func_start SaveScriptVariableValueBytes +SaveScriptVariableValueBytes: ; 0x0204BBCC + stmdb sp!, {r3, r4, r5, lr} + sub sp, sp, #8 + mov r3, r0 + mov r5, r1 + mov r4, r2 + add r0, sp, #0 + mov r2, r3 + mov r1, #0 + bl LoadScriptVariableRaw + ldr r2, [sp, #4] + mov r1, #0 + b _0204BC08 +_0204BBFC: + ldrb r0, [r5], #1 + add r1, r1, #1 + strb r0, [r2], #1 +_0204BC08: + cmp r1, r4 + blt _0204BBFC + add sp, sp, #8 + ldmia sp!, {r3, r4, r5, pc} + arm_func_end SaveScriptVariableValueBytes + + arm_func_start ScriptVariablesEqual +ScriptVariablesEqual: ; 0x0204BC18 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr} + sub sp, sp, #0x10 + mov r8, r0 + mov r7, r1 + mov r6, r2 + add r0, sp, #8 + mov r1, r8 + mov r2, r7 + bl LoadScriptVariableRaw + add r0, sp, #0 + mov r1, r8 + mov r2, r6 + bl LoadScriptVariableRaw + ldr r0, [sp, #8] + mov r5, #0 + ldrsh r4, [r0, #8] + b _0204BC98 +_0204BC5C: + mov r2, r5, lsl #0x10 + mov r0, r8 + mov r1, r7 + mov r2, r2, lsr #0x10 + bl LoadScriptVariableValueAtIndex + mov r2, r5, lsl #0x10 + mov sb, r0 + mov r0, r8 + mov r1, r6 + mov r2, r2, lsr #0x10 + bl LoadScriptVariableValueAtIndex + cmp sb, r0 + movne r0, #0 + bne _0204BCA4 + add r5, r5, #1 +_0204BC98: + cmp r5, r4 + blt _0204BC5C + mov r0, #1 +_0204BCA4: + add sp, sp, #0x10 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + arm_func_end ScriptVariablesEqual + + arm_func_start sub_0204BCAC +sub_0204BCAC: ; 0x0204BCAC + stmdb sp!, {r3, lr} + sub sp, sp, #8 + cmp r2, #0xb + addls pc, pc, r2, lsl #2 + b _0204BD68 +_0204BCC0: ; jump table + b _0204BCF0 ; case 0 + b _0204BCF8 ; case 1 + b _0204BD00 ; case 2 + b _0204BD08 ; case 3 + b _0204BD14 ; case 4 + b _0204BD1C ; case 5 + b _0204BD28 ; case 6 + b _0204BD30 ; case 7 + b _0204BD38 ; case 8 + b _0204BD40 ; case 9 + b _0204BD4C ; case 10 + b _0204BD5C ; case 11 +_0204BCF0: + mov r0, r1 + b _0204BD88 +_0204BCF8: + sub r0, r0, r1 + b _0204BD88 +_0204BD00: + add r0, r0, r1 + b _0204BD88 +_0204BD08: + mul r1, r0, r1 + mov r0, r1 + b _0204BD88 +_0204BD14: + bl _s32_div_f + b _0204BD88 +_0204BD1C: + bl _s32_div_f + mov r0, r1 + b _0204BD88 +_0204BD28: + and r0, r0, r1 + b _0204BD88 +_0204BD30: + orr r0, r0, r1 + b _0204BD88 +_0204BD38: + eor r0, r0, r1 + b _0204BD88 +_0204BD40: + mov r2, #1 + orr r0, r0, r2, lsl r1 + b _0204BD88 +_0204BD4C: + mov r2, #1 + mvn r1, r2, lsl r1 + and r0, r0, r1 + b _0204BD88 +_0204BD5C: + mov r0, r1 + bl RandInt + b _0204BD88 +_0204BD68: + ldr r1, _0204BD90 ; =_0209CEAC + add r0, sp, #0 + ldr r3, [r1, #4] + ldr ip, [r1] + ldr r1, _0204BD94 ; =_0209CF28 + str ip, [sp] + str r3, [sp, #4] + bl Debug_FatalError +_0204BD88: + add sp, sp, #8 + ldmia sp!, {r3, pc} + .align 2, 0 +_0204BD90: .word _0209CEAC +_0204BD94: .word _0209CF28 + arm_func_end sub_0204BCAC + + arm_func_start sub_0204BD98 +sub_0204BD98: ; 0x0204BD98 + stmdb sp!, {r3, lr} + sub sp, sp, #8 + cmp r2, #0xa + addls pc, pc, r2, lsl #2 + b _0204BE9C +_0204BDAC: ; jump table + b _0204BDD8 ; case 0 + b _0204BDE0 ; case 1 + b _0204BDE8 ; case 2 + b _0204BE10 ; case 3 + b _0204BE38 ; case 4 + b _0204BE24 ; case 5 + b _0204BE4C ; case 6 + b _0204BDFC ; case 7 + b _0204BE60 ; case 8 + b _0204BE74 ; case 9 + b _0204BE88 ; case 10 +_0204BDD8: + mov r0, #1 + b _0204BEBC +_0204BDE0: + mov r0, #0 + b _0204BEBC +_0204BDE8: + cmp r0, r1 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + b _0204BEBC +_0204BDFC: + cmp r0, r1 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + b _0204BEBC +_0204BE10: + cmp r0, r1 + movgt r0, #1 + movle r0, #0 + and r0, r0, #0xff + b _0204BEBC +_0204BE24: + cmp r0, r1 + movge r0, #1 + movlt r0, #0 + and r0, r0, #0xff + b _0204BEBC +_0204BE38: + cmp r0, r1 + movlt r0, #1 + movge r0, #0 + and r0, r0, #0xff + b _0204BEBC +_0204BE4C: + cmp r0, r1 + movle r0, #1 + movgt r0, #0 + and r0, r0, #0xff + b _0204BEBC +_0204BE60: + tst r0, r1 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + b _0204BEBC +_0204BE74: + teq r0, r1 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + b _0204BEBC +_0204BE88: + mov r2, #1 + tst r0, r2, lsl r1 + moveq r2, #0 + and r0, r2, #0xff + b _0204BEBC +_0204BE9C: + ldr r1, _0204BEC4 ; =_0209CEAC + add r0, sp, #0 + ldr r3, [r1, #0xc] + ldr ip, [r1, #8] + ldr r1, _0204BEC8 ; =_0209CF48 + str ip, [sp] + str r3, [sp, #4] + bl Debug_FatalError +_0204BEBC: + add sp, sp, #8 + ldmia sp!, {r3, pc} + .align 2, 0 +_0204BEC4: .word _0209CEAC +_0204BEC8: .word _0209CF48 + arm_func_end sub_0204BD98 + + arm_func_start sub_0204BECC +sub_0204BECC: ; 0x0204BECC + ldr ip, _0204BED4 ; =sub_0204BCAC + bx ip + .align 2, 0 +_0204BED4: .word sub_0204BCAC + arm_func_end sub_0204BECC + + arm_func_start sub_0204BED8 +sub_0204BED8: ; 0x0204BED8 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r5, r2 + mov r4, r3 + mov r7, r0 + mov r6, r1 + bl LoadScriptVariableValue + mov r1, r5 + mov r2, r4 + bl sub_0204BCAC + mov r2, r0 + mov r0, r7 + mov r1, r6 + bl SaveScriptVariableValue + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end sub_0204BED8 + + arm_func_start sub_0204BF10 +sub_0204BF10: ; 0x0204BF10 + stmdb sp!, {r4, r5, r6, r7, r8, lr} + mov r8, r0 + mov r6, r2 + mov r7, r1 + mov r5, r3 + bl LoadScriptVariableValue + mov r4, r0 + mov r0, r8 + mov r1, r6 + bl LoadScriptVariableValue + mov r1, r0 + mov r0, r4 + mov r2, r5 + bl sub_0204BCAC + mov r2, r0 + mov r0, r8 + mov r1, r7 + bl SaveScriptVariableValue + ldmia sp!, {r4, r5, r6, r7, r8, pc} + arm_func_end sub_0204BF10 + + arm_func_start sub_0204BF5C +sub_0204BF5C: ; 0x0204BF5C + ldr ip, _0204BF64 ; =sub_0204BD98 + bx ip + .align 2, 0 +_0204BF64: .word sub_0204BD98 + arm_func_end sub_0204BF5C + + arm_func_start sub_0204BF68 +sub_0204BF68: ; 0x0204BF68 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r2 + mov r4, r3 + bl LoadScriptVariableValue + mov r1, r5 + mov r2, r4 + bl sub_0204BD98 + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_0204BF68 + + arm_func_start sub_0204BF88 +sub_0204BF88: ; 0x0204BF88 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r7, r0 + mov r6, r2 + mov r5, r3 + bl LoadScriptVariableValue + mov r4, r0 + mov r0, r7 + mov r1, r6 + bl LoadScriptVariableValue + mov r1, r0 + mov r0, r4 + mov r2, r5 + bl sub_0204BD98 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end sub_0204BF88 + + arm_func_start EventFlagResume +EventFlagResume: ; 0x0204BFC0 + stmdb sp!, {r4, lr} + bl GetGameMode + cmp r0, #1 + ldmlsia sp!, {r4, pc} + sub r4, r0, #2 + ldr r0, _0204C1E0 ; =_0209CF64 + mov r1, r4 + bl Debug_Print0 + mov r0, r4, lsl #0x10 + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x21 + bl LoadScriptVariableValueAtIndex + mov r2, r0 + mov r0, #0 + mov r1, #0x1c + bl SaveScriptVariableValue + mov r0, r4, lsl #0x10 + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x22 + bl LoadScriptVariableValueAtIndex + mov r2, r0 + mov r0, #0 + mov r1, #0x1d + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x23 + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl LoadScriptVariableValueAtIndex + mov r2, r0 + mov r0, #0 + mov r1, #0x1e + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x24 + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl LoadScriptVariableValueAtIndex + mov r2, r0 + mov r0, #0 + mov r1, #0x1f + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x25 + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl LoadScriptVariableValueAtIndex + mov r2, r0 + mov r0, #0 + mov r1, #0x20 + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x2d + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl LoadScriptVariableValueAtIndex + mov r2, r0 + mov r0, #0 + mov r1, #0x27 + bl SaveScriptVariableValue + mov r0, r4, lsl #0x10 + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x2e + bl LoadScriptVariableValueAtIndex + mov r2, r0 + mov r0, #0 + mov r1, #0x28 + bl SaveScriptVariableValue + mov r0, r4, lsl #0x10 + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x2f + bl LoadScriptVariableValueAtIndex + mov r2, r0 + mov r0, #0 + mov r1, #0x29 + bl SaveScriptVariableValue + mov r0, r4, lsl #0x10 + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x30 + bl LoadScriptVariableValueAtIndex + mov r2, r0 + mov r0, #0 + mov r1, #0x2a + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x31 + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl LoadScriptVariableValueAtIndex + mov r2, r0 + mov r0, #0 + mov r1, #0x2b + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x32 + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl LoadScriptVariableValueAtIndex + mov r2, r0 + mov r0, #0 + mov r1, #0x2c + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x37 + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl LoadScriptVariableValueAtIndex + mov r2, r0 + mov r0, #0 + mov r1, #0x34 + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x38 + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl LoadScriptVariableValueAtIndex + mov r2, r0 + mov r0, #0 + mov r1, #0x35 + bl SaveScriptVariableValue + mov r0, r4, lsl #0x10 + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x39 + bl LoadScriptVariableValueAtIndex + mov r2, r0 + mov r0, #0 + mov r1, #0x36 + bl SaveScriptVariableValue + bl sub_0204CBE8 + ldmia sp!, {r4, pc} + .align 2, 0 +_0204C1E0: .word _0209CF64 + arm_func_end EventFlagResume + + arm_func_start EventFlagBackup +EventFlagBackup: ; 0x0204C1E4 + stmdb sp!, {r4, lr} + bl GetGameMode + cmp r0, #1 + ldmlsia sp!, {r4, pc} + sub r4, r0, #2 + ldr r0, _0204C404 ; =_0209CF84 + mov r1, r4 + bl Debug_Print0 + mov r0, #0 + mov r1, #0x1c + bl LoadScriptVariableValue + mov r1, r4, lsl #0x10 + mov r3, r0 + mov r2, r1, lsr #0x10 + mov r0, #0 + mov r1, #0x21 + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r1, #0x1d + bl LoadScriptVariableValue + mov r3, r0 + mov r0, #0 + mov r1, #0x22 + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r1, #0x1e + bl LoadScriptVariableValue + mov r3, r0 + mov r0, #0 + mov r1, #0x23 + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r1, #0x1f + bl LoadScriptVariableValue + mov r3, r0 + mov r0, #0 + mov r1, #0x24 + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r1, #0x20 + bl LoadScriptVariableValue + mov r3, r0 + mov r0, #0 + mov r1, #0x25 + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r1, #0x27 + bl LoadScriptVariableValue + mov r3, r0 + mov r0, #0 + mov r1, #0x2d + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r1, #0x28 + bl LoadScriptVariableValue + mov r1, r4, lsl #0x10 + mov r3, r0 + mov r2, r1, lsr #0x10 + mov r0, #0 + mov r1, #0x2e + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r1, #0x29 + bl LoadScriptVariableValue + mov r1, r4, lsl #0x10 + mov r2, r1, lsr #0x10 + mov r3, r0 + mov r0, #0 + mov r1, #0x2f + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r1, #0x2a + bl LoadScriptVariableValue + mov r3, r0 + mov r0, #0 + mov r1, #0x30 + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r1, #0x2b + bl LoadScriptVariableValue + mov r3, r0 + mov r0, #0 + mov r1, #0x31 + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r1, #0x2c + bl LoadScriptVariableValue + mov r3, r0 + mov r0, #0 + mov r1, #0x32 + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r1, #0x34 + bl LoadScriptVariableValue + mov r3, r0 + mov r0, #0 + mov r1, #0x37 + mov r2, r4, lsl #0x10 + mov r2, r2, lsr #0x10 + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r1, #0x35 + bl LoadScriptVariableValue + mov r3, r0 + mov r0, r4, lsl #0x10 + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x38 + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r1, #0x36 + bl LoadScriptVariableValue + mov r1, r4, lsl #0x10 + mov r3, r0 + mov r2, r1, lsr #0x10 + mov r0, #0 + mov r1, #0x39 + bl SaveScriptVariableValueAtIndex + bl ScenarioFlagBackup + ldmia sp!, {r4, pc} + .align 2, 0 +_0204C404: .word _0209CF84 + arm_func_end EventFlagBackup + + arm_func_start DumpScriptVariableValues +DumpScriptVariableValues: ; 0x0204C408 + stmdb sp!, {r4, lr} + mov r4, r0 + bl EventFlagBackup + ldr r1, _0204C42C ; =_022AB0AC + mov r0, r4 + mov r2, #0x400 + bl MemcpySimple + mov r0, #1 + ldmia sp!, {r4, pc} + .align 2, 0 +_0204C42C: .word _022AB0AC + arm_func_end DumpScriptVariableValues + + arm_func_start RestoreScriptVariableValues +RestoreScriptVariableValues: ; 0x0204C430 + stmdb sp!, {r4, lr} + sub sp, sp, #8 + mov r1, #0 + mov r4, r0 + add r0, sp, #0 + mov r2, r1 + bl LoadScriptVariableRaw + ldr r0, _0204C484 ; =_022AB0AC + mov r1, r4 + mov r2, #0x400 + bl MemcpySimple + ldr r1, [sp] + ldr r0, [sp, #4] + ldrsh r1, [r1, #0xa] + ldr r0, [r0] + cmp r1, r0 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + add sp, sp, #8 + ldmia sp!, {r4, pc} + .align 2, 0 +_0204C484: .word _022AB0AC + arm_func_end RestoreScriptVariableValues + + arm_func_start InitScenarioScriptVars +InitScenarioScriptVars: ; 0x0204C488 + stmdb sp!, {r4, r5, r6, r7, r8, lr} + mov r1, #0 + mov r2, r1 + mov r0, #2 + bl SetScenarioScriptVar + mov r1, #0 + mov r2, r1 + mov r0, #3 + bl SetScenarioScriptVar + mov r1, #0 + mov r2, r1 + mov r0, #4 + bl SetScenarioScriptVar + mov r1, #0 + mov r2, r1 + mov r0, #5 + bl SetScenarioScriptVar + mov r1, #0 + mov r2, r1 + mov r0, #6 + bl SetScenarioScriptVar + mov r1, #0 + mov r0, #7 + mov r2, r1 + bl SetScenarioScriptVar + mov r1, #0 + mov r0, #8 + mov r2, r1 + bl SetScenarioScriptVar + mov r1, #0 + mov r0, #9 + mov r2, r1 + bl SetScenarioScriptVar + mov r1, #0 + mov r0, #0xa + mov r2, r1 + bl SetScenarioScriptVar + mov r1, #0 + mov r0, #0xb + mov r2, r1 + bl SetScenarioScriptVar + mov r1, #0 + mov r0, #0xc + mov r2, r1 + bl SetScenarioScriptVar + mov r0, #0 + mov r1, #0x11 + bl ZinitScriptVariable + mov r0, #0 + mov r1, #0x1b + bl ZinitScriptVariable + mov r8, #0 + mov r6, #0x1a + mov r7, r8 + mov r5, r8 + mov r4, r6 +_0204C568: + mov r2, r8, lsl #0x10 + mov r0, r7 + mov r1, r6 + mov r3, r7 + mov r2, r2, lsr #0x10 + bl SaveScriptVariableValueAtIndex + add r0, r8, #4 + mov r2, r0, lsl #0x10 + mov r0, r5 + mov r1, r4 + mov r3, r5 + mov r2, r2, lsr #0x10 + bl SaveScriptVariableValueAtIndex + add r8, r8, #1 + cmp r8, #4 + blt _0204C568 + mov r0, #0 + mov r2, r0 + mov r1, #0x13 + bl SaveScriptVariableValue + mov r1, #0x14 + sub r2, r1, #0x15 + mov r0, #0 + bl SaveScriptVariableValue + mov r0, #0 + mov r2, r0 + mov r1, #0x6f + bl SaveScriptVariableValue + ldmia sp!, {r4, r5, r6, r7, r8, pc} + arm_func_end InitScenarioScriptVars + + arm_func_start sub_0204C5DC +sub_0204C5DC: ; 0x0204C5DC + stmdb sp!, {r4, r5, r6, lr} + mov r6, r0 + mov r5, r1 + mov r0, #0 + mov r4, r2 + mov r1, r6 + mov r2, r0 + bl LoadScriptVariableValueAtIndex + str r0, [r5] + mov r1, r6 + mov r0, #0 + mov r2, #1 + bl LoadScriptVariableValueAtIndex + str r0, [r4] + ldmia sp!, {r4, r5, r6, pc} + arm_func_end sub_0204C5DC + + arm_func_start SetScenarioScriptVar +SetScenarioScriptVar: ; 0x0204C618 + stmdb sp!, {r3, r4, r5, r6, r7, r8, lr} + sub sp, sp, #0xc + mov r8, r0 + mov r7, r1 + mov r0, #0 + mov r6, r2 + mov r1, r8 + mov r2, r0 + bl LoadScriptVariableValueAtIndex + mov r5, r0 + mov r1, r8 + mov r0, #0 + mov r2, #1 + bl LoadScriptVariableValueAtIndex + mov r4, r0 + stmia sp, {r4, r7} + ldr r1, _0204C6C4 ; =_0209DFA0 + mov r0, #9 + mov r2, r8 + mov r3, r5 + str r6, [sp, #8] + bl Debug_Print + cmp r8, #3 + bne _0204C694 + cmp r7, r5 + cmpeq r6, r4 + beq _0204C694 + mov r0, #0 + mov r2, r0 + mov r1, #0x33 + bl SaveScriptVariableValue +_0204C694: + mov r0, #0 + mov r1, r8 + mov r2, r0 + mov r3, r7 + bl SaveScriptVariableValueAtIndex + mov r1, r8 + mov r3, r6 + mov r0, #0 + mov r2, #1 + bl SaveScriptVariableValueAtIndex + add sp, sp, #0xc + ldmia sp!, {r3, r4, r5, r6, r7, r8, pc} + .align 2, 0 +_0204C6C4: .word _0209DFA0 + arm_func_end SetScenarioScriptVar + + arm_func_start sub_0204C6C8 +sub_0204C6C8: ; 0x0204C6C8 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r7, r0 + mov r6, r1 + mov r0, #0 + mov r5, r2 + mov r1, r7 + mov r2, r0 + bl LoadScriptVariableValueAtIndex + mov r4, r0 + mov r1, r7 + mov r0, #0 + mov r2, #1 + bl LoadScriptVariableValueAtIndex + cmp r4, #0x35 + moveq r0, #0 + ldmeqia sp!, {r3, r4, r5, r6, r7, pc} + cmp r4, r6 + movlt r0, #1 + ldmltia sp!, {r3, r4, r5, r6, r7, pc} + bne _0204C72C + cmp r5, #0 + blt _0204C72C + cmp r0, r5 + movlt r0, #1 + ldmltia sp!, {r3, r4, r5, r6, r7, pc} +_0204C72C: + mov r0, #0 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end sub_0204C6C8 + + arm_func_start sub_0204C734 +sub_0204C734: ; 0x0204C734 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r7, r0 + mov r6, r1 + mov r0, #0 + mov r5, r2 + mov r1, r7 + mov r2, r0 + bl LoadScriptVariableValueAtIndex + mov r4, r0 + mov r1, r7 + mov r0, #0 + mov r2, #1 + bl LoadScriptVariableValueAtIndex + cmp r4, #0x35 + moveq r0, #0 + ldmeqia sp!, {r3, r4, r5, r6, r7, pc} + cmp r4, r6 + movlt r0, #1 + ldmltia sp!, {r3, r4, r5, r6, r7, pc} + bne _0204C7A4 + cmp r5, #0 + blt _0204C79C + cmp r0, r5 + bgt _0204C7A4 + mov r0, #1 + ldmia sp!, {r3, r4, r5, r6, r7, pc} +_0204C79C: + mov r0, #1 + ldmia sp!, {r3, r4, r5, r6, r7, pc} +_0204C7A4: + mov r0, #0 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end sub_0204C734 + + arm_func_start sub_0204C7AC +sub_0204C7AC: ; 0x0204C7AC + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r7, r0 + mov r6, r1 + mov r0, #0 + mov r5, r2 + mov r1, r7 + mov r2, r0 + bl LoadScriptVariableValueAtIndex + mov r4, r0 + mov r1, r7 + mov r0, #0 + mov r2, #1 + bl LoadScriptVariableValueAtIndex + cmp r4, r6 + bne _0204C800 + cmp r5, #0 + movlt r0, #1 + ldmltia sp!, {r3, r4, r5, r6, r7, pc} + cmp r0, r5 + moveq r0, #1 + ldmeqia sp!, {r3, r4, r5, r6, r7, pc} +_0204C800: + mov r0, #0 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end sub_0204C7AC + + arm_func_start sub_0204C808 +sub_0204C808: ; 0x0204C808 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r7, r0 + mov r6, r1 + mov r0, #0 + mov r5, r2 + mov r1, r7 + mov r2, r0 + bl LoadScriptVariableValueAtIndex + mov r4, r0 + mov r1, r7 + mov r0, #0 + mov r2, #1 + bl LoadScriptVariableValueAtIndex + cmp r4, #0x35 + moveq r0, #0 + ldmeqia sp!, {r3, r4, r5, r6, r7, pc} + cmp r4, r6 + movgt r0, #1 + ldmgtia sp!, {r3, r4, r5, r6, r7, pc} + bne _0204C878 + cmp r5, #0 + blt _0204C870 + cmp r0, r5 + blt _0204C878 + mov r0, #1 + ldmia sp!, {r3, r4, r5, r6, r7, pc} +_0204C870: + mov r0, #1 + ldmia sp!, {r3, r4, r5, r6, r7, pc} +_0204C878: + mov r0, #0 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end sub_0204C808 + + arm_func_start sub_0204C880 +sub_0204C880: ; 0x0204C880 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r7, r0 + mov r6, r1 + mov r0, #0 + mov r5, r2 + mov r1, r7 + mov r2, r0 + bl LoadScriptVariableValueAtIndex + mov r4, r0 + mov r1, r7 + mov r0, #0 + mov r2, #1 + bl LoadScriptVariableValueAtIndex + cmp r4, #0x35 + moveq r0, #0 + ldmeqia sp!, {r3, r4, r5, r6, r7, pc} + cmp r4, r6 + movgt r0, #1 + ldmgtia sp!, {r3, r4, r5, r6, r7, pc} + bne _0204C8E4 + cmp r5, #0 + blt _0204C8E4 + cmp r0, r5 + movgt r0, #1 + ldmgtia sp!, {r3, r4, r5, r6, r7, pc} +_0204C8E4: + mov r0, #0 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end sub_0204C880 + + arm_func_start GetSpecialEpisodeType +GetSpecialEpisodeType: ; 0x0204C8EC + ldr ip, _0204C8FC ; =LoadScriptVariableValue + mov r0, #0 + mov r1, #0x4a + bx ip + .align 2, 0 +_0204C8FC: .word LoadScriptVariableValue + arm_func_end GetSpecialEpisodeType + + arm_func_start SetSpecialEpisodeType +SetSpecialEpisodeType: ; 0x0204C900 + ldr ip, _0204C914 ; =SaveScriptVariableValue + mov r2, r0 + mov r0, #0 + mov r1, #0x4a + bx ip + .align 2, 0 +_0204C914: .word SaveScriptVariableValue + arm_func_end SetSpecialEpisodeType + + arm_func_start sub_0204C918 +sub_0204C918: ; 0x0204C918 + ldr r0, _0204C924 ; =_022AB4AC + ldr r0, [r0] + bx lr + .align 2, 0 +_0204C924: .word _022AB4AC + arm_func_end sub_0204C918 + + arm_func_start sub_0204C928 +sub_0204C928: ; 0x0204C928 + ldr r1, _0204C934 ; =_022AB4AC + str r0, [r1] + bx lr + .align 2, 0 +_0204C934: .word _022AB4AC + arm_func_end sub_0204C928 + + arm_func_start GetExecuteSpecialEpisodeType +GetExecuteSpecialEpisodeType: ; 0x0204C938 + ldr ip, _0204C948 ; =LoadScriptVariableValue + mov r0, #0 + mov r1, #0x49 + bx ip + .align 2, 0 +_0204C948: .word LoadScriptVariableValue + arm_func_end GetExecuteSpecialEpisodeType + + arm_func_start IsSpecialEpisodeOpen +IsSpecialEpisodeOpen: ; 0x0204C94C + stmdb sp!, {r3, lr} + mov r0, r0, lsl #0x10 + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x4b + bl LoadScriptVariableValueAtIndex + cmp r0, #0 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + ldmia sp!, {r3, pc} + arm_func_end IsSpecialEpisodeOpen + + arm_func_start sub_0204C978 +sub_0204C978: ; 0x0204C978 + ldr ip, _0204C99C ; =SaveScriptVariableValueAtIndex + cmp r1, #0 + movne r3, #1 + mov r0, r0, lsl #0x10 + mov r2, r0, lsr #0x10 + moveq r3, #0 + mov r0, #0 + mov r1, #0x4b + bx ip + .align 2, 0 +_0204C99C: .word SaveScriptVariableValueAtIndex + arm_func_end sub_0204C978 + + arm_func_start sub_0204C9A0 +sub_0204C9A0: ; 0x0204C9A0 + stmdb sp!, {r3, lr} + mov r0, #0 + mov r1, #0x4b + mov r2, #0x4c + bl ScriptVariablesEqual + cmp r0, #0 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + ldmia sp!, {r3, pc} + arm_func_end sub_0204C9A0 + + arm_func_start sub_0204C9C8 +sub_0204C9C8: ; 0x0204C9C8 + stmdb sp!, {r3, lr} + mov r0, r0, lsl #0x10 + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x4c + bl LoadScriptVariableValueAtIndex + cmp r0, #0 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + ldmia sp!, {r3, pc} + arm_func_end sub_0204C9C8 + + arm_func_start sub_0204C9F4 +sub_0204C9F4: ; 0x0204C9F4 + ldr ip, _0204CA18 ; =SaveScriptVariableValueAtIndex + cmp r1, #0 + movne r3, #1 + mov r0, r0, lsl #0x10 + mov r2, r0, lsr #0x10 + moveq r3, #0 + mov r0, #0 + mov r1, #0x4c + bx ip + .align 2, 0 +_0204CA18: .word SaveScriptVariableValueAtIndex + arm_func_end sub_0204C9F4 + + arm_func_start sub_0204CA1C +sub_0204CA1C: ; 0x0204CA1C + stmdb sp!, {r3, lr} + mov r0, r0, lsl #0x10 + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x4d + bl LoadScriptVariableValueAtIndex + cmp r0, #0 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + ldmia sp!, {r3, pc} + arm_func_end sub_0204CA1C + + arm_func_start sub_0204CA48 +sub_0204CA48: ; 0x0204CA48 + ldr ip, _0204CA6C ; =SaveScriptVariableValueAtIndex + cmp r1, #0 + movne r3, #1 + mov r0, r0, lsl #0x10 + mov r2, r0, lsr #0x10 + moveq r3, #0 + mov r0, #0 + mov r1, #0x4d + bx ip + .align 2, 0 +_0204CA6C: .word SaveScriptVariableValueAtIndex + arm_func_end sub_0204CA48 + + arm_func_start HasPlayedOldGame +HasPlayedOldGame: ; 0x0204CA70 + stmdb sp!, {r3, lr} + mov r0, #0 + mov r1, #0x6f + bl LoadScriptVariableValue + cmp r0, #0 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + ldmia sp!, {r3, pc} + arm_func_end HasPlayedOldGame + + arm_func_start GetPerformanceFlagWithChecks +GetPerformanceFlagWithChecks: ; 0x0204CA94 + stmdb sp!, {r4, lr} + mov r4, r0 + cmp r4, #7 + addls pc, pc, r4, lsl #2 + b _0204CB10 +_0204CAA8: ; jump table + b _0204CAC8 ; case 0 + b _0204CB00 ; case 1 + b _0204CB00 ; case 2 + b _0204CAEC ; case 3 + b _0204CAEC ; case 4 + b _0204CAEC ; case 5 + b _0204CAEC ; case 6 + b _0204CAEC ; case 7 +_0204CAC8: + mov r0, #0 + mov r2, r0 + mov r1, #3 + bl LoadScriptVariableValueAtIndex + cmp r0, #0x35 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + ldmia sp!, {r4, pc} +_0204CAEC: + bl GetGameMode + cmp r0, #3 + bne _0204CB10 + mov r0, #0 + ldmia sp!, {r4, pc} +_0204CB00: + bl GetGameMode + cmp r0, #3 + moveq r0, #1 + ldmeqia sp!, {r4, pc} +_0204CB10: + mov r0, r4, lsl #0x10 + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x4e + bl LoadScriptVariableValueAtIndex + and r0, r0, #0xff + ldmia sp!, {r4, pc} + arm_func_end GetPerformanceFlagWithChecks + + arm_func_start sub_0204CB2C +sub_0204CB2C: ; 0x0204CB2C + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + mov r4, r1 + cmp r5, #7 + addls pc, pc, r5, lsl #2 + b _0204CB70 +_0204CB44: ; jump table + b _0204CB70 ; case 0 + b _0204CB64 ; case 1 + b _0204CB64 ; case 2 + b _0204CB64 ; case 3 + b _0204CB64 ; case 4 + b _0204CB64 ; case 5 + b _0204CB64 ; case 6 + b _0204CB64 ; case 7 +_0204CB64: + bl GetGameMode + cmp r0, #3 + ldmeqia sp!, {r3, r4, r5, pc} +_0204CB70: + cmp r4, #0 + movne r3, #1 + mov r0, r5, lsl #0x10 + mov r2, r0, lsr #0x10 + moveq r3, #0 + mov r0, #0 + mov r1, #0x4e + bl SaveScriptVariableValueAtIndex + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_0204CB2C + + arm_func_start GetScenarioBalance +GetScenarioBalance: ; 0x0204CB94 + stmdb sp!, {r3, lr} + mov r0, #0 + mov r1, #0x49 + bl LoadScriptVariableValue + mvn r1, #0 + cmp r0, r1 + bne _0204CBD8 + mov r0, #0 + mov r1, #0x14 + bl LoadScriptVariableValue + cmp r0, #0 + bge _0204CBD0 + mov r0, #0 + mov r1, #0x13 + bl LoadScriptVariableValue +_0204CBD0: + and r0, r0, #0xff + ldmia sp!, {r3, pc} +_0204CBD8: + cmp r0, #0 + moveq r0, #1 + movne r0, #3 + ldmia sp!, {r3, pc} + arm_func_end GetScenarioBalance + + arm_func_start sub_0204CBE8 +sub_0204CBE8: ; 0x0204CBE8 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr} + bl GetGameMode + cmp r0, #1 + ldmlsia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + sub r4, r0, #2 + ldr r0, _0204CCB4 ; =_0209DFC8 + mov r1, r4 + bl Debug_Print0 + mov r0, r4, lsl #0x10 + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x1a + bl LoadScriptVariableValueAtIndex + mov r3, r0 + mov r0, #0 + mov r2, r0 + mov r1, #2 + bl SaveScriptVariableValueAtIndex + add r2, r4, #4 + mov r2, r2, lsl #0x10 + mov r0, #0 + mov r1, #0x1a + mov r2, r2, lsr #0x10 + bl LoadScriptVariableValueAtIndex + mov r3, r0 + mov r0, #0 + mov r1, #2 + mov r2, #1 + bl SaveScriptVariableValueAtIndex + mov r8, #0 + mov sb, r4, lsl #7 + mov r7, r8 + mov r6, #0x1b + mov r5, r8 + mov r4, #0x11 +_0204CC74: + mov r2, sb, lsl #0x10 + mov r0, r7 + mov r1, r6 + mov r2, r2, lsr #0x10 + bl LoadScriptVariableValueAtIndex + mov r2, r8, lsl #0x10 + mov r3, r0 + mov r0, r5 + mov r1, r4 + mov r2, r2, lsr #0x10 + bl SaveScriptVariableValueAtIndex + add r8, r8, #1 + cmp r8, #0x80 + add sb, sb, #1 + blt _0204CC74 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + .align 2, 0 +_0204CCB4: .word _0209DFC8 + arm_func_end sub_0204CBE8 + + arm_func_start ScenarioFlagBackup +ScenarioFlagBackup: ; 0x0204CCB8 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr} + bl GetGameMode + cmp r0, #1 + ldmlsia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + sub r4, r0, #2 + ldr r0, _0204CD84 ; =_0209DFE8 + mov r1, r4 + bl Debug_Print0 + mov r0, #0 + mov r2, r0 + mov r1, #2 + bl LoadScriptVariableValueAtIndex + mov r1, r4, lsl #0x10 + mov r3, r0 + mov r2, r1, lsr #0x10 + mov r0, #0 + mov r1, #0x1a + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r1, #2 + mov r2, #1 + bl LoadScriptVariableValueAtIndex + add r2, r4, #4 + mov r2, r2, lsl #0x10 + mov r3, r0 + mov r0, #0 + mov r1, #0x1a + mov r2, r2, lsr #0x10 + bl SaveScriptVariableValueAtIndex + mov r8, #0 + mov sb, r4, lsl #7 + mov r7, r8 + mov r6, #0x11 + mov r5, r8 + mov r4, #0x1b +_0204CD44: + mov r2, r8, lsl #0x10 + mov r0, r7 + mov r1, r6 + mov r2, r2, lsr #0x10 + bl LoadScriptVariableValueAtIndex + mov r2, sb, lsl #0x10 + mov r3, r0 + mov r0, r5 + mov r1, r4 + mov r2, r2, lsr #0x10 + bl SaveScriptVariableValueAtIndex + add r8, r8, #1 + cmp r8, #0x80 + add sb, sb, #1 + blt _0204CD44 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + .align 2, 0 +_0204CD84: .word _0209DFE8 + arm_func_end ScenarioFlagBackup + + arm_func_start InitWorldMapScriptVars +InitWorldMapScriptVars: ; 0x0204CD88 + stmdb sp!, {r3, lr} + mov r0, #0 + mov r1, #0x55 + bl ZinitScriptVariable + mov r0, #0 + mov r1, #0x56 + bl ZinitScriptVariable + mov r0, #0 + mov r1, #0x57 + mov r2, #1 + bl SaveScriptVariableValue + ldmia sp!, {r3, pc} + arm_func_end InitWorldMapScriptVars + + arm_func_start sub_0204CDB8 +sub_0204CDB8: ; 0x0204CDB8 + ldr ip, _0204CDC8 ; =ZinitScriptVariable + mov r0, #0 + mov r1, #0x56 + bx ip + .align 2, 0 +_0204CDC8: .word ZinitScriptVariable + arm_func_end sub_0204CDB8 + + arm_func_start sub_0204CDCC +sub_0204CDCC: ; 0x0204CDCC + stmdb sp!, {r3, lr} + mov r0, #0 + mov r1, #0x57 + bl LoadScriptVariableValue + mov r0, r0, lsl #0x18 + mov r0, r0, asr #0x18 + ldmia sp!, {r3, pc} + arm_func_end sub_0204CDCC + + arm_func_start sub_0204CDE8 +sub_0204CDE8: ; 0x0204CDE8 + ldr ip, _0204CDFC ; =SaveScriptVariableValue + mov r2, r0 + mov r0, #0 + mov r1, #0x57 + bx ip + .align 2, 0 +_0204CDFC: .word SaveScriptVariableValue + arm_func_end sub_0204CDE8 + + arm_func_start sub_0204CE00 +sub_0204CE00: ; 0x0204CE00 + stmdb sp!, {r4, lr} + mov r4, r0 + bl GetGameMode + cmp r0, #3 + mov r0, r4, lsl #0x10 + mov r2, r0, lsr #0x10 + mov r0, #0 + bne _0204CE2C + mov r1, #0x56 + bl LoadScriptVariableValueAtIndex + b _0204CE34 +_0204CE2C: + mov r1, #0x55 + bl LoadScriptVariableValueAtIndex +_0204CE34: + cmp r0, #0 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + ldmia sp!, {r4, pc} + arm_func_end sub_0204CE00 + + arm_func_start sub_0204CE48 +sub_0204CE48: ; 0x0204CE48 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + mov r4, r1 + bl GetGameMode + cmp r0, #3 + mov r0, r5, lsl #0x10 + mov r3, r4 + bne _0204CE7C + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x56 + bl SaveScriptVariableValueAtIndex + ldmia sp!, {r3, r4, r5, pc} +_0204CE7C: + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x55 + bl SaveScriptVariableValueAtIndex + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_0204CE48 + + arm_func_start InitDungeonListScriptVars +InitDungeonListScriptVars: ; 0x0204CE90 + stmdb sp!, {r3, lr} + mov r0, #0 + mov r1, #0x4f + bl ZinitScriptVariable + mov r0, #0 + mov r1, #0x54 + bl ZinitScriptVariable + mov r0, #0 + mov r1, #0x50 + bl ZinitScriptVariable + mov r0, #0 + mov r1, #0x51 + bl ZinitScriptVariable + mov r0, #0 + mov r1, #0x52 + bl ZinitScriptVariable + mov r0, #0 + mov r1, #0x53 + bl ZinitScriptVariable + ldmia sp!, {r3, pc} + arm_func_end InitDungeonListScriptVars + + arm_func_start sub_0204CEE0 +sub_0204CEE0: ; 0x0204CEE0 + stmdb sp!, {r3, lr} + mov r0, r0, lsl #0x10 + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x50 + bl LoadScriptVariableValueAtIndex + cmp r0, #0 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + ldmia sp!, {r3, pc} + arm_func_end sub_0204CEE0 + + arm_func_start sub_0204CF0C +sub_0204CF0C: ; 0x0204CF0C + stmdb sp!, {r3, lr} + mov r0, r0, lsl #0x10 + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x52 + bl LoadScriptVariableValueAtIndex + cmp r0, #0 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + ldmia sp!, {r3, pc} + arm_func_end sub_0204CF0C + + arm_func_start SetDungeonConquest +SetDungeonConquest: ; 0x0204CF38 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r0, r0, lsl #0x10 + mov r3, r1 + mov r2, r0, lsr #0x10 + mov r0, #0 + mov r1, #0x52 + bl SaveScriptVariableValueAtIndex + mov r7, #0 + ldr r6, _0204CF98 ; =_0209E008 + mov r5, r7 + mov r4, #0x52 +_0204CF64: + ldrb r2, [r6, r7] + add r7, r7, #1 + cmp r2, #0xff + bne _0204CF80 + mov r0, #0x23 + bl SetAdventureLogCompleted + ldmia sp!, {r3, r4, r5, r6, r7, pc} +_0204CF80: + mov r0, r5 + mov r1, r4 + bl LoadScriptVariableValueAtIndex + cmp r0, #0 + bne _0204CF64 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_0204CF98: .word _0209E008 + arm_func_end SetDungeonConquest + + arm_func_start GetDungeonMode +GetDungeonMode: ; 0x0204CF9C + stmdb sp!, {r4, lr} + mov r0, r0, lsl #0x10 + mov r4, r0, lsr #0x10 + mov r2, r4 + mov r0, #0 + mov r1, #0x4f + bl LoadScriptVariableValueAtIndex + cmp r0, #0 + movne r0, #1 + moveq r0, #0 + tst r0, #0xff + mov r2, r4 + mov r0, #0 + mov r1, #0x54 + beq _0204CFF8 + bl LoadScriptVariableValueAtIndex + cmp r0, #0 + movne r0, #1 + moveq r0, #0 + tst r0, #0xff + movne r0, #3 + moveq r0, #1 + ldmia sp!, {r4, pc} +_0204CFF8: + bl LoadScriptVariableValueAtIndex + cmp r0, #0 + movne r0, #1 + moveq r0, #0 + tst r0, #0xff + movne r0, #2 + moveq r0, #0 + ldmia sp!, {r4, pc} + arm_func_end GetDungeonMode + + arm_func_start sub_0204D018 +sub_0204D018: ; 0x0204D018 + stmdb sp!, {r4, lr} + cmp r1, #3 + addls pc, pc, r1, lsl #2 + ldmia sp!, {r4, pc} +_0204D028: ; jump table + b _0204D038 ; case 0 + b _0204D06C ; case 1 + b _0204D0A0 ; case 2 + b _0204D0D4 ; case 3 +_0204D038: + mov r0, r0, lsl #0x10 + mov r4, r0, lsr #0x10 + mov r0, #0 + mov r2, r4 + mov r3, r0 + mov r1, #0x4f + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r2, r4 + mov r3, r0 + mov r1, #0x54 + bl SaveScriptVariableValueAtIndex + ldmia sp!, {r4, pc} +_0204D06C: + mov r0, r0, lsl #0x10 + mov r4, r0, lsr #0x10 + mov r2, r4 + mov r0, #0 + mov r1, #0x4f + mov r3, #1 + bl SaveScriptVariableValueAtIndex + mov r0, #0 + mov r2, r4 + mov r3, r0 + mov r1, #0x54 + bl SaveScriptVariableValueAtIndex + ldmia sp!, {r4, pc} +_0204D0A0: + mov r0, r0, lsl #0x10 + mov r4, r0, lsr #0x10 + mov r0, #0 + mov r2, r4 + mov r3, r0 + mov r1, #0x4f + bl SaveScriptVariableValueAtIndex + mov r2, r4 + mov r0, #0 + mov r1, #0x54 + mov r3, #1 + bl SaveScriptVariableValueAtIndex + ldmia sp!, {r4, pc} +_0204D0D4: + mov r0, r0, lsl #0x10 + mov r4, r0, lsr #0x10 + mov r2, r4 + mov r0, #0 + mov r1, #0x4f + mov r3, #1 + bl SaveScriptVariableValueAtIndex + mov r2, r4 + mov r0, #0 + mov r1, #0x54 + mov r3, #1 + bl SaveScriptVariableValueAtIndex + ldmia sp!, {r4, pc} + arm_func_end sub_0204D018 + + arm_func_start GlobalProgressAlloc +GlobalProgressAlloc: ; 0x0204D108 + stmdb sp!, {r3, lr} + mov r0, #0x20c + mov r1, #0 + bl MemAlloc + ldr r2, _0204D12C ; =GLOBAL_PROGRESS_PTR + mov r1, #0x20c + str r0, [r2] + bl MemZero + ldmia sp!, {r3, pc} + .align 2, 0 +_0204D12C: .word GLOBAL_PROGRESS_PTR + arm_func_end GlobalProgressAlloc + + arm_func_start ResetGlobalProgress +ResetGlobalProgress: ; 0x0204D130 + ldr r0, _0204D144 ; =GLOBAL_PROGRESS_PTR + ldr ip, _0204D148 ; =MemZero + mov r1, #0x20c + ldr r0, [r0] + bx ip + .align 2, 0 +_0204D144: .word GLOBAL_PROGRESS_PTR +_0204D148: .word MemZero + arm_func_end ResetGlobalProgress + + arm_func_start SetMonsterFlag1 +SetMonsterFlag1: ; 0x0204D14C + stmdb sp!, {r3, lr} + ldr r3, _0204D184 ; =GLOBAL_PROGRESS_PTR + mov r1, r0, asr #4 + add r1, r0, r1, lsr #27 + mov r2, r0, lsr #0x1f + rsb r0, r2, r0, lsl #27 + ldr lr, [r3] + mov ip, r1, asr #5 + ldr r3, [lr, ip, lsl #2] + add r0, r2, r0, ror #27 + mov r1, #1 + orr r0, r3, r1, lsl r0 + str r0, [lr, ip, lsl #2] + ldmia sp!, {r3, pc} + .align 2, 0 +_0204D184: .word GLOBAL_PROGRESS_PTR + arm_func_end SetMonsterFlag1 + + arm_func_start GetMonsterFlag1 +GetMonsterFlag1: ; 0x0204D188 + ldr r3, _0204D1C0 ; =GLOBAL_PROGRESS_PTR + mov r1, r0, asr #4 + add r2, r0, r1, lsr #27 + mov r1, r0, lsr #0x1f + rsb r0, r1, r0, lsl #27 + add r0, r1, r0, ror #27 + ldr r3, [r3] + mov r2, r2, asr #5 + ldr r2, [r3, r2, lsl #2] + mov r1, #1 + tst r2, r1, lsl r0 + moveq r1, #0 + and r0, r1, #0xff + bx lr + .align 2, 0 +_0204D1C0: .word GLOBAL_PROGRESS_PTR + arm_func_end GetMonsterFlag1 + + arm_func_start SetMonsterFlag2 +SetMonsterFlag2: ; 0x0204D1C4 + stmdb sp!, {r3, lr} + bl FemaleToMaleForm + ldr r2, _0204D204 ; =GLOBAL_PROGRESS_PTR + mov r1, r0, asr #4 + ldr r3, [r2] + add r1, r0, r1, lsr #27 + mov r2, r0, lsr #0x1f + rsb r0, r2, r0, lsl #27 + add lr, r3, #0x98 + mov ip, r1, asr #5 + ldr r3, [lr, ip, lsl #2] + add r0, r2, r0, ror #27 + mov r1, #1 + orr r0, r3, r1, lsl r0 + str r0, [lr, ip, lsl #2] + ldmia sp!, {r3, pc} + .align 2, 0 +_0204D204: .word GLOBAL_PROGRESS_PTR + arm_func_end SetMonsterFlag2 + + arm_func_start HasMonsterBeenAttackedInDungeons +HasMonsterBeenAttackedInDungeons: ; 0x0204D208 + stmdb sp!, {r3, lr} + bl FemaleToMaleForm + ldr r3, _0204D24C ; =GLOBAL_PROGRESS_PTR + mov r1, r0, asr #4 + add r2, r0, r1, lsr #27 + mov r1, r0, lsr #0x1f + rsb r0, r1, r0, lsl #27 + add r0, r1, r0, ror #27 + ldr r3, [r3] + mov r2, r2, asr #5 + add r2, r3, r2, lsl #2 + ldr r2, [r2, #0x98] + mov r1, #1 + tst r2, r1, lsl r0 + moveq r1, #0 + and r0, r1, #0xff + ldmia sp!, {r3, pc} + .align 2, 0 +_0204D24C: .word GLOBAL_PROGRESS_PTR + arm_func_end HasMonsterBeenAttackedInDungeons + + arm_func_start SetDungeonTipShown +SetDungeonTipShown: ; 0x0204D250 + stmdb sp!, {r3, lr} + ldr r2, _0204D28C ; =GLOBAL_PROGRESS_PTR + mov r1, r0, asr #4 + ldr r3, [r2] + add r1, r0, r1, lsr #27 + mov r2, r0, lsr #0x1f + rsb r0, r2, r0, lsl #27 + add lr, r3, #0x94 + mov ip, r1, asr #5 + ldr r3, [lr, ip, lsl #2] + add r0, r2, r0, ror #27 + mov r1, #1 + orr r0, r3, r1, lsl r0 + str r0, [lr, ip, lsl #2] + ldmia sp!, {r3, pc} + .align 2, 0 +_0204D28C: .word GLOBAL_PROGRESS_PTR + arm_func_end SetDungeonTipShown + + arm_func_start GetDungeonTipShown +GetDungeonTipShown: ; 0x0204D290 + cmp r0, #0x1f + movge r0, #0 + bxge lr + ldr r2, _0204D2D8 ; =GLOBAL_PROGRESS_PTR + mov r1, r0, asr #4 + add r1, r0, r1, lsr #27 + ldr r3, [r2] + mov r2, r1, asr #5 + mov r1, r0, lsr #0x1f + add r2, r3, r2, lsl #2 + rsb r0, r1, r0, lsl #27 + add r0, r1, r0, ror #27 + ldr r2, [r2, #0x94] + mov r1, #1 + tst r2, r1, lsl r0 + moveq r1, #0 + and r0, r1, #0xff + bx lr + .align 2, 0 +_0204D2D8: .word GLOBAL_PROGRESS_PTR + arm_func_end GetDungeonTipShown + + arm_func_start SetMaxReachedFloor +SetMaxReachedFloor: ; 0x0204D2DC + cmp r0, #0xb4 + ldrlo r2, _0204D2F4 ; =GLOBAL_PROGRESS_PTR + ldrlo r2, [r2] + addlo r0, r2, r0 + strlob r1, [r0, #0x143] + bx lr + .align 2, 0 +_0204D2F4: .word GLOBAL_PROGRESS_PTR + arm_func_end SetMaxReachedFloor + + arm_func_start GetMaxReachedFloor +GetMaxReachedFloor: ; 0x0204D2F8 + cmp r0, #0xb4 + ldrlo r1, _0204D314 ; =GLOBAL_PROGRESS_PTR + movhs r0, #0 + ldrlo r1, [r1] + addlo r0, r1, r0 + ldrlob r0, [r0, #0x143] + bx lr + .align 2, 0 +_0204D314: .word GLOBAL_PROGRESS_PTR + arm_func_end GetMaxReachedFloor + + arm_func_start IncrementNbAdventures +IncrementNbAdventures: ; 0x0204D318 + ldr r0, _0204D344 ; =GLOBAL_PROGRESS_PTR + ldr r1, _0204D348 ; =0x000F423F + ldr r3, [r0] + ldr r2, [r3, #0x1f8] + add r2, r2, #1 + str r2, [r3, #0x1f8] + ldr r2, [r0] + ldr r0, [r2, #0x1f8] + cmp r0, r1 + strhi r1, [r2, #0x1f8] + bx lr + .align 2, 0 +_0204D344: .word GLOBAL_PROGRESS_PTR +_0204D348: .word 0x000F423F + arm_func_end IncrementNbAdventures + + arm_func_start GetNbAdventures +GetNbAdventures: ; 0x0204D34C + ldr r0, _0204D35C ; =GLOBAL_PROGRESS_PTR + ldr r0, [r0] + ldr r0, [r0, #0x1f8] + bx lr + .align 2, 0 +_0204D35C: .word GLOBAL_PROGRESS_PTR + arm_func_end GetNbAdventures + + arm_func_start CanMonsterSpawn +CanMonsterSpawn: ; 0x0204D360 + mov r0, #1 + bx lr + arm_func_end CanMonsterSpawn + + arm_func_start IncrementExclusiveMonsterCounts +IncrementExclusiveMonsterCounts: ; 0x0204D368 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr} + ldr r4, _0204D3B8 ; =VERSION_EXCLUSIVE_MONSTERS + ldr r7, _0204D3BC ; =GLOBAL_PROGRESS_PTR + mov r6, r0 + mov r5, #0 + mov r8, #1 +_0204D380: + mov r0, r5, lsl #2 + ldrsh r0, [r4, r0] + bl GetDexNumber + mov sb, r0 + mov r0, r6 + bl GetDexNumber + cmp sb, r0 + ldreq r0, [r7] + addeq r0, r0, r5 + add r5, r5, #1 + streqb r8, [r0, #0x12c] + cmp r5, #0x17 + blt _0204D380 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + .align 2, 0 +_0204D3B8: .word VERSION_EXCLUSIVE_MONSTERS +_0204D3BC: .word GLOBAL_PROGRESS_PTR + arm_func_end IncrementExclusiveMonsterCounts + + arm_func_start CopyProgressInfoTo +CopyProgressInfoTo: ; 0x0204D3C0 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr} + ldr r4, _0204D538 ; =0x00000483 + mov r5, r0 + mov r8, #0 + add r7, sp, #0 + mov r6, #1 +_0204D3D8: + mov r0, r8, lsl #0x10 + mov r0, r0, asr #0x10 + bl GetMonsterFlag1 + strb r0, [sp] + mov r0, r5 + mov r1, r7 + mov r2, r6 + bl CopyBitsTo + add r8, r8, #1 + cmp r8, r4 + blt _0204D3D8 + mov r7, #0 + add r6, sp, #0 + mov r4, #1 +_0204D410: + mov r0, r7 + bl GetDungeonTipShown + strb r0, [sp] + mov r0, r5 + mov r1, r6 + mov r2, r4 + bl CopyBitsTo + add r7, r7, #1 + cmp r7, #0x1f + blt _0204D410 + ldr r4, _0204D538 ; =0x00000483 + mov r8, #0 + add r7, sp, #0 + mov r6, #1 +_0204D448: + mov r0, r8, lsl #0x10 + mov r0, r0, asr #0x10 + bl HasMonsterBeenAttackedInDungeons + strb r0, [sp] + mov r0, r5 + mov r1, r7 + mov r2, r6 + bl CopyBitsTo + add r8, r8, #1 + cmp r8, r4 + blt _0204D448 + ldr r8, _0204D53C ; =_0209E011 + ldr sb, _0204D540 ; =_0209E010 + ldr r6, _0204D544 ; =GLOBAL_PROGRESS_PTR + mov r4, #0 + mov r7, #1 +_0204D488: + ldr r0, [r6] + mov r2, r7 + add r0, r0, r4 + ldrb r0, [r0, #0x12c] + cmp r0, #0 + movne r1, sb + moveq r1, r8 + mov r0, r5 + bl CopyBitsTo + add r4, r4, #1 + cmp r4, #0x17 + blt _0204D488 + ldr r4, _0204D544 ; =GLOBAL_PROGRESS_PTR + mov r7, #0 + mov r6, #7 +_0204D4C4: + ldr r1, [r4] + mov r0, r5 + add r1, r1, #0x43 + add r1, r1, #0x100 + mov r2, r6 + add r1, r1, r7 + bl CopyBitsTo + add r7, r7, #1 + cmp r7, #0xb4 + blt _0204D4C4 + ldr r1, _0204D544 ; =GLOBAL_PROGRESS_PTR + mov r0, r5 + ldr r1, [r1] + mov r2, #0x20 + add r1, r1, #0x1f8 + bl CopyBitsTo + ldr r4, _0204D544 ; =GLOBAL_PROGRESS_PTR + mov r7, #0 + mov r6, #8 +_0204D510: + ldr r1, [r4] + mov r0, r5 + add r1, r1, #0x1fc + mov r2, r6 + add r1, r1, r7 + bl CopyBitsTo + add r7, r7, #1 + cmp r7, #0x10 + blt _0204D510 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + .align 2, 0 +_0204D538: .word 0x00000483 +_0204D53C: .word _0209E011 +_0204D540: .word _0209E010 +_0204D544: .word GLOBAL_PROGRESS_PTR + arm_func_end CopyProgressInfoTo + + arm_func_start CopyProgressInfoFromScratchTo +CopyProgressInfoFromScratchTo: ; 0x0204D548 + stmdb sp!, {r3, lr} + sub sp, sp, #0x10 + mov r3, r0 + mov r2, r1 + add r0, sp, #0 + mov r1, r3 + bl sub_02050990 + add r0, sp, #0 + bl CopyProgressInfoTo + add r0, sp, #0 + bl sub_020509BC + ldr r0, [sp, #8] + add sp, sp, #0x10 + ldmia sp!, {r3, pc} + arm_func_end CopyProgressInfoFromScratchTo + + arm_func_start CopyProgressInfoFrom +CopyProgressInfoFrom: ; 0x0204D580 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, lr} + sub sp, sp, #4 + ldr r1, _0204D740 ; =GLOBAL_PROGRESS_PTR + mov r4, r0 + ldr r0, [r1] + mov r1, #0x20c + bl MemZero + ldr r5, _0204D744 ; =0x00000483 + mov r8, #0 + add r7, sp, #0 + mov r6, #1 +_0204D5AC: + mov r0, r4 + mov r1, r7 + mov r2, r6 + bl CopyBitsFrom + ldrb r0, [sp] + cmp r0, #0 + beq _0204D5D4 + mov r0, r8, lsl #0x10 + mov r0, r0, asr #0x10 + bl SetMonsterFlag1 +_0204D5D4: + add r8, r8, #1 + cmp r8, r5 + blt _0204D5AC + mov r7, #0 + add r6, sp, #0 + mov r5, #1 +_0204D5EC: + mov r0, r4 + mov r1, r6 + mov r2, r5 + bl CopyBitsFrom + ldrb r0, [sp] + cmp r0, #0 + beq _0204D610 + mov r0, r7 + bl SetDungeonTipShown +_0204D610: + add r7, r7, #1 + cmp r7, #0x1f + blt _0204D5EC + ldr r5, _0204D744 ; =0x00000483 + mov r8, #0 + add r7, sp, #0 + mov r6, #1 +_0204D62C: + mov r0, r4 + mov r1, r7 + mov r2, r6 + bl CopyBitsFrom + ldrb r0, [sp] + cmp r0, #0 + beq _0204D654 + mov r0, r8, lsl #0x10 + mov r0, r0, asr #0x10 + bl SetMonsterFlag2 +_0204D654: + add r8, r8, #1 + cmp r8, r5 + blt _0204D62C + mov sb, #0 + mov r6, #1 + ldr sl, _0204D740 ; =GLOBAL_PROGRESS_PTR + mov r5, sb + add r8, sp, #1 + mov r7, r6 +_0204D678: + mov r0, r4 + mov r1, r8 + mov r2, r7 + bl CopyBitsFrom + ldrb r0, [sp, #1] + tst r0, #1 + ldr r0, [sl] + movne r1, r6 + add r0, r0, sb + moveq r1, r5 + add sb, sb, #1 + strb r1, [r0, #0x12c] + cmp sb, #0x17 + blt _0204D678 + ldr r8, _0204D740 ; =GLOBAL_PROGRESS_PTR + mov r7, #0 + add r6, sp, #1 + mov r5, #7 +_0204D6C0: + mov r0, r4 + mov r1, r6 + mov r2, r5 + bl CopyBitsFrom + ldrb r1, [sp, #1] + ldr r0, [r8] + add r0, r0, r7 + and r1, r1, #0x7f + add r7, r7, #1 + strb r1, [r0, #0x143] + cmp r7, #0xb4 + blt _0204D6C0 + ldr r1, _0204D740 ; =GLOBAL_PROGRESS_PTR + mov r0, r4 + ldr r1, [r1] + mov r2, #0x20 + add r1, r1, #0x1f8 + bl CopyBitsFrom + ldr r5, _0204D740 ; =GLOBAL_PROGRESS_PTR + mov r7, #0 + mov r6, #8 +_0204D714: + ldr r1, [r5] + mov r0, r4 + add r1, r1, #0x1fc + mov r2, r6 + add r1, r1, r7 + bl CopyBitsFrom + add r7, r7, #1 + cmp r7, #0x10 + blt _0204D714 + add sp, sp, #4 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, pc} + .align 2, 0 +_0204D740: .word GLOBAL_PROGRESS_PTR +_0204D744: .word 0x00000483 + arm_func_end CopyProgressInfoFrom + + arm_func_start CopyProgressInfoFromScratchFrom +CopyProgressInfoFromScratchFrom: ; 0x0204D748 + stmdb sp!, {r3, lr} + sub sp, sp, #0x10 + mov r3, r0 + mov r2, r1 + add r0, sp, #0 + mov r1, r3 + bl sub_02050974 + add r0, sp, #0 + bl CopyProgressInfoFrom + add r0, sp, #0 + bl sub_020509BC + ldr r0, [sp, #8] + add sp, sp, #0x10 + ldmia sp!, {r3, pc} + arm_func_end CopyProgressInfoFromScratchFrom + + arm_func_start InitKaomadoStream +InitKaomadoStream: ; 0x0204D780 + stmdb sp!, {r3, lr} + bl FileRom_InitDataTransfer + ldr r0, _0204D798 ; =_022AB4B0 + bl FileRom_Veneer_FileInit + bl FileRom_StopDataTransfer + ldmia sp!, {r3, pc} + .align 2, 0 +_0204D798: .word _022AB4B0 + arm_func_end InitKaomadoStream + + arm_func_start InitPortraitParams +InitPortraitParams: ; 0x0204D79C + mov r2, #0 + strh r2, [r0] + sub r1, r2, #2 + strb r1, [r0, #2] + strb r2, [r0, #3] + mov r1, #2 + str r1, [r0, #4] + mov r1, #9 + str r1, [r0, #8] + strb r2, [r0, #0xc] + strb r2, [r0, #0xd] + strb r2, [r0, #0xe] + strb r2, [r0, #0xf] + bx lr + arm_func_end InitPortraitParams + + arm_func_start InitPortraitParamsWithMonsterId +InitPortraitParamsWithMonsterId: ; 0x0204D7D4 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + mov r4, r1 + bl InitPortraitParams + strh r4, [r5] + mov r0, #0 + strb r0, [r5, #2] + ldmia sp!, {r3, r4, r5, pc} + arm_func_end InitPortraitParamsWithMonsterId + + arm_func_start SetPortraitEmotion +SetPortraitEmotion: ; 0x0204D7F4 + ldrsh r2, [r0] + cmp r2, #0 + strneb r1, [r0, #2] + bx lr + arm_func_end SetPortraitEmotion + + arm_func_start SetPortraitLayout +SetPortraitLayout: ; 0x0204D804 + ldrsh r2, [r0] + cmp r2, #0 + cmpne r1, #0x20 + bxeq lr + mov r2, #6 + mul r2, r1, r2 + ldr r3, _0204D844 ; =PORTRAIT_LAYOUTS + strb r1, [r0, #3] + ldrsh r1, [r3, r2] + add r2, r3, r2 + str r1, [r0, #4] + ldrsh r1, [r2, #2] + str r1, [r0, #8] + ldrb r1, [r2, #4] + strb r1, [r0, #0xc] + bx lr + .align 2, 0 +_0204D844: .word PORTRAIT_LAYOUTS + arm_func_end SetPortraitLayout + + arm_func_start SetPortraitOffset +SetPortraitOffset: ; 0x0204D848 + stmdb sp!, {r3, lr} + ldrsh r2, [r0] + cmp r2, #0 + ldmeqia sp!, {r3, pc} + ldrb r3, [r0, #3] + mov r2, #6 + ldr lr, _0204D890 ; =PORTRAIT_LAYOUTS + smulbb ip, r3, r2 + ldrsh r3, [lr, ip] + ldr r2, [r1] + add ip, lr, ip + add r2, r3, r2 + str r2, [r0, #4] + ldrsh r2, [ip, #2] + ldr r1, [r1, #4] + add r1, r2, r1 + str r1, [r0, #8] + ldmia sp!, {r3, pc} + .align 2, 0 +_0204D890: .word PORTRAIT_LAYOUTS + arm_func_end SetPortraitOffset + + arm_func_start AllowPortraitDefault +AllowPortraitDefault: ; 0x0204D894 + strb r1, [r0, #0xf] + bx lr + arm_func_end AllowPortraitDefault + + arm_func_start IsValidPortrait +IsValidPortrait: ; 0x0204D89C + ldrsh r1, [r0] + cmp r1, #0 + ldrnesb r1, [r0, #2] + mvnne r0, #1 + cmpne r1, r0 + movne r0, #1 + moveq r0, #0 + bx lr + arm_func_end IsValidPortrait + + arm_func_start LoadPortrait +LoadPortrait: ; 0x0204D8BC + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0xc + mov sl, r0 + mov sb, r1 + ldrsh r7, [sl] + ldrsb r8, [sl, #2] + bl FileRom_InitDataTransfer + ldr r0, _0204DA14 ; =_022AB4B0 + ldr r1, _0204DA18 ; =KAOMADO_FILEPATH + bl FileRom_HandleOpen + mov fp, #0 + mov r4, fp + mov r5, #1 + b _0204D9DC +_0204D8F4: + mov r0, #0x28 + mul r0, r7, r0 + add r0, r0, r8, lsl #1 + mov r1, r0, lsl #2 + ldr r0, _0204DA14 ; =_022AB4B0 + mov r2, #0 + sub r7, r7, #0x258 + bl FileRom_HandleSeek + ldr r0, _0204DA14 ; =_022AB4B0 + add r1, sp, #0 + mov r2, #0xc + bl FileRom_HandleRead + ldr r0, [sp, #4] + cmp r0, #0 + movge r0, #1 + movlt r0, #0 + strb r0, [sl, #0xd] + ldrb r0, [sl, #0xc] + cmp r0, #0 + beq _0204D984 + ldr r0, [sp, #4] + cmp r0, #0 + mov r1, r0 + bge _0204D96C + ldr r1, [sp] + cmp r0, #0 + rsblt r0, r0, #0 + sub r6, r0, r1 + strb r5, [sl, #0xe] + b _0204D99C +_0204D96C: + ldr r2, [sp, #8] + cmp r2, #0 + rsblt r2, r2, #0 + sub r6, r2, r0 + strb r4, [sl, #0xe] + b _0204D99C +_0204D984: + ldr r0, [sp, #4] + ldr r1, [sp] + cmp r0, #0 + rsblt r0, r0, #0 + sub r6, r0, r1 + strb fp, [sl, #0xe] +_0204D99C: + cmp r1, #0 + ble _0204D9DC + cmp sb, #0 + beq _0204D9C8 + ldr r0, _0204DA14 ; =_022AB4B0 + mov r2, #0 + bl FileRom_HandleSeek + ldr r0, _0204DA14 ; =_022AB4B0 + mov r1, sb + mov r2, r6 + bl FileRom_HandleRead +_0204D9C8: + ldr r0, _0204DA14 ; =_022AB4B0 + bl FileClose + bl FileRom_StopDataTransfer + mov r0, #1 + b _0204DA0C +_0204D9DC: + cmp r7, #0 + bgt _0204D8F4 + ldrb r0, [sl, #0xf] + cmp r0, #0 + cmpne r8, #0 + movne r8, #0 + ldrnesh r7, [sl] + bne _0204D9DC + ldr r0, _0204DA14 ; =_022AB4B0 + bl FileClose + bl FileRom_StopDataTransfer + mov r0, #0 +_0204DA0C: + add sp, sp, #0xc + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_0204DA14: .word _022AB4B0 +_0204DA18: .word KAOMADO_FILEPATH + arm_func_end LoadPortrait + + arm_func_start sub_0204DA1C +sub_0204DA1C: ; 0x0204DA1C + ldr r1, _0204DA28 ; =ARM9_UNKNOWN_TABLE__NA_209E164 + ldrb r0, [r1, r0] + bx lr + .align 2, 0 +_0204DA28: .word ARM9_UNKNOWN_TABLE__NA_209E164 + arm_func_end sub_0204DA1C + + arm_func_start sub_0204DA2C +sub_0204DA2C: ; 0x0204DA2C + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, lr} + sub sp, sp, #0x68 + mov r4, r2 + mov r2, #0 + mov r5, r1 + mov r6, r2 + add r1, sp, #0 +_0204DA48: + strb r6, [r1, r2] + add r2, r2, #1 + cmp r2, #0x22 + blt _0204DA48 + add r3, sp, #0x22 + ldr r2, _0204DB04 ; =ARM9_UNKNOWN_TABLE__NA_209E164 + b _0204DA84 +_0204DA64: + ldrb r1, [r0] + ldrb r1, [r2, r1] + cmp r1, #0xff + strb r1, [r3, r6] + moveq r0, #0 + beq _0204DAFC + add r0, r0, #1 + add r6, r6, #1 +_0204DA84: + cmp r6, r4 + blt _0204DA64 + add r1, r4, r4, lsl #2 + and r0, r1, #7 + add r0, r0, #7 + mov r0, r0, asr #3 + add sl, r0, r1, asr #3 + add r0, sp, #0x58 + add r1, sp, #0 + mov r2, sl + bl sub_02050990 + mov sb, #0 + add r8, sp, #0x58 + add r7, sp, #0x22 + mov r6, #5 + b _0204DAD8 +_0204DAC4: + mov r0, r8 + mov r2, r6 + add r1, r7, sb + bl CopyBitsTo + add sb, sb, #1 +_0204DAD8: + cmp sb, r4 + blt _0204DAC4 + add r0, sp, #0x58 + bl sub_020509BC + add r1, sp, #0 + mov r0, r5 + mov r2, sl + bl MemcpySimple + mov r0, #1 +_0204DAFC: + add sp, sp, #0x68 + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, pc} + .align 2, 0 +_0204DB04: .word ARM9_UNKNOWN_TABLE__NA_209E164 + arm_func_end sub_0204DA2C + + arm_func_start sub_0204DB08 +sub_0204DB08: ; 0x0204DB08 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr} + sub sp, sp, #0x48 + mov r4, r2 + add r3, r4, r4, lsl #2 + and r2, r3, #7 + add r2, r2, #7 + mov r2, r2, asr #3 + mov r5, r0 + add r0, sp, #0x38 + add r2, r2, r3, asr #3 + bl sub_02050974 + mov sb, #0 + add r8, sp, #0x38 + add r7, sp, #0 + mov r6, #5 + b _0204DB5C +_0204DB48: + mov r0, r8 + mov r2, r6 + add r1, r7, sb + bl CopyBitsFrom + add sb, sb, #1 +_0204DB5C: + cmp sb, r4 + blt _0204DB48 + add r0, sp, #0x38 + bl sub_020509BC + mov r3, #0 + add r2, sp, #0 + ldr r1, _0204DB9C ; =WONDER_MAIL_BITS_MAP + b _0204DB8C +_0204DB7C: + ldrb r0, [r2, r3] + add r3, r3, #1 + ldrb r0, [r1, r0] + strb r0, [r5], #1 +_0204DB8C: + cmp r3, r4 + blt _0204DB7C + add sp, sp, #0x48 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + .align 2, 0 +_0204DB9C: .word WONDER_MAIL_BITS_MAP + arm_func_end sub_0204DB08 + + arm_func_start sub_0204DBA0 +sub_0204DBA0: ; 0x0204DBA0 + stmdb sp!, {r4, r5, r6, lr} + sub sp, sp, #0xa0 + mov r2, r0 + mov r5, r1 + mov r1, r2 + add r0, sp, #0x10 + mov r2, #0x36 + mov r4, #0 + bl MemcpySimple + ldr r3, _0204DC9C ; =ARM9_UNKNOWN_TABLE__NA_209E12C + mov r6, r4 + add r2, sp, #0x10 + add r0, sp, #0x46 + mov ip, r4 +_0204DBD8: + mov lr, ip + ldrb r1, [r3, r6] + b _0204DBF0 +_0204DBE4: + cmp lr, r1 + beq _0204DBF8 + add lr, lr, #1 +_0204DBF0: + cmp lr, #0x36 + blt _0204DBE4 +_0204DBF8: + ldrb r1, [r2, lr] + strb r1, [r0, r6] + add r6, r6, #1 + cmp r6, #0x36 + blt _0204DBD8 + add r1, sp, #0x7c + mov r2, #0x36 + bl sub_0204DA2C + cmp r0, #0 + moveq r0, #0 + beq _0204DC94 + ldrb r0, [sp, #0x7c] + add r1, sp, #0x7d + mov r2, #0x20 + bl sub_0204E0A0 + mov r3, #1 + add r2, sp, #0x7c +_0204DC3C: + ldrb r1, [r2, r3] + and r0, r3, #0xff + add r3, r3, #1 + add r0, r1, r0 + add r0, r4, r0 + cmp r3, #0x21 + and r4, r0, #0xff + blt _0204DC3C + ldrb r0, [sp, #0x7c] + cmp r0, r4 + movne r0, #0 + bne _0204DC94 + add r0, sp, #0 + add r1, sp, #0x7d + mov r2, #0x20 + bl sub_02050974 + add r0, sp, #0 + mov r1, r5 + bl sub_0205C2A4 + add r0, sp, #0 + bl sub_020509BC + mov r0, #1 +_0204DC94: + add sp, sp, #0xa0 + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_0204DC9C: .word ARM9_UNKNOWN_TABLE__NA_209E12C + arm_func_end sub_0204DBA0 + + arm_func_start sub_0204DCA0 +sub_0204DCA0: ; 0x0204DCA0 + stmdb sp!, {r4, r5, r6, lr} + sub sp, sp, #0xa0 + mov r4, #0 + mov r5, r0 + mov r6, r1 + mov r2, r4 + mov r1, r4 + add r0, sp, #0x7c +_0204DCC0: + strb r1, [r0, r2] + add r2, r2, #1 + cmp r2, #0x22 + blt _0204DCC0 + add r0, sp, #0 + add r1, sp, #0x7d + mov r2, #0x20 + bl sub_02050990 + add r0, sp, #0 + mov r1, r6 + bl sub_0205C548 + add r0, sp, #0 + bl sub_020509BC + mov r3, #1 + add r2, sp, #0x7c +_0204DCFC: + ldrb r1, [r2, r3] + and r0, r3, #0xff + add r3, r3, #1 + add r0, r1, r0 + add r0, r4, r0 + cmp r3, #0x21 + and r4, r0, #0xff + blt _0204DCFC + add r1, sp, #0x7d + mov r0, r4 + mov r2, #0x20 + strb r4, [sp, #0x7c] + bl sub_0204E02C + add r0, sp, #0x46 + add r1, sp, #0x7c + mov r2, #0x36 + bl sub_0204DB08 + ldr r2, _0204DD7C ; =ARM9_UNKNOWN_TABLE__NA_209E12C + mov ip, #0 + add r4, sp, #0x46 + add r1, sp, #0x10 +_0204DD50: + ldrb r3, [r4, ip] + ldrb r0, [r2, ip] + add ip, ip, #1 + cmp ip, #0x36 + strb r3, [r1, r0] + blt _0204DD50 + mov r0, r5 + mov r2, #0x36 + bl MemcpySimple + add sp, sp, #0xa0 + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_0204DD7C: .word ARM9_UNKNOWN_TABLE__NA_209E12C + arm_func_end sub_0204DCA0 + + arm_func_start WonderMailPasswordToMission +WonderMailPasswordToMission: ; 0x0204DD80 + stmdb sp!, {r4, r5, lr} + sub sp, sp, #0x6c + mov r2, r0 + mov r4, r1 + mov r1, r2 + add r0, sp, #0x10 + mov r2, #0x22 + bl MemcpySimple + mov lr, #0 + ldr r3, _0204DE74 ; =WONDER_MAIL_BITS_SWAP + add r2, sp, #0x10 + add r0, sp, #0x32 + mov r5, lr +_0204DDB4: + mov ip, r5 + ldrb r1, [r3, lr] + b _0204DDCC +_0204DDC0: + cmp ip, r1 + beq _0204DDD4 + add ip, ip, #1 +_0204DDCC: + cmp ip, #0x22 + blt _0204DDC0 +_0204DDD4: + ldrb r1, [r2, ip] + strb r1, [r0, lr] + add lr, lr, #1 + cmp lr, #0x22 + blt _0204DDB4 + add r1, sp, #0x54 + mov r2, #0x22 + bl sub_0204DA2C + cmp r0, #0 + moveq r0, #0 + beq _0204DE6C + ldrb r0, [sp, #0x54] + add r1, sp, #0x58 + mov r2, #0x11 + bl sub_0204E0A0 + add r0, sp, #0x58 + mov r1, #0x11 + bl sub_02004F80 + mov r5, r0 + ldrb r2, [sp, #0x54] + ldr r0, _0204DE78 ; =_0209E264 + mov r1, r5 + bl Debug_Print0 + ldr r0, [sp, #0x54] + cmp r0, r5 + movne r0, #0 + bne _0204DE6C + add r0, sp, #0 + add r1, sp, #0x58 + mov r2, #0x11 + bl sub_02050974 + add r0, sp, #0 + mov r1, r4 + mov r2, #1 + bl sub_0205FD88 + add r0, sp, #0 + bl sub_020509BC + mov r0, #1 +_0204DE6C: + add sp, sp, #0x6c + ldmia sp!, {r4, r5, pc} + .align 2, 0 +_0204DE74: .word WONDER_MAIL_BITS_SWAP +_0204DE78: .word _0209E264 + arm_func_end WonderMailPasswordToMission + + arm_func_start sub_0204DE7C +sub_0204DE7C: ; 0x0204DE7C + stmdb sp!, {r4, r5, lr} + sub sp, sp, #0x6c + mov r2, #0 + mov r4, r0 + mov r5, r1 + mov r1, r2 + add r0, sp, #0x54 +_0204DE98: + strb r1, [r0, r2] + add r2, r2, #1 + cmp r2, #0x16 + blt _0204DE98 + add r0, sp, #0 + add r1, sp, #0x58 + mov r2, #0x11 + bl sub_02050990 + add r0, sp, #0 + mov r1, r5 + mov r2, #1 + bl sub_0205FE80 + add r0, sp, #0 + bl sub_020509BC + add r0, sp, #0x58 + mov r1, #0x11 + bl sub_02004F80 + mov r1, r0 + str r1, [sp, #0x54] + ldrb r2, [sp, #0x54] + ldr r0, _0204DF4C ; =_0209E264 + bl Debug_Print0 + ldrb r0, [sp, #0x54] + add r1, sp, #0x58 + mov r2, #0x11 + bl sub_0204E02C + add r0, sp, #0x32 + add r1, sp, #0x54 + mov r2, #0x22 + bl sub_0204DB08 + ldr r2, _0204DF50 ; =WONDER_MAIL_BITS_SWAP + mov lr, #0 + add ip, sp, #0x32 + add r1, sp, #0x10 +_0204DF20: + ldrb r3, [ip, lr] + ldrb r0, [r2, lr] + add lr, lr, #1 + cmp lr, #0x22 + strb r3, [r1, r0] + blt _0204DF20 + mov r0, r4 + mov r2, #0x22 + bl MemcpySimple + add sp, sp, #0x6c + ldmia sp!, {r4, r5, pc} + .align 2, 0 +_0204DF4C: .word _0209E264 +_0204DF50: .word WONDER_MAIL_BITS_SWAP + arm_func_end sub_0204DE7C + + arm_func_start sub_0204DF54 +sub_0204DF54: ; 0x0204DF54 + stmdb sp!, {r4, r5, r6, r7, r8, lr} + tst r2, #0x1f + movne r0, #0 + ldmneia sp!, {r4, r5, r6, r7, r8, pc} + mov r5, #0 + ldr ip, _0204DFAC ; =ARM9_UNKNOWN_TABLE__NA_209E280 + mov r4, r5 + b _0204DF9C +_0204DF74: + mov r6, r4 + add r7, r1, r5 + add r8, r0, r5 +_0204DF80: + ldrb lr, [r7, r6] + ldrb r3, [ip, r6] + add r6, r6, #1 + cmp r6, #0x20 + strb lr, [r8, r3] + blt _0204DF80 + add r5, r5, #0x20 +_0204DF9C: + cmp r5, r2 + blo _0204DF74 + mov r0, #1 + ldmia sp!, {r4, r5, r6, r7, r8, pc} + .align 2, 0 +_0204DFAC: .word ARM9_UNKNOWN_TABLE__NA_209E280 + arm_func_end sub_0204DF54 + + arm_func_start sub_0204DFB0 +sub_0204DFB0: ; 0x0204DFB0 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr} + tst r2, #0x1f + movne r0, #0 + ldmneia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + mov r5, #0 + mov lr, r5 + ldr ip, _0204E028 ; =ARM9_UNKNOWN_TABLE__NA_209E280 + mov r4, r5 + b _0204E018 +_0204DFD4: + mov sb, r4 + add r7, r1, r5 + add r8, r0, r5 +_0204DFE0: + mov r6, lr + ldrb r3, [ip, sb] + b _0204DFF8 +_0204DFEC: + cmp r6, r3 + beq _0204E000 + add r6, r6, #1 +_0204DFF8: + cmp r6, #0x20 + blt _0204DFEC +_0204E000: + ldrb r3, [r7, r6] + strb r3, [r8, sb] + add sb, sb, #1 + cmp sb, #0x20 + blt _0204DFE0 + add r5, r5, #0x20 +_0204E018: + cmp r5, r2 + blo _0204DFD4 + mov r0, #1 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + .align 2, 0 +_0204E028: .word ARM9_UNKNOWN_TABLE__NA_209E280 + arm_func_end sub_0204DFB0 + + arm_func_start sub_0204E02C +sub_0204E02C: ; 0x0204E02C + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, lr} + mov sl, r0 + and r0, sl, #0xf + add r0, r0, sl, asr #4 + add r0, r0, #8 + tst sl, #1 + movne r7, #1 + mov r5, #0 + mov sb, r1 + mov r8, r2 + and r6, r0, #0xff + mvneq r7, #0 + mov r1, r5 + ldr r4, _0204E09C ; =WONDER_MAIL_ENCRYPTION_TABLE + b _0204E090 +_0204E068: + mla r0, r1, r7, sl + and r0, r0, #0xff + ldrb r3, [sb, r5] + ldrb r2, [r4, r0] + add r0, r1, #1 + mov r1, r6 + add r2, r3, r2 + strb r2, [sb, r5] + bl _s32_div_f + add r5, r5, #1 +_0204E090: + cmp r5, r8 + blo _0204E068 + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, pc} + .align 2, 0 +_0204E09C: .word WONDER_MAIL_ENCRYPTION_TABLE + arm_func_end sub_0204E02C + + arm_func_start sub_0204E0A0 +sub_0204E0A0: ; 0x0204E0A0 + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, lr} + mov sl, r0 + and r0, sl, #0xf + add r0, r0, sl, asr #4 + add r0, r0, #8 + tst sl, #1 + movne r7, #1 + mov r5, #0 + mov sb, r1 + mov r8, r2 + and r6, r0, #0xff + mvneq r7, #0 + mov r1, r5 + ldr r4, _0204E110 ; =WONDER_MAIL_ENCRYPTION_TABLE + b _0204E104 +_0204E0DC: + mla r0, r1, r7, sl + and r0, r0, #0xff + ldrb r3, [sb, r5] + ldrb r2, [r4, r0] + add r0, r1, #1 + mov r1, r6 + sub r2, r3, r2 + strb r2, [sb, r5] + bl _s32_div_f + add r5, r5, #1 +_0204E104: + cmp r5, r8 + blo _0204E0DC + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, pc} + .align 2, 0 +_0204E110: .word WONDER_MAIL_ENCRYPTION_TABLE + arm_func_end sub_0204E0A0 + + arm_func_start sub_0204E114 +sub_0204E114: ; 0x0204E114 + stmdb sp!, {r4, lr} + mov r4, r0 + bl GetDungeonModeSpecial + cmp r0, #3 +#ifdef JAPAN + moveq r0, #0x37c +#else + ldreq r0, _0204E14C ; =0x00000B2C +#endif + beq _0204E144 + cmp r4, #0xd4 + ldreq r0, _0204E150 ; =0x00000B2D +#ifdef JAPAN + addne r0, r4, #0x2c8 +#else + addne r0, r4, #0x278 + addne r0, r0, #0x800 +#endif + movne r0, r0, lsl #0x10 + movne r0, r0, lsr #0x10 +_0204E144: + bl StringFromId + ldmia sp!, {r4, pc} + .align 2, 0 +#ifdef JAPAN +_0204E150: .word 0x0000037D +#else +_0204E14C: .word 0x00000B2C +_0204E150: .word 0x00000B2D +#endif + arm_func_end sub_0204E114 + + arm_func_start sub_0204E154 +sub_0204E154: ; 0x0204E154 + stmdb sp!, {r3, lr} + sub sp, sp, #0x10 + mov r3, r0 + mov r2, r1 + add r0, sp, #0 + mov r1, r3 + bl sub_02050990 + add r0, sp, #0 + bl sub_0204ABB8 + add r0, sp, #0 + bl sub_0204F9F4 + add r0, sp, #0 + bl CopyLogTo + add r0, sp, #0 + bl sub_020509BC + ldr r0, [sp, #8] + add sp, sp, #0x10 + ldmia sp!, {r3, pc} + arm_func_end sub_0204E154 + + arm_func_start sub_0204E19C +sub_0204E19C: ; 0x0204E19C + stmdb sp!, {r3, lr} + sub sp, sp, #0x10 + mov r3, r0 + mov r2, r1 + add r0, sp, #0 + mov r1, r3 + bl sub_02050974 + add r0, sp, #0 + bl sub_0204ACDC + add r0, sp, #0 + bl sub_0204FA0C + add r0, sp, #0 + bl CopyLogFrom + add r0, sp, #0 + bl sub_020509BC + ldr r0, [sp, #8] + add sp, sp, #0x10 + ldmia sp!, {r3, pc} + arm_func_end sub_0204E19C + + arm_func_start sub_0204E1E4 +sub_0204E1E4: ; 0x0204E1E4 + stmdb sp!, {r3, lr} + mov r0, #0 + bl sub_0204E8EC + ldr r1, _0204E208 ; =_022AB4F8 + mov r2, #0 + ldr r0, _0204E20C ; =_022AB5AC + strb r2, [r1, #1] + bl sub_0200C4CC + ldmia sp!, {r3, pc} + .align 2, 0 +_0204E208: .word _022AB4F8 +_0204E20C: .word _022AB5AC + arm_func_end sub_0204E1E4 + + arm_func_start sub_0204E210 +sub_0204E210: ; 0x0204E210 + stmdb sp!, {r3, lr} + bl GetGameMode + cmp r0, #1 + mov r0, #0 + bhi _0204E2AC + mov r2, r0 + mov r1, #0x32 + bl LoadScriptVariableValueAtIndex + cmp r0, #6 + cmpne r0, #0xa + mov r0, #0 + bne _0204E258 + mov r2, r0 + mov r1, #0x2e + bl LoadScriptVariableValueAtIndex + mov r0, r0, lsl #0x18 + mov r0, r0, asr #0x18 + ldmia sp!, {r3, pc} +_0204E258: + mov r1, #0x32 + mov r2, #1 + bl LoadScriptVariableValueAtIndex + cmp r0, #6 + cmpne r0, #0xa + mov r0, #0 + bne _0204E28C + mov r1, #0x2e + mov r2, #1 + bl LoadScriptVariableValueAtIndex + mov r0, r0, lsl #0x18 + mov r0, r0, asr #0x18 + ldmia sp!, {r3, pc} +_0204E28C: + mov r1, #0x32 + mov r2, #2 + bl LoadScriptVariableValueAtIndex + cmp r0, #6 + cmpne r0, #0xa + bne _0204E2D4 + mov r0, #2 + ldmia sp!, {r3, pc} +_0204E2AC: + mov r1, #0x2c + bl LoadScriptVariableValue + cmp r0, #6 + bne _0204E2D4 + mov r0, #0 + mov r1, #0x28 + bl LoadScriptVariableValue + mov r0, r0, lsl #0x18 + mov r0, r0, asr #0x18 + ldmia sp!, {r3, pc} +_0204E2D4: + mvn r0, #0 + ldmia sp!, {r3, pc} + arm_func_end sub_0204E210 + + arm_func_start sub_0204E2DC +sub_0204E2DC: ; 0x0204E2DC + stmdb sp!, {r4, lr} + mov r4, r0 + bl GetGameMode + strb r0, [r4] + cmp r0, #1 + mov r0, #0 + bhi _0204E398 + mov r2, r0 + mov r1, #0x32 + bl LoadScriptVariableValueAtIndex + cmp r0, #6 + cmpne r0, #0xa + mov r0, #0 + bne _0204E334 + mov r3, #2 + mov r2, r0 + mov r1, #0x2e + strb r3, [r4] + bl LoadScriptVariableValueAtIndex + mov r0, r0, lsl #0x18 + mov r0, r0, asr #0x18 + ldmia sp!, {r4, pc} +_0204E334: + mov r1, #0x32 + mov r2, #1 + bl LoadScriptVariableValueAtIndex + cmp r0, #6 + cmpne r0, #0xa + mov r0, #0 + bne _0204E370 + mov r3, #3 + mov r1, #0x2e + mov r2, #1 + strb r3, [r4] + bl LoadScriptVariableValueAtIndex + mov r0, r0, lsl #0x18 + mov r0, r0, asr #0x18 + ldmia sp!, {r4, pc} +_0204E370: + mov r1, #0x32 + mov r2, #2 + bl LoadScriptVariableValueAtIndex + cmp r0, #6 + cmpne r0, #0xa + bne _0204E3C0 + mov r0, #4 + strb r0, [r4] + mov r0, #2 + ldmia sp!, {r4, pc} +_0204E398: + mov r1, #0x2c + bl LoadScriptVariableValue + cmp r0, #6 + bne _0204E3C0 + mov r0, #0 + mov r1, #0x28 + bl LoadScriptVariableValue + mov r0, r0, lsl #0x18 + mov r0, r0, asr #0x18 + ldmia sp!, {r4, pc} +_0204E3C0: + mvn r0, #0 + ldmia sp!, {r4, pc} + arm_func_end sub_0204E2DC + + arm_func_start sub_0204E3C8 +sub_0204E3C8: ; 0x0204E3C8 + stmdb sp!, {r3, lr} + bl sub_02048BFC + cmp r0, #2 + bne _0204E400 + bl sub_02048CB8 + ldr r1, _0204E408 ; =0x000F1207 + cmp r0, r1 + bne _0204E400 + mov r0, #1 + mov r1, #0 + bl GetSosMailCount + cmp r0, #0 + moveq r0, #1 + ldmeqia sp!, {r3, pc} +_0204E400: + mov r0, #0 + ldmia sp!, {r3, pc} + .align 2, 0 +_0204E408: .word 0x000F1207 + arm_func_end sub_0204E3C8 + + arm_func_start sub_0204E40C +sub_0204E40C: ; 0x0204E40C + stmdb sp!, {r3, lr} + bl sub_02048BFC + cmp r0, #2 + bne _0204E458 + bl sub_02048CB8 + ldr r1, _0204E460 ; =0x000F1207 + cmp r0, r1 + bne _0204E458 + mov r0, #1 + mov r1, #0 + bl GetSosMailCount + cmp r0, #0 + bne _0204E458 + mov r0, #7 + mov r1, #0 + bl GetSosMailCount + cmp r0, #0 + movne r0, #1 + ldmneia sp!, {r3, pc} +_0204E458: + mov r0, #0 + ldmia sp!, {r3, pc} + .align 2, 0 +_0204E460: .word 0x000F1207 + arm_func_end sub_0204E40C + + arm_func_start sub_0204E464 +sub_0204E464: ; 0x0204E464 + stmdb sp!, {r3, lr} + bl sub_02048BFC + cmp r0, #2 + bne _0204E4B0 + bl sub_02048CB8 + ldr r1, _0204E4B8 ; =0x000F1207 + cmp r0, r1 + bne _0204E4B0 + mov r0, #1 + mov r1, #0 + bl GetSosMailCount + cmp r0, #0 + beq _0204E4B0 + mov r0, #7 + mov r1, #0 + bl GetSosMailCount + cmp r0, #0 + moveq r0, #1 + ldmeqia sp!, {r3, pc} +_0204E4B0: + mov r0, #0 + ldmia sp!, {r3, pc} + .align 2, 0 +_0204E4B8: .word 0x000F1207 + arm_func_end sub_0204E464 + + arm_func_start sub_0204E4BC +sub_0204E4BC: ; 0x0204E4BC + stmdb sp!, {r3, lr} + bl sub_02048BFC + cmp r0, #2 + bne _0204E4E0 + bl sub_02048CB8 + ldr r1, _0204E4E8 ; =0x000F1207 + cmp r0, r1 + moveq r0, #0 + ldmeqia sp!, {r3, pc} +_0204E4E0: + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_0204E4E8: .word 0x000F1207 + arm_func_end sub_0204E4BC + + arm_func_start sub_0204E4EC +sub_0204E4EC: ; 0x0204E4EC + stmdb sp!, {r4, lr} + bl sub_02048CB8 + mov r4, r0 + bl sub_02048BFC + cmp r0, #2 + bne _0204E524 + ldr r1, _0204E52C ; =0x000F1207 + cmp r4, r1 + addne r0, r1, #1 + cmpne r4, r0 + addne r0, r1, #3 + cmpne r4, r0 + movne r0, #1 + ldmneia sp!, {r4, pc} +_0204E524: + mov r0, #0 + ldmia sp!, {r4, pc} + .align 2, 0 +_0204E52C: .word 0x000F1207 + arm_func_end sub_0204E4EC + + arm_func_start sub_0204E530 +sub_0204E530: ; 0x0204E530 + stmdb sp!, {r3, lr} + bl sub_02048BFC + cmp r0, #1 + bne _0204E57C + mov r0, #1 + mov r1, #0 + bl GetSosMailCount + cmp r0, #0 + bne _0204E57C + mov r0, #7 + mov r1, #0 + bl GetSosMailCount + cmp r0, #0 + bne _0204E57C + bl sub_0204E210 + mvn r1, #0 + cmp r0, r1 + moveq r0, #1 + ldmeqia sp!, {r3, pc} +_0204E57C: + mov r0, #0 + ldmia sp!, {r3, pc} + arm_func_end sub_0204E530 + + arm_func_start sub_0204E584 +sub_0204E584: ; 0x0204E584 + stmdb sp!, {r3, lr} + bl sub_02048BFC + cmp r0, #1 + bne _0204E5DC + mov r0, #1 + mov r1, #0 + bl GetSosMailCount + cmp r0, #0 + bne _0204E5DC + mov r0, #7 + mov r1, #0 + bl GetSosMailCount + cmp r0, #0 + bne _0204E5DC + bl sub_0204E210 + mvn r1, #0 + cmp r0, r1 + bne _0204E5DC + bl sub_0205633C + cmp r0, #0 + moveq r0, #1 + ldmeqia sp!, {r3, pc} +_0204E5DC: + mov r0, #0 + ldmia sp!, {r3, pc} + arm_func_end sub_0204E584 + + arm_func_start sub_0204E5E4 +sub_0204E5E4: ; 0x0204E5E4 + stmdb sp!, {r3, lr} + bl sub_02048BFC + cmp r0, #1 + bne _0204E63C + mov r0, #1 + mov r1, #0 + bl GetSosMailCount + cmp r0, #0 + bne _0204E63C + mov r0, #7 + mov r1, #0 + bl GetSosMailCount + cmp r0, #0 + bne _0204E63C + bl sub_0204E210 + mvn r1, #0 + cmp r0, r1 + bne _0204E63C + bl sub_02056360 + cmp r0, #0 + moveq r0, #1 + ldmeqia sp!, {r3, pc} +_0204E63C: + mov r0, #0 + ldmia sp!, {r3, pc} + arm_func_end sub_0204E5E4 + + arm_func_start sub_0204E644 +sub_0204E644: ; 0x0204E644 + stmdb sp!, {r3, lr} + mov r0, #4 + bl GetPerformanceFlagWithChecks + cmp r0, #0 + beq _0204E69C + bl sub_02048BFC + cmp r0, #1 + bne _0204E69C + mov r0, #1 + mov r1, #0 + bl GetSosMailCount + cmp r0, #0 + bne _0204E69C + mov r0, #7 + mov r1, #0 + bl GetSosMailCount + cmp r0, #0 + bne _0204E69C + bl sub_0205633C + cmp r0, #0 + moveq r0, #1 + ldmeqia sp!, {r3, pc} +_0204E69C: + mov r0, #0 + ldmia sp!, {r3, pc} + arm_func_end sub_0204E644 + + arm_func_start sub_0204E6A4 +sub_0204E6A4: ; 0x0204E6A4 + stmdb sp!, {r3, lr} + bl sub_02048BFC + cmp r0, #2 + bne _0204E6F0 + bl sub_02048CB8 + ldr r1, _0204E6F8 ; =0x000F1207 + cmp r0, r1 + bne _0204E6F0 + mov r0, #1 + mov r1, #0 + bl GetSosMailCount + cmp r0, #0 + beq _0204E6F0 + mov r0, #7 + mov r1, #0 + bl GetSosMailCount + cmp r0, #0 + moveq r0, #1 + ldmeqia sp!, {r3, pc} +_0204E6F0: + mov r0, #0 + ldmia sp!, {r3, pc} + .align 2, 0 +_0204E6F8: .word 0x000F1207 + arm_func_end sub_0204E6A4 + + arm_func_start sub_0204E6FC +sub_0204E6FC: ; 0x0204E6FC + ldr r0, _0204E708 ; =_022AB4FC + ldrsb r0, [r0, #0xd] + bx lr + .align 2, 0 +_0204E708: .word _022AB4FC + arm_func_end sub_0204E6FC + + arm_func_start sub_0204E70C +sub_0204E70C: ; 0x0204E70C + stmdb sp!, {r4, lr} + ldr r0, _0204E75C ; =_022AB4FC + ldrsb r4, [r0, #0xd] + and r1, r4, #0xff + cmp r1, #1 + bhi _0204E754 + ldrsh r0, [r0, #2] + bl GetDungeonModeSpecial + cmp r0, #1 + beq _0204E744 + cmp r0, #2 + beq _0204E74C + cmp r0, #3 + bne _0204E754 +_0204E744: + mov r0, #0 + ldmia sp!, {r4, pc} +_0204E74C: + mov r0, #1 + ldmia sp!, {r4, pc} +_0204E754: + mov r0, r4 + ldmia sp!, {r4, pc} + .align 2, 0 +_0204E75C: .word _022AB4FC + arm_func_end sub_0204E70C + + arm_func_start sub_0204E760 +sub_0204E760: ; 0x0204E760 + ldr r0, _0204E76C ; =_022AB4FC + ldrsh r0, [r0, #2] + bx lr + .align 2, 0 +_0204E76C: .word _022AB4FC + arm_func_end sub_0204E760 + + arm_func_start sub_0204E770 +sub_0204E770: ; 0x0204E770 + ldr r0, _0204E77C ; =_022AB4FC + ldrb r0, [r0] + bx lr + .align 2, 0 +_0204E77C: .word _022AB4FC + arm_func_end sub_0204E770 + + arm_func_start sub_0204E780 +sub_0204E780: ; 0x0204E780 + ldr r0, _0204E78C ; =_022AB4FC + ldrb r0, [r0, #0x14] + bx lr + .align 2, 0 +_0204E78C: .word _022AB4FC + arm_func_end sub_0204E780 + + arm_func_start sub_0204E790 +sub_0204E790: ; 0x0204E790 + stmdb sp!, {r4, lr} + ldr lr, _0204E7B4 ; =_022AB4FC + mov r4, r0 + mov ip, #0xb +_0204E7A0: + ldmia lr!, {r0, r1, r2, r3} + stmia r4!, {r0, r1, r2, r3} + subs ip, ip, #1 + bne _0204E7A0 + ldmia sp!, {r4, pc} + .align 2, 0 +_0204E7B4: .word _022AB4FC + arm_func_end sub_0204E790 + + arm_func_start sub_0204E7B8 +sub_0204E7B8: ; 0x0204E7B8 + stmdb sp!, {r3, lr} + ldr r1, _0204E8E0 ; =_022AB4FC + mov r0, #0 + ldrsb r2, [r1, #0xd] + mov r1, #0x28 + bl SaveScriptVariableValue + ldr r1, _0204E8E0 ; =_022AB4FC + mov r0, #0 + ldrsh r2, [r1, #2] + mov r1, #0x27 + bl SaveScriptVariableValue + ldr r1, _0204E8E0 ; =_022AB4FC + mov r0, #0 + ldrsh r2, [r1, #2] + mov r1, #0x29 + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x2c + mov r2, #6 + bl SaveScriptVariableValue + mov r0, #0 + mov r1, #0x2b + mov r2, #6 + bl SaveScriptVariableValue + ldr r0, _0204E8E0 ; =_022AB4FC + ldrsb r0, [r0, #0xd] + cmp r0, #3 + addls pc, pc, r0, lsl #2 + b _0204E8D4 +_0204E82C: ; jump table + b _0204E8D4 ; case 0 + b _0204E83C ; case 1 + b _0204E8B0 ; case 2 + b _0204E8D4 ; case 3 +_0204E83C: + mov r0, #0 + mov r1, #0x27 + mov r2, #0xd7 + bl SaveScriptVariableValue + ldr r0, _0204E8E0 ; =_022AB4FC + ldr r1, _0204E8E4 ; =_022AB518 + ldrb r0, [r0] + bl sub_0205F00C + cmp r0, #0 + beq _0204E8D4 + ldr r1, _0204E8E0 ; =_022AB4FC + ldrb r1, [r1, #0x1d] + cmp r1, #0 + beq _0204E8A0 + add r0, r0, #4 + bl sub_0204F7A8 + ldr r1, _0204E8E8 ; =CLIENT_LEVEL_TABLE + mov r0, r0, lsl #1 + ldrsh r1, [r1, r0] + ldr r3, _0204E8E0 ; =_022AB4FC + mov ip, #1 + ldr r0, _0204E8E4 ; =_022AB518 + mov r2, #0 + strb ip, [r3, #0x1d] + bl sub_020544C8 +_0204E8A0: + ldr r0, _0204E8E0 ; =_022AB4FC + mov r1, #1 + strb r1, [r0, #0xf] + b _0204E8D4 +_0204E8B0: + mov r0, #0 + mov r1, #0x27 + mov r2, #0xd6 + bl SaveScriptVariableValue + ldr r1, _0204E8E0 ; =_022AB4FC + mov r0, #0 + ldrsb r2, [r1, #0x12] + mov r1, #0x29 + bl SaveScriptVariableValue +_0204E8D4: + ldr r0, _0204E8E0 ; =_022AB4FC + ldrsb r0, [r0, #0xd] + ldmia sp!, {r3, pc} + .align 2, 0 +_0204E8E0: .word _022AB4FC +_0204E8E4: .word _022AB518 +_0204E8E8: .word CLIENT_LEVEL_TABLE + arm_func_end sub_0204E7B8 + + arm_func_start sub_0204E8EC +sub_0204E8EC: ; 0x0204E8EC + stmdb sp!, {r4, lr} + movs r4, r0 + beq _0204E920 + ldr lr, _0204E944 ; =_022AB4FC + mov ip, #0xb +_0204E900: + ldmia r4!, {r0, r1, r2, r3} + stmia lr!, {r0, r1, r2, r3} + subs ip, ip, #1 + bne _0204E900 + ldr r0, _0204E948 ; =_022AB4F8 + mov r1, #1 + strb r1, [r0] + ldmia sp!, {r4, pc} +_0204E920: + mov r3, #0 + ldr r0, _0204E944 ; =_022AB4FC + sub r2, r3, #1 + strb r2, [r0, #0xd] + ldr r1, _0204E948 ; =_022AB4F8 + strb r2, [r0, #0xe] + strb r3, [r1] + strh r2, [r0, #2] + ldmia sp!, {r4, pc} + .align 2, 0 +_0204E944: .word _022AB4FC +_0204E948: .word _022AB4F8 + arm_func_end sub_0204E8EC + + arm_func_start SetEnterDungeon +SetEnterDungeon: ; 0x0204E94C + stmdb sp!, {r3, lr} + mov r1, r0 + ldr r0, _0204E96C ; =_022AB4FC + bl InitDungeonInit + ldr r0, _0204E970 ; =_022AB4F8 + mov r1, #1 + strb r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_0204E96C: .word _022AB4FC +_0204E970: .word _022AB4F8 + arm_func_end SetEnterDungeon + + arm_func_start sub_0204E974 +sub_0204E974: ; 0x0204E974 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + bl sub_0205B77C + ldr r2, _0204EA4C ; =_022AB4FC + mov r1, #2 + mov r4, r0 + strb r1, [r2, #0xd] + sub r0, r1, #3 + strb r0, [r2, #0xe] + mov r0, #0xd6 + strh r0, [r2, #2] + ldr r0, _0204EA50 ; =_022AB510 + mov r1, r5 + strb r5, [r2, #0x12] + bl sub_0205BB7C + ldr r0, _0204EA54 ; =_022AB5A8 + mov r1, r5 + bl sub_0205BD14 + ldr r1, _0204EA4C ; =_022AB4FC + mov r2, #0 + strb r2, [r1, #0xf] + strb r2, [r1, #0x10] + strb r2, [r1, #4] + mov r0, #7 + strb r2, [r1, #0x11] + bl GetPerformanceFlagWithChecks + ldr r1, _0204EA4C ; =_022AB4FC + mov r2, #0 + strb r0, [r1, #5] + mov r0, #6 + strb r2, [r1, #6] + bl GetPerformanceFlagWithChecks + ldr r1, _0204EA4C ; =_022AB4FC + strb r0, [r1, #8] + mov r0, #1 + bl GetPerformanceFlagWithChecks + ldr r1, _0204EA4C ; =_022AB4FC + mov r2, #0 + strb r0, [r1, #9] + strb r2, [r1, #0xa] + strb r2, [r1, #0xb] + strb r2, [r1, #7] + strb r2, [r1, #0xc] + ldrb r0, [r4, #4] + add r0, r0, #0xda + and r0, r0, #0xff + cmp r0, #5 + strlsb r2, [r1, #5] + movls r0, #1 + strlsb r0, [r1, #7] + ldr r0, _0204EA58 ; =_022AB4F8 + mov r1, #1 + strb r1, [r0] + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_0204EA4C: .word _022AB4FC +_0204EA50: .word _022AB510 +_0204EA54: .word _022AB5A8 +_0204EA58: .word _022AB4F8 + arm_func_end sub_0204E974 + + arm_func_start InitDungeonInit +InitDungeonInit: ; 0x0204EA5C + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r7, r0 + mov r6, r1 + bl GetGameMode + mov r4, r0 + mov r0, r6 + strh r6, [r7, #2] + bl DungeonSwapIdxToId + strb r0, [r7] + mov r1, #1 + strb r1, [r7, #1] + sub r1, r1, #2 + strb r1, [r7, #0x12] + mov r0, #0 + str r0, [r7, #0xac] + strb r0, [r7, #0xd] + strb r1, [r7, #0xe] + strb r0, [r7, #4] + strb r0, [r7, #0xf] + strb r0, [r7, #0x10] + strb r0, [r7, #0x11] + cmp r4, #2 + strneb r0, [r7, #5] + strneb r0, [r7, #6] + strneb r0, [r7, #8] + bne _0204EAF0 + mov r0, #7 + bl GetPerformanceFlagWithChecks + strb r0, [r7, #5] + mov r0, #5 + bl GetPerformanceFlagWithChecks + strb r0, [r7, #6] + mov r0, #6 + bl GetPerformanceFlagWithChecks + strb r0, [r7, #8] + mov r0, #1 + bl GetPerformanceFlagWithChecks +_0204EAF0: + strb r0, [r7, #9] + mov r3, #0 + strb r3, [r7, #0xa] + strb r3, [r7, #0xb] + strb r3, [r7, #7] + strb r3, [r7, #0xc] + mov r1, r3 + mov r0, #0x44 +_0204EB10: + mla r2, r3, r0, r7 + strb r1, [r2, #0x1c] + add r3, r3, #1 + strh r1, [r2, #0x20] + cmp r3, #2 + blt _0204EB10 + cmp r4, #5 + bne _0204EB88 + mov r0, #1 + strb r0, [r7, #5] + strb r1, [r7, #6] + strb r1, [r7, #8] + strb r1, [r7, #9] + strb r1, [r7, #0xb] + mov r0, #3 + strb r0, [r7, #0xd] + strb r1, [r7, #4] + sub r0, r6, #0x26 + strb r1, [r7, #0x11] + cmp r0, #5 + addls pc, pc, r0, lsl #2 + b _0204EB84 +_0204EB68: ; jump table + b _0204EB80 ; case 0 + b _0204EB80 ; case 1 + b _0204EB80 ; case 2 + b _0204EB80 ; case 3 + b _0204EB80 ; case 4 + b _0204EB80 ; case 5 +_0204EB80: + strb r1, [r7, #5] +_0204EB84: + ldmia sp!, {r3, r4, r5, r6, r7, pc} +_0204EB88: + mov r0, r6 + bl GetDungeonModeSpecial + cmp r0, #1 + beq _0204EBB0 + cmp r0, #2 + beq _0204EF50 + cmp r0, #3 + moveq r0, #0 + streqb r0, [r7, #0xd] + b _0204EF88 +_0204EBB0: + mov r4, #0 + mov r0, r6 + strb r4, [r7, #0xd] + mov r5, r4 + bl IsNoLossPenaltyDungeon + strb r0, [r7, #0xc] + cmp r6, #0x44 + bgt _0204ECA4 + bge _0204EE70 + cmp r6, #0x3e + bgt _0204EC60 + bge _0204EE68 + cmp r6, #0x21 + bgt _0204EC1C + bge _0204EDEC + cmp r6, #0xb + bgt _0204EC10 + subs r0, r6, #8 + addpl pc, pc, r0, lsl #2 + b _0204EF34 +_0204EC00: ; jump table + b _0204ED88 ; case 0 + b _0204ED9C ; case 1 + b _0204EDB0 ; case 2 + b _0204EDC4 ; case 3 +_0204EC10: + cmp r6, #0x20 + beq _0204EDD8 + b _0204EF34 +_0204EC1C: + cmp r6, #0x22 + bgt _0204EC2C + beq _0204EE10 + b _0204EF34 +_0204EC2C: + sub r0, r6, #0x23 + cmp r0, #8 + addls pc, pc, r0, lsl #2 + b _0204EF34 +_0204EC3C: ; jump table + b _0204EE24 ; case 0 + b _0204EF34 ; case 1 + b _0204EF34 ; case 2 + b _0204EE48 ; case 3 + b _0204EE48 ; case 4 + b _0204EE48 ; case 5 + b _0204EE60 ; case 6 + b _0204EE60 ; case 7 + b _0204EE60 ; case 8 +_0204EC60: + cmp r6, #0x41 + bgt _0204EC88 + bge _0204EE68 + cmp r6, #0x3f + bgt _0204EC7C + beq _0204EE68 + b _0204EF34 +_0204EC7C: + cmp r6, #0x40 + beq _0204EE68 + b _0204EF34 +_0204EC88: + cmp r6, #0x42 + bgt _0204EC98 + beq _0204EE68 + b _0204EF34 +_0204EC98: + cmp r6, #0x43 + beq _0204EE70 + b _0204EF34 +_0204ECA4: + cmp r6, #0x73 + bgt _0204ECF4 + bge _0204EE88 + cmp r6, #0x70 + bgt _0204ECD8 + bge _0204EE88 + cmp r6, #0x45 + bgt _0204ECCC + beq _0204EE70 + b _0204EF34 +_0204ECCC: + cmp r6, #0x6f + beq _0204EE88 + b _0204EF34 +_0204ECD8: + cmp r6, #0x71 + bgt _0204ECE8 + beq _0204EE88 + b _0204EF34 +_0204ECE8: + cmp r6, #0x72 + beq _0204EE88 + b _0204EF34 +_0204ECF4: + cmp r6, #0x76 + bgt _0204ED1C + bge _0204EE88 + cmp r6, #0x74 + bgt _0204ED10 + beq _0204EE88 + b _0204EF34 +_0204ED10: + cmp r6, #0x75 + beq _0204EE88 + b _0204EF34 +_0204ED1C: + cmp r6, #0x87 + bgt _0204ED7C + subs r0, r6, #0x78 + addpl pc, pc, r0, lsl #2 + b _0204ED70 +_0204ED30: ; jump table + b _0204EE88 ; case 0 + b _0204EE88 ; case 1 + b _0204EE88 ; case 2 + b _0204EE9C ; case 3 + b _0204EEC4 ; case 4 + b _0204EF34 ; case 5 + b _0204EF34 ; case 6 + b _0204EF34 ; case 7 + b _0204EEEC ; case 8 + b _0204EF34 ; case 9 + b _0204EF34 ; case 10 + b _0204EF34 ; case 11 + b _0204EF34 ; case 12 + b _0204EF34 ; case 13 + b _0204EF34 ; case 14 + b _0204EF10 ; case 15 +_0204ED70: + cmp r6, #0x77 + beq _0204EE88 + b _0204EF34 +_0204ED7C: + cmp r6, #0xa4 + beq _0204EF24 + b _0204EF34 +_0204ED88: + ldr r2, _0204EF98 ; =_020A2904 + mov r0, r7 + mov r1, r4 + bl AddGuestMonster + b _0204EF34 +_0204ED9C: + ldr r2, _0204EF9C ; =_020A2AD8 + mov r0, r7 + mov r1, r4 + bl AddGuestMonster + b _0204EF34 +_0204EDB0: + ldr r2, _0204EFA0 ; =_020A2AB4 + mov r0, r7 + mov r1, r4 + bl AddGuestMonster + b _0204EF34 +_0204EDC4: + ldr r2, _0204EFA4 ; =_020A294C + mov r0, r7 + mov r1, r4 + bl AddGuestMonster + b _0204EF34 +_0204EDD8: + ldr r2, _0204EFA8 ; =_020A2970 + mov r0, r7 + mov r1, #0 + bl AddGuestMonster + b _0204EF34 +_0204EDEC: + ldr r2, _0204EFAC ; =_020A2A48 + mov r0, r7 + mov r1, r4 + bl AddGuestMonster + ldr r2, _0204EFB0 ; =_020A2A24 + mov r0, r7 + mov r1, #1 + bl AddGuestMonster + b _0204EF34 +_0204EE10: + ldr r2, _0204EFB4 ; =_020A29DC + mov r0, r7 + mov r1, r4 + bl AddGuestMonster + b _0204EF34 +_0204EE24: + mov r0, #0x19 + bl GetPerformanceFlagWithChecks + cmp r0, #0 + bne _0204EF34 + ldr r2, _0204EFB8 ; =_020A2A00 + mov r0, r7 + mov r1, r4 + bl AddGuestMonster + b _0204EF34 +_0204EE48: + ldr r2, _0204EFBC ; =_020A2A6C + mov r0, r7 + mov r1, r4 + mov r5, #1 + bl AddGuestMonster + b _0204EF34 +_0204EE60: + mov r4, #1 + b _0204EF34 +_0204EE68: + mov r4, #1 + b _0204EF34 +_0204EE70: + ldr r2, _0204EFC0 ; =_020A2A90 + mov r0, r7 + mov r1, #0 + bl AddGuestMonster + mov r4, #1 + b _0204EF34 +_0204EE88: + ldr r2, _0204EFC4 ; =_020A2AFC + mov r0, r7 + mov r1, #0 + bl AddGuestMonster + b _0204EF34 +_0204EE9C: + mov r0, r4 + mov r1, #0x10 + bl LoadScriptVariableValue + cmp r0, #0 + bne _0204EF34 + ldr r2, _0204EFC8 ; =_020A2B20 + mov r0, r7 + mov r1, r4 + bl AddGuestMonster + b _0204EF34 +_0204EEC4: + mov r0, r4 + mov r1, #0x10 + bl LoadScriptVariableValue + cmp r0, #0 + bne _0204EF34 + ldr r2, _0204EFCC ; =_020A2928 + mov r0, r7 + mov r1, r4 + bl AddGuestMonster + b _0204EF34 +_0204EEEC: + ldr r2, _0204EFD0 ; =GUEST_MONSTER_DATA + mov r0, r7 + mov r1, r4 + bl AddGuestMonster + ldr r2, _0204EFD4 ; =_020A28E0 + mov r0, r7 + mov r1, #1 + bl AddGuestMonster + b _0204EF34 +_0204EF10: + ldr r2, _0204EFD8 ; =_020A29B8 + mov r0, r7 + mov r1, r4 + bl AddGuestMonster + b _0204EF34 +_0204EF24: + ldr r2, _0204EFDC ; =_020A2994 + mov r0, r7 + mov r1, r4 + bl AddGuestMonster +_0204EF34: + cmp r4, #0 + movne r0, #1 + strneb r0, [r7, #0xb] + cmp r5, #0 + movne r0, #1 + strneb r0, [r7, #7] + b _0204EF88 +_0204EF50: + sub r0, r6, #0x26 + cmp r0, #5 + addls pc, pc, r0, lsl #2 + b _0204EF80 +_0204EF60: ; jump table + b _0204EF78 ; case 0 + b _0204EF78 ; case 1 + b _0204EF78 ; case 2 + b _0204EF78 ; case 3 + b _0204EF78 ; case 4 + b _0204EF78 ; case 5 +_0204EF78: + mov r0, #1 + strb r0, [r7, #0xb] +_0204EF80: + mov r0, #1 + strb r0, [r7, #0xd] +_0204EF88: + mov r0, #0 + strb r0, [r7, #4] + strb r0, [r7, #0x11] + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_0204EF98: .word _020A2904 +_0204EF9C: .word _020A2AD8 +_0204EFA0: .word _020A2AB4 +_0204EFA4: .word _020A294C +_0204EFA8: .word _020A2970 +_0204EFAC: .word _020A2A48 +_0204EFB0: .word _020A2A24 +_0204EFB4: .word _020A29DC +_0204EFB8: .word _020A2A00 +_0204EFBC: .word _020A2A6C +_0204EFC0: .word _020A2A90 +_0204EFC4: .word _020A2AFC +_0204EFC8: .word _020A2B20 +_0204EFCC: .word _020A2928 +_0204EFD0: .word GUEST_MONSTER_DATA +_0204EFD4: .word _020A28E0 +_0204EFD8: .word _020A29B8 +_0204EFDC: .word _020A2994 + arm_func_end InitDungeonInit + + arm_func_start IsNoLossPenaltyDungeon +IsNoLossPenaltyDungeon: ; 0x0204EFE0 + stmdb sp!, {r4, lr} + cmp r0, #0x1a + mov r4, #0 + cmpne r0, #0x79 + beq _0204F000 + cmp r0, #0x7d + beq _0204F008 + b _0204F01C +_0204F000: + mov r4, #1 + b _0204F01C +_0204F008: + mov r0, r4 + mov r1, #0x10 + bl LoadScriptVariableValue + cmp r0, #0 + moveq r4, #1 +_0204F01C: + mov r0, r4 + ldmia sp!, {r4, pc} + arm_func_end IsNoLossPenaltyDungeon + + arm_func_start sub_0204F024 +sub_0204F024: ; 0x0204F024 + ldr r1, _0204F030 ; =_022AB4FC + strb r0, [r1, #0xe] + bx lr + .align 2, 0 +_0204F030: .word _022AB4FC + arm_func_end sub_0204F024 + + arm_func_start sub_0204F034 +sub_0204F034: ; 0x0204F034 + stmdb sp!, {r3, lr} + mov r0, #0 + mov r1, #0x28 + bl LoadScriptVariableValue + mov r0, r0, lsl #0x18 + mov r0, r0, asr #0x18 + ldmia sp!, {r3, pc} + arm_func_end sub_0204F034 + + arm_func_start sub_0204F050 +sub_0204F050: ; 0x0204F050 + stmdb sp!, {r3, lr} + mov r0, #0 + mov r1, #0x27 + bl LoadScriptVariableValue + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + mvn r1, #0 + cmp r0, r1 + cmpne r0, #0xd6 + ldmeqia sp!, {r3, pc} + cmp r0, #0xd7 + cmpeq r0, #0xd9 + cmpeq r0, #0xd8 + ldmeqia sp!, {r3, pc} + mov r0, #0 + mov r1, #0x29 + bl LoadScriptVariableValue + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + ldmia sp!, {r3, pc} + arm_func_end sub_0204F050 + + arm_func_start sub_0204F0A0 +sub_0204F0A0: ; 0x0204F0A0 + stmdb sp!, {r3, lr} + mov r0, #0 + mov r1, #0x27 + bl LoadScriptVariableValue + mov r0, r0, lsl #0x10 + mvn r1, #0 + cmp r1, r0, asr #16 + mov r0, r0, asr #0x10 + moveq r0, #0xff + ldmeqia sp!, {r3, pc} + cmp r0, #0xd6 + moveq r0, #0xd4 + ldmeqia sp!, {r3, pc} + sub r1, r0, #0xd7 + mov r1, r1, lsl #0x10 + mov r1, r1, asr #0x10 + mov r1, r1, lsl #0x10 + mov r1, r1, lsr #0x10 + cmp r1, #2 + bhi _0204F104 + mov r0, #0 + mov r1, #0x29 + bl LoadScriptVariableValue + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 +_0204F104: + bl DungeonSwapIdxToId + ldmia sp!, {r3, pc} + arm_func_end sub_0204F0A0 + + arm_func_start sub_0204F10C +sub_0204F10C: ; 0x0204F10C + stmdb sp!, {r4, lr} + mov r4, r0 + mov r0, #0 + mov r1, #0x27 + bl LoadScriptVariableValue + mov r0, r0, lsl #0x10 + mov r1, r0, asr #0x10 + mvn r0, #0 + cmp r1, r0 + cmpne r1, #0xd6 + cmpne r1, #0xd7 + cmpne r1, #0xd8 + cmpne r1, #0xd9 + movne r0, #1 + strneh r1, [r4] + mvneq r0, #0 + streqh r0, [r4] + moveq r0, #0 + ldmia sp!, {r4, pc} + arm_func_end sub_0204F10C + + arm_func_start sub_0204F158 +sub_0204F158: ; 0x0204F158 + stmdb sp!, {r4, lr} + mov r4, r0 + mov r0, #0 + mov r1, #0x27 + bl LoadScriptVariableValue + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + cmp r0, #0xd7 + bne _0204F1AC + mov r0, #0 + mov r1, #0x29 + bl LoadScriptVariableValue + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + bl DungeonSwapIdxToId + cmp r0, #0xff + beq _0204F1AC + cmp r0, #0xb4 + strlob r0, [r4] + movlo r0, #1 + ldmloia sp!, {r4, pc} +_0204F1AC: + mov r0, #0 + ldmia sp!, {r4, pc} + arm_func_end sub_0204F158 + + arm_func_start sub_0204F1B4 +sub_0204F1B4: ; 0x0204F1B4 + stmdb sp!, {r4, lr} + mov r4, r0 + mov r0, #0 + mov r1, #0x27 + bl LoadScriptVariableValue + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + cmp r0, #0xd6 + mov r0, #0 + ldmneia sp!, {r4, pc} + mov r1, #0x29 + bl LoadScriptVariableValue + strb r0, [r4] + mov r0, #1 + ldmia sp!, {r4, pc} + arm_func_end sub_0204F1B4 + + arm_func_start sub_0204F1F0 +sub_0204F1F0: ; 0x0204F1F0 + stmdb sp!, {r3, r4, r5, lr} + movs r5, r0 + mov r4, r1 + beq _0204F22C + ldr lr, _0204F23C ; =_022AB5AC + mov ip, #0xe +_0204F208: + ldmia r5!, {r0, r1, r2, r3} + stmia lr!, {r0, r1, r2, r3} + subs ip, ip, #1 + bne _0204F208 + ldmia r5, {r0, r1} + ldr r2, _0204F240 ; =_022AB4F8 + stmia lr, {r0, r1} + strb r4, [r2, #1] + ldmia sp!, {r3, r4, r5, pc} +_0204F22C: + ldr r0, _0204F240 ; =_022AB4F8 + mov r1, #0 + strb r1, [r0, #1] + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_0204F23C: .word _022AB5AC +_0204F240: .word _022AB4F8 + arm_func_end sub_0204F1F0 + + arm_func_start sub_0204F244 +sub_0204F244: ; 0x0204F244 + stmdb sp!, {r4, lr} + movs r4, r0 + beq _0204F270 + ldr lr, _0204F27C ; =_022AB5AC + mov ip, #0xe +_0204F258: + ldmia lr!, {r0, r1, r2, r3} + stmia r4!, {r0, r1, r2, r3} + subs ip, ip, #1 + bne _0204F258 + ldmia lr, {r0, r1} + stmia r4, {r0, r1} +_0204F270: + ldr r0, _0204F280 ; =_022AB4F8 + ldrb r0, [r0, #1] + ldmia sp!, {r4, pc} + .align 2, 0 +_0204F27C: .word _022AB5AC +_0204F280: .word _022AB4F8 + arm_func_end sub_0204F244 + + arm_func_start sub_0204F284 +sub_0204F284: ; 0x0204F284 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #8 + mov sl, r0 + add r0, sp, #0 + mov sb, r1 + bl GetPartyMembers + mov r6, r0 + mov r0, sl + bl GetMaxMembersAllowed + cmp r6, r0 + ble _0204F2C0 + cmp r0, #1 + ldreq r0, _0204F354 ; =0x00000301 + ldrne r0, _0204F358 ; =0x00000101 + b _0204F34C +_0204F2C0: + cmp sb, #0 + beq _0204F2D8 + add r0, r6, #1 + cmp r0, #4 + ldrgt r0, _0204F358 ; =0x00000101 + bgt _0204F34C +_0204F2D8: + mov r7, #0 + mov r8, r7 + add r5, sp, #0 + ldr r4, _0204F35C ; =TEAM_MEMBER_TABLE_PTR + mov fp, #0x44 + b _0204F310 +_0204F2F0: + mov r0, r8, lsl #1 + ldrsh r0, [r5, r0] + ldr r1, [r4] + smlabb r0, r0, fp, r1 + ldrsh r0, [r0, #4] + bl GetBodySize + add r7, r7, r0 + add r8, r8, #1 +_0204F310: + cmp r8, r6 + blt _0204F2F0 + cmp sb, #0 + beq _0204F32C + mov r0, sb + bl GetBodySize + add r7, r7, r0 +_0204F32C: + cmp r7, #6 + movgt r0, #0x81 + bgt _0204F34C + mov r0, sl + bl IsLevelResetDungeon + cmp r0, #0 + ldrne r0, _0204F360 ; =0x00002002 + moveq r0, #0 +_0204F34C: + add sp, sp, #8 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_0204F354: .word 0x00000301 +_0204F358: .word 0x00000101 +_0204F35C: .word TEAM_MEMBER_TABLE_PTR +_0204F360: .word 0x00002002 + arm_func_end sub_0204F284 + + arm_func_start sub_0204F364 +sub_0204F364: ; 0x0204F364 + stmdb sp!, {r4, r5, r6, lr} + mov r6, r0 + mov r5, #0 + bl GetMaxItemsAllowed + mov r4, r0 + bl GetNbItemsInBag + cmp r4, #0 + ble _0204F39C + cmp r4, r0 + bge _0204F39C + orr r5, r5, #2 + cmp r4, #0 + orreq r5, r5, #0x800 + orrne r5, r5, #0x400 +_0204F39C: + mov r0, r6 + bl IsMoneyAllowed + cmp r0, #0 + bne _0204F3BC + bl GetMoneyCarried + cmp r0, #0 + orrgt r5, r5, #2 + orrgt r5, r5, #0x1000 +_0204F3BC: + mov r0, r5 + ldmia sp!, {r4, r5, r6, pc} + arm_func_end sub_0204F364 + + arm_func_start CheckMissionRestrictions +CheckMissionRestrictions: ; 0x0204F3C4 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + bl GetGameMode + cmp r0, #2 + bne _0204F424 + mov r0, r5 + bl DungeonSwapIdToIdx + bl GetDungeonModeSpecial + cmp r0, #2 + bne _0204F424 + add r1, sp, #2 + add r2, sp, #0 + mov r0, r5 + bl sub_0205EE40 + cmp r0, #0 + beq _0204F424 + ldrsh r0, [sp] + cmp r0, #0 + movne r0, #0x21 + ldmneia sp!, {r3, r4, r5, pc} + ldrh r0, [sp, #2] + cmp r0, #0 + movne r0, #0x41 + ldmneia sp!, {r3, r4, r5, pc} +_0204F424: + cmp r5, #0x26 + cmpne r5, #0x29 + cmpne r5, #0x3f + cmpne r5, #0x63 + cmpne r5, #0x64 + cmpne r5, #0x65 + cmpne r5, #0x66 + cmpne r5, #0x67 + cmpne r5, #0x68 + cmpne r5, #0x6b + cmpne r5, #0x6c + cmpne r5, #0x6d + cmpne r5, #0x6e + cmpne r5, #0xae + ldreq r0, _0204F484 ; =0x00004001 + ldmeqia sp!, {r3, r4, r5, pc} + mov r0, r5 + mov r1, #0 + bl sub_0204F284 + mov r4, r0 + mov r0, r5 + bl sub_0204F364 + orr r0, r4, r0 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_0204F484: .word 0x00004001 + arm_func_end CheckMissionRestrictions + + arm_func_start sub_0204F488 +sub_0204F488: ; 0x0204F488 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr} + mov sb, r0 + mov r8, r1 + mov r7, r2 + bl DungeonSwapIdToIdx + mov r5, r0 + mov r0, sb + bl GetMaxReachedFloor + mov r6, r0 + mov r0, r5 + bl GetDungeonMode + mov r4, r0 + cmp r4, #1 + moveq r0, #0x11 + ldmeqia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + cmp r6, #1 + bge _0204F4EC + mov r0, r5 + bl sub_0204CEE0 + cmp r0, #0 + bne _0204F4EC + cmp r4, #3 + movne r0, #5 + moveq r0, #9 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} +_0204F4EC: + cmp r8, r6 + movgt r0, #9 + ldmgtia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + cmp sb, #0x26 + cmpne sb, #0x29 + cmpne sb, #0x3f + cmpne sb, #0x63 + cmpne sb, #0x64 + cmpne sb, #0x65 + cmpne sb, #0x66 + cmpne sb, #0x67 + cmpne sb, #0x68 + cmpne sb, #0x6b + cmpne sb, #0x6c + cmpne sb, #0x6d + cmpne sb, #0x6e + cmpne sb, #0xae + ldreq r0, _0204F558 ; =0x00004001 + ldmeqia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + mov r0, sb + mov r1, r7 + bl sub_0204F284 + mov r4, r0 + mov r0, sb + bl sub_0204F364 + orr r0, r4, r0 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + .align 2, 0 +_0204F558: .word 0x00004001 + arm_func_end sub_0204F488 + + arm_func_start sub_0204F55C +sub_0204F55C: ; 0x0204F55C + ldr r1, _0204F578 ; =SECONDARY_TERRAIN_TYPES + ldrb r0, [r1, r0] + cmp r0, #2 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_0204F578: .word SECONDARY_TERRAIN_TYPES + arm_func_end sub_0204F55C + + arm_func_start GetNbFloors +GetNbFloors: ; 0x0204F57C + cmp r0, #0xb4 + blo _0204F590 + cmp r0, #0xbd + movls r0, #5 + bxls lr +_0204F590: + cmp r0, #0xbe + moveq r0, #1 + bxeq lr + cmp r0, #0xbf + ldrlo r1, _0204F5B0 ; =DUNGEON_DATA_LIST + movhs r0, #0x30 + ldrlob r0, [r1, r0, lsl #2] + bx lr + .align 2, 0 +_0204F5B0: .word DUNGEON_DATA_LIST + arm_func_end GetNbFloors + + arm_func_start GetNbFloorsPlusOne +GetNbFloorsPlusOne: ; 0x0204F5B4 + stmdb sp!, {r3, lr} + bl GetNbFloors + add r0, r0, #1 + and r0, r0, #0xff + ldmia sp!, {r3, pc} + arm_func_end GetNbFloorsPlusOne + + arm_func_start GetDungeonGroup +GetDungeonGroup: ; 0x0204F5C8 + cmp r0, #0xb4 + ldrlo r1, _0204F5DC ; =_0209E3A1 + movhs r0, #0x35 + ldrlob r0, [r1, r0, lsl #2] + bx lr + .align 2, 0 +_0204F5DC: .word _0209E3A1 + arm_func_end GetDungeonGroup + + arm_func_start GetNbPrecedingFloors +GetNbPrecedingFloors: ; 0x0204F5E0 + cmp r0, #0xb4 + ldrlo r1, _0204F5F4 ; =_0209E3A2 + movhs r0, #0 + ldrlob r0, [r1, r0, lsl #2] + bx lr + .align 2, 0 +_0204F5F4: .word _0209E3A2 + arm_func_end GetNbPrecedingFloors + + arm_func_start GetNbFloorsDungeonGroup +GetNbFloorsDungeonGroup: ; 0x0204F5F8 + cmp r0, #0xb4 + ldrlo r1, _0204F60C ; =_0209E3A3 + movhs r0, #0 + ldrlob r0, [r1, r0, lsl #2] + bx lr + .align 2, 0 +_0204F60C: .word _0209E3A3 + arm_func_end GetNbFloorsDungeonGroup + + arm_func_start sub_0204F610 +sub_0204F610: ; 0x0204F610 + stmdb sp!, {r4, lr} + mov r4, r0 + cmp r4, #0xb4 + movhs r0, #0 + ldmhsia sp!, {r4, pc} + bl GetMaxMembersAllowed + cmp r0, #1 + bne _0204F644 + mov r0, r4 + bl IsRecruitingAllowed + cmp r0, #0 + moveq r0, #1 + ldmeqia sp!, {r4, pc} +_0204F644: + mov r0, #0 + ldmia sp!, {r4, pc} + arm_func_end sub_0204F610 + + arm_func_start DungeonFloorToGroupFloor +DungeonFloorToGroupFloor: ; 0x0204F64C + stmdb sp!, {r3, r4, r5, lr} + mov r5, r1 + mov r4, r0 + ldrb r0, [r5] + cmp r0, #0xb4 + blo _0204F690 + cmp r0, #0xbd + bhi _0204F690 + mov r0, #0x35 + strb r0, [r4] + ldrb r0, [r5] + ldrb r1, [r5, #1] + sub r0, r0, #0xb4 + add r0, r0, r0, lsl #2 + add r0, r1, r0 + strb r0, [r4, #1] + ldmia sp!, {r3, r4, r5, pc} +_0204F690: + cmp r0, #0xbe + bne _0204F6B0 + mov r0, #0x35 + strb r0, [r4] + ldrb r0, [r5, #1] + add r0, r0, #0x32 + strb r0, [r4, #1] + ldmia sp!, {r3, r4, r5, pc} +_0204F6B0: + cmp r0, #0xbf + blo _0204F6D8 + cmp r0, #0xd3 + bhi _0204F6D8 + mov r0, #0x35 + strb r0, [r4] + ldrb r0, [r5, #1] + add r0, r0, #0x33 + strb r0, [r4, #1] + ldmia sp!, {r3, r4, r5, pc} +_0204F6D8: + bl GetDungeonGroup + strb r0, [r4] + ldrb r0, [r5] + bl GetNbPrecedingFloors + ldrb r1, [r5, #1] + add r0, r1, r0 + strb r0, [r4, #1] + ldmia sp!, {r3, r4, r5, pc} + arm_func_end DungeonFloorToGroupFloor + + arm_func_start sub_0204F6F8 +sub_0204F6F8: ; 0x0204F6F8 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + mov r0, r1 + mov r1, r2 + bl sub_0204F77C + cmp r5, #3 + addls pc, pc, r5, lsl #2 + b _0204F770 +_0204F718: ; jump table + b _0204F728 ; case 0 + b _0204F734 ; case 1 + b _0204F74C ; case 2 + b _0204F760 ; case 3 +_0204F728: + bl GetGroundNameId + mov r4, r0 + b _0204F770 +_0204F734: + bl GetGroundNameId +#ifdef JAPAN + add r0, r0, #3 + add r0, r0, #0x100 +#else + ldr r1, _0204F778 ; =0xFFFFFEFD + add r0, r0, r1 +#endif + mov r0, r0, lsl #0x10 + mov r4, r0, lsr #0x10 + b _0204F770 +_0204F74C: +#if defined(EUROPE) + add r0, r0, #0xbe + add r0, r0, #0x4300 +#elif defined(JAPAN) + add r0, r0, #0x26c + add r0, r0, #0x400 +#else + add r0, r0, #0x3bc + add r0, r0, #0x4000 +#endif + mov r0, r0, lsl #0x10 + mov r4, r0, lsr #0x10 + b _0204F770 +_0204F760: +#if defined(EUROPE) + add r0, r0, #0xbd + add r0, r0, #0x4200 +#elif defined(JAPAN) + add r0, r0, #0x6f + add r0, r0, #0x700 +#else + add r0, r0, #0xbb + add r0, r0, #0x4200 +#endif + mov r0, r0, lsl #0x10 + mov r4, r0, lsr #0x10 +_0204F770: + mov r0, r4 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +#ifndef JAPAN +_0204F778: .word 0xFFFFFEFD +#endif + arm_func_end sub_0204F6F8 + + arm_func_start sub_0204F77C +sub_0204F77C: ; 0x0204F77C + stmdb sp!, {r3, r4, r5, lr} + movs r4, r1 + mov r5, r0 + beq _0204F7A0 + cmp r5, #0xae + bne _0204F7A0 + bl GetNbFloorsDungeonGroup + cmp r4, r0 + moveq r5, #0x7f +_0204F7A0: + mov r0, r5 + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_0204F77C + + arm_func_start sub_0204F7A8 +sub_0204F7A8: ; 0x0204F7A8 + stmdb sp!, {r3, r4, lr} + sub sp, sp, #4 + mov r4, r0 + ldrb r0, [r4] + cmp r0, #0xb4 + movhs r0, #1 + bhs _0204F808 + bl GetNbFloors + add r1, r0, #1 + ldrb r0, [r4, #1] + and r1, r1, #0xff + cmp r0, r1 + movhs r0, #1 + bhs _0204F808 + add r0, sp, #0 + mov r1, r4 + bl DungeonFloorToGroupFloor + ldrb r2, [sp] + cmp r2, #0x64 + movhs r0, #1 + ldrlo r1, _0204F810 ; =MISSION_FLOOR_RANKS_PTRS + ldrlob r0, [sp, #1] + ldrlo r1, [r1, r2, lsl #2] + ldrlob r0, [r1, r0] +_0204F808: + add sp, sp, #4 + ldmia sp!, {r3, r4, pc} + .align 2, 0 +_0204F810: .word MISSION_FLOOR_RANKS_PTRS + arm_func_end sub_0204F7A8 + + arm_func_start GetMissionRank +GetMissionRank: ; 0x0204F814 + stmdb sp!, {r3, r4, lr} + sub sp, sp, #4 + mov r4, r0 + ldrb r0, [r4] + cmp r0, #0xb4 + movhs r0, #1 + bhs _0204F880 + bl GetNbFloors + add r1, r0, #1 + ldrb r0, [r4, #1] + and r1, r1, #0xff + cmp r0, r1 + movhs r0, #1 + bhs _0204F880 + add r0, sp, #0 + mov r1, r4 + bl DungeonFloorToGroupFloor + ldrb r2, [sp] + cmp r2, #0x64 + movhs r0, #1 + bhs _0204F880 + ldrb r1, [sp, #1] + ldr r0, _0204F888 ; =MISSION_FLOOR_RANKS_PTRS + cmp r1, #1 + ldr r0, [r0, r2, lsl #2] + movle r1, #2 + ldrb r0, [r0, r1] +_0204F880: + add sp, sp, #4 + ldmia sp!, {r3, r4, pc} + .align 2, 0 +_0204F888: .word MISSION_FLOOR_RANKS_PTRS + arm_func_end GetMissionRank + + arm_func_start GetOutlawLevel +GetOutlawLevel: ; 0x0204F88C + stmdb sp!, {r3, lr} + bl GetMissionRank + ldr r1, _0204F8A4 ; =OUTLAW_LEVEL_TABLE + mov r0, r0, lsl #1 + ldrsh r0, [r1, r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_0204F8A4: .word OUTLAW_LEVEL_TABLE + arm_func_end GetOutlawLevel + + arm_func_start GetOutlawLeaderLevel +GetOutlawLeaderLevel: ; 0x0204F8A8 + stmdb sp!, {r3, lr} + bl GetMissionRank + ldr r1, _0204F8C0 ; =OUTLAW_LEVEL_TABLE + mov r0, r0, lsl #1 + ldrsh r0, [r1, r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_0204F8C0: .word OUTLAW_LEVEL_TABLE + arm_func_end GetOutlawLeaderLevel + + arm_func_start GetOutlawMinionLevel +GetOutlawMinionLevel: ; 0x0204F8C4 + stmdb sp!, {r3, lr} + bl GetMissionRank + ldr r1, _0204F8DC ; =OUTLAW_MINION_LEVEL_TABLE + mov r0, r0, lsl #1 + ldrsh r0, [r1, r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_0204F8DC: .word OUTLAW_MINION_LEVEL_TABLE + arm_func_end GetOutlawMinionLevel + + arm_func_start AddGuestMonster +AddGuestMonster: ; 0x0204F8E0 + stmdb sp!, {r3, r4, r5, r6, lr} + sub sp, sp, #0x3c + add lr, sp, #0x18 + mov r5, r0 + mov r4, r1 + mov r6, r2 + mov ip, #2 +_0204F8FC: + ldmia r6!, {r0, r1, r2, r3} + stmia lr!, {r0, r1, r2, r3} + subs ip, ip, #1 + bne _0204F8FC + ldr r1, [r6] + mov r0, #1 + str r1, [lr] + strb r0, [r5, #0xf] + ldrsh r0, [sp, #0x1c] + bl GetNameString + mov r1, r0 + add r0, sp, #0 + mov r2, #0xa + bl StrncpyName + add r2, sp, #0 + add r1, r5, #0x1c + mov r0, #0x44 + mla r0, r4, r0, r1 + add r1, sp, #0x18 + str r2, [sp, #0x18] + bl GuestMonsterToGroundMonster + add sp, sp, #0x3c + ldmia sp!, {r3, r4, r5, r6, pc} + arm_func_end AddGuestMonster + + arm_func_start GetGroundNameId +GetGroundNameId: ; 0x0204F958 + stmdb sp!, {r4, lr} + mov r4, r0 + cmp r4, #6 + bne _0204F980 + mov r0, #0x1b + bl GetPerformanceFlagWithChecks + cmp r0, #0 + bne _0204F99C + ldr r0, _0204F9B0 ; =0x000042B9 + ldmia sp!, {r4, pc} +_0204F980: + cmp r4, #0x15 + bne _0204F99C + mov r0, #0x1c + bl GetPerformanceFlagWithChecks + cmp r0, #0 +#ifdef JAPAN + moveq r0, #0x1c4 +#else + ldreq r0, _0204F9B4 ; =0x000042BA +#endif + ldmeqia sp!, {r4, pc} +_0204F99C: +#if defined(EUROPE) + add r0, r4, #0xba + add r0, r0, #0x4100 +#elif defined(JAPAN) + add r0, r4, #0xc2 +#else + add r0, r4, #0x1b8 + add r0, r0, #0x4000 +#endif + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + ldmia sp!, {r4, pc} + .align 2, 0 +#if defined(EUROPE) +_0204F9B0: .word 0x000042BB +_0204F9B4: .word 0x000042BC +#elif defined(JAPAN) +_0204F9B0: .word 0x000001C3 +#else +_0204F9B0: .word 0x000042B9 +_0204F9B4: .word 0x000042BA +#endif + arm_func_end GetGroundNameId + + arm_func_start sub_0204F9B8 +sub_0204F9B8: ; 0x0204F9B8 + ldr ip, _0204F9C4 ; =ResetPlayTimer + ldr r0, _0204F9C8 ; =_022AB694 + bx ip + .align 2, 0 +_0204F9C4: .word ResetPlayTimer +_0204F9C8: .word _022AB694 + arm_func_end sub_0204F9B8 + + arm_func_start sub_0204F9CC +sub_0204F9CC: ; 0x0204F9CC + ldr ip, _0204F9D8 ; =PlayTimerTick + ldr r0, _0204F9DC ; =_022AB694 + bx ip + .align 2, 0 +_0204F9D8: .word PlayTimerTick +_0204F9DC: .word _022AB694 + arm_func_end sub_0204F9CC + + arm_func_start sub_0204F9E0 +sub_0204F9E0: ; 0x0204F9E0 + ldr ip, _0204F9EC ; =GetPlayTimeSeconds + ldr r0, _0204F9F0 ; =_022AB694 + bx ip + .align 2, 0 +_0204F9EC: .word GetPlayTimeSeconds +_0204F9F0: .word _022AB694 + arm_func_end sub_0204F9E0 + + arm_func_start sub_0204F9F4 +sub_0204F9F4: ; 0x0204F9F4 + ldr ip, _0204FA04 ; =sub_02050E5C + mov r1, r0 + ldr r0, _0204FA08 ; =_022AB694 + bx ip + .align 2, 0 +_0204FA04: .word sub_02050E5C +_0204FA08: .word _022AB694 + arm_func_end sub_0204F9F4 + + arm_func_start sub_0204FA0C +sub_0204FA0C: ; 0x0204FA0C + ldr ip, _0204FA1C ; =sub_02050E8C + mov r1, r0 + ldr r0, _0204FA20 ; =_022AB694 + bx ip + .align 2, 0 +_0204FA1C: .word sub_02050E8C +_0204FA20: .word _022AB694 + arm_func_end sub_0204FA0C + + arm_func_start SetAdventureLogStructLocation +SetAdventureLogStructLocation: ; 0x0204FA24 + ldr r1, _0204FA34 ; =_022AB69C + ldr r0, _0204FA38 ; =ADVENTURE_LOG_PTR + str r1, [r0] + bx lr + .align 2, 0 +_0204FA34: .word _022AB69C +_0204FA38: .word ADVENTURE_LOG_PTR + arm_func_end SetAdventureLogStructLocation + + arm_func_start SetAdventureLogDungeonFloor +SetAdventureLogDungeonFloor: ; 0x0204FA3C + ldr r1, _0204FA58 ; =ADVENTURE_LOG_PTR + ldrb r2, [r0] + ldr r1, [r1] + strb r2, [r1, #0x278] + ldrb r0, [r0, #1] + strb r0, [r1, #0x279] + bx lr + .align 2, 0 +_0204FA58: .word ADVENTURE_LOG_PTR + arm_func_end SetAdventureLogDungeonFloor + + arm_func_start GetAdventureLogDungeonFloor +GetAdventureLogDungeonFloor: ; 0x0204FA5C + ldr r0, _0204FA6C ; =ADVENTURE_LOG_PTR + ldr r0, [r0] + add r0, r0, #0x278 + bx lr + .align 2, 0 +_0204FA6C: .word ADVENTURE_LOG_PTR + arm_func_end GetAdventureLogDungeonFloor + + arm_func_start ClearAdventureLogStruct +ClearAdventureLogStruct: ; 0x0204FA70 + mov r3, #0 + ldr r1, _0204FB98 ; =ADVENTURE_LOG_PTR + mov r0, r3 +_0204FA7C: + ldr r2, [r1] + str r0, [r2, r3, lsl #2] + add r3, r3, #1 + cmp r3, #4 + blt _0204FA7C + ldr r1, _0204FB98 ; =ADVENTURE_LOG_PTR + mov r3, #0 + ldr r2, [r1] + str r0, [r2, #0x2c] + ldr r2, [r1] + str r0, [r2, #0x30] + ldr r2, [r1] + str r0, [r2, #0x34] + ldr r2, [r1] + str r0, [r2, #0x28] + ldr r2, [r1] + str r0, [r2, #0x10] + ldr r2, [r1] + str r0, [r2, #0x14] + ldr r2, [r1] + str r0, [r2, #0x18] + ldr r2, [r1] + str r0, [r2, #0x1c] + ldr r2, [r1] + str r0, [r2, #0x20] + ldr r2, [r1] + str r0, [r2, #0x24] + ldr r2, [r1] + str r0, [r2, #0x38] + ldr r2, [r1] + str r0, [r2, #0x3c] + ldr r2, [r1] + str r0, [r2, #0x40] +_0204FB00: + ldr r2, [r1] + add r2, r2, r0, lsl #2 + str r3, [r2, #0x44] + ldr r2, [r1] + add r2, r2, r0, lsl #2 + add r0, r0, #1 + str r3, [r2, #0xd8] + cmp r0, #0x25 + blt _0204FB00 + ldr r0, _0204FB98 ; =ADVENTURE_LOG_PTR + mov r2, #0 +_0204FB2C: + ldr r1, [r0] + add r1, r1, r3, lsl #2 + add r3, r3, #1 + str r2, [r1, #0x16c] + cmp r3, #0x11 + blt _0204FB2C + ldr r0, _0204FB98 ; =ADVENTURE_LOG_PTR + mov ip, #0 +_0204FB4C: + ldr r1, [r0] + add r1, r1, r2, lsl #2 + add r2, r2, #1 + str ip, [r1, #0x1b0] + cmp r2, #0x2c + blt _0204FB4C + ldr r1, _0204FB98 ; =ADVENTURE_LOG_PTR + ldr r0, [r1] + str ip, [r0, #0x260] + mov r0, #0x3e8 +_0204FB74: + rsb r2, ip, #5 + mul r3, r2, r0 + ldr r2, [r1] + add r2, r2, ip, lsl #2 + add ip, ip, #1 + str r3, [r2, #0x264] + cmp ip, #5 + blt _0204FB74 + bx lr + .align 2, 0 +_0204FB98: .word ADVENTURE_LOG_PTR + arm_func_end ClearAdventureLogStruct + + arm_func_start SetAdventureLogCompleted +SetAdventureLogCompleted: ; 0x0204FB9C + ldr r1, _0204FBC0 ; =ADVENTURE_LOG_PTR + mov r3, r0, asr #5 + ldr ip, [r1] + and r0, r0, #0x1f + ldr r2, [ip, r3, lsl #2] + mov r1, #1 + orr r0, r2, r1, lsl r0 + str r0, [ip, r3, lsl #2] + bx lr + .align 2, 0 +_0204FBC0: .word ADVENTURE_LOG_PTR + arm_func_end SetAdventureLogCompleted + + arm_func_start IsAdventureLogNotEmpty +IsAdventureLogNotEmpty: ; 0x0204FBC4 + ldr r0, _0204FBF8 ; =ADVENTURE_LOG_PTR + mov r1, #0 + ldr r2, [r0] + b _0204FBE8 +_0204FBD4: + ldr r0, [r2, r1, lsl #2] + cmp r0, #0 + movne r0, #1 + bxne lr + add r1, r1, #1 +_0204FBE8: + cmp r1, #4 + blt _0204FBD4 + mov r0, #0 + bx lr + .align 2, 0 +_0204FBF8: .word ADVENTURE_LOG_PTR + arm_func_end IsAdventureLogNotEmpty + + arm_func_start GetAdventureLogCompleted +GetAdventureLogCompleted: ; 0x0204FBFC + ldr r1, _0204FC24 ; =ADVENTURE_LOG_PTR + mov r2, r0, asr #5 + ldr r1, [r1] + and r3, r0, #0x1f + ldr r0, [r1, r2, lsl #2] + mov r1, #1 + tst r0, r1, lsl r3 + moveq r1, #0 + and r0, r1, #0xff + bx lr + .align 2, 0 +_0204FC24: .word ADVENTURE_LOG_PTR + arm_func_end GetAdventureLogCompleted + + arm_func_start IncrementNbDungeonsCleared +IncrementNbDungeonsCleared: ; 0x0204FC28 + ldr r0, _0204FC64 ; =ADVENTURE_LOG_PTR + ldr r1, _0204FC68 ; =0x000F423F + ldr r3, [r0] + ldr r2, [r3, #0x10] + add r2, r2, #1 + str r2, [r3, #0x10] + ldr r3, [r0] + ldr r2, [r3] + orr r2, r2, #0x10 + str r2, [r3] + ldr r2, [r0] + ldr r0, [r2, #0x10] + cmp r0, r1 + strgt r1, [r2, #0x10] + bx lr + .align 2, 0 +_0204FC64: .word ADVENTURE_LOG_PTR +_0204FC68: .word 0x000F423F + arm_func_end IncrementNbDungeonsCleared + + arm_func_start GetNbDungeonsCleared +GetNbDungeonsCleared: ; 0x0204FC6C + ldr r0, _0204FC7C ; =ADVENTURE_LOG_PTR + ldr r0, [r0] + ldr r0, [r0, #0x10] + bx lr + .align 2, 0 +_0204FC7C: .word ADVENTURE_LOG_PTR + arm_func_end GetNbDungeonsCleared + + arm_func_start IncrementNbFriendRescues +IncrementNbFriendRescues: ; 0x0204FC80 + ldr r0, _0204FCC0 ; =ADVENTURE_LOG_PTR + ldr r1, _0204FCC4 ; =0x000F423F + ldr r3, [r0] + ldr r2, [r3, #0x14] + add r2, r2, #1 + str r2, [r3, #0x14] + ldr r2, [r0] + ldr r0, [r2, #0x14] + cmp r0, r1 + ldr r0, _0204FCC0 ; =ADVENTURE_LOG_PTR + strgt r1, [r2, #0x14] + ldr r1, [r0] + ldr r0, [r1] + orr r0, r0, #0x40 + str r0, [r1] + bx lr + .align 2, 0 +_0204FCC0: .word ADVENTURE_LOG_PTR +_0204FCC4: .word 0x000F423F + arm_func_end IncrementNbFriendRescues + + arm_func_start GetNbFriendRescues +GetNbFriendRescues: ; 0x0204FCC8 + ldr r0, _0204FCD8 ; =ADVENTURE_LOG_PTR + ldr r0, [r0] + ldr r0, [r0, #0x14] + bx lr + .align 2, 0 +_0204FCD8: .word ADVENTURE_LOG_PTR + arm_func_end GetNbFriendRescues + + arm_func_start IncrementNbEvolutions +IncrementNbEvolutions: ; 0x0204FCDC + ldr r0, _0204FD1C ; =ADVENTURE_LOG_PTR + ldr r1, _0204FD20 ; =0x000F423F + ldr r3, [r0] + ldr r2, [r3, #0x18] + add r2, r2, #1 + str r2, [r3, #0x18] + ldr r2, [r0] + ldr r0, [r2, #0x18] + cmp r0, r1 + ldr r0, _0204FD1C ; =ADVENTURE_LOG_PTR + strgt r1, [r2, #0x18] + ldr r1, [r0] + ldr r0, [r1] + orr r0, r0, #0x80 + str r0, [r1] + bx lr + .align 2, 0 +_0204FD1C: .word ADVENTURE_LOG_PTR +_0204FD20: .word 0x000F423F + arm_func_end IncrementNbEvolutions + + arm_func_start GetNbEvolutions +GetNbEvolutions: ; 0x0204FD24 + ldr r0, _0204FD34 ; =ADVENTURE_LOG_PTR + ldr r0, [r0] + ldr r0, [r0, #0x18] + bx lr + .align 2, 0 +_0204FD34: .word ADVENTURE_LOG_PTR + arm_func_end GetNbEvolutions + + arm_func_start IncrementNbSteals +IncrementNbSteals: ; 0x0204FD38 + bx lr + arm_func_end IncrementNbSteals + + arm_func_start IncrementNbEggsHatched +IncrementNbEggsHatched: ; 0x0204FD3C + ldr r1, _0204FD70 ; =ADVENTURE_LOG_PTR + ldr r0, _0204FD74 ; =0x000F423F + ldr r2, [r1] + ldr r1, [r2, #0x1c] + cmp r1, r0 + addlt r0, r1, #1 + strlt r0, [r2, #0x1c] + ldr r0, _0204FD70 ; =ADVENTURE_LOG_PTR + ldr r1, [r0] + ldr r0, [r1] + orr r0, r0, #0x100 + str r0, [r1] + bx lr + .align 2, 0 +_0204FD70: .word ADVENTURE_LOG_PTR +_0204FD74: .word 0x000F423F + arm_func_end IncrementNbEggsHatched + + arm_func_start GetNbEggsHatched +GetNbEggsHatched: ; 0x0204FD78 + ldr r0, _0204FD88 ; =ADVENTURE_LOG_PTR + ldr r0, [r0] + ldr r0, [r0, #0x1c] + bx lr + .align 2, 0 +_0204FD88: .word ADVENTURE_LOG_PTR + arm_func_end GetNbEggsHatched + + arm_func_start GetNbPokemonJoined +GetNbPokemonJoined: ; 0x0204FD8C + ldr r0, _0204FD9C ; =ADVENTURE_LOG_PTR + ldr r0, [r0] + ldr r0, [r0, #0x2c] + bx lr + .align 2, 0 +_0204FD9C: .word ADVENTURE_LOG_PTR + arm_func_end GetNbPokemonJoined + + arm_func_start GetNbMovesLearned +GetNbMovesLearned: ; 0x0204FDA0 + ldr r0, _0204FDB0 ; =ADVENTURE_LOG_PTR + ldr r0, [r0] + ldr r0, [r0, #0x34] + bx lr + .align 2, 0 +_0204FDB0: .word ADVENTURE_LOG_PTR + arm_func_end GetNbMovesLearned + + arm_func_start SetVictoriesOnOneFloor +SetVictoriesOnOneFloor: ; 0x0204FDB4 + ldr r1, _0204FDE0 ; =0x000F423F + cmp r0, r1 + movgt r0, r1 + ldr r1, _0204FDE4 ; =ADVENTURE_LOG_PTR + ldr r2, [r1] + str r0, [r2, #0x28] + ldr r1, [r1] + ldr r0, [r1] + orr r0, r0, #0x200 + str r0, [r1] + bx lr + .align 2, 0 +_0204FDE0: .word 0x000F423F +_0204FDE4: .word ADVENTURE_LOG_PTR + arm_func_end SetVictoriesOnOneFloor + + arm_func_start GetVictoriesOnOneFloor +GetVictoriesOnOneFloor: ; 0x0204FDE8 + ldr r0, _0204FDF8 ; =ADVENTURE_LOG_PTR + ldr r0, [r0] + ldr r0, [r0, #0x28] + bx lr + .align 2, 0 +_0204FDF8: .word ADVENTURE_LOG_PTR + arm_func_end GetVictoriesOnOneFloor + + arm_func_start SetPokemonJoined +SetPokemonJoined: ; 0x0204FDFC + stmdb sp!, {r3, lr} + bl GetDexNumberVeneer + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldr r3, _0204FE54 ; =ADVENTURE_LOG_PTR + mov r1, r0, asr #4 + ldr lr, [r3] + add r1, r0, r1, lsr #27 + ldr ip, [lr] + mov r2, r0, lsr #0x1f + orr ip, ip, #1 + str ip, [lr] + ldr r3, [r3] + rsb r0, r2, r0, lsl #27 + add lr, r3, #0x44 + mov ip, r1, asr #5 + ldr r3, [lr, ip, lsl #2] + add r0, r2, r0, ror #27 + mov r1, #1 + orr r0, r3, r1, lsl r0 + str r0, [lr, ip, lsl #2] + ldmia sp!, {r3, pc} + .align 2, 0 +_0204FE54: .word ADVENTURE_LOG_PTR + arm_func_end SetPokemonJoined + + arm_func_start SetPokemonBattled +SetPokemonBattled: ; 0x0204FE58 + stmdb sp!, {r3, lr} + bl GetDexNumberVeneer + cmp r0, #0 + ldmeqia sp!, {r3, pc} + ldr r3, _0204FEB0 ; =ADVENTURE_LOG_PTR + mov r1, r0, asr #4 + ldr lr, [r3] + add r1, r0, r1, lsr #27 + ldr ip, [lr] + mov r2, r0, lsr #0x1f + orr ip, ip, #2 + str ip, [lr] + ldr r3, [r3] + rsb r0, r2, r0, lsl #27 + add lr, r3, #0xd8 + mov ip, r1, asr #5 + ldr r3, [lr, ip, lsl #2] + add r0, r2, r0, ror #27 + mov r1, #1 + orr r0, r3, r1, lsl r0 + str r0, [lr, ip, lsl #2] + ldmia sp!, {r3, pc} + .align 2, 0 +_0204FEB0: .word ADVENTURE_LOG_PTR + arm_func_end SetPokemonBattled + + arm_func_start GetNbPokemonBattled +GetNbPokemonBattled: ; 0x0204FEB4 + ldr r0, _0204FEC4 ; =ADVENTURE_LOG_PTR + ldr r0, [r0] + ldr r0, [r0, #0x30] + bx lr + .align 2, 0 +_0204FEC4: .word ADVENTURE_LOG_PTR + arm_func_end GetNbPokemonBattled + + arm_func_start IncrementNbBigTreasureWins +IncrementNbBigTreasureWins: ; 0x0204FEC8 + ldr r0, _0204FEE0 ; =ADVENTURE_LOG_PTR + ldr ip, _0204FEE4 ; =SetNbBigTreasureWins + ldr r0, [r0] + ldr r0, [r0, #0x38] + add r0, r0, #1 + bx ip + .align 2, 0 +_0204FEE0: .word ADVENTURE_LOG_PTR +_0204FEE4: .word SetNbBigTreasureWins + arm_func_end IncrementNbBigTreasureWins + + arm_func_start SetNbBigTreasureWins +SetNbBigTreasureWins: ; 0x0204FEE8 + ldr r2, _0204FF18 ; =ADVENTURE_LOG_PTR + ldr r1, _0204FF1C ; =0x000F423F + ldr r3, [r2] + cmp r0, r1 + ldr r2, [r3] + movgt r0, r1 + orr r2, r2, #0x400 + ldr r1, _0204FF18 ; =ADVENTURE_LOG_PTR + str r2, [r3] + ldr r1, [r1] + str r0, [r1, #0x38] + bx lr + .align 2, 0 +_0204FF18: .word ADVENTURE_LOG_PTR +_0204FF1C: .word 0x000F423F + arm_func_end SetNbBigTreasureWins + + arm_func_start GetNbBigTreasureWins +GetNbBigTreasureWins: ; 0x0204FF20 + ldr r0, _0204FF30 ; =ADVENTURE_LOG_PTR + ldr r0, [r0] + ldr r0, [r0, #0x38] + bx lr + .align 2, 0 +_0204FF30: .word ADVENTURE_LOG_PTR + arm_func_end GetNbBigTreasureWins + + arm_func_start SetNbRecycled +SetNbRecycled: ; 0x0204FF34 + ldr r2, _0204FF64 ; =ADVENTURE_LOG_PTR + ldr r1, _0204FF68 ; =0x000F423F + ldr r3, [r2] + cmp r0, r1 + ldr r2, [r3] + movgt r0, r1 + orr r2, r2, #0x800 + ldr r1, _0204FF64 ; =ADVENTURE_LOG_PTR + str r2, [r3] + ldr r1, [r1] + str r0, [r1, #0x3c] + bx lr + .align 2, 0 +_0204FF64: .word ADVENTURE_LOG_PTR +_0204FF68: .word 0x000F423F + arm_func_end SetNbRecycled + + arm_func_start GetNbRecycled +GetNbRecycled: ; 0x0204FF6C + ldr r0, _0204FF7C ; =ADVENTURE_LOG_PTR + ldr r0, [r0] + ldr r0, [r0, #0x3c] + bx lr + .align 2, 0 +_0204FF7C: .word ADVENTURE_LOG_PTR + arm_func_end GetNbRecycled + + arm_func_start IncrementNbSkyGiftsSent +IncrementNbSkyGiftsSent: ; 0x0204FF80 + ldr r0, _0204FF98 ; =ADVENTURE_LOG_PTR + ldr ip, _0204FF9C ; =SetNbSkyGiftsSent + ldr r0, [r0] + ldr r0, [r0, #0x40] + add r0, r0, #1 + bx ip + .align 2, 0 +_0204FF98: .word ADVENTURE_LOG_PTR +_0204FF9C: .word SetNbSkyGiftsSent + arm_func_end IncrementNbSkyGiftsSent + + arm_func_start SetNbSkyGiftsSent +SetNbSkyGiftsSent: ; 0x0204FFA0 + ldr r2, _0204FFD0 ; =ADVENTURE_LOG_PTR + ldr r1, _0204FFD4 ; =0x000F423F + ldr r3, [r2] + cmp r0, r1 + ldr r2, [r3] + movgt r0, r1 + orr r2, r2, #0x1000 + ldr r1, _0204FFD0 ; =ADVENTURE_LOG_PTR + str r2, [r3] + ldr r1, [r1] + str r0, [r1, #0x40] + bx lr + .align 2, 0 +_0204FFD0: .word ADVENTURE_LOG_PTR +_0204FFD4: .word 0x000F423F + arm_func_end SetNbSkyGiftsSent + + arm_func_start GetNbSkyGiftsSent +GetNbSkyGiftsSent: ; 0x0204FFD8 + ldr r0, _0204FFE8 ; =ADVENTURE_LOG_PTR + ldr r0, [r0] + ldr r0, [r0, #0x40] + bx lr + .align 2, 0 +_0204FFE8: .word ADVENTURE_LOG_PTR + arm_func_end GetNbSkyGiftsSent + + arm_func_start ComputeSpecialCounters +ComputeSpecialCounters: ; 0x0204FFEC + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + mov r4, #0 + mov r8, r4 +_0204FFF8: + mov r0, #0x44 + mul sl, r8, r0 + ldr r0, _0205022C ; =TEAM_MEMBER_TABLE_PTR + ldr r0, [r0] + ldrb r0, [r0, sl] + tst r0, #1 + movne r0, #1 + moveq r0, #0 + tst r0, #0xff + beq _0205009C + mov sb, #0 + mov r7, #1 + ldr r3, _02050230 ; =ADVENTURE_LOG_PTR + ldr ip, _0205022C ; =TEAM_MEMBER_TABLE_PTR + mov fp, sb + mov lr, r7 + mov r2, #6 +_0205003C: + mul r1, sb, r2 + ldr r0, [ip] + add r0, r0, sl + add r5, r0, #0x22 + ldrb r0, [r5, r1] + add r1, r5, r1 + tst r0, #1 + movne r0, r7 + moveq r0, fp + tst r0, #0xff + beq _02050090 + ldrh r0, [r1, #2] + ldr r5, [r3] + mov r1, r0, lsr #5 + add r6, r5, r1, lsl #2 + mov r1, r0, lsr #0x1f + rsb r0, r1, r0, lsl #27 + ldr r5, [r6, #0x16c] + add r0, r1, r0, ror #27 + orr r0, r5, lr, lsl r0 + str r0, [r6, #0x16c] +_02050090: + add sb, sb, #1 + cmp sb, #4 + blt _0205003C +_0205009C: + ldr r0, _02050234 ; =0x0000022B + add r8, r8, #1 + cmp r8, r0 + blt _0204FFF8 + mov r6, #0 + add r5, r0, #0x258 +_020500B4: + mov r0, r6, lsl #0x10 + mov r0, r0, asr #0x10 + bl GetDexNumberVeneer + add r6, r6, #1 + cmp r6, r5 + blt _020500B4 + mov r7, #0 + ldr r5, _02050230 ; =ADVENTURE_LOG_PTR + ldr sb, _02050238 ; =0x0000021F + mov r8, r7 + mov r6, #1 +_020500E0: + mov r0, r8, lsl #0x10 + mov r0, r0, lsr #0x10 + bl IsRealMove + cmp r0, #0 + beq _02050120 + mov r0, r8, asr #4 + add r0, r8, r0, lsr #27 + ldr r2, [r5] + mov r0, r0, asr #5 + add r2, r2, r0, lsl #2 + mov r1, r8, lsr #0x1f + rsb r0, r1, r8, lsl #27 + ldr r2, [r2, #0x16c] + add r0, r1, r0, ror #27 + tst r2, r6, lsl r0 + addne r7, r7, #1 +_02050120: + add r8, r8, #1 + cmp r8, sb + blt _020500E0 + cmp r7, #0 + ble _02050150 + ldr r0, _02050230 ; =ADVENTURE_LOG_PTR + ldr r1, [r0] + str r7, [r1, #0x34] + ldr r1, [r0] + ldr r0, [r1] + orr r0, r0, #4 + str r0, [r1] +_02050150: + mov sb, #1 + ldr r5, _02050230 ; =ADVENTURE_LOG_PTR + ldr sl, _0205023C ; =0x00000483 + mov r8, #0 + mov r6, sb +_02050164: + mov r0, sb, lsl #0x10 + mov r0, r0, asr #0x10 + bl GetBaseFormCastformCherrimDeoxys + mov r7, r0 + bl GetDexNumberVeneer + cmp r0, #0 + beq _020501B4 + mov r1, r0, asr #4 + add r1, r0, r1, lsr #27 + ldr r3, [r5] + mov r2, r1, asr #5 + mov r1, r0, lsr #0x1f + add r2, r3, r2, lsl #2 + rsb r0, r1, r0, lsl #27 + ldr r2, [r2, #0x44] + add r0, r1, r0, ror #27 + tst r2, r6, lsl r0 + beq _020501B4 + mov r0, r7 + bl RecruitSpecialPokemonLog +_020501B4: + add sb, sb, #1 + cmp sb, sl + blt _02050164 + ldr r0, _02050230 ; =ADVENTURE_LOG_PTR + mov r2, #1 + ldr r1, [r0] + ldr r3, _02050240 ; =0x000001ED + mov r0, r2 +_020501D4: + mov r5, r2, asr #4 + add r5, r2, r5, lsr #27 + mov sb, r5, asr #5 + mov r6, r2, lsr #0x1f + rsb r5, r6, r2, lsl #27 + add r7, r1, sb, lsl #2 + add r6, r6, r5, ror #27 + add r5, r1, sb, lsl #2 + ldr r7, [r7, #0x44] + ldr r5, [r5, #0xd8] + tst r7, r0, lsl r6 + addne r8, r8, #1 + tst r5, r0, lsl r6 + add r2, r2, #1 + addne r4, r4, #1 + cmp r2, r3 + blt _020501D4 + ldr r0, _02050230 ; =ADVENTURE_LOG_PTR + str r8, [r1, #0x2c] + ldr r0, [r0] + str r4, [r0, #0x30] + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_0205022C: .word TEAM_MEMBER_TABLE_PTR +_02050230: .word ADVENTURE_LOG_PTR +_02050234: .word 0x0000022B +_02050238: .word 0x0000021F +_0205023C: .word 0x00000483 +_02050240: .word 0x000001ED + arm_func_end ComputeSpecialCounters + + arm_func_start RecruitSpecialPokemonLog +RecruitSpecialPokemonLog: ; 0x02050244 + stmdb sp!, {r3, lr} + cmp r0, #0x258 + subge r0, r0, #0x258 + movge r0, r0, lsl #0x10 + ldr r2, _020502AC ; =ADVENTURE_LOG_ENCOUNTERS_MONSTER_IDS + mov r3, #0 + movge r0, r0, asr #0x10 +_02050260: + mov r1, r3, lsl #1 + ldrsh r1, [r2, r1] + cmp r1, #0 + ldmeqia sp!, {r3, pc} + cmp r1, #0xc9 + bne _0205028C + cmp r0, #0xc9 + blt _02050294 + cmp r0, #0xe4 + ble _0205029C + b _02050294 +_0205028C: + cmp r1, r0 + beq _0205029C +_02050294: + add r3, r3, #1 + b _02050260 +_0205029C: + add r0, r3, #0x24 + and r0, r0, #0xff + bl SetAdventureLogCompleted + ldmia sp!, {r3, pc} + .align 2, 0 +_020502AC: .word ADVENTURE_LOG_ENCOUNTERS_MONSTER_IDS + arm_func_end RecruitSpecialPokemonLog + + arm_func_start IncrementNbFainted +IncrementNbFainted: ; 0x020502B0 + ldr r1, _020502E4 ; =ADVENTURE_LOG_PTR + ldr r0, _020502E8 ; =0x000F423F + ldr r2, [r1] + ldr r1, [r2, #0x24] + cmp r1, r0 + addlt r0, r1, #1 + strlt r0, [r2, #0x24] + ldr r0, _020502E4 ; =ADVENTURE_LOG_PTR + ldr r1, [r0] + ldr r0, [r1] + orr r0, r0, #0x20 + str r0, [r1] + bx lr + .align 2, 0 +_020502E4: .word ADVENTURE_LOG_PTR +_020502E8: .word 0x000F423F + arm_func_end IncrementNbFainted + + arm_func_start GetNbFainted +GetNbFainted: ; 0x020502EC + ldr r0, _020502FC ; =ADVENTURE_LOG_PTR + ldr r0, [r0] + ldr r0, [r0, #0x24] + bx lr + .align 2, 0 +_020502FC: .word ADVENTURE_LOG_PTR + arm_func_end GetNbFainted + + arm_func_start SetItemAcquired +SetItemAcquired: ; 0x02050300 + stmdb sp!, {r4, r5, r6, lr} + ldrsh r0, [r0, #4] + bl NormalizeTreasureBox + mov r4, r0 + mov r0, r4, lsl #0x10 + mov r0, r0, asr #0x10 + bl IsItemValidVeneer + cmp r0, #0 + ldmeqia sp!, {r4, r5, r6, pc} + cmp r4, #0x3b + blt _02050380 + cmp r4, #0x41 + bgt _02050380 + sub r0, r4, #0x21 + and r0, r0, #0xff + mov r5, #1 + bl SetAdventureLogCompleted + mov r6, #0x1a + b _02050364 +_0205034C: + and r0, r6, #0xff + bl GetAdventureLogCompleted + cmp r0, #0 + moveq r5, #0 + beq _0205036C + add r6, r6, #1 +_02050364: + cmp r6, #0x20 + ble _0205034C +_0205036C: + cmp r5, #0 + beq _02050380 + mov r0, #0x15 + mov r1, #1 + bl sub_0204CB2C +_02050380: + ldr r3, _020503C8 ; =ADVENTURE_LOG_PTR + mov r0, r4, asr #4 + ldr ip, [r3] + add r0, r4, r0, lsr #27 + mov r2, r4, lsr #0x1f + rsb r1, r2, r4, lsl #27 + add lr, ip, #0x1b0 + mov ip, r0, asr #5 + ldr r4, [lr, ip, lsl #2] + add r0, r2, r1, ror #27 + mov r1, #1 + orr r0, r4, r1, lsl r0 + str r0, [lr, ip, lsl #2] + ldr r1, [r3] + ldr r0, [r1] + orr r0, r0, #8 + str r0, [r1] + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_020503C8: .word ADVENTURE_LOG_PTR + arm_func_end SetItemAcquired + + arm_func_start GetNbItemAcquired +GetNbItemAcquired: ; 0x020503CC + stmdb sp!, {r4, lr} + ldr r1, _0205041C ; =ADVENTURE_LOG_PTR + mov r0, #0 + ldr r4, [r1] + mov lr, r0 + mov ip, #1 +_020503E4: + mov r1, lr, asr #4 + add r1, lr, r1, lsr #27 + mov r1, r1, asr #5 + add r3, r4, r1, lsl #2 + mov r2, lr, lsr #0x1f + rsb r1, r2, lr, lsl #27 + ldr r3, [r3, #0x1b0] + add r1, r2, r1, ror #27 + tst r3, ip, lsl r1 + add lr, lr, #1 + addne r0, r0, #1 + cmp lr, #0x580 + blt _020503E4 + ldmia sp!, {r4, pc} + .align 2, 0 +_0205041C: .word ADVENTURE_LOG_PTR + arm_func_end GetNbItemAcquired + + arm_func_start SetChallengeLetterCleared +SetChallengeLetterCleared: ; 0x02050420 + stmdb sp!, {r4, lr} + ldr r3, _020504A0 ; =ADVENTURE_LOG_PTR + mov r2, r0, lsr #0x1f + ldr ip, [r3] + rsb r1, r2, r0, lsl #27 + mov lr, r0, lsr #5 + add r4, ip, #0x260 + ldr ip, [r4, lr, lsl #2] + add r1, r2, r1, ror #27 + mov r0, #1 + orr r1, ip, r0, lsl r1 + str r1, [r4, lr, lsl #2] + ldr r4, [r3] + mov ip, r0 + b _02050488 +_0205045C: + mov r1, r0, asr #4 + add r1, r0, r1, lsr #27 + mov r1, r1, asr #5 + add r3, r4, r1, lsl #2 + mov r2, r0, lsr #0x1f + rsb r1, r2, r0, lsl #27 + ldr r3, [r3, #0x260] + add r1, r2, r1, ror #27 + tst r3, ip, lsl r1 + ldmeqia sp!, {r4, pc} + add r0, r0, #1 +_02050488: + cmp r0, #6 + blt _0205045C + ldr r0, [r4, #4] + orr r0, r0, #4 + str r0, [r4, #4] + ldmia sp!, {r4, pc} + .align 2, 0 +_020504A0: .word ADVENTURE_LOG_PTR + arm_func_end SetChallengeLetterCleared + + arm_func_start GetSentryDutyGamePoints +GetSentryDutyGamePoints: ; 0x020504A4 + ldr r1, _020504B8 ; =ADVENTURE_LOG_PTR + ldr r1, [r1] + add r0, r1, r0, lsl #2 + ldr r0, [r0, #0x264] + bx lr + .align 2, 0 +_020504B8: .word ADVENTURE_LOG_PTR + arm_func_end GetSentryDutyGamePoints + + arm_func_start SetSentryDutyGamePoints +SetSentryDutyGamePoints: ; 0x020504BC + stmdb sp!, {r3, lr} + ldr r1, _02050548 ; =ADVENTURE_LOG_PTR + mov lr, #0 + ldr r2, [r1] + b _020504EC +_020504D0: + add r1, r2, lr, lsl #2 + ldr r1, [r1, #0x264] + cmp r0, r1 + bhi _020504F4 + add r1, lr, #1 + mov r1, r1, lsl #0x10 + mov lr, r1, asr #0x10 +_020504EC: + cmp lr, #5 + blt _020504D0 +_020504F4: + cmp lr, #5 + mvnge r0, #0 + ldmgeia sp!, {r3, pc} + mov ip, #4 + ldr r2, _02050548 ; =ADVENTURE_LOG_PTR + b _02050528 +_0205050C: + ldr r3, [r2] + sub r1, ip, #1 + add ip, r3, ip, lsl #2 + ldr r3, [ip, #0x260] + mov r1, r1, lsl #0x10 + str r3, [ip, #0x264] + mov ip, r1, asr #0x10 +_02050528: + cmp ip, lr + bgt _0205050C + ldr r1, _02050548 ; =ADVENTURE_LOG_PTR + ldr r1, [r1] + add r1, r1, lr, lsl #2 + str r0, [r1, #0x264] + mov r0, lr + ldmia sp!, {r3, pc} + .align 2, 0 +_02050548: .word ADVENTURE_LOG_PTR + arm_func_end SetSentryDutyGamePoints + + arm_func_start CopyLogTo +CopyLogTo: ; 0x0205054C + stmdb sp!, {r4, lr} + mov r4, r0 + bl ComputeSpecialCounters + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + mov r2, #0x14 + add r1, r1, #0x10 + bl CopyBitsTo + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + mov r2, #0x14 + add r1, r1, #0x14 + bl CopyBitsTo + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + mov r2, #0x14 + add r1, r1, #0x18 + bl CopyBitsTo + mov r0, r4 + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r2, #0x80 + ldr r1, [r1] + bl CopyBitsTo + mov r0, r4 + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r2, #0xe + ldr r1, [r1] + add r1, r1, #0x2c + bl CopyBitsTo + mov r0, r4 + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r2, #0xe + ldr r1, [r1] + add r1, r1, #0x30 + bl CopyBitsTo + mov r0, r4 + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r2, #9 + ldr r1, [r1] + add r1, r1, #0x34 + bl CopyBitsTo + mov r0, r4 + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r2, #0x14 + ldr r1, [r1] + add r1, r1, #0x28 + bl CopyBitsTo + mov r0, r4 + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r2, #0x14 + ldr r1, [r1] + add r1, r1, #0x24 + bl CopyBitsTo + mov r0, r4 + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r2, #0x14 + ldr r1, [r1] + add r1, r1, #0x1c + bl CopyBitsTo + mov r0, r4 + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r2, #0x14 + ldr r1, [r1] + add r1, r1, #0x38 + bl CopyBitsTo + mov r0, r4 + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r2, #0x14 + ldr r1, [r1] + add r1, r1, #0x3c + bl CopyBitsTo + mov r0, r4 + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r2, #0x14 + ldr r1, [r1] + add r1, r1, #0x40 + bl CopyBitsTo + mov r0, r4 + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r2, #0x4a0 + ldr r1, [r1] + add r1, r1, #0x44 + bl CopyBitsTo + mov r0, r4 + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r2, #0x4a0 + ldr r1, [r1] + add r1, r1, #0xd8 + bl CopyBitsTo + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + mov r2, #0x220 + add r1, r1, #0x16c + bl CopyBitsTo + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + mov r2, #0x580 + add r1, r1, #0x1b0 + bl CopyBitsTo + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + mov r2, #0x20 + add r1, r1, #0x260 + bl CopyBitsTo + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + mov r2, #0xa0 + add r1, r1, #0x264 + bl CopyBitsTo + ldr r1, _02050734 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + add r1, r1, #0x278 + bl sub_020515C4 + ldmia sp!, {r4, pc} + .align 2, 0 +_02050734: .word ADVENTURE_LOG_PTR + arm_func_end CopyLogTo + + arm_func_start CopyLogFrom +CopyLogFrom: ; 0x02050738 + stmdb sp!, {r4, lr} + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r2, #0x14 + ldr r1, [r1] + mov r4, r0 + add r1, r1, #0x10 + bl CopyBitsFrom + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + mov r2, #0x14 + add r1, r1, #0x14 + bl CopyBitsFrom + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + mov r2, #0x14 + add r1, r1, #0x18 + bl CopyBitsFrom + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + mov r2, #0x80 + bl CopyBitsFrom + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + mov r2, #0xe + add r1, r1, #0x2c + bl CopyBitsFrom + mov r0, r4 + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r2, #0xe + ldr r1, [r1] + add r1, r1, #0x30 + bl CopyBitsFrom + mov r0, r4 + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r2, #9 + ldr r1, [r1] + add r1, r1, #0x34 + bl CopyBitsFrom + mov r0, r4 + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r2, #0x14 + ldr r1, [r1] + add r1, r1, #0x28 + bl CopyBitsFrom + mov r0, r4 + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r2, #0x14 + ldr r1, [r1] + add r1, r1, #0x24 + bl CopyBitsFrom + mov r0, r4 + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r2, #0x14 + ldr r1, [r1] + add r1, r1, #0x1c + bl CopyBitsFrom + mov r0, r4 + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r2, #0x14 + ldr r1, [r1] + add r1, r1, #0x38 + bl CopyBitsFrom + mov r0, r4 + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r2, #0x14 + ldr r1, [r1] + add r1, r1, #0x3c + bl CopyBitsFrom + mov r0, r4 + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r2, #0x14 + ldr r1, [r1] + add r1, r1, #0x40 + bl CopyBitsFrom + mov r0, r4 + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r2, #0x4a0 + ldr r1, [r1] + add r1, r1, #0x44 + bl CopyBitsFrom + mov r0, r4 + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r2, #0x4a0 + ldr r1, [r1] + add r1, r1, #0xd8 + bl CopyBitsFrom + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + mov r2, #0x220 + add r1, r1, #0x16c + bl CopyBitsFrom + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + mov r2, #0x580 + add r1, r1, #0x1b0 + bl CopyBitsFrom + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + mov r2, #0x20 + add r1, r1, #0x260 + bl CopyBitsFrom + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + mov r2, #0xa0 + add r1, r1, #0x264 + bl CopyBitsFrom + ldr r1, _02050918 ; =ADVENTURE_LOG_PTR + mov r0, r4 + ldr r1, [r1] + add r1, r1, #0x278 + bl Copy16BitsFrom + ldmia sp!, {r4, pc} + .align 2, 0 +_02050918: .word ADVENTURE_LOG_PTR + arm_func_end CopyLogFrom + + arm_func_start GetAbilityString +GetAbilityString: ; 0x0205091C +#if defined(EUROPE) + add r1, r1, #0x5e0 + add r1, r1, #0x3000 +#elif defined(JAPAN) + add r1, r1, #0x81 + add r1, r1, #0x4800 +#else + add r1, r1, #0xde + add r1, r1, #0x3500 +#endif + mov r1, r1, lsl #0x10 + ldr ip, _02050938 ; =CopyNStringFromId + mov r1, r1, lsr #0x10 + mov r2, #0x50 + bx ip + .align 2, 0 +_02050938: .word CopyNStringFromId + arm_func_end GetAbilityString + + arm_func_start GetAbilityDescStringId +GetAbilityDescStringId: ; 0x0205093C +#if defined(EUROPE) + add r0, r0, #0x25c + add r0, r0, #0x3400 +#elif defined(JAPAN) + add r0, r0, #0xfd + add r0, r0, #0x4800 +#else + add r0, r0, #0x5a + add r0, r0, #0x3600 +#endif + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + bx lr + arm_func_end GetAbilityDescStringId + + arm_func_start GetTypeStringId +GetTypeStringId: ; 0x02050950 +#if defined(EUROPE) + add r0, r0, #0xcd + add r0, r0, #0x3500 +#elif defined(JAPAN) + add r0, r0, #0x6e + add r0, r0, #0x4800 +#else + add r0, r0, #0xcb + add r0, r0, #0x3500 +#endif + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + bx lr + arm_func_end GetTypeStringId + + arm_func_start GetConversion2ConvertToType +GetConversion2ConvertToType: ; 0x02050964 + ldr r1, _02050970 ; =_020A192C + ldrb r0, [r1, r0] + bx lr + .align 2, 0 +_02050970: .word _020A192C + arm_func_end GetConversion2ConvertToType + + arm_func_start sub_02050974 +sub_02050974: ; 0x02050974 + str r1, [r0] + mov r3, #0 + str r3, [r0, #8] + str r3, [r0, #0xc] + add r1, r1, r2 + str r1, [r0, #4] + bx lr + arm_func_end sub_02050974 + + arm_func_start sub_02050990 +sub_02050990: ; 0x02050990 + str r1, [r0] + mov r3, #0 + str r3, [r0, #8] + str r3, [r0, #0xc] + add r3, r1, r2 + str r3, [r0, #4] + mov r0, r1 + ldr ip, _020509B8 ; =MemZero + mov r1, r2 + bx ip + .align 2, 0 +_020509B8: .word MemZero + arm_func_end sub_02050990 + + arm_func_start sub_020509BC +sub_020509BC: ; 0x020509BC + bx lr + arm_func_end sub_020509BC + + arm_func_start CopyBitsTo +CopyBitsTo: ; 0x020509C0 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov ip, #0 + mov r3, #1 + mov r5, ip + mov r4, ip + b _02050A34 +_020509D8: + ldrb r6, [r1] + sub r2, r2, #1 + tst r6, r3, lsl ip + ldrne r7, [r0] + ldrne lr, [r0, #8] + ldrneb r6, [r7] + add ip, ip, #1 + orrne r6, r6, r3, lsl lr + strneb r6, [r7] + ldr lr, [r0, #8] + cmp ip, #8 + add lr, lr, #1 + moveq ip, r5 + addeq r1, r1, #1 + str lr, [r0, #8] + cmp lr, #8 + ldreq lr, [r0] + addeq lr, lr, #1 + streq lr, [r0] + streq r4, [r0, #8] + ldr lr, [r0, #0xc] + add lr, lr, #1 + str lr, [r0, #0xc] +_02050A34: + cmp r2, #0 + bne _020509D8 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end CopyBitsTo + + arm_func_start CopyBitsFrom +CopyBitsFrom: ; 0x02050A40 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov lr, #0 + mov ip, lr + mov r3, #1 + mov r6, lr + mov r5, lr + b _02050AC0 +_02050A5C: + cmp lr, #0 + streqb ip, [r1] + ldr r7, [r0] + ldr r4, [r0, #8] + ldrb r7, [r7] + sub r2, r2, #1 + tst r7, r3, lsl r4 + ldrneb r4, [r1] + orrne r4, r4, r3, lsl lr + strneb r4, [r1] + ldr r4, [r0, #8] + add lr, lr, #1 + cmp lr, #8 + add r4, r4, #1 + moveq lr, r6 + addeq r1, r1, #1 + str r4, [r0, #8] + cmp r4, #8 + ldreq r4, [r0] + addeq r4, r4, #1 + streq r4, [r0] + streq r5, [r0, #8] + ldr r4, [r0, #0xc] + add r4, r4, #1 + str r4, [r0, #0xc] +_02050AC0: + cmp r2, #0 + bne _02050A5C + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end CopyBitsFrom + + arm_func_start StoreDefaultTeamData +StoreDefaultTeamData: ; 0x02050ACC + stmdb sp!, {lr} + sub sp, sp, #0x14 +#ifdef JAPAN + ldr r1, _02050E54 ; =0x000004C5 + add r0, sp, #0 +#else + add r0, sp, #0 + mov r1, #0x234 +#endif + bl GetStringFromFileVeneer + ldr r0, _02050B08 ; =_022AB918 + add r1, sp, #0 +#ifdef JAPAN + mov r2, #5 +#else + mov r2, #0xa +#endif + bl StrncpyName + ldr r0, _02050B0C ; =_022AB918 + mov r1, #0 +#ifdef JAPAN + str r1, [r0, #8] + strb r1, [r0, #0xc] +#else + str r1, [r0, #0xc] + strb r1, [r0, #0x10] +#endif + add sp, sp, #0x14 + ldmia sp!, {pc} + .align 2, 0 +#ifdef JAPAN +_02050E54: .word 0x000004C5 +#endif +_02050B08: .word _022AB918 +_02050B0C: .word _022AB918 + arm_func_end StoreDefaultTeamData + + arm_func_start GetMainTeamNameWithCheck +GetMainTeamNameWithCheck: ; 0x02050B10 + stmdb sp!, {r4, lr} + sub sp, sp, #0x40 + mov r4, r0 + mov r0, #1 + bl GetPerformanceFlagWithChecks + cmp r0, #0 + ldrne r0, _02050B70 ; =_022AB918 + ldrneb r0, [r0] + cmpne r0, #0 + beq _02050B4C + ldr r1, _02050B74 ; =_022AB918 + mov r0, r4 +#ifdef JAPAN + mov r2, #5 +#else + mov r2, #0xa +#endif + bl StrncpySimpleNoPad + b _02050B68 +_02050B4C: + ldr r1, _02050B78 ; =0x00000237 + add r0, sp, #0 + bl GetStringFromFileVeneer + add r1, sp, #0 + mov r0, r4 +#ifdef JAPAN + mov r2, #5 +#else + mov r2, #0xa +#endif + bl StrncpyName +_02050B68: + add sp, sp, #0x40 + ldmia sp!, {r4, pc} + .align 2, 0 +_02050B70: .word _022AB918 +_02050B74: .word _022AB918 +#ifdef JAPAN +_02050B78: .word 0x000004C8 +#else +_02050B78: .word 0x00000237 +#endif + arm_func_end GetMainTeamNameWithCheck + + arm_func_start GetMainTeamName +GetMainTeamName: ; 0x02050B7C + ldr ip, _02050B8C ; =StrncpySimpleNoPadSafe + ldr r1, _02050B90 ; =_022AB918 +#ifdef JAPAN + mov r2, #5 +#else + mov r2, #0xa +#endif + bx ip + .align 2, 0 +_02050B8C: .word StrncpySimpleNoPadSafe +_02050B90: .word _022AB918 + arm_func_end GetMainTeamName + + arm_func_start SetMainTeamName +SetMainTeamName: ; 0x02050B94 + ldr r1, _02050BB4 ; =_022AB918 + mov r3, #0 +_02050B9C: + ldrb r2, [r0], #1 + strb r2, [r1, r3] + add r3, r3, #1 +#ifdef JAPAN + cmp r3, #5 +#else + cmp r3, #0xa +#endif + blt _02050B9C + bx lr + .align 2, 0 +_02050BB4: .word _022AB918 + arm_func_end SetMainTeamName + + arm_func_start GetRankupPoints +GetRankupPoints: ; 0x02050BB8 + stmdb sp!, {r4, lr} + bl GetRank + mov r4, r0 + mov r0, #0x16 + bl GetPerformanceFlagWithChecks + cmp r0, #0 + beq _02050BE4 + cmp r4, #0xc + bne _02050BF0 + mov r0, #0 + ldmia sp!, {r4, pc} +_02050BE4: + cmp r4, #8 + movhs r0, #0 + ldmhsia sp!, {r4, pc} +_02050BF0: + mov r0, r4 + bl GetRankUpEntry + ldr r1, _02050C0C ; =_022AB918 + ldr r2, [r0, #4] +#ifdef JAPAN + ldr r0, [r1, #8] +#else + ldr r0, [r1, #0xc] +#endif + sub r0, r2, r0 + ldmia sp!, {r4, pc} + .align 2, 0 +_02050C0C: .word _022AB918 + arm_func_end GetRankupPoints + + arm_func_start sub_02050C10 +sub_02050C10: ; 0x02050C10 +#ifdef JAPAN +#define SUB_02050C10_OFFSET #8 +#else +#define SUB_02050C10_OFFSET #0xc +#endif + stmdb sp!, {r3, lr} + ldr r1, _02050C6C ; =_022AB918 + ldr r2, [r1, SUB_02050C10_OFFSET] + add r2, r2, r0 + mov r0, #0x16 + str r2, [r1, SUB_02050C10_OFFSET] + bl GetPerformanceFlagWithChecks + cmp r0, #0 + beq _02050C4C + ldr r0, _02050C6C ; =_022AB918 + ldr r1, _02050C70 ; =0x05F5E0FF + ldr r2, [r0, SUB_02050C10_OFFSET] + cmp r2, r1 + strgt r1, [r0, SUB_02050C10_OFFSET] + ldmia sp!, {r3, pc} +_02050C4C: + mov r0, #7 + bl GetRankUpEntry + ldr r1, _02050C6C ; =_022AB918 + ldr r2, [r0, #4] + ldr r0, [r1, SUB_02050C10_OFFSET] + cmp r0, r2 + strgt r2, [r1, SUB_02050C10_OFFSET] + ldmia sp!, {r3, pc} + .align 2, 0 +_02050C6C: .word _022AB918 +_02050C70: .word 0x05F5E0FF + arm_func_end sub_02050C10 + + arm_func_start GetRank +GetRank: ; 0x02050C74 + stmdb sp!, {r3, r4, r5, lr} + mov r5, #0 + ldr r4, _02050CCC ; =_022AB918 + b _02050CA4 +_02050C84: + mov r0, r5 + bl GetRankUpEntry +#ifdef JAPAN + ldr r1, [r4, #8] +#else + ldr r1, [r4, #0xc] +#endif + ldr r0, [r0, #4] + cmp r1, r0 + blt _02050CAC + add r0, r5, #1 + and r5, r0, #0xff +_02050CA4: + cmp r5, #0xc + blo _02050C84 +_02050CAC: + mov r0, #0x16 + bl GetPerformanceFlagWithChecks + cmp r0, #0 + bne _02050CC4 + cmp r5, #8 + movhi r5, #8 +_02050CC4: + mov r0, r5 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_02050CCC: .word _022AB918 + arm_func_end GetRank + + arm_func_start sub_02050CD0 +sub_02050CD0: ; 0x02050CD0 + stmdb sp!, {r3, lr} + bl GetRank + cmp r0, #8 + movhi r0, #8 + ldmia sp!, {r3, pc} + arm_func_end sub_02050CD0 + + arm_func_start GetRankStorageSize +GetRankStorageSize: ; 0x02050CE4 + stmdb sp!, {r3, lr} + bl GetRank + bl GetRankUpEntry + ldr r0, [r0, #8] + ldmia sp!, {r3, pc} + arm_func_end GetRankStorageSize + + arm_func_start sub_02050CF8 +sub_02050CF8: ; 0x02050CF8 + stmdb sp!, {r3, lr} + sub sp, sp, #0x10 + mov r3, r0 + mov r2, r1 + add r0, sp, #0 + mov r1, r3 + bl sub_02050990 + ldr r1, _02050D70 ; =_022AB918 + add r0, sp, #0 +#ifdef JAPAN + mov r2, #0x28 +#else + mov r2, #0x50 +#endif + bl CopyBitsTo + ldr r1, _02050D74 ; =_022AB924 + add r0, sp, #0 + mov r2, #0x20 + bl CopyBitsTo + mov r0, #1 + bl GetPerformanceFlagWithChecks + ldr r1, _02050D78 ; =_022AB918 + tst r0, #0xff +#ifdef JAPAN + strb r0, [r1, #0xc] +#else + strb r0, [r1, #0x10] +#endif + ldrne r1, _02050D7C ; =ARM9_UNKNOWN_DATA__NA_209E6BC + add r0, sp, #0 + ldreq r1, _02050D80 ; =_0209E6BD + mov r2, #1 + bl CopyBitsTo + add r0, sp, #0 + bl sub_020509BC + ldr r0, [sp, #8] + add sp, sp, #0x10 + ldmia sp!, {r3, pc} + .align 2, 0 +_02050D70: .word _022AB918 +_02050D74: .word _022AB924 +_02050D78: .word _022AB918 +_02050D7C: .word ARM9_UNKNOWN_DATA__NA_209E6BC +_02050D80: .word _0209E6BD + arm_func_end sub_02050CF8 + + arm_func_start sub_02050D84 +sub_02050D84: ; 0x02050D84 + stmdb sp!, {lr} + sub sp, sp, #0x14 + mov r3, r0 + mov r2, r1 + add r0, sp, #4 + mov r1, r3 + bl sub_02050974 + ldr r1, _02050DFC ; =_022AB918 + add r0, sp, #4 +#ifdef JAPAN + mov r2, #0x28 +#else + mov r2, #0x50 +#endif + bl CopyBitsFrom + ldr r1, _02050E00 ; =_022AB924 + add r0, sp, #4 + mov r2, #0x20 + bl CopyBitsFrom + add r0, sp, #4 + add r1, sp, #0 + mov r2, #1 + bl CopyBitsFrom + ldrb r0, [sp] + ldr r1, _02050E04 ; =_022AB918 + tst r0, #1 + movne r2, #1 + moveq r2, #0 + add r0, sp, #4 +#ifdef JAPAN + strb r2, [r1, #0xc] +#else + strb r2, [r1, #0x10] +#endif + bl sub_020509BC + ldr r0, [sp, #0xc] + add sp, sp, #0x14 + ldmia sp!, {pc} + .align 2, 0 +_02050DFC: .word _022AB918 +_02050E00: .word _022AB924 +_02050E04: .word _022AB918 + arm_func_end sub_02050D84 + + arm_func_start ResetPlayTimer +ResetPlayTimer: ; 0x02050E08 + mov r1, #0 + strb r1, [r0, #4] + str r1, [r0] + bx lr + arm_func_end ResetPlayTimer + + arm_func_start PlayTimerTick +PlayTimerTick: ; 0x02050E18 + ldrb r1, [r0, #4] + add r2, r1, #1 + and r1, r2, #0xff + strb r2, [r0, #4] + cmp r1, #0x3c + bxlo lr + mov r1, #0 + strb r1, [r0, #4] + ldr r2, [r0] + ldr r1, _02050E50 ; =0x022550FF + cmp r2, r1 + addlo r1, r2, #1 + strlo r1, [r0] + bx lr + .align 2, 0 +_02050E50: .word 0x022550FF + arm_func_end PlayTimerTick + + arm_func_start GetPlayTimeSeconds +GetPlayTimeSeconds: ; 0x02050E54 + ldr r0, [r0] + bx lr + arm_func_end GetPlayTimeSeconds + + arm_func_start sub_02050E5C +sub_02050E5C: ; 0x02050E5C + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + mov r4, r1 + mov r0, r4 + add r1, r5, #4 + mov r2, #6 + bl CopyBitsTo + mov r0, r4 + mov r1, r5 + mov r2, #0x20 + bl CopyBitsTo + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_02050E5C + + arm_func_start sub_02050E8C +sub_02050E8C: ; 0x02050E8C + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + mov r4, r1 + mov r0, r4 + add r1, r5, #4 + mov r2, #6 + bl CopyBitsFrom + mov r0, r4 + mov r1, r5 + mov r2, #0x20 + bl CopyBitsFrom + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_02050E8C + + arm_func_start sub_02050EBC +sub_02050EBC: ; 0x02050EBC + stmdb sp!, {r0, r1, r2, r3} + ldrsh r3, [sp, #2] + ldrsh r0, [sp, #6] + ldrsh r2, [sp] + ldrsh r1, [sp, #4] + add r0, r3, r0 + strh r0, [sp, #2] + ldrsh r0, [sp, #2] + add r1, r2, r1 + strh r1, [sp] + cmp r0, #0x3e8 + subge r0, r0, #0x3e8 + ldrgesh r1, [sp] + strgeh r0, [sp, #2] + addge r0, r1, #1 + strgeh r0, [sp] + ldrh r1, [sp, #2] + ldrh r0, [sp] + orr r0, r0, r1, lsl #16 + add sp, sp, #0x10 + bx lr + arm_func_end sub_02050EBC + + arm_func_start SubFixedPoint +SubFixedPoint: ; 0x02050F10 + stmdb sp!, {r0, r1, r2, r3} + ldrsh r3, [sp, #2] + ldrsh r0, [sp, #6] + ldrsh r2, [sp] + ldrsh r1, [sp, #4] + sub r0, r3, r0 + strh r0, [sp, #2] + ldrsh r0, [sp, #2] + sub r1, r2, r1 + strh r1, [sp] + cmp r0, #0 + addlt r0, r0, #0x3e8 + ldrltsh r1, [sp] + strlth r0, [sp, #2] + sublt r0, r1, #1 + strlth r0, [sp] + ldrsh r0, [sp] + cmp r0, #0 + movlt r0, #0 + strlth r0, [sp, #2] + strlth r0, [sp] + ldrh r1, [sp, #2] + ldrh r0, [sp] + orr r0, r0, r1, lsl #16 + add sp, sp, #0x10 + bx lr + arm_func_end SubFixedPoint + + arm_func_start sub_02050F78 +sub_02050F78: ; 0x02050F78 + stmdb sp!, {r0, r1, r2, r3} + stmdb sp!, {r3} + sub sp, sp, #4 + ldrsh r1, [sp, #8] + ldrsh r0, [sp, #0xc] + cmp r1, r0 + ldrgth r1, [sp, #0xe] + ldrgth r0, [sp, #0xc] + orrgt r0, r0, r1, lsl #16 + bgt _02050FE8 + ldrlth r1, [sp, #0xa] + ldrlth r0, [sp, #8] + orrlt r0, r0, r1, lsl #16 + blt _02050FE8 + ldrsh r1, [sp, #0xa] + ldrsh r0, [sp, #0xe] + cmp r1, r0 + ldrgth r1, [sp, #0xc] + ldrgth r0, [sp, #0xe] + strgth r1, [sp] + strgth r0, [sp, #2] + ldrleh r1, [sp, #8] + ldrleh r0, [sp, #0xa] + strleh r1, [sp] + strleh r0, [sp, #2] + ldrh r1, [sp, #2] + ldrh r0, [sp] + orr r0, r0, r1, lsl #16 +_02050FE8: + add sp, sp, #4 + ldmia sp!, {r3} + add sp, sp, #0x10 + bx lr + arm_func_end sub_02050F78 + + arm_func_start sub_02050FF8 +sub_02050FF8: ; 0x02050FF8 + stmdb sp!, {r3} + sub sp, sp, #4 + strh r0, [sp] + ldrh r0, [sp] + mov r1, #0 + strh r1, [sp, #2] + orr r0, r0, r1, lsl #16 + add sp, sp, #4 + ldmia sp!, {r3} + bx lr + arm_func_end sub_02050FF8 + + arm_func_start BinToDecFixedPoint +BinToDecFixedPoint: ; 0x02051020 + stmdb sp!, {r3} + sub sp, sp, #4 + ldr r2, [r0, #4] + mov r1, #0x3e8 + mov r0, r2, lsl #0x10 + mov r0, r0, lsr #0x10 + mul r1, r0, r1 + mov r2, r2, lsr #0x10 + mov r0, r1, lsr #0x10 + strh r2, [sp] + strh r0, [sp, #2] + ldrh r1, [sp, #2] + ldrh r0, [sp] + orr r0, r0, r1, lsl #16 + add sp, sp, #4 + ldmia sp!, {r3} + bx lr + arm_func_end BinToDecFixedPoint + + arm_func_start CeilFixedPoint +CeilFixedPoint: ; 0x02051064 + stmdb sp!, {r0, r1, r2, r3} + ldrsh r0, [sp] + ldrsh r1, [sp, #2] + cmp r0, #0 + bne _02051088 + cmp r1, #0 + movne r0, #1 + moveq r0, #0 + b _02051090 +_02051088: + cmp r1, #0 + addne r0, r0, #1 +_02051090: + add sp, sp, #0x10 + bx lr + arm_func_end CeilFixedPoint + + arm_func_start sub_02051098 +sub_02051098: ; 0x02051098 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + mov r4, r1 + mov r2, #0x10 + bl CopyBitsFrom + mov r0, r5 + add r1, r4, #2 + mov r2, #0x10 + bl CopyBitsFrom + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_02051098 + + arm_func_start sub_020510C0 +sub_020510C0: ; 0x020510C0 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + mov r4, r1 + mov r2, #0x10 + bl CopyBitsTo + mov r0, r5 + add r1, r4, #2 + mov r2, #0x10 + bl CopyBitsTo + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_020510C0 + + arm_func_start sub_020510E8 +sub_020510E8: ; 0x020510E8 + ldr r3, _02051128 ; =_020AFF88 + mov ip, #1 + str r0, [r3] + ldr r0, _0205112C ; =0x6C078965 + b _02051114 +_020510FC: + add r1, r3, ip, lsl #2 + ldr r1, [r1, #-4] + eor r1, r1, r1, lsr #30 + mla r2, r1, r0, ip + str r2, [r3, ip, lsl #2] + add ip, ip, #1 +_02051114: + cmp ip, #0x270 + blt _020510FC + ldr r0, _02051130 ; =_020AFF7C + str ip, [r0] + bx lr + .align 2, 0 +_02051128: .word _020AFF88 +_0205112C: .word 0x6C078965 +_02051130: .word _020AFF7C + arm_func_end sub_020510E8 + + arm_func_start sub_02051134 +sub_02051134: ; 0x02051134 + stmdb sp!, {r4, lr} + ldr r0, _0205126C ; =_020AFF7C + ldr r1, [r0] + cmp r1, #0x270 + blt _02051230 + ldr r0, _02051270 ; =0x00000271 + cmp r1, r0 + bne _0205115C + add r0, r0, #0x1300 + bl sub_020510E8 +_0205115C: + ldr ip, _02051274 ; =_020AFF88 + ldr r2, _02051278 ; =_020AFF80 + mov r0, #0 +_02051168: + add r3, ip, r0, lsl #2 + ldr r4, [ip, r0, lsl #2] + ldr r1, [r3, #4] + and r4, r4, #0x80000000 + bic r1, r1, #0x80000000 + orr r4, r4, r1 + and r1, r4, #1 + ldr r3, [r3, #0x634] + ldr r1, [r2, r1, lsl #2] + eor r3, r3, r4, lsr #1 + eor r1, r3, r1 + str r1, [ip, r0, lsl #2] + add r0, r0, #1 + cmp r0, #0xe3 + blt _02051168 + ldr r4, _02051274 ; =_020AFF88 + ldr r3, _02051278 ; =_020AFF80 + ldr r1, _0205127C ; =0x0000026F + b _020511E8 +_020511B4: + add ip, r4, r0, lsl #2 + ldr lr, [r4, r0, lsl #2] + ldr r2, [ip, #4] + and lr, lr, #0x80000000 + bic r2, r2, #0x80000000 + orr lr, lr, r2 + and r2, lr, #1 + ldr ip, [ip, #-0x38c] + ldr r2, [r3, r2, lsl #2] + eor ip, ip, lr, lsr #1 + eor r2, ip, r2 + str r2, [r4, r0, lsl #2] + add r0, r0, #1 +_020511E8: + cmp r0, r1 + blt _020511B4 + ldr r1, _02051274 ; =_020AFF88 + ldr r0, _02051278 ; =_020AFF80 + ldr r3, [r1, #0x9bc] + ldr r2, [r1] + and r3, r3, #0x80000000 + bic r2, r2, #0x80000000 + orr ip, r3, r2 + and r2, ip, #1 + ldr r3, [r1, #0x630] + ldr r0, [r0, r2, lsl #2] + eor r2, r3, ip, lsr #1 + eor r2, r2, r0 + ldr r0, _0205126C ; =_020AFF7C + str r2, [r1, #0x9bc] + mov r1, #0 + str r1, [r0] +_02051230: + ldr r1, _0205126C ; =_020AFF7C + ldr r2, _02051274 ; =_020AFF88 + ldr r3, [r1] + ldr r0, _02051280 ; =0x9D2C5680 + ldr r2, [r2, r3, lsl #2] + add ip, r3, #1 + eor r3, r2, r2, lsr #11 + and r2, r0, r3, lsl #7 + ldr r0, _02051284 ; =0xEFC60000 + eor r2, r3, r2 + and r0, r0, r2, lsl #15 + eor r0, r2, r0 + str ip, [r1] + eor r0, r0, r0, lsr #18 + ldmia sp!, {r4, pc} + .align 2, 0 +_0205126C: .word _020AFF7C +_02051270: .word 0x00000271 +_02051274: .word _020AFF88 +_02051278: .word _020AFF80 +_0205127C: .word 0x0000026F +_02051280: .word 0x9D2C5680 +_02051284: .word 0xEFC60000 + arm_func_end sub_02051134 + + arm_func_start DungeonGoesUp +DungeonGoesUp: ; 0x02051288 + mov r1, #0xc + mul r1, r0, r1 + ldr r0, _020512AC ; =DUNGEON_RESTRICTIONS + ldr r0, [r0, r1] + tst r0, #1 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_020512AC: .word DUNGEON_RESTRICTIONS + arm_func_end DungeonGoesUp + + arm_func_start GetTurnLimit +GetTurnLimit: ; 0x020512B0 + mov r1, #0xc + mul r1, r0, r1 + ldr r0, _020512C4 ; =_020A0C6C + ldrsh r0, [r0, r1] + bx lr + .align 2, 0 +_020512C4: .word _020A0C6C + arm_func_end GetTurnLimit + + arm_func_start DoesNotSaveWhenEntering +DoesNotSaveWhenEntering: ; 0x020512C8 + mov r1, #0xc + mul r1, r0, r1 + ldr r0, _020512EC ; =DUNGEON_RESTRICTIONS + ldr r0, [r0, r1] + tst r0, #0x80 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_020512EC: .word DUNGEON_RESTRICTIONS + arm_func_end DoesNotSaveWhenEntering + + arm_func_start TreasureBoxDropsEnabled +TreasureBoxDropsEnabled: ; 0x020512F0 + mov r1, #0xc + mul r1, r0, r1 + ldr r0, _02051314 ; =DUNGEON_RESTRICTIONS + ldr r0, [r0, r1] + tst r0, #0x400 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_02051314: .word DUNGEON_RESTRICTIONS + arm_func_end TreasureBoxDropsEnabled + + arm_func_start IsLevelResetDungeon +IsLevelResetDungeon: ; 0x02051318 + mov r1, #0xc + mul r1, r0, r1 + ldr r0, _0205133C ; =DUNGEON_RESTRICTIONS + ldr r0, [r0, r1] + tst r0, #0x10 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_0205133C: .word DUNGEON_RESTRICTIONS + arm_func_end IsLevelResetDungeon + + arm_func_start GetMaxItemsAllowed +GetMaxItemsAllowed: ; 0x02051340 + mov r1, #0xc + mul r1, r0, r1 + ldr r0, _02051354 ; =_020A0C69 + ldrb r0, [r0, r1] + bx lr + .align 2, 0 +_02051354: .word _020A0C69 + arm_func_end GetMaxItemsAllowed + + arm_func_start IsMoneyAllowed +IsMoneyAllowed: ; 0x02051358 + mov r1, #0xc + mul r1, r0, r1 + ldr r0, _0205137C ; =DUNGEON_RESTRICTIONS + ldr r0, [r0, r1] + tst r0, #0x20 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_0205137C: .word DUNGEON_RESTRICTIONS + arm_func_end IsMoneyAllowed + + arm_func_start GetMaxRescueAttempts +GetMaxRescueAttempts: ; 0x02051380 + mov r1, #0xc + mul r1, r0, r1 + ldr r0, _02051394 ; =_020A0C68 + ldrsb r0, [r0, r1] + bx lr + .align 2, 0 +_02051394: .word _020A0C68 + arm_func_end GetMaxRescueAttempts + + arm_func_start IsRecruitingAllowed +IsRecruitingAllowed: ; 0x02051398 + mov r1, #0xc + mul r1, r0, r1 + ldr r0, _020513BC ; =DUNGEON_RESTRICTIONS + ldr r0, [r0, r1] + tst r0, #8 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_020513BC: .word DUNGEON_RESTRICTIONS + arm_func_end IsRecruitingAllowed + + arm_func_start GetLeaderChangeFlag +GetLeaderChangeFlag: ; 0x020513C0 + mov r1, #0xc + mul r1, r0, r1 + ldr r0, _020513E4 ; =DUNGEON_RESTRICTIONS + ldr r0, [r0, r1] + tst r0, #0x40 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_020513E4: .word DUNGEON_RESTRICTIONS + arm_func_end GetLeaderChangeFlag + + arm_func_start GetRandomMovementChance +GetRandomMovementChance: ; 0x020513E8 + mov r1, #0xc + mul r1, r0, r1 + ldr r0, _020513FC ; =_020A0C6E + ldrsh r0, [r0, r1] + bx lr + .align 2, 0 +_020513FC: .word _020A0C6E + arm_func_end GetRandomMovementChance + + arm_func_start CanEnemyEvolve +CanEnemyEvolve: ; 0x02051400 + mov r1, #0xc + mul r1, r0, r1 + ldr r0, _02051424 ; =DUNGEON_RESTRICTIONS + ldr r0, [r0, r1] + tst r0, #2 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_02051424: .word DUNGEON_RESTRICTIONS + arm_func_end CanEnemyEvolve + + arm_func_start GetMaxMembersAllowed +GetMaxMembersAllowed: ; 0x02051428 + mov r1, #0xc + mul r1, r0, r1 + ldr r0, _0205143C ; =_020A0C6A + ldrb r0, [r0, r1] + bx lr + .align 2, 0 +_0205143C: .word _020A0C6A + arm_func_end GetMaxMembersAllowed + + arm_func_start IsIqEnabled +IsIqEnabled: ; 0x02051440 + mov r1, #0xc + mul r1, r0, r1 + ldr r0, _02051464 ; =DUNGEON_RESTRICTIONS + ldr r0, [r0, r1] + tst r0, #0x100 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_02051464: .word DUNGEON_RESTRICTIONS + arm_func_end IsIqEnabled + + arm_func_start IsTrapInvisibleWhenAttacking +IsTrapInvisibleWhenAttacking: ; 0x02051468 + mov r1, #0xc + mul r1, r0, r1 + ldr r0, _0205148C ; =DUNGEON_RESTRICTIONS + ldr r0, [r0, r1] + tst r0, #0x200 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_0205148C: .word DUNGEON_RESTRICTIONS + arm_func_end IsTrapInvisibleWhenAttacking + + arm_func_start JoinedAtRangeCheck +JoinedAtRangeCheck: ; 0x02051490 + cmp r0, #0xd9 + blo _020514A4 + cmp r0, #0xe4 + movlo r0, #1 + blo _020514A8 +_020514A4: + mov r0, #0 +_020514A8: + and r0, r0, #0xff + bx lr + arm_func_end JoinedAtRangeCheck + + arm_func_start IsDojoDungeon +IsDojoDungeon: ; 0x020514B0 + cmp r0, #0xb4 + blo _020514C4 + cmp r0, #0xd3 + movls r0, #1 + bxls lr +_020514C4: + mov r0, #0 + bx lr + arm_func_end IsDojoDungeon + + arm_func_start IsFutureDungeon +IsFutureDungeon: ; 0x020514CC + cmp r0, #0x1b + blo _020514E0 + cmp r0, #0x21 + movls r0, #1 + bxls lr +_020514E0: + mov r0, #0 + bx lr + arm_func_end IsFutureDungeon + + arm_func_start IsSpecialEpisodeDungeon +IsSpecialEpisodeDungeon: ; 0x020514E8 + cmp r0, #0x7b + blo _020514FC + cmp r0, #0xa4 + movls r0, #1 + bxls lr +_020514FC: + mov r0, #0 + bx lr + arm_func_end IsSpecialEpisodeDungeon + + arm_func_start RetrieveFromItemList1 +RetrieveFromItemList1: ; 0x02051504 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r7, r0 + ldr r0, _02051564 ; =0x0000270F + mov r6, r1 + bl RandIntSafe + mov r4, r0 + ldr r0, _02051564 ; =0x0000270F + bl RandIntSafe + mov r5, r0 + ldrb r0, [r7] + cmp r0, #0xb4 + cmphs r0, #0xd3 + movhs r0, #0x55 + ldmhsia sp!, {r3, r4, r5, r6, r7, pc} + bl GetNbFloorsPlusOne + ldrb r1, [r7, #1] + cmp r1, r0 + movhs r0, #0x55 + ldmhsia sp!, {r3, r4, r5, r6, r7, pc} + mov r0, r6 + mov r1, r4 + mov r2, r5 + bl GetItemIdFromList + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_02051564: .word 0x0000270F + arm_func_end RetrieveFromItemList1 + + arm_func_start IsForbiddenFloor +IsForbiddenFloor: ; 0x02051568 + stmdb sp!, {r3, lr} + mov r1, r0 + add r0, sp, #0 + bl DungeonFloorToGroupFloor + ldrb ip, [sp] + ldrb lr, [sp, #1] + ldr r1, _020515C0 ; =MISSION_FLOORS_FORBIDDEN + mov r3, #0 +_02051588: + ldrb r0, [r1, r3, lsl #1] + mov r2, r3, lsl #1 + cmp r0, #0x64 + beq _020515B8 + cmp ip, r0 + addeq r0, r1, r2 + ldreqb r0, [r0, #1] + cmpeq lr, r0 + moveq r0, #1 + ldmeqia sp!, {r3, pc} + add r3, r3, #1 + b _02051588 +_020515B8: + mov r0, #0 + ldmia sp!, {r3, pc} + .align 2, 0 +_020515C0: .word MISSION_FLOORS_FORBIDDEN + arm_func_end IsForbiddenFloor + + arm_func_start sub_020515C4 +sub_020515C4: ; 0x020515C4 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + mov r4, r1 + mov r2, #8 + bl CopyBitsTo + mov r0, r5 + add r1, r4, #1 + mov r2, #8 + bl CopyBitsTo + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_020515C4 + + arm_func_start Copy16BitsFrom +Copy16BitsFrom: ; 0x020515EC + stmdb sp!, {r3, r4, r5, lr} + mov r4, r1 + mov r3, #0 + strb r3, [r4] + mov r5, r0 + mov r2, #8 + strb r3, [r4, #1] + bl CopyBitsFrom + mov r0, r5 + add r1, r4, #1 + mov r2, #8 + bl CopyBitsFrom + ldmia sp!, {r3, r4, r5, pc} + arm_func_end Copy16BitsFrom + + arm_func_start sub_02051620 +sub_02051620: ; 0x02051620 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + mov r4, r1 + mov r2, #7 + bl CopyBitsTo + mov r0, r5 + add r1, r4, #1 + mov r2, #7 + bl CopyBitsTo + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_02051620 + + arm_func_start sub_02051648 +sub_02051648: ; 0x02051648 + stmdb sp!, {r3, r4, r5, lr} + mov r4, r1 + mov r3, #0 + strb r3, [r4] + mov r5, r0 + mov r2, #7 + strb r3, [r4, #1] + bl CopyBitsFrom + mov r0, r5 + add r1, r4, #1 + mov r2, #7 + bl CopyBitsFrom + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_02051648 + + arm_func_start RetrieveFromItemList2 +RetrieveFromItemList2: ; 0x0205167C + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r7, r0 + ldr r0, _020516D8 ; =0x0000270F + mov r6, r1 + bl RandIntSafe + mov r5, r0 + ldr r0, _020516D8 ; =0x0000270F + bl RandIntSafe + mov r4, r0 + ldrb r0, [r7] + cmp r0, #0xb4 + movhs r0, #0x55 + ldmhsia sp!, {r3, r4, r5, r6, r7, pc} + bl GetNbFloorsPlusOne + ldrb r1, [r7, #1] + cmp r1, r0 + movhs r0, #0x55 + ldmhsia sp!, {r3, r4, r5, r6, r7, pc} + mov r0, r6 + mov r1, r5 + mov r2, r4 + bl GetItemIdFromList + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_020516D8: .word 0x0000270F + arm_func_end RetrieveFromItemList2 + + arm_func_start IsInvalidForMission +IsInvalidForMission: ; 0x020516DC + cmp r0, #0xb4 + movhs r0, #1 + bxhs lr + mov r2, #0 + ldr r1, _02051718 ; =_020A1864 + b _02051704 +_020516F4: + cmp r3, r0 + moveq r0, #1 + bxeq lr + add r2, r2, #1 +_02051704: + ldrb r3, [r1, r2] + cmp r3, #0xb4 + bne _020516F4 + mov r0, #0 + bx lr + .align 2, 0 +_02051718: .word _020A1864 + arm_func_end IsInvalidForMission + + arm_func_start IsExpEnabledInDungeon +IsExpEnabledInDungeon: ; 0x0205171C + mov r1, #0xc + mul r1, r0, r1 + ldr r0, _02051740 ; =DUNGEON_RESTRICTIONS + ldr r0, [r0, r1] + tst r0, #4 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_02051740: .word DUNGEON_RESTRICTIONS + arm_func_end IsExpEnabledInDungeon + + arm_func_start IsSkyExclusiveDungeon +IsSkyExclusiveDungeon: ; 0x02051744 + cmp r0, #0x67 + blo _02051758 + cmp r0, #0xb0 + movls r0, #1 + bxls lr +_02051758: + mov r0, #0 + bx lr + arm_func_end IsSkyExclusiveDungeon + + arm_func_start JoinedAtRangeCheck2 +JoinedAtRangeCheck2: ; 0x02051760 + cmp r0, #0xd7 + beq _02051778 + cmp r0, #0xec + blo _02051780 + cmp r0, #0xf0 + bhi _02051780 +_02051778: + mov r0, #1 + bx lr +_02051780: + mov r0, #0 + bx lr + arm_func_end JoinedAtRangeCheck2 + + arm_func_start sub_02051788 +sub_02051788: ; 0x02051788 + ldr r1, _02051794 ; =_020A20B1 + ldrb r0, [r1, r0, lsl #1] + bx lr + .align 2, 0 +_02051794: .word _020A20B1 + arm_func_end sub_02051788 + + arm_func_start sub_02051798 +sub_02051798: ; 0x02051798 + mov ip, #0 + ldr r2, _020517D0 ; =ARM9_UNKNOWN_TABLE__NA_20A20B0 + b _020517C0 +_020517A4: + add r1, r2, ip, lsl #1 + ldrb r1, [r1, #1] + mov r3, ip, lsl #1 + cmp r0, r1 + ldreqb r0, [r2, r3] + bxeq lr + add ip, ip, #1 +_020517C0: + cmp ip, #0x100 + blt _020517A4 + mov r0, #0xff + bx lr + .align 2, 0 +_020517D0: .word ARM9_UNKNOWN_TABLE__NA_20A20B0 + arm_func_end sub_02051798 + + arm_func_start GetBagCapacity +GetBagCapacity: ; 0x020517D4 + ldr r1, _020517E0 ; =BAG_CAPACITY_TABLE + ldr r0, [r1, r0, lsl #2] + bx lr + .align 2, 0 +_020517E0: .word BAG_CAPACITY_TABLE + arm_func_end GetBagCapacity + + arm_func_start GetBagCapacitySpecialEpisode +GetBagCapacitySpecialEpisode: ; 0x020517E4 + ldr r1, _020517F0 ; =BAG_CAPACITY_TABLE_SPECIAL_EPISODES + ldr r0, [r1, r0, lsl #2] + bx lr + .align 2, 0 +_020517F0: .word BAG_CAPACITY_TABLE_SPECIAL_EPISODES + arm_func_end GetBagCapacitySpecialEpisode + + arm_func_start GetRankUpEntry +GetRankUpEntry: ; 0x020517F4 + ldr r1, _02051800 ; =RANK_UP_TABLE + add r0, r1, r0, lsl #4 + bx lr + .align 2, 0 +_02051800: .word RANK_UP_TABLE + arm_func_end GetRankUpEntry + + arm_func_start sub_02051804 +sub_02051804: ; 0x02051804 + stmdb sp!, {r4, lr} + add ip, r0, #0x100 + ldrsh r4, [ip, #0x40] + mov ip, #0x14 + ldr lr, [sp, #8] + smlabb r4, r4, ip, r0 + cmp lr, #1 + moveq r1, #0 + stmeqia r4, {r1, r2} + streq r1, [r4, #8] + strne r3, [r4] + strne r2, [r4, #4] + strne r1, [r4, #8] + ldrneh r1, [sp, #0xc] + str lr, [r4, #0xc] + add r0, r0, #0x100 + str r1, [r4, #0x10] + ldrsh r1, [r0, #0x40] + add r1, r1, #1 + strh r1, [r0, #0x40] + ldmia sp!, {r4, pc} + arm_func_end sub_02051804 + + arm_func_start sub_02051858 +sub_02051858: ; 0x02051858 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r7, r0 + mov r6, r1 + mov r0, #0x1c + mov r1, #0 + mov r5, r2 + mov r4, r3 + bl MemAlloc + str r0, [r7, #8] + str r6, [r7, #0xc] + mov r0, #1 + strb r0, [r7, #0x16] + str r5, [r7] + str r4, [r7, #4] + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end sub_02051858 + + arm_func_start sub_02051894 +sub_02051894: ; 0x02051894 + stmdb sp!, {r4, lr} + mov r4, r0 + ldrb r0, [r4, #0x16] + cmp r0, #0 + ldmeqia sp!, {r4, pc} + ldr r0, [r4, #8] + bl MemFree + mov r0, #0 + strb r0, [r4, #0x16] + ldmia sp!, {r4, pc} + arm_func_end sub_02051894 + + arm_func_start sub_020518BC +sub_020518BC: ; 0x020518BC + stmdb sp!, {r3, r4, lr} + sub sp, sp, #4 + mov r4, r0 + cmp r2, #0 + mov r0, #0 + bne _02051934 + cmp r1, #1 + bne _02051904 + ldr r1, _020519B0 ; =0x06018000 + ldr r2, _020519B4 ; =0x0400001C + str r1, [r4, #0x10] + str r0, [sp] + ldr r0, [r4, #8] + sub r3, r1, #0x9000 + mov r1, #1 + bl sub_0200B2C4 + mov r0, #1 + b _02051990 +_02051904: + cmp r1, #0 + bne _02051990 + ldr r1, _020519B8 ; =0x06010000 + ldr r2, _020519BC ; =0x04000018 + str r1, [r4, #0x10] + str r0, [sp] + ldr r0, [r4, #8] + sub r3, r1, #0x2000 + mov r1, #1 + bl sub_0200B2C4 + mov r0, #1 + b _02051990 +_02051934: + cmp r1, #1 + bne _02051964 + ldr r1, _020519C0 ; =0x06218000 + ldr r2, _020519C4 ; =0x0400101C + str r1, [r4, #0x10] + str r0, [sp] + ldr r0, [r4, #8] + sub r3, r1, #0x9000 + mov r1, #1 + bl sub_0200B2C4 + mov r0, #1 + b _02051990 +_02051964: + cmp r1, #0 + bne _02051990 + ldr r1, _020519C8 ; =0x06210000 + ldr r2, _020519CC ; =0x04001018 + str r1, [r4, #0x10] + str r0, [sp] + ldr r0, [r4, #8] + sub r3, r1, #0x2000 + mov r1, #1 + bl sub_0200B2C4 + mov r0, #1 +_02051990: + cmp r0, #0 + beq _020519A8 + ldr r0, [r4, #8] + bl sub_0200B3D4 + ldr r0, [r4, #8] + bl sub_0200B330 +_020519A8: + add sp, sp, #4 + ldmia sp!, {r3, r4, pc} + .align 2, 0 +_020519B0: .word 0x06018000 +_020519B4: .word 0x0400001C +_020519B8: .word 0x06010000 +_020519BC: .word 0x04000018 +_020519C0: .word 0x06218000 +_020519C4: .word 0x0400101C +_020519C8: .word 0x06210000 +_020519CC: .word 0x04001018 + arm_func_end sub_020518BC + + arm_func_start sub_020519D0 +sub_020519D0: ; 0x020519D0 + stmdb sp!, {r3, lr} + mov r0, #0x21c + mov r1, #0 + bl MemAlloc + ldr r2, _02051B3C ; =_020B09B0 + mov r1, #0x21c + str r0, [r2] + bl MemZero + mov r1, #0 + ldr r0, _02051B3C ; =_020B09B0 + str r1, [sp] + ldr r0, [r0] + mov r2, #0x100 + add r0, r0, #0x1a4 + mov r3, #0x5000000 + bl sub_0200A124 + ldr r0, _02051B3C ; =_020B09B0 + mov r2, #0 + ldr r1, [r0] + mov r3, #0x100 + str r2, [sp] + add r0, r1, #0x1cc + add r1, r1, #0x1a4 + bl sub_0200A478 + mov r1, #0 + str r1, [sp] + ldr r0, _02051B3C ; =_020B09B0 + mov r2, #0x100 + ldr r0, [r0] + ldr r3, _02051B40 ; =0x05000400 + add r0, r0, #0x1b8 + bl sub_0200A124 + ldr r0, _02051B3C ; =_020B09B0 + mov r2, #0 + ldr r1, [r0] + mov r3, #0x100 + str r2, [sp] + add r0, r1, #0x1f4 + add r1, r1, #0x1b8 + bl sub_0200A478 + ldr r0, _02051B3C ; =_020B09B0 + mov r2, #0 + ldr r0, [r0] + mov r3, r2 + add r1, r0, #0x1cc + bl sub_02051858 + ldr r0, _02051B3C ; =_020B09B0 + mov r2, #1 + ldr r1, [r0] + mov r3, #0 + add r0, r1, #0x18 + add r1, r1, #0x1cc + bl sub_02051858 + ldr r0, _02051B3C ; =_020B09B0 + mov r1, #0 + ldr r0, [r0] + mov r2, r1 + bl sub_020518BC + ldr r0, _02051B3C ; =_020B09B0 + mov r1, #1 + ldr r0, [r0] + mov r2, #0 + add r0, r0, #0x18 + bl sub_020518BC + ldr r0, _02051B3C ; =_020B09B0 + ldr r1, [r0] + add r0, r1, #0x30 + add r1, r1, #0x1f4 + mov r2, #0 + mov r3, #1 + bl sub_02051858 + ldr r0, _02051B3C ; =_020B09B0 + mov r2, #1 + ldr r1, [r0] + mov r3, r2 + add r0, r1, #0x48 + add r1, r1, #0x1f4 + bl sub_02051858 + ldr r0, _02051B3C ; =_020B09B0 + mov r1, #0 + ldr r0, [r0] + mov r2, #1 + add r0, r0, #0x30 + bl sub_020518BC + ldr r0, _02051B3C ; =_020B09B0 + mov r1, #1 + ldr r0, [r0] + mov r2, r1 + add r0, r0, #0x48 + bl sub_020518BC + ldmia sp!, {r3, pc} + .align 2, 0 +_02051B3C: .word _020B09B0 +_02051B40: .word 0x05000400 + arm_func_end sub_020519D0 + + arm_func_start sub_02051B44 +sub_02051B44: ; 0x02051B44 + stmdb sp!, {r3, lr} + ldr r0, _02051C20 ; =_020B09B0 + ldr r0, [r0] + bl sub_02051894 + ldr r0, _02051C20 ; =_020B09B0 + ldr r0, [r0] + add r0, r0, #0x18 + bl sub_02051894 + ldr r0, _02051C20 ; =_020B09B0 + ldr r0, [r0] + ldr r0, [r0, #8] + bl sub_0200B314 + ldr r0, _02051C20 ; =_020B09B0 + ldr r0, [r0] + ldr r0, [r0, #0x20] + bl sub_0200B314 + ldr r0, _02051C20 ; =_020B09B0 + ldr r0, [r0] + add r0, r0, #0x30 + bl sub_02051894 + ldr r0, _02051C20 ; =_020B09B0 + ldr r0, [r0] + add r0, r0, #0x48 + bl sub_02051894 + ldr r0, _02051C20 ; =_020B09B0 + ldr r0, [r0] + ldr r0, [r0, #0x38] + bl sub_0200B314 + ldr r0, _02051C20 ; =_020B09B0 + ldr r0, [r0] + ldr r0, [r0, #0x50] + bl sub_0200B314 + ldr r0, _02051C20 ; =_020B09B0 + ldr r0, [r0] + add r0, r0, #0x1cc + bl sub_0200A4C4 + ldr r0, _02051C20 ; =_020B09B0 + ldr r0, [r0] + add r0, r0, #0x1f4 + bl sub_0200A4C4 + ldr r0, _02051C20 ; =_020B09B0 + ldr r0, [r0] + add r0, r0, #0x1a4 + bl sub_0200A158 + ldr r0, _02051C20 ; =_020B09B0 + ldr r0, [r0] + add r0, r0, #0x1b8 + bl sub_0200A158 + ldr r0, _02051C20 ; =_020B09B0 + ldr r0, [r0] + bl MemFree + ldr r0, _02051C20 ; =_020B09B0 + mov r1, #0 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_02051C20: .word _020B09B0 + arm_func_end sub_02051B44 + + arm_func_start sub_02051C24 +sub_02051C24: ; 0x02051C24 + stmdb sp!, {r4, r5, r6, r7, r8, lr} + ldr r0, _02051D64 ; =_020B09B0 + ldr r0, [r0] + cmp r0, #0 + ldmeqia sp!, {r4, r5, r6, r7, r8, pc} + mov r0, #8 + bl sub_0200302C + ldr r0, _02051D64 ; =_020B09B0 + ldr r0, [r0] + ldr r0, [r0, #8] + bl sub_0200B340 + ldr r0, _02051D64 ; =_020B09B0 + ldr r0, [r0] + ldr r0, [r0, #0x38] + bl sub_0200B340 + ldr r0, _02051D64 ; =_020B09B0 + ldr r0, [r0] + ldr r0, [r0, #0x20] + bl sub_0200B340 + ldr r0, _02051D64 ; =_020B09B0 + ldr r0, [r0] + ldr r0, [r0, #0x50] + bl sub_0200B340 + ldr r0, _02051D64 ; =_020B09B0 + ldr r0, [r0] + add r0, r0, #0x1cc + bl sub_0200A510 + ldr r0, _02051D64 ; =_020B09B0 + ldr r0, [r0] + add r0, r0, #0x1f4 + bl sub_0200A510 + ldr r0, _02051D64 ; =_020B09B0 + ldr r0, [r0] + add r0, r0, #0x1a4 + bl sub_0200A184 + ldr r0, _02051D64 ; =_020B09B0 + ldr r0, [r0] + add r0, r0, #0x1b8 + bl sub_0200A184 + ldr r0, _02051D64 ; =_020B09B0 + mov r6, #0 + ldr r0, [r0] + mov r8, r6 + add r4, r0, #0x60 + add r0, r4, #0x100 + ldrsh r5, [r0, #0x40] + mov r7, #0x14 + b _02051D3C +_02051CE4: + smlabb r2, r6, r7, r4 + ldr r0, [r2, #4] + cmp r0, #0 + beq _02051D20 + ldr r1, [r2, #0xc] + cmp r1, #0 + bne _02051D10 + ldr r1, [r2, #8] + ldr r2, [r2] + bl ArrayCopy32 + b _02051D30 +_02051D10: + cmp r1, #1 + bne _02051D30 + bl MemFree + b _02051D30 +_02051D20: + ldr r1, [r2, #8] + ldr r2, [r2] + mov r0, r8 + bl ArrayFill32 +_02051D30: + add r0, r6, #1 + mov r0, r0, lsl #0x10 + mov r6, r0, asr #0x10 +_02051D3C: + cmp r6, r5 + blt _02051CE4 + ldr r0, _02051D64 ; =_020B09B0 + mov r2, #0 + ldr r1, [r0] + mov r0, #8 + add r1, r1, #0x100 + strh r2, [r1, #0xa0] + bl sub_020030FC + ldmia sp!, {r4, r5, r6, r7, r8, pc} + .align 2, 0 +_02051D64: .word _020B09B0 + arm_func_end sub_02051C24 + + arm_func_start sub_02051D68 +sub_02051D68: ; 0x02051D68 + ldr r2, _02051D84 ; =_020B09B0 + mov r1, #0x28 + ldr r2, [r2] + ldr ip, _02051D88 ; =sub_0200A504 + add r2, r2, #0x1cc + mla r0, r1, r0, r2 + bx ip + .align 2, 0 +_02051D84: .word _020B09B0 +_02051D88: .word sub_0200A504 + arm_func_end sub_02051D68 + + arm_func_start sub_02051D8C +sub_02051D8C: ; 0x02051D8C + stmdb sp!, {r3, lr} + sub sp, sp, #8 + ldr ip, _02051DCC ; =_020B09B0 + str r1, [sp, #4] + ldr ip, [ip] + ldr lr, [sp, #0x10] + mov r1, #0x30 + mla ip, lr, r1, ip + mov r1, #0x18 + mla r1, r3, r1, ip + str r0, [sp] + ldr r0, [r1, #8] + add r1, sp, #0 + bl sub_0200B3FC + add sp, sp, #8 + ldmia sp!, {r3, pc} + .align 2, 0 +_02051DCC: .word _020B09B0 + arm_func_end sub_02051D8C + + arm_func_start sub_02051DD0 +sub_02051DD0: ; 0x02051DD0 + stmdb sp!, {r3, lr} + ldr r3, _02051DF8 ; =_020B09B0 + mov r2, #0x30 + ldr ip, [r3] + mov r3, #0x18 + mla r2, r1, r2, ip + mla r1, r0, r3, r2 + ldr r0, [r1, #8] + bl sub_0200B3D4 + ldmia sp!, {r3, pc} + .align 2, 0 +_02051DF8: .word _020B09B0 + arm_func_end sub_02051DD0 + + arm_func_start sub_02051DFC +sub_02051DFC: ; 0x02051DFC + ldr r3, _02051E1C ; =_020B09B0 + mov r2, #0x30 + ldr ip, [r3] + mov r3, #0x18 + mla r2, r1, r2, ip + mla r1, r0, r3, r2 + ldr r0, [r1, #8] + bx lr + .align 2, 0 +_02051E1C: .word _020B09B0 + arm_func_end sub_02051DFC + + arm_func_start sub_02051E20 +sub_02051E20: ; 0x02051E20 + stmdb sp!, {r3, lr} + sub sp, sp, #8 + ldr ip, _02051E5C ; =_020B09B0 + str r1, [sp, #4] + ldr ip, [ip] + mov r1, #0x30 + mla ip, r3, r1, ip + mov r1, #0x18 + mla r1, r2, r1, ip + str r0, [sp] + ldr r0, [r1, #8] + add r1, sp, #0 + bl sub_0200B3C0 + add sp, sp, #8 + ldmia sp!, {r3, pc} + .align 2, 0 +_02051E5C: .word _020B09B0 + arm_func_end sub_02051E20 + + arm_func_start sub_02051E60 +sub_02051E60: ; 0x02051E60 + stmdb sp!, {r3, lr} + ldr r3, _02051E88 ; =_020B09B0 + mov r2, #0x30 + ldr ip, [r3] + mov r3, #0x18 + mla r2, r1, r2, ip + mla r1, r0, r3, r2 + ldr r0, [r1, #8] + bl sub_0200B330 + ldmia sp!, {r3, pc} + .align 2, 0 +_02051E88: .word _020B09B0 + arm_func_end sub_02051E60 + + arm_func_start GetBgRegionArea +GetBgRegionArea: ; 0x02051E8C + stmdb sp!, {r3, lr} + ldr ip, _02051EB4 ; =_020B09B0 + mov r3, #0x30 + ldr lr, [ip] + mov ip, #0x18 + mla r3, r2, r3, lr + mla r2, r1, ip, r3 + ldr r1, [r2, #0x10] + add r0, r1, r0 + ldmia sp!, {r3, pc} + .align 2, 0 +_02051EB4: .word _020B09B0 + arm_func_end GetBgRegionArea + + arm_func_start sub_02051EB8 +sub_02051EB8: ; 0x02051EB8 + ldr r2, _02051ED0 ; =_020B09B0 + mov r1, #0x14 + ldr r2, [r2] + add r2, r2, #0x1a4 + mla r0, r1, r0, r2 + bx lr + .align 2, 0 +_02051ED0: .word _020B09B0 + arm_func_end sub_02051EB8 + + arm_func_start sub_02051ED4 +sub_02051ED4: ; 0x02051ED4 + ldr r2, _02051EEC ; =_020B09B0 + mov r1, #0x28 + ldr r2, [r2] + add r2, r2, #0x1cc + mla r0, r1, r0, r2 + bx lr + .align 2, 0 +_02051EEC: .word _020B09B0 + arm_func_end sub_02051ED4 + + arm_func_start sub_02051EF0 +sub_02051EF0: ; 0x02051EF0 + stmdb sp!, {r3, lr} + cmp r3, #0 + beq _02051F4C + ldrb lr, [r0] + mov ip, #0xff + ldrb lr, [r3, lr, lsl #2] + mul lr, r2, lr + mov lr, lr, lsr #8 + strb lr, [sp] + ldrb lr, [r0, #1] + add lr, r3, lr, lsl #2 + ldrb lr, [lr, #1] + mul lr, r2, lr + mov lr, lr, lsr #8 + strb lr, [sp, #1] + ldrb r0, [r0, #2] + add r0, r3, r0, lsl #2 + ldrb r0, [r0, #2] + mul r0, r2, r0 + mov r0, r0, lsr #8 + strb r0, [sp, #2] + strb ip, [sp, #3] + b _02051F84 +_02051F4C: + ldrb ip, [r0] + mov r3, #0xff + mul lr, ip, r2 + mov ip, lr, lsr #8 + strb ip, [sp] + ldrb ip, [r0, #1] + mul lr, ip, r2 + mov ip, lr, lsr #8 + strb ip, [sp, #1] + ldrb r0, [r0, #2] + mul r2, r0, r2 + mov r0, r2, lsr #8 + strb r0, [sp, #2] + strb r3, [sp, #3] +_02051F84: + ldr r0, _02051FB0 ; =_020B09B0 + mov r1, r1, lsl #0x10 + ldr r0, [r0] + ldr r2, [sp, #8] + add r3, r0, #0x1cc + mov r0, #0x28 + mla r0, r2, r0, r3 + add r2, sp, #0 + mov r1, r1, lsr #0x10 + bl sub_0200A590 + ldmia sp!, {r3, pc} + .align 2, 0 +_02051FB0: .word _020B09B0 + arm_func_end sub_02051EF0 + + arm_func_start sub_02051FB4 +sub_02051FB4: ; 0x02051FB4 + stmdb sp!, {r3, lr} + sub sp, sp, #8 + str r3, [sp] + mov r3, #0 + str r3, [sp, #4] + ldr ip, _02051FEC ; =_020B09B0 + mov r3, r2 + mov r2, r1 + ldr ip, [ip] + mov r1, r0 + add r0, ip, #0x60 + bl sub_02051804 + add sp, sp, #8 + ldmia sp!, {r3, pc} + .align 2, 0 +_02051FEC: .word _020B09B0 + arm_func_end sub_02051FB4 + + arm_func_start sub_02051FF0 +sub_02051FF0: ; 0x02051FF0 + stmdb sp!, {r3, r4, r5, lr} + sub sp, sp, #8 + mov r3, r0 + mov r5, r1 + add r0, sp, #0 + mov r1, r3 + bl LoadFileFromRom + ldr r0, [sp] + bl GetAtSize + mov r4, r0 + cmp r4, #0 + ldrle r0, [sp] + strle r0, [r5] + ldrle r4, [sp, #4] + ble _02052054 + mov r1, #0 + bl MemAlloc + mov r1, r4 + ldr r2, [sp] + mov r4, r0 + bl DecompressAtNormalVeneer + str r4, [r5] + add r0, sp, #0 + ldr r4, [r4, #0xc] + bl UnloadFile +_02052054: + mov r0, r4 + add sp, sp, #8 + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_02051FF0 + + arm_func_start sub_02052060 +sub_02052060: ; 0x02052060 + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0x2c + ldr r4, _020522E4 ; =_020B09B0 + mov sl, r1 + ldr r7, [sp, #0x54] + ldr r4, [r4] + mov r1, #0x30 + mla r4, r7, r1, r4 + ldr fp, [sp, #0x50] + mov r1, #0x18 + mla r4, fp, r1, r4 + mov sb, r2 + add r1, sp, #0x28 + mov r2, #0xf + mov r8, r3 + ldr r5, [r4, #0x10] + bl sub_02051FF0 + mov r3, r0 + ldr r4, [sp, #0x28] + mov r0, #0 + str r0, [sp] + str r0, [sp, #4] + ldr r0, _020522E4 ; =_020B09B0 + ldr r2, [r4, #8] + ldr r0, [r0] + add r1, r5, sl + add r2, r4, r2 + add r0, r0, #0x60 + bl sub_02051804 + mov r0, #1 + str r0, [sp] + mov r1, #0 + ldr r0, _020522E4 ; =_020B09B0 + str r1, [sp, #4] + ldr r0, [r0] + mov r2, r4 + mov r3, r1 + add r0, r0, #0x60 + bl sub_02051804 + ldr r1, [sp, #0x28] + rsb r0, sb, #0x20 + mov r0, r0, lsl #0x10 + ldr r1, [r1, #0x10] + str r0, [sp, #0x18] + add r0, r4, r1 + str r0, [sp, #0xc] + mov r5, #0 + b _020521CC +_02052120: + mov r6, #0 + mov r0, r6 + str r0, [sp, #8] + ldr r0, [sp, #0xc] + mov r1, sb, lsl #0x10 + add r0, r0, sb, lsl #6 + str r0, [sp, #0x10] + mov r0, r1, asr #0x10 + str r0, [sp, #0x14] +_02052144: + ldr r0, [sp, #0x10] + mov r1, r6, lsl #1 + ldrh r1, [r1, r0] + ldr r2, _020522E8 ; =0x00000FFF + mov r0, r6, lsl #0x10 + and r2, r1, r2 + mov r2, r2, lsl #0x10 + mov r1, r1, lsl #4 + mov r2, r2, lsr #0x10 + add r1, r8, r1, lsr #16 + add r2, r2, sl, lsr #5 + mov r1, r1, lsl #0x1c + mov r2, r2, lsl #0x10 + mov r1, r1, lsr #0x10 + orr r1, r1, r2, lsr #16 + mov r1, r1, lsl #0x10 + mov r2, r1, lsr #0x10 + ldr r1, [sp, #0x14] + mov r0, r0, asr #0x10 + str r7, [sp] + mov r3, fp + bl sub_02051D8C + ldr r0, [sp, #8] + add r6, r6, #1 + add r0, r0, #1 + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + str r0, [sp, #8] + cmp r0, #0x20 + blo _02052144 + add r0, r5, #1 + mov r0, r0, lsl #0x10 + mov r5, r0, lsr #0x10 + add sb, sb, #1 +_020521CC: + ldr r0, [sp, #0x18] + cmp r5, r0, lsr #16 + blo _02052120 + mov r0, fp + mov r1, r7 + bl sub_02051E60 + ldr r0, [sp, #0x28] + ldr r3, _020522EC ; =ARM9_UNKNOWN_PTR__NA_20A2C84 + ldr r0, [r0] + add r2, sp, #0x1c + add r5, r4, r0 + mov r4, #0 + mov r1, #4 +_02052200: + ldrb r0, [r3], #1 + subs r1, r1, #1 + strb r0, [r2], #1 + bne _02052200 + mov r0, #0x28 + mul r6, r7, r0 + b _020522B0 +_0205221C: + add r3, sp, #0x1c + add r2, sp, #0x20 + mov r1, #4 +_02052228: + ldrb r0, [r3], #1 + subs r1, r1, #1 + strb r0, [r2], #1 + bne _02052228 + ldrb r0, [r5] + add r3, sp, #0x20 + add r2, sp, #0x24 + strb r0, [sp, #0x20] + ldrb r0, [r5, #1] + mov r1, #4 + strb r0, [sp, #0x21] + ldrb r0, [r5, #2] + strb r0, [sp, #0x22] + ldrb r0, [r5, #3] + strb r0, [sp, #0x23] +_02052264: + ldrb r0, [r3], #1 + subs r1, r1, #1 + strb r0, [r2], #1 + bne _02052264 + add r0, r4, r8, lsl #4 + cmp r0, #0x100 + bge _020522C8 + ldr r1, _020522E4 ; =_020B09B0 + mov r0, r0, lsl #0x10 + ldr r1, [r1] + mov r0, r0, asr #0x10 + add r3, r1, #0x1cc + mov r1, r0, lsl #0x10 + add r2, sp, #0x24 + add r0, r3, r6 + mov r1, r1, lsr #0x10 + bl sub_0200A590 + add r4, r4, #1 + add r5, r5, #4 +_020522B0: + ldr r0, [sp, #0x28] + ldr r1, [r0, #4] + mov r0, r1, asr #1 + add r0, r1, r0, lsr #30 + cmp r4, r0, asr #2 + blt _0205221C +_020522C8: + ldr r0, _020522E4 ; =_020B09B0 + ldr r0, [r0] + add r0, r0, #0x1cc + add r0, r0, r6 + bl sub_0200A504 + add sp, sp, #0x2c + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_020522E4: .word _020B09B0 +_020522E8: .word 0x00000FFF +_020522EC: .word ARM9_UNKNOWN_PTR__NA_20A2C84 + arm_func_end sub_02052060 + + arm_func_start sub_020522F0 +sub_020522F0: ; 0x020522F0 + stmdb sp!, {r4, lr} + mov r4, r1 + bl sub_02051FF0 + str r0, [r4, #8] + ldr r1, [r4] + ldr r0, [r1, #8] + add r0, r1, r0 + str r0, [r4, #4] + ldr r0, [r4] + ldr r0, [r0, #0x10] + add r0, r1, r0 + str r0, [r4, #0xc] + ldr r0, [r4] + ldr r0, [r0] + add r0, r1, r0 + str r0, [r4, #0x10] + ldmia sp!, {r4, pc} + arm_func_end sub_020522F0 + + arm_func_start sub_02052334 +sub_02052334: ; 0x02052334 + stmdb sp!, {r4, lr} + mov r4, r0 + ldr r0, [r4] + cmp r0, #0 + ldmeqia sp!, {r4, pc} + bl MemFree + mov r0, #0 + str r0, [r4] + ldmia sp!, {r4, pc} + arm_func_end sub_02052334 + + arm_func_start LoadMonsterMd +LoadMonsterMd: ; 0x02052358 + stmdb sp!, {r3, lr} + ldr r0, _02052388 ; =_020B09C0 + ldr r1, _0205238C ; =_020A31B8 + mov r2, #0 + bl LoadFileFromRom + bl LoadM2nAndN2m + ldr r0, _02052390 ; =_020B09B4 + ldr r1, [r0, #0xc] +#ifdef EUROPE + str r1, [r0, #8] +#else + str r1, [r0, #4] +#endif + add r1, r1, #8 + str r1, [r0] + ldmia sp!, {r3, pc} + .align 2, 0 +_02052388: .word _020B09C0 +_0205238C: .word _020A31B8 +_02052390: .word _020B09B4 + arm_func_end LoadMonsterMd + + arm_func_start GetNameRaw +GetNameRaw: ; 0x02052394 + stmdb sp!, {r4, lr} + mov r4, r0 + mov r0, r1 + mov r1, #0x258 + bl _s32_div_f +#if defined(EUROPE) + add r0, r1, #0x21 + add r0, r0, #0x2200 +#elif defined(JAPAN) + add r0, r1, #0x590 + add r0, r0, #0x1000 +#else + add r0, r1, #0x1f + add r0, r0, #0x2200 +#endif + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + bl StringFromId + mov r1, r0 + mov r0, r4 + mov r2, #0x14 + bl strncpy + ldmia sp!, {r4, pc} + arm_func_end GetNameRaw + + arm_func_start GetName +GetName: ; 0x020523D0 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + mov r0, r1 + mov r1, #0x258 + mov r4, r2 + bl _s32_div_f +#if defined(EUROPE) + add r0, r1, #0x21 + add r0, r0, #0x2200 +#elif defined(JAPAN) + add r0, r1, #0x590 + add r0, r0, #0x1000 +#else + add r0, r1, #0x1f + add r0, r0, #0x2200 +#endif + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + bl StringFromId + mov r3, r0 + mov r0, r5 + mov r2, r4 + ldr r1, _02052414 ; =_020A31D4 + bl SprintfStatic__02052418 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_02052414: .word _020A31D4 + arm_func_end GetName + + arm_func_start SprintfStatic__02052418 +SprintfStatic__02052418: ; 0x02052418 + stmdb sp!, {r0, r1, r2, r3} + stmdb sp!, {r3, lr} + add r2, sp, #0xc + bic r2, r2, #3 + ldr r1, [sp, #0xc] + add r2, r2, #4 + bl vsprintf + ldmia sp!, {r3, lr} + add sp, sp, #0x10 + bx lr + arm_func_end SprintfStatic__02052418 + + arm_func_start GetNameWithGender +GetNameWithGender: ; 0x02052440 +#ifdef JAPAN + stmdb sp!, {r4, r5, r6, lr} +#else + stmdb sp!, {r3, r4, r5, r6, lr} + sub sp, sp, #4 +#endif + mov r5, r1 + mov r6, r0 + mov r0, r5 + mov r1, #0x258 + mov r4, r2 + bl _s32_div_f +#if defined(EUROPE) + add r0, r1, #0x21 + add r0, r0, #0x2200 +#elif defined(JAPAN) + add r0, r1, #0x590 + add r0, r0, #0x1000 +#else + add r0, r1, #0x1f + add r0, r0, #0x2200 +#endif + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + bl StringFromId + ldr r2, _020524F4 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + mov r3, r0 + smlabb r0, r5, r1, r2 + ldrb r0, [r0, #0x12] + cmp r0, #3 + cmpne r5, #0x1d + cmpne r5, #0x20 + bne _020524B0 + ldr r1, _020524F8 ; =_020A31D4 + mov r0, r6 + mov r2, r4 + bl SprintfStatic__02052418 +#ifdef JAPAN + ldmia sp!, {r4, r5, r6, pc} +#else + b _020524EC +#endif +_020524B0: + cmp r0, #2 + bne _020524D4 + ldr r1, _020524FC ; =_020A31E4 +#ifdef JAPAN + mov r0, r6 + mov r2, r4 + bl SprintfStatic__02052418 + ldmia sp!, {r4, r5, r6, pc} +_020524D4: + ldr r1, _02052838_JP ; =_020A45C8_JP + mov r0, r6 + mov r2, r4 + bl SprintfStatic__02052418 + ldmia sp!, {r4, r5, r6, pc} +#else + mov r5, #0xbe + mov r0, r6 + mov r2, r4 + str r5, [sp] + bl SprintfStatic__02052418 + b _020524EC +_020524D4: + ldr r1, _020524FC ; =_020A31E4 + mov r5, #0xbd + mov r0, r6 + mov r2, r4 + str r5, [sp] + bl SprintfStatic__02052418 +_020524EC: + add sp, sp, #4 + ldmia sp!, {r3, r4, r5, r6, pc} +#endif + .align 2, 0 +_020524F4: .word _020B09B4 +_020524F8: .word _020A31D4 +_020524FC: .word _020A31E4 +#ifdef JAPAN +_02052838_JP: .word _020A45C8_JP +#endif + arm_func_end GetNameWithGender + + arm_func_start GetSpeciesString +GetSpeciesString: ; 0x02052500 + stmdb sp!, {r3, r4, r5, lr} + mov r4, r1 + mov r5, r0 + mov r0, r4 + bl GetBaseForm + cmp r0, #0xc9 + bne _02052684 + cmp r4, #0xca + moveq r4, #1 + beq _02052660 + cmp r4, #0xcb + moveq r4, #2 + beq _02052660 + cmp r4, #0xcc + moveq r4, #3 + beq _02052660 + cmp r4, #0xcd + moveq r4, #4 + beq _02052660 + cmp r4, #0xce + moveq r4, #5 + beq _02052660 + cmp r4, #0xcf + moveq r4, #6 + beq _02052660 + cmp r4, #0xd0 + moveq r4, #7 + beq _02052660 + cmp r4, #0xd1 + moveq r4, #8 + beq _02052660 + cmp r4, #0xd2 + moveq r4, #9 + beq _02052660 + cmp r4, #0xd3 + moveq r4, #0xa + beq _02052660 + cmp r4, #0xd4 + moveq r4, #0xb + beq _02052660 + cmp r4, #0xd5 + moveq r4, #0xc + beq _02052660 + cmp r4, #0xd6 + moveq r4, #0xd + beq _02052660 + cmp r4, #0xd7 + moveq r4, #0xe + beq _02052660 + cmp r4, #0xd8 + moveq r4, #0xf + beq _02052660 + cmp r4, #0xd9 + moveq r4, #0x10 + beq _02052660 + cmp r4, #0xda + moveq r4, #0x11 + beq _02052660 + cmp r4, #0xdb + moveq r4, #0x12 + beq _02052660 + cmp r4, #0xdc + moveq r4, #0x13 + beq _02052660 + cmp r4, #0xdd + moveq r4, #0x14 + beq _02052660 + cmp r4, #0xde + moveq r4, #0x15 + beq _02052660 + cmp r4, #0xdf + moveq r4, #0x16 + beq _02052660 + cmp r4, #0xe0 + moveq r4, #0x17 + beq _02052660 + cmp r4, #0xe1 + moveq r4, #0x18 + beq _02052660 + cmp r4, #0xe2 + moveq r4, #0x19 + beq _02052660 + cmp r4, #0xe3 + moveq r4, #0x1a + beq _02052660 + cmp r4, #0xe4 + moveq r4, #0x1b + movne r4, #0 +_02052660: + ldr r0, _020526B8 ; =0x000022E8 + bl StringFromId + ldr r1, _020526BC ; =UNOWN_SPECIES_ADDITIONAL_CHAR_PTR_TABLE + mov r2, r0 + ldr r3, [r1, r4, lsl #2] + ldr r1, _020526C0 ; =_020A31F4 + mov r0, r5 + bl SprintfStatic__02052418 + ldmia sp!, {r3, r4, r5, pc} +_02052684: + mov r0, r4 + mov r1, #0x258 + bl _s32_div_f +#if defined(EUROPE) + add r0, r1, #0x21 + add r0, r0, #0x2200 +#elif defined(JAPAN) + add r0, r1, #0x590 + add r0, r0, #0x1000 +#else + add r0, r1, #0x1f + add r0, r0, #0x2200 +#endif + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + bl StringFromId + mov r2, r0 + ldr r1, _020526C4 ; =_020A31FC + mov r0, r5 + bl SprintfStatic__02052418 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +#if defined(EUROPE) +_020526B8: .word 0x000022EA +#elif defined(JAPAN) +_020526B8: .word 0x00001659 +#else +_020526B8: .word 0x000022E8 +#endif +_020526BC: .word UNOWN_SPECIES_ADDITIONAL_CHAR_PTR_TABLE +_020526C0: .word _020A31F4 +_020526C4: .word _020A31FC + arm_func_end GetSpeciesString + + arm_func_start GetNameString +GetNameString: ; 0x020526C8 + stmdb sp!, {r3, lr} + mov r1, #0x258 + bl _s32_div_f +#if defined(EUROPE) + add r0, r1, #0x21 + add r0, r0, #0x2200 +#elif defined(JAPAN) + add r0, r1, #0x590 + add r0, r0, #0x1000 +#else + add r0, r1, #0x1f + add r0, r0, #0x2200 +#endif + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + bl StringFromId + ldmia sp!, {r3, pc} + arm_func_end GetNameString + + arm_func_start GetSpriteIndex__020526EC +GetSpriteIndex__020526EC: ; 0x020526EC + ldr r2, _02052704 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrh r0, [r0, #0x10] + bx lr + .align 2, 0 +_02052704: .word _020B09B4 + arm_func_end GetSpriteIndex__020526EC + + arm_func_start GetSpriteIndex__02052708 +GetSpriteIndex__02052708: ; 0x02052708 + ldr r2, _02052720 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrh r0, [r0, #0x10] + bx lr + .align 2, 0 +_02052720: .word _020B09B4 + arm_func_end GetSpriteIndex__02052708 + + arm_func_start GetSpriteIndex__02052724 +GetSpriteIndex__02052724: ; 0x02052724 + ldr r2, _0205273C ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrh r0, [r0, #0x10] + bx lr + .align 2, 0 +_0205273C: .word _020B09B4 + arm_func_end GetSpriteIndex__02052724 + + arm_func_start GetDexNumber +GetDexNumber: ; 0x02052740 + ldr r2, _02052758 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrsh r0, [r0, #4] + bx lr + .align 2, 0 +_02052758: .word _020B09B4 + arm_func_end GetDexNumber + + arm_func_start GetCategoryString +GetCategoryString: ; 0x0205275C + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + bl sub_02025888 + mov r4, r0 + mov r0, r5 + mov r1, #0x258 + bl _s32_div_f +#if defined(EUROPE) + add r0, r1, #0x79 + add r0, r0, #0x2400 +#elif defined(JAPAN) + add r0, r1, #0x1a40 +#else + add r0, r1, #0x77 + add r0, r0, #0x2400 +#endif + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + bl StringFromId + mov r2, r0 + ldr r1, _020527A4 ; =_020A3200 + mov r0, r4 + bl SprintfStatic__02052418 + mov r0, r4 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_020527A4: .word _020A3200 + arm_func_end GetCategoryString + + arm_func_start GetMonsterGender +GetMonsterGender: ; 0x020527A8 + ldr r2, _020527C0 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrb r0, [r0, #0x12] + bx lr + .align 2, 0 +_020527C0: .word _020B09B4 + arm_func_end GetMonsterGender + + arm_func_start GetBodySize +GetBodySize: ; 0x020527C4 + ldr r2, _020527DC ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrb r0, [r0, #0x13] + bx lr + .align 2, 0 +_020527DC: .word _020B09B4 + arm_func_end GetBodySize + + arm_func_start GetSpriteSize +GetSpriteSize: ; 0x020527E0 + stmdb sp!, {r3, lr} + mov r1, #0x258 + bl _s32_div_f + mov r0, r1, lsl #0x10 + ldr r2, _02052818 ; =MONSTER_SPRITE_DATA + mov r0, r0, asr #0x10 + ldrb r0, [r2, r0, lsl #1] + cmp r0, #0 + moveq r0, #0 + ldmeqia sp!, {r3, pc} + cmp r0, #6 + movls r0, #6 + ldrhib r0, [r2, r1, lsl #1] + ldmia sp!, {r3, pc} + .align 2, 0 +_02052818: .word MONSTER_SPRITE_DATA + arm_func_end GetSpriteSize + + arm_func_start GetSpriteFileSize +GetSpriteFileSize: ; 0x0205281C + stmdb sp!, {r3, lr} + mov r1, #0x258 + bl _s32_div_f + ldr r0, _02052838 ; =_020A2D09 + ldrb r0, [r0, r1, lsl #1] + mov r0, r0, lsl #9 + ldmia sp!, {r3, pc} + .align 2, 0 +_02052838: .word _020A2D09 + arm_func_end GetSpriteFileSize + + arm_func_start GetShadowSize +GetShadowSize: ; 0x0205283C + ldr r2, _02052854 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrb r0, [r0, #0x2e] + bx lr + .align 2, 0 +_02052854: .word _020B09B4 + arm_func_end GetShadowSize + + arm_func_start GetSpeedStatus +GetSpeedStatus: ; 0x02052858 + ldr r2, _02052870 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrsh r0, [r0, #6] + bx lr + .align 2, 0 +_02052870: .word _020B09B4 + arm_func_end GetSpeedStatus + + arm_func_start GetMobilityType +GetMobilityType: ; 0x02052874 + ldr r2, _0205288C ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrb r0, [r0, #0x16] + bx lr + .align 2, 0 +_0205288C: .word _020B09B4 + arm_func_end GetMobilityType + + arm_func_start GetRegenSpeed +GetRegenSpeed: ; 0x02052890 + ldr r2, _020528B0 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrb r0, [r0, #0x30] + mov r0, r0, lsl #1 + and r0, r0, #0xff + bx lr + .align 2, 0 +_020528B0: .word _020B09B4 + arm_func_end GetRegenSpeed + + arm_func_start GetCanMoveFlag +GetCanMoveFlag: ; 0x020528B4 + ldr r2, _020528DC ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrb r0, [r0, #0x1a] + tst r0, #0x10 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_020528DC: .word _020B09B4 + arm_func_end GetCanMoveFlag + + arm_func_start GetChanceAsleep +GetChanceAsleep: ; 0x020528E0 + ldr r2, _020528F8 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrb r0, [r0, #0x2f] + bx lr + .align 2, 0 +_020528F8: .word _020B09B4 + arm_func_end GetChanceAsleep + + arm_func_start GetWeightMultiplier +GetWeightMultiplier: ; 0x020528FC + ldr r2, _02052914 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrh r0, [r0, #0x28] + bx lr + .align 2, 0 +_02052914: .word _020B09B4 + arm_func_end GetWeightMultiplier + + arm_func_start GetSize +GetSize: ; 0x02052918 + ldr r2, _02052930 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrh r0, [r0, #0x2a] + bx lr + .align 2, 0 +_02052930: .word _020B09B4 + arm_func_end GetSize + + arm_func_start GetBaseHp +GetBaseHp: ; 0x02052934 + ldr r2, _0205294C ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrh r0, [r0, #0x20] + bx lr + .align 2, 0 +_0205294C: .word _020B09B4 + arm_func_end GetBaseHp + + arm_func_start CanThrowItems +CanThrowItems: ; 0x02052950 + ldr r2, _02052978 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrb r0, [r0, #0x1a] + tst r0, #0x20 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_02052978: .word _020B09B4 + arm_func_end CanThrowItems + + arm_func_start CanEvolve +CanEvolve: ; 0x0205297C + ldr r2, _020529A4 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrb r0, [r0, #0x1a] + tst r0, #0x40 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_020529A4: .word _020B09B4 + arm_func_end CanEvolve + + arm_func_start GetMonsterPreEvolution +GetMonsterPreEvolution: ; 0x020529A8 + ldr r2, _020529C0 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrsh r0, [r0, #8] + bx lr + .align 2, 0 +_020529C0: .word _020B09B4 + arm_func_end GetMonsterPreEvolution + + arm_func_start GetBaseOffensiveStat +GetBaseOffensiveStat: ; 0x020529C4 + ldr r3, _020529E0 ; =_020B09B4 + mov r2, #0x44 + ldr r3, [r3] + smlabb r0, r0, r2, r3 + add r0, r0, r1 + ldrb r0, [r0, #0x24] + bx lr + .align 2, 0 +_020529E0: .word _020B09B4 + arm_func_end GetBaseOffensiveStat + + arm_func_start GetBaseDefensiveStat +GetBaseDefensiveStat: ; 0x020529E4 + ldr r3, _02052A00 ; =_020B09B4 + mov r2, #0x44 + ldr r3, [r3] + smlabb r0, r0, r2, r3 + add r0, r0, r1 + ldrb r0, [r0, #0x26] + bx lr + .align 2, 0 +_02052A00: .word _020B09B4 + arm_func_end GetBaseDefensiveStat + + arm_func_start GetType +GetType: ; 0x02052A04 + ldr r3, _02052A20 ; =_020B09B4 + mov r2, #0x44 + ldr r3, [r3] + smlabb r0, r0, r2, r3 + add r0, r0, r1 + ldrb r0, [r0, #0x14] + bx lr + .align 2, 0 +_02052A20: .word _020B09B4 + arm_func_end GetType + + arm_func_start GetAbility +GetAbility: ; 0x02052A24 + ldr r3, _02052A40 ; =_020B09B4 + mov r2, #0x44 + ldr r3, [r3] + smlabb r0, r0, r2, r3 + add r0, r0, r1 + ldrb r0, [r0, #0x18] + bx lr + .align 2, 0 +_02052A40: .word _020B09B4 + arm_func_end GetAbility + + arm_func_start GetRecruitRate2 +GetRecruitRate2: ; 0x02052A44 + ldr r2, _02052A5C ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrsh r0, [r0, #0x22] + bx lr + .align 2, 0 +_02052A5C: .word _020B09B4 + arm_func_end GetRecruitRate2 + + arm_func_start GetRecruitRate1 +GetRecruitRate1: ; 0x02052A60 + ldr r2, _02052A78 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrsh r0, [r0, #0x1e] + bx lr + .align 2, 0 +_02052A78: .word _020B09B4 + arm_func_end GetRecruitRate1 + + arm_func_start GetExp +GetExp: ; 0x02052A7C + stmdb sp!, {r4, lr} + ldr r2, _02052AAC ; =_020B09B4 + sub r3, r1, #1 + ldr r2, [r2] + mov r1, #0x44 + smlabb r0, r0, r1, r2 + ldrsh r4, [r0, #0x1c] + mov r1, #0xa + mul r0, r4, r3 + bl _s32_div_f + add r0, r4, r0 + ldmia sp!, {r4, pc} + .align 2, 0 +_02052AAC: .word _020B09B4 + arm_func_end GetExp + + arm_func_start GetEvoParameters +GetEvoParameters: ; 0x02052AB0 + ldr r3, _02052ADC ; =_020B09B4 + mov r2, #0x44 + ldr ip, [r3] + mov r3, #4 + smlabb r1, r1, r2, ip + add r2, r1, #8 +_02052AC8: + ldrh r1, [r2], #2 + subs r3, r3, #1 + strh r1, [r0], #2 + bne _02052AC8 + bx lr + .align 2, 0 +_02052ADC: .word _020B09B4 + arm_func_end GetEvoParameters + + arm_func_start GetTreasureBoxChances +GetTreasureBoxChances: ; 0x02052AE0 + stmdb sp!, {r4, lr} + mov r2, #0x44 + smulbb r4, r0, r2 + ldr r2, _02052B24 ; =_020B09B4 + mov lr, #0 +_02052AF4: + ldr r3, [r2] + add r0, lr, #1 + add r3, r4, r3 + add r3, r3, lr, lsl #1 + ldrsh r3, [r3, #0x3c] + mov r0, r0, lsl #0x10 + mov ip, lr, lsl #1 + mov lr, r0, asr #0x10 + strh r3, [r1, ip] + cmp lr, #4 + blt _02052AF4 + ldmia sp!, {r4, pc} + .align 2, 0 +_02052B24: .word _020B09B4 + arm_func_end GetTreasureBoxChances + + arm_func_start GetIqGroup +GetIqGroup: ; 0x02052B28 + ldr r2, _02052B40 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrb r0, [r0, #0x17] + bx lr + .align 2, 0 +_02052B40: .word _020B09B4 + arm_func_end GetIqGroup + + arm_func_start GetSpawnThreshold +GetSpawnThreshold: ; 0x02052B44 + ldr r2, _02052B5C ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrb r0, [r0, #0x31] + bx lr + .align 2, 0 +_02052B5C: .word _020B09B4 + arm_func_end GetSpawnThreshold + + arm_func_start NeedsItemToSpawn +NeedsItemToSpawn: ; 0x02052B60 + ldr r2, _02052B88 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrb r0, [r0, #0x1a] + tst r0, #0x80 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_02052B88: .word _020B09B4 + arm_func_end NeedsItemToSpawn + + arm_func_start GetExclusiveItem +GetExclusiveItem: ; 0x02052B8C + ldr r2, _02052BB4 ; =_020B09B4 + mov r3, r1, lsr #0x1f + ldr ip, [r2] + mov r2, #0x44 + rsb r1, r3, r1, lsl #30 + smlabb r2, r0, r2, ip + add r0, r3, r1, ror #30 + add r0, r2, r0, lsl #1 + ldrsh r0, [r0, #0x34] + bx lr + .align 2, 0 +_02052BB4: .word _020B09B4 + arm_func_end GetExclusiveItem + + arm_func_start GetFamilyIndex +GetFamilyIndex: ; 0x02052BB8 + ldr r2, _02052BD0 ; =_020B09B4 + mov r1, #0x44 + ldr r2, [r2] + smlabb r0, r0, r1, r2 + ldrsh r0, [r0, #0x32] + bx lr + .align 2, 0 +_02052BD0: .word _020B09B4 + arm_func_end GetFamilyIndex + + arm_func_start LoadM2nAndN2m +LoadM2nAndN2m: ; 0x02052BD4 + stmdb sp!, {r3, lr} +#ifdef EUROPE + sub sp, sp, #0x100 +#endif + ldr r0, _02052C2C ; =_020B09C8 + bl PointsToZero + cmp r0, #0 + beq _02052C00 +#ifdef EUROPE + bl GetLanguage + mov r2, r0 + ldr r1, _02052FA8 ; =_020B12F4_EU + add r0, sp, #0 + ldr r2, [r1, r2, lsl #2] + ldr r1, _02052FAC ; =_020A3210 + bl SprintfStatic__02052418 +#endif + ldr r0, _02052C2C ; =_020B09C8 + bl ZInit8 + ldr r0, _02052C2C ; =_020B09C8 +#ifdef EUROPE + add r1, sp, #0 +#else + ldr r1, _02052C30 ; =_020A3210 +#endif + mov r2, #0 + bl LoadFileFromRom +_02052C00: + ldr r0, _02052C34 ; =_020B09D0 + bl PointsToZero + cmp r0, #0 +#ifdef EUROPE + beq _02052F9C + bl GetLanguage + mov r2, r0 + ldr r1, _02052FB4 ; =_020B1308_EU + add r0, sp, #0 + ldr r2, [r1, r2, lsl #2] + ldr r1, _02052FAC ; =_020A3210 + bl SprintfStatic__02052418 +#else + ldmeqia sp!, {r3, pc} +#endif + ldr r0, _02052C34 ; =_020B09D0 + bl ZInit8 + ldr r0, _02052C34 ; =_020B09D0 +#ifdef EUROPE + add r1, sp, #0 +#else + ldr r1, _02052C38 ; =_020A322C +#endif + mov r2, #0 + bl LoadFileFromRom +#ifdef EUROPE +_02052F9C: + add sp, sp, #0x100 +#endif + ldmia sp!, {r3, pc} + .align 2, 0 +_02052C2C: .word _020B09C8 +#ifdef EUROPE +_02052FA8: .word _020B12F4_EU +_02052FAC: .word _020A3210 +#else +_02052C30: .word _020A3210 +#endif +_02052C34: .word _020B09D0 +#ifdef EUROPE +_02052FB4: .word _020B1308_EU +#else +_02052C38: .word _020A322C +#endif + arm_func_end LoadM2nAndN2m + + arm_func_start sub_02052C3C +sub_02052C3C: ; 0x02052C3C + stmdb sp!, {r3, lr} + ldr r1, _02052C68 ; =_022ABDE0 + ldr r0, _02052C6C ; =TEAM_MEMBER_TABLE_PTR + str r1, [r0] + bl LoadMonsterMd + ldr r0, _02052C70 ; =_022AB92C + mov r1, #0 + strh r1, [r0] + bl sub_020550DC + bl sub_020560B8 + ldmia sp!, {r3, pc} + .align 2, 0 +_02052C68: .word _022ABDE0 +_02052C6C: .word TEAM_MEMBER_TABLE_PTR +_02052C70: .word _022AB92C + arm_func_end sub_02052C3C + + arm_func_start sub_02052C74 +sub_02052C74: ; 0x02052C74 + stmdb sp!, {r3, lr} + bl sub_020550E0 + bl RemoveActiveMembersFromAllTeams + ldr r2, _02052CD4 ; =TEAM_MEMBER_TABLE_PTR + mov lr, #0 + ldr r0, [r2] + mov r3, lr + add r0, r0, #0x9000 + str lr, [r0, #0x878] + str lr, [r0, #0x87c] + mov r0, #0x44 +_02052CA0: + mul ip, lr, r0 + ldr r1, [r2] + add lr, lr, #1 + add r1, r1, ip + add r1, r1, #0x9800 + strh r3, [r1, #0x9c] + ldr r1, [r2] + cmp lr, #4 + add r1, r1, ip + add r1, r1, #0x9000 + strb r3, [r1, #0x898] + blt _02052CA0 + ldmia sp!, {r3, pc} + .align 2, 0 +_02052CD4: .word TEAM_MEMBER_TABLE_PTR + arm_func_end sub_02052C74 + + arm_func_start sub_02052CD8 +sub_02052CD8: ; 0x02052CD8 + stmdb sp!, {r3, lr} + bl sub_02055118 + bl RemoveActiveMembersFromSpecialEpisodeTeam + ldmia sp!, {r3, pc} + arm_func_end sub_02052CD8 + + arm_func_start sub_02052CE8 +sub_02052CE8: ; 0x02052CE8 + ldr ip, _02052CF0 ; =RemoveActiveMembersFromRescueTeam + bx ip + .align 2, 0 +_02052CF0: .word RemoveActiveMembersFromRescueTeam + arm_func_end sub_02052CE8 + + arm_func_start sub_02052CF4 +sub_02052CF4: ; 0x02052CF4 + stmdb sp!, {r3, r4, r5, r6, r7, r8, lr} + sub sp, sp, #0x1c + mov r8, r0 + mov r4, #1 + mov r7, r1 + strb r4, [r8] + mov r0, r7 + strb r4, [r8, #1] + mov r6, r2 + mov r5, r3 + ldr r4, [sp, #0x38] + bl GetBaseHp + strh r0, [r8, #0xa] + mov r0, r7 + mov r1, #0 + bl GetBaseOffensiveStat + strb r0, [r8, #0xc] + mov r0, r7 + mov r1, #1 + bl GetBaseOffensiveStat + strb r0, [r8, #0xd] + mov r0, r7 + mov r1, #0 + bl GetBaseDefensiveStat + strb r0, [r8, #0xe] + mov r0, r7 + mov r1, #1 + bl GetBaseDefensiveStat + strb r0, [r8, #0xf] + strh r7, [r8, #4] + mov r3, #0 + str r3, [r8, #0x10] + strb r3, [r8, #0x20] + mov r0, #1 + strh r0, [r8, #8] + ldrb r2, [r5] + add r0, r8, #0x14 + mov r1, r7 + strb r2, [r8, #2] + ldrb r2, [r5, #1] + strb r2, [r8, #3] + strb r3, [r8, #6] + strb r3, [r8, #7] + ldrsh r2, [r8, #8] + bl EnableAllLearnableIqSkills + cmp r4, #0 + beq _02052DDC + mov r3, #0 + add r1, sp, #0 +_02052DB8: + mov r2, r3, lsl #1 + ldrh r0, [r4, r2] + add r3, r3, #1 + cmp r3, #4 + strh r0, [r1, r2] + blt _02052DB8 + add r0, r8, #0x22 + bl GetInfoGroundMoveset + b _02052DEC +_02052DDC: + ldrb r2, [sp, #0x3c] + mov r1, r7 + add r0, r8, #0x22 + bl sub_02053F10 +_02052DEC: + cmp r6, #0 + bne _02052E14 + add r0, sp, #8 + mov r1, r7 + bl GetNameRaw + add r1, sp, #8 + add r0, r8, #0x3a + mov r2, #0xa + bl StrncpyName + b _02052E24 +_02052E14: + mov r1, r6 + add r0, r8, #0x3a + mov r2, #0xa + bl StrncpySimple +_02052E24: + add sp, sp, #0x1c + ldmia sp!, {r3, r4, r5, r6, r7, r8, pc} + arm_func_end sub_02052CF4 + + arm_func_start sub_02052E2C +sub_02052E2C: ; 0x02052E2C + stmdb sp!, {r3, lr} + sub sp, sp, #8 + ldr lr, [sp, #0x10] + mov ip, #0 + str lr, [sp] + str ip, [sp, #4] + bl sub_02052CF4 + add sp, sp, #8 + ldmia sp!, {r3, pc} + arm_func_end sub_02052E2C + + arm_func_start GuestMonsterToGroundMonster +GuestMonsterToGroundMonster: ; 0x02052E50 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + mov r0, #1 + mov r4, r1 + strb r0, [r5] + ldrsh r1, [r4, #0x12] + mov r2, #0 + add r0, r5, #0x14 + strb r1, [r5, #1] + ldrsh r1, [r4, #0x10] + strh r1, [r5, #0xa] + ldrsh r1, [r4, #0x16] + strb r1, [r5, #0xc] + ldrsh r1, [r4, #0x18] + strb r1, [r5, #0xd] + ldrsh r1, [r4, #0x1a] + strb r1, [r5, #0xe] + ldrsh r1, [r4, #0x1c] + strb r1, [r5, #0xf] + ldrsh r1, [r4, #4] + strh r1, [r5, #4] + ldr r1, [r4, #0x20] + str r1, [r5, #0x10] + strb r2, [r5, #0x20] + ldrsh r1, [r4, #0x14] + strh r1, [r5, #8] + ldrb r1, [r4, #6] + strb r1, [r5, #2] + ldrb r1, [r4, #7] + strb r1, [r5, #3] + strb r2, [r5, #6] + strb r2, [r5, #7] + ldrsh r1, [r5, #4] + ldrsh r2, [r5, #8] + bl EnableAllLearnableIqSkills + add r0, r5, #0x22 + add r1, r4, #8 + bl GetInfoGroundMoveset + ldr r1, [r4] + add r0, r5, #0x3a + mov r2, #0xa + bl StrncpySimple + ldmia sp!, {r3, r4, r5, pc} + arm_func_end GuestMonsterToGroundMonster + + arm_func_start sub_02052EFC +sub_02052EFC: ; 0x02052EFC + stmdb sp!, {r4, lr} + mov r4, r0 + mov r0, #1 + strb r0, [r4, #1] + ldrsh r0, [r4, #4] + bl GetBaseHp + strh r0, [r4, #0xa] + ldrsh r0, [r4, #4] + mov r1, #0 + bl GetBaseOffensiveStat + strb r0, [r4, #0xc] + ldrsh r0, [r4, #4] + mov r1, #1 + bl GetBaseOffensiveStat + strb r0, [r4, #0xd] + ldrsh r0, [r4, #4] + mov r1, #0 + bl GetBaseDefensiveStat + strb r0, [r4, #0xe] + ldrsh r0, [r4, #4] + mov r1, #1 + bl GetBaseDefensiveStat + strb r0, [r4, #0xf] + mov r0, #0 + str r0, [r4, #0x10] + strb r0, [r4, #0x20] + mov r2, #1 + strh r2, [r4, #8] + ldrsh r1, [r4, #4] + add r0, r4, #0x14 + bl EnableAllLearnableIqSkills + ldrsh r1, [r4, #4] + add r0, r4, #0x22 + mov r2, #0 + bl sub_02053F10 + ldmia sp!, {r4, pc} + arm_func_end sub_02052EFC + + arm_func_start sub_02052F8C +sub_02052F8C: ; 0x02052F8C + stmdb sp!, {r3, lr} + sub sp, sp, #8 + ldr lr, [sp, #0x10] + mov ip, #1 + str lr, [sp] + str ip, [sp, #4] + bl sub_02052CF4 + add sp, sp, #8 + ldmia sp!, {r3, pc} + arm_func_end sub_02052F8C + + arm_func_start StrcmpMonsterName +StrcmpMonsterName: ; 0x02052FB0 + stmdb sp!, {r3, r4, lr} + sub sp, sp, #0x14 + mov r4, r0 + mov r0, r1 + bl GetNameString + mov r1, r0 + add r0, sp, #0 +#ifdef JAPAN + bl sub_02025304_JP +#else + bl StrcpyName +#endif + add r1, sp, #0 + mov r0, r4 + mov r2, #0xa + bl StrncmpSimple + cmp r0, #0 + moveq r0, #1 + movne r0, #0 + and r0, r0, #0xff + add sp, sp, #0x14 + ldmia sp!, {r3, r4, pc} + arm_func_end StrcmpMonsterName + + arm_func_start sub_02052FF8 +sub_02052FF8: ; 0x02052FF8 + stmdb sp!, {r3, lr} + ldr r2, _02053034 ; =TEAM_MEMBER_TABLE_PTR + mov r3, #0x44 + ldr ip, [r2] + mov r2, #0xa + smlabb r0, r0, r3, ip + smlabb r1, r1, r3, ip + add r0, r0, #0x3a + add r1, r1, #0x3a + bl sub_01FF8F28 + cmp r0, #0 + movlt r0, #1 + movge r0, #0 + and r0, r0, #0xff + ldmia sp!, {r3, pc} + .align 2, 0 +_02053034: .word TEAM_MEMBER_TABLE_PTR + arm_func_end sub_02052FF8 + + arm_func_start sub_02053038 +sub_02053038: ; 0x02053038 + stmdb sp!, {r4, r5, r6, lr} + sub sp, sp, #0x48 + mov ip, r1 + mov lr, r0 + cmp ip, #0xd + blo _020530BC + ldr r6, _020530CC ; =_020A328C + add r5, sp, #0 + mov r4, #4 +_0205305C: + ldmia r6!, {r0, r1, r2, r3} + stmia r5!, {r0, r1, r2, r3} + subs r4, r4, #1 + bne _0205305C + ldmia r6, {r0, r1} + stmia r5, {r0, r1} + mov r3, #0 + add r1, sp, #0 + b _020530AC +_02053080: + mov r2, r3, lsl #3 + ldrsh r0, [r1, r2] + cmp r0, #0 + beq _020530B4 + cmp lr, r0 + addeq r0, r1, r2 + ldreq r0, [r0, #4] + cmpeq ip, r0 + moveq r0, #1 + beq _020530C4 + add r3, r3, #1 +_020530AC: + cmp r3, #0xa + blt _02053080 +_020530B4: + mov r0, #0 + b _020530C4 +_020530BC: + ldr r0, _020530D0 ; =_020A327C + ldrb r0, [r0, ip] +_020530C4: + add sp, sp, #0x48 + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_020530CC: .word _020A328C +_020530D0: .word _020A327C + arm_func_end sub_02053038 + + arm_func_start sub_020530D4 +sub_020530D4: ; 0x020530D4 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + sub sp, sp, #8 + mov r4, r0 + ldrb r5, [r4] + mov r0, #0x44 + ldr ip, _02053170 ; =TEAM_MEMBER_TABLE_PTR + tst r5, #1 + smulbb r6, r1, r0 + movne r0, #1 + moveq r0, #0 + mov r3, r2 + ldr r7, [ip] + tst r0, #0xff + beq _02053158 + ldrh r5, [r4, #0x3e] + ldrh lr, [r4, #0x40] + ldrh ip, [r4, #0x42] + mov r0, r4 + mov r2, r1 + strh r5, [sp] + add r1, r7, r6 + strh lr, [sp, #2] + strh ip, [sp, #4] + ldrb r5, [r4] + bl sub_02053250 + ldrh r2, [sp] + ldrh r1, [sp, #2] + ldrh r0, [sp, #4] + strh r2, [r4, #0x3e] + strh r1, [r4, #0x40] + strh r0, [r4, #0x42] + strb r5, [r4] + b _02053168 +_02053158: + mov r0, r4 + mov r2, r1 + add r1, r7, r6 + bl sub_02053250 +_02053168: + add sp, sp, #8 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_02053170: .word TEAM_MEMBER_TABLE_PTR + arm_func_end sub_020530D4 + + arm_func_start sub_02053174 +sub_02053174: ; 0x02053174 + stmdb sp!, {r4, r5, r6, r7, r8, sb, lr} + sub sp, sp, #0xc + mov r5, r0 + ldrb r6, [r5] + mov r0, #0x44 + ldr r4, _02053220 ; =TEAM_MEMBER_TABLE_PTR + tst r6, #1 + smulbb r8, r1, r0 + movne r0, #1 + moveq r0, #0 + mov ip, r2 + ldr sb, [r4] + tst r0, #0xff + beq _02053200 + ldrh r7, [r5, #0x3e] + ldrh r6, [r5, #0x40] + ldrh lr, [r5, #0x42] + ldrb r4, [r5] + mov r0, r5 + mov r2, r1 + str r3, [sp] + mov r3, ip + strh r7, [sp, #4] + add r1, sb, r8 + strh r6, [sp, #6] + strh lr, [sp, #8] + bl sub_02053374 + ldrh r2, [sp, #4] + ldrh r1, [sp, #6] + ldrh r0, [sp, #8] + strh r2, [r5, #0x3e] + strh r1, [r5, #0x40] + strh r0, [r5, #0x42] + strb r4, [r5] + b _02053218 +_02053200: + str r3, [sp] + mov r0, r5 + mov r2, r1 + mov r3, ip + add r1, sb, r8 + bl sub_02053374 +_02053218: + add sp, sp, #0xc + ldmia sp!, {r4, r5, r6, r7, r8, sb, pc} + .align 2, 0 +_02053220: .word TEAM_MEMBER_TABLE_PTR + arm_func_end sub_02053174 + + arm_func_start sub_02053224 +sub_02053224: ; 0x02053224 + stmdb sp!, {r3, lr} + ldr r3, _0205324C ; =TEAM_MEMBER_TABLE_PTR + mov ip, r1 + ldr r3, [r3] + mov r1, #0x44 + smlabb r1, ip, r1, r3 + mov r3, r2 + mov r2, ip + bl sub_02053250 + ldmia sp!, {r3, pc} + .align 2, 0 +_0205324C: .word TEAM_MEMBER_TABLE_PTR + arm_func_end sub_02053224 + + arm_func_start sub_02053250 +sub_02053250: ; 0x02053250 + stmdb sp!, {r4, r5, r6, lr} + sub sp, sp, #8 + mov r5, r1 + ldrb r1, [r5] + mov r6, r0 + add r0, r5, #0x14 + strb r1, [r6] + ldrb r1, [r5, #1] + add r3, r6, #0x4c + mov r4, r2 + strb r1, [r6, #2] + ldrsh r1, [r5, #8] + strh r1, [r6, #6] + ldmia r0, {r0, r1, r2} + stmia r3, {r0, r1, r2} + add r0, r6, #0x5a + bl ShuffleHiddenPower + ldrb r1, [r5, #2] + mov r0, r4 + strb r1, [r6, #3] + ldrb r1, [r5, #3] + strb r1, [r6, #4] + bl sub_020564B0 + strb r0, [r6, #1] + strh r4, [r6, #8] + ldrsh r0, [r5, #4] + mov r3, #0 + strh r0, [r6, #0xc] + ldrb r0, [r5, #0x20] + strb r0, [r6, #0x58] + ldrsh r0, [r5, #0xa] + strh r0, [r6, #0x10] + strh r0, [r6, #0xe] +_020532D4: + add r2, r5, r3 + ldrb r0, [r2, #0xc] + add r1, r6, r3 + add r3, r3, #1 + strb r0, [r1, #0x12] + ldrb r0, [r2, #0xe] + cmp r3, #2 + strb r0, [r1, #0x14] + blt _020532D4 + ldr r2, [r5, #0x10] + add r0, r6, #0x1c + add r1, r5, #0x22 + str r2, [r6, #0x18] + bl GroundToDungeonMoveset + add r0, r6, #0x5e + add r1, r5, #0x3a + mov r2, #0xa + bl StrncpySimple + add r0, r6, #0x3e + bl ItemZInit + mov r0, #0x64 + bl sub_02050FF8 + strh r0, [sp, #4] + mov r0, r0, lsr #0x10 + strh r0, [sp, #6] + ldrh r2, [sp, #4] + ldrh r1, [sp, #6] + mov r0, #0x64 + strh r2, [r6, #0x44] + strh r1, [r6, #0x46] + bl sub_02050FF8 + strh r0, [sp] + mov r0, r0, lsr #0x10 + strh r0, [sp, #2] + ldrh r1, [sp] + ldrh r0, [sp, #2] + strh r1, [r6, #0x48] + strh r0, [r6, #0x4a] + add sp, sp, #8 + ldmia sp!, {r4, r5, r6, pc} + arm_func_end sub_02053250 + + arm_func_start sub_02053374 +sub_02053374: ; 0x02053374 + stmdb sp!, {r4, r5, r6, lr} + sub sp, sp, #8 + mov r5, r1 + ldrb r1, [r5] + mov r6, r0 + add r0, r5, #0x14 + strb r1, [r6] + ldrb r1, [r5, #1] + add r3, r6, #0x4c + mov r4, r2 + strb r1, [r6, #2] + ldrsh r1, [r5, #8] + strh r1, [r6, #6] + ldmia r0, {r0, r1, r2} + stmia r3, {r0, r1, r2} + add r0, r6, #0x5a + bl ShuffleHiddenPower + ldrb r2, [r5, #2] + ldrb r1, [sp, #0x18] + mov r0, r4 + strb r2, [r6, #3] + ldrb r2, [r5, #3] + strb r2, [r6, #4] + bl sub_02056504 + strb r0, [r6, #1] + strh r4, [r6, #8] + ldrsh r0, [r5, #4] + mov r3, #0 + strh r0, [r6, #0xc] + ldrb r0, [r5, #0x20] + strb r0, [r6, #0x58] + ldrsh r0, [r5, #0xa] + strh r0, [r6, #0x10] + strh r0, [r6, #0xe] +_020533FC: + add r2, r5, r3 + ldrb r0, [r2, #0xc] + add r1, r6, r3 + add r3, r3, #1 + strb r0, [r1, #0x12] + ldrb r0, [r2, #0xe] + cmp r3, #2 + strb r0, [r1, #0x14] + blt _020533FC + ldr r2, [r5, #0x10] + add r0, r6, #0x1c + add r1, r5, #0x22 + str r2, [r6, #0x18] + bl GroundToDungeonMoveset + add r0, r6, #0x5e + add r1, r5, #0x3a + mov r2, #0xa + bl StrncpySimple + add r0, r6, #0x3e + bl ItemZInit + mov r0, #0x64 + bl sub_02050FF8 + strh r0, [sp, #4] + mov r0, r0, lsr #0x10 + strh r0, [sp, #6] + ldrh r2, [sp, #4] + ldrh r1, [sp, #6] + mov r0, #0x64 + strh r2, [r6, #0x44] + strh r1, [r6, #0x46] + bl sub_02050FF8 + strh r0, [sp] + mov r0, r0, lsr #0x10 + strh r0, [sp, #2] + ldrh r1, [sp] + ldrh r0, [sp, #2] + strh r1, [r6, #0x48] + strh r0, [r6, #0x4a] + add sp, sp, #8 + ldmia sp!, {r4, r5, r6, pc} + arm_func_end sub_02053374 + + arm_func_start sub_0205349C +sub_0205349C: ; 0x0205349C + ldr r3, _020534B4 ; =TEAM_MEMBER_TABLE_PTR + ldr ip, _020534B8 ; =sub_020534BC + ldr r3, [r3] + mov r2, #0x44 + smlabb r0, r0, r2, r3 + bx ip + .align 2, 0 +_020534B4: .word TEAM_MEMBER_TABLE_PTR +_020534B8: .word sub_020534BC + arm_func_end sub_0205349C + + arm_func_start sub_020534BC +sub_020534BC: ; 0x020534BC + stmdb sp!, {r3, r4, r5, lr} + mov r4, r1 + ldrb r1, [r4] + mov r5, r0 + add r0, r4, #0x4c + strb r1, [r5] + ldrb r1, [r4, #2] + add ip, r5, #0x14 + mov r3, #0 + strb r1, [r5, #1] + ldrsh r1, [r4, #6] + strh r1, [r5, #8] + ldmia r0, {r0, r1, r2} + stmia ip, {r0, r1, r2} + ldrb r0, [r4, #3] + strb r0, [r5, #2] + ldrb r0, [r4, #4] + strb r0, [r5, #3] + ldrsh r0, [r4, #0xc] + strh r0, [r5, #4] + ldrb r0, [r4, #0x58] + strb r0, [r5, #0x20] + ldrsh r0, [r4, #0x10] + strh r0, [r5, #0xa] +_0205351C: + add r2, r4, r3 + ldrb r0, [r2, #0x12] + add r1, r5, r3 + add r3, r3, #1 + strb r0, [r1, #0xc] + ldrb r0, [r2, #0x14] + cmp r3, #2 + strb r0, [r1, #0xe] + blt _0205351C + ldr r2, [r4, #0x18] + add r0, r5, #0x22 + add r1, r4, #0x1c + str r2, [r5, #0x10] + bl DungeonToGroundMoveset + add r0, r5, #0x3a + add r1, r4, #0x5e + mov r2, #0xa + bl StrncpySimple + ldmia sp!, {r3, r4, r5, pc} + arm_func_end sub_020534BC + + arm_func_start sub_02053568 +sub_02053568: ; 0x02053568 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + ldr r4, _0205361C ; =_020A3258 + b _0205358C +_02053578: + ldrsh r1, [r5, #4] + bl DexNumbersEqual + cmp r0, #0 + bne _02053598 + add r4, r4, #4 +_0205358C: + ldrsh r0, [r4] + cmp r0, #0 + bne _02053578 +_02053598: + ldrsh r0, [r4] + cmp r0, #0 + ldmeqia sp!, {r3, r4, r5, pc} + add r0, r5, #0x22 + bl GetNbMoves + cmp r0, #4 + bne _02053604 + ldrsh r0, [r4] + cmp r0, #0x148 + ldmneia sp!, {r3, r4, r5, pc} + ldr r1, _02053620 ; =0x0000013B + add r0, r5, #0x22 + bl GetMovesetIdx__02013CAC + mvn r1, #0 + cmp r0, r1 + ldmeqia sp!, {r3, r4, r5, pc} + mov r1, #6 + mul r2, r0, r1 + add r3, r5, #0x22 + mov r0, #0 + strb r0, [r3, r2] + ldrh r1, [r4, #2] + add r0, r3, r2 + bl GetInfoMoveGround + ldr r0, _02053624 ; =_020A32D4 + bl Debug_Print0 + ldmia sp!, {r3, r4, r5, pc} +_02053604: + add r2, r5, #0x22 + mov r1, #6 + mla r0, r1, r0, r2 + ldrh r1, [r4, #2] + bl GetInfoMoveGround + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_0205361C: .word _020A3258 +_02053620: .word 0x0000013B +_02053624: .word _020A32D4 + arm_func_end sub_02053568 + + arm_func_start sub_02053628 +sub_02053628: ; 0x02053628 + b _0205364C +_0205362C: + ldrsh r2, [r0, #4] + cmp r3, r2 + ldreqb r3, [r1, #2] + ldreqb r2, [r0, #2] + cmpeq r3, r2 + addeq r0, r1, #4 + bxeq lr + add r1, r1, #6 + arm_func_end sub_02053628 +_0205364C: + ldrsh r3, [r1] + cmp r3, #0 + bne _0205362C + mov r0, #0 + bx lr + + arm_func_start sub_02053660 +sub_02053660: ; 0x02053660 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr} + movs r4, r2 + mov r5, r1 + mov r6, r0 + cmpne r5, #0 + mvneq r0, #0 + ldmeqia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + mov r1, #0 + mov sb, r1 + add r0, sp, #0 +_02053688: + strb sb, [r0, r1] + add r1, r1, #1 + cmp r1, #4 + blt _02053688 + b _0205375C +_0205369C: + mov r1, r8 + add r0, r6, #0x22 + bl GetMovesetIdx__02013CAC + mvn r1, #0 + cmp r0, r1 + bne _02053758 + add r0, r6, #0x22 + bl GetNbMoves + mov r7, r0 + cmp r7, #4 + bne _02053738 + mov r7, #0 + mov sb, r7 + add r1, sp, #0 +_020536D4: + ldrb r0, [r1, sb] + add sb, sb, #1 + cmp r0, #0 + addeq r7, r7, #1 + cmp sb, #4 + blt _020536D4 + cmp r7, #0 + beq _02053774 + bl Rand16Bit + mov r1, r7 + bl _s32_div_f + mov r7, r1 + mov r0, #6 + mul ip, r7, r0 + add r0, r6, #0x22 + mov r1, r8 + add r2, r6, ip + mov r3, #0 + add r0, r0, ip + strb r3, [r2, #0x22] + bl GetInfoMoveGround + add r0, sp, #0 + mov r1, #1 + strb r1, [r0, r7] + b _02053758 +_02053738: + add r1, r6, #0x22 + mov r0, #6 + mla r0, r7, r0, r1 + mov r1, r8 + bl GetInfoMoveGround + add r0, sp, #0 + mov r1, #1 + strb r1, [r0, r7] +_02053758: + add sb, sb, #1 +_0205375C: + cmp sb, r4 + bge _02053774 + mov r0, sb, lsl #1 + ldrh r8, [r5, r0] + cmp r8, #0 + bne _0205369C +_02053774: + mov r0, #0 + mov r3, r0 + add r2, sp, #0 +_02053780: + ldrb r1, [r2, r3] + add r3, r3, #1 + cmp r1, #0 + addne r0, r0, #1 + cmp r3, #4 + blt _02053780 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc} + arm_func_end sub_02053660 + + arm_func_start GetLvlUpEntry +GetLvlUpEntry: ; 0x0205379C + stmdb sp!, {r3, r4, r5, r6, lr} + sub sp, sp, #0xc + mov r6, r1 + mov r5, r0 + mov r0, r6 + mov r1, #0x258 + mov r4, r2 + bl _s32_div_f + ldr r0, _02053844 ; =_022AB92C + ldrsh r0, [r0] + cmp r0, r1 + beq _02053820 + mov r0, r6 + mov r1, #0x258 + bl _s32_div_f + sub r0, r1, #1 + ldr r2, _02053844 ; =_022AB92C + mov r0, r0, lsl #0x10 + strh r1, [r2] + mov r1, r0, lsr #0x10 + add r2, sp, #4 + mov r0, #5 + mov r3, #0 + bl DirectoryFileMngr_OpenDirectoryFile + ldr r1, [sp, #4] + add r0, sp, #0 + bl HandleSir0Translation + ldr r2, [sp] + ldr r0, _02053848 ; =_022AB930 + mov r1, #0 + bl DecompressAtNormalVeneer + add r0, sp, #4 + bl UnloadFile +_02053820: + subs r4, r4, #1 + ldr r1, _02053848 ; =_022AB930 + movmi r4, #0 + mov r0, #0xc + mla r0, r4, r0, r1 + ldmia r0, {r0, r1, r2} + stmia r5, {r0, r1, r2} + add sp, sp, #0xc + ldmia sp!, {r3, r4, r5, r6, pc} + .align 2, 0 +_02053844: .word _022AB92C +_02053848: .word _022AB930 + arm_func_end GetLvlUpEntry + + arm_func_start GetEncodedHalfword +GetEncodedHalfword: ; 0x0205384C + ldrb ip, [r0] + add r2, r0, #1 + mov r0, r2 + tst ip, #0x80 + addne r0, r2, #1 + ldrneb r2, [r2] + moveq r2, ip + moveq ip, #0 + and r3, r2, #0x7f + mov r2, ip, lsl #0x19 + orr r2, r3, r2, lsr #18 + strh r2, [r1] + bx lr + arm_func_end GetEncodedHalfword + + arm_func_start sub_02053880 +sub_02053880: ; 0x02053880 + cmp r0, #0xee + mov r3, #1 + bne _0205389C + ldr r2, _020538F0 ; =_020A18C0 + ldrsh r2, [r2] + cmp r1, r2 + movlt r3, #0 +_0205389C: + cmp r0, #0xef + bne _020538B4 + ldr r2, _020538F4 ; =_020A189C + ldrsh r2, [r2] + cmp r1, r2 + movlt r3, #0 +_020538B4: + cmp r0, #0x110 + bne _020538CC + ldr r2, _020538F8 ; =_020A1884 + ldrsh r2, [r2] + cmp r1, r2 + movlt r3, #0 +_020538CC: + ldr r2, _020538FC ; =0x0000021A + cmp r0, r2 + bne _020538E8 + ldr r0, _02053900 ; =_020A1880 + ldrsh r0, [r0] + cmp r1, r0 + movlt r3, #0 +_020538E8: + mov r0, r3 + bx lr + .align 2, 0 +_020538F0: .word _020A18C0 +_020538F4: .word _020A189C +_020538F8: .word _020A1884 +_020538FC: .word 0x0000021A +_02053900: .word _020A1880 + arm_func_end sub_02053880 + + arm_func_start sub_02053904 +sub_02053904: ; 0x02053904 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + ldr r4, _02053A08 ; =0x00000229 + ldr r8, [sp, #0x28] + mov sl, r0 + mov sb, r2 + mov fp, r3 + mov r6, #0 + cmp r1, r4 + moveq r0, r6 + ldmeqia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + cmp r1, #0 + moveq r0, r6 + ldmeqia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + cmp r8, #0 + beq _0205394C + ldrsh r5, [sp, #0x2c] + cmp r5, #0 + bgt _02053950 +_0205394C: + mov r5, #0 +_02053950: + mov r0, r1 + bl GetMovesetLevelUpPtr + mov r4, r0 + b _020539F4 +_02053960: + mov r0, r4 + add r1, sp, #0 + bl GetEncodedHalfword + ldrb r1, [r0] + add r4, r0, #1 + cmp r1, sb + bgt _02053A00 + bne _020539F4 + ldrh r0, [sp] + mov r1, fp + mov r7, #1 + bl sub_02053880 + cmp r0, #0 + moveq r7, #0 + cmp r5, #0 + ble _020539D8 + mov r2, #0 + ldrh r0, [sp] + b _020539C8 +_020539AC: + mov r1, r2, lsl #1 + ldrh r1, [r8, r1] + cmp r0, r1 + beq _020539D0 + add r1, r2, #1 + mov r1, r1, lsl #0x10 + mov r2, r1, asr #0x10 +_020539C8: + cmp r2, r5 + blt _020539AC +_020539D0: + cmp r2, r5 + bne _020539F4 +_020539D8: + cmp r7, #0 + beq _020539F4 + cmp r6, #0x10 + ldrlth r1, [sp] + movlt r0, r6, lsl #1 + addlt r6, r6, #1 + strlth r1, [sl, r0] +_020539F4: + ldrb r0, [r4] + cmp r0, #0 + bne _02053960 +_02053A00: + mov r0, r6 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_02053A08: .word 0x00000229 + arm_func_end sub_02053904 + + arm_func_start sub_02053A0C +sub_02053A0C: ; 0x02053A0C + stmdb sp!, {r4, r5, r6, lr} + sub sp, sp, #8 + mov r6, r0 + mov r0, r1 + mov r5, r2 + mov r4, r3 + bl FemaleToMaleForm + mov ip, #0 + mov r1, r0 + str ip, [sp] + mov r0, r6 + mov r2, r5 + mov r3, r4 + str ip, [sp, #4] + bl sub_02053904 + add sp, sp, #8 + ldmia sp!, {r4, r5, r6, pc} + arm_func_end sub_02053A0C + + arm_func_start sub_02053A50 +sub_02053A50: ; 0x02053A50 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + mov sl, r0 + mov r0, r3 + ldr r7, [sp, #0x2c] + mov sb, r1 + mov r8, r2 + mov r5, #0 + bl FemaleToMaleForm + mov r4, r0 + bl sub_02053B38 + cmp r0, #0 + movne r0, r5 + ldmneia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + ldr r0, [sp, #0x28] + cmp r0, #1 + bne _02053B30 + mov r0, r4 + bl GetMovesetEggPtr + mov r4, r0 + mov fp, #1 + b _02053B24 +_02053AA4: + mov r0, r4 + add r1, sp, #0 + mov r6, fp + bl GetEncodedHalfword + mov r4, r0 + ldrh r0, [sp] + mov r1, r7 + bl sub_02053880 + cmp r0, #0 + moveq r6, #0 + cmp r6, #0 + beq _02053B24 + mov r2, #0 + mov r3, r2 + ldrh r0, [sp] + b _02053B04 +_02053AE4: + mov r1, r3, lsl #1 + ldrh r1, [sb, r1] + cmp r0, r1 + moveq r2, #1 + beq _02053B0C + add r1, r3, #1 + mov r1, r1, lsl #0x10 + mov r3, r1, asr #0x10 +_02053B04: + cmp r3, r8 + blt _02053AE4 +_02053B0C: + cmp r2, #0 + bne _02053B24 + cmp r5, #0x10 + movlt r1, r5, lsl #1 + strlth r0, [sl, r1] + addlt r5, r5, #1 +_02053B24: + ldrb r0, [r4] + cmp r0, #0 + bne _02053AA4 +_02053B30: + mov r0, r5 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + arm_func_end sub_02053A50 + + arm_func_start sub_02053B38 +sub_02053B38: ; 0x02053B38 + cmp r0, #0 + ble _02053B4C + ldr r1, _02053B5C ; =0x00000229 + cmp r0, r1 + blt _02053B54 +_02053B4C: + mov r0, #1 + bx lr +_02053B54: + mov r0, #0 + bx lr + .align 2, 0 +_02053B5C: .word 0x00000229 + arm_func_end sub_02053B38 + + arm_func_start sub_02053B60 +sub_02053B60: ; 0x02053B60 + stmdb sp!, {r4, r5, r6, r7, r8, lr} + sub sp, sp, #0x48 + mov r8, r0 + mov r0, r1 + mov r7, r2 + mov r6, r3 + bl FemaleToMaleForm + mov r4, r0 + bl sub_02053B38 + cmp r0, #0 + movne r0, #0 + bne _02053C98 + mov r0, r4 + bl FemaleToMaleForm + mov r5, #0 + mov r1, r0 + str r5, [sp] + mov r0, r8 + mov r2, r7 + mov r3, r6 + str r5, [sp, #4] + bl sub_02053904 + mov r5, r0 + cmp r5, #4 + bge _02053C68 + mov r3, #0 + add r0, sp, #0x28 + b _02053BE0 +_02053BD0: + mov r2, r3, lsl #1 + ldrh r1, [r8, r2] + add r3, r3, #1 + strh r1, [r0, r2] +_02053BE0: + cmp r3, r5 + blt _02053BD0 + mov r2, r5, lsl #0x10 + str r7, [sp] + add r0, sp, #8 + add r1, sp, #0x28 + mov r3, r4 + mov r2, r2, asr #0x10 + str r6, [sp, #4] + bl sub_02053A50 + mov r6, r0 + cmp r6, #0 + ble _02053C68 + add r4, sp, #8 + b _02053C60 +_02053C1C: + mov r0, r6 + bl RandIntSafe + mov r1, r0, lsl #1 + ldrh r2, [r4, r1] + mov r1, r5, lsl #1 + add r3, r0, #1 + strh r2, [r8, r1] + b _02053C50 +_02053C3C: + mov r0, r3, lsl #1 + ldrh r1, [r4, r0] + add r0, r4, r3, lsl #1 + add r3, r3, #1 + strh r1, [r0, #-2] +_02053C50: + cmp r3, r6 + blt _02053C3C + sub r6, r6, #1 + add r5, r5, #1 +_02053C60: + cmp r5, #4 + blt _02053C1C +_02053C68: + mov r0, r5, lsl #0x10 + mov r1, r0, asr #0x10 + mov r2, #0 + b _02053C8C +_02053C78: + add r0, r1, #1 + mov r1, r1, lsl #1 + mov r0, r0, lsl #0x10 + strh r2, [r8, r1] + mov r1, r0, asr #0x10 +_02053C8C: + cmp r1, #4 + blt _02053C78 + mov r0, r5 +_02053C98: + add sp, sp, #0x48 + ldmia sp!, {r4, r5, r6, r7, r8, pc} + arm_func_end sub_02053B60 + + arm_func_start sub_02053CA0 +sub_02053CA0: ; 0x02053CA0 + stmdb sp!, {r4, lr} + mov r4, #0 + ldr lr, _02053D18 ; =FORBIDDEN_FORGOT_MOVE_LIST + b _02053CFC +_02053CB0: + cmp ip, r2 + ldreqb ip, [lr, #2] + cmpeq r3, ip + bne _02053CF8 + mov r2, #1 + cmp r1, #1 + suble r2, r1, #1 + mov r4, #0 + b _02053CDC +_02053CD4: + strh r1, [r0], #2 + add r4, r4, #1 +_02053CDC: + cmp r4, r2 + bge _02053D08 + add r1, lr, r4, lsl #1 + ldrh r1, [r1, #4] + cmp r1, #0 + bne _02053CD4 + b _02053D08 +_02053CF8: + add lr, lr, #6 +_02053CFC: + ldrsh ip, [lr] + cmp ip, #0 + bne _02053CB0 +_02053D08: + mov r1, #0 + strh r1, [r0] + mov r0, r4 + ldmia sp!, {r4, pc} + .align 2, 0 +_02053D18: .word FORBIDDEN_FORGOT_MOVE_LIST + arm_func_end sub_02053CA0 + + arm_func_start sub_02053D1C +sub_02053D1C: ; 0x02053D1C + stmdb sp!, {r3, r4, r5, r6, lr} + sub sp, sp, #4 + ldr r2, _02053DCC ; =0x00000229 + mov r6, r1 + mov r4, r0 + cmp r6, r2 + moveq r0, #0 + beq _02053DC4 + cmp r6, #0 + moveq r0, #0 + beq _02053DC4 + cmp r4, #0x160 + moveq r0, #0 + beq _02053DC4 + mov r0, r6 + bl GetMovesetLevelUpPtr + add r5, sp, #2 + b _02053D80 +_02053D64: + mov r1, r5 + bl GetEncodedHalfword + ldrh r1, [sp, #2] + add r0, r0, #1 + cmp r4, r1 + moveq r0, #1 + beq _02053DC4 +_02053D80: + ldrb r1, [r0] + cmp r1, #0 + bne _02053D64 + mov r0, r6 + bl GetMovesetHmTmPtr + add r5, sp, #0 + b _02053DB4 +_02053D9C: + mov r1, r5 + bl GetEncodedHalfword + ldrh r1, [sp] + cmp r1, r4 + moveq r0, #1 + beq _02053DC4 +_02053DB4: + ldrb r1, [r0] + cmp r1, #0 + bne _02053D9C + mov r0, #0 +_02053DC4: + add sp, sp, #4 + ldmia sp!, {r3, r4, r5, r6, pc} + .align 2, 0 +_02053DCC: .word 0x00000229 + arm_func_end sub_02053D1C + + arm_func_start GetEvoFamily +GetEvoFamily: ; 0x02053DD0 + stmdb sp!, {r4, r5, r6, r7, r8, lr} + sub sp, sp, #8 + ldr r2, _02053E84 ; =_020A3248 + ldrsh r3, [r0, #4] + ldr r4, [r2, #8] + ldr r2, [r2, #0xc] + mov r7, r1 + strh r3, [r7] + ldrb r1, [r0, #1] + str r2, [sp, #4] + str r4, [sp] + strb r1, [r7, #2] + ldrb r5, [r0, #6] + mov r3, #0 + ldrsh r2, [r0, #4] + cmp r5, #0 + ldrneb r1, [r0, #7] + add r4, r3, #1 + add r8, sp, #0 + cmpne r1, #0 + strne r1, [sp] + ldreqb r0, [r0, #7] + strne r5, [sp, #4] + streq r5, [sp] + streq r0, [sp, #4] + mov r5, #0 + b _02053E70 +_02053E3C: + ldr r6, [r8, r5, lsl #2] + cmp r6, #0 + beq _02053E78 + mov r0, r2 + bl GetMonsterPreEvolution + movs r2, r0 + beq _02053E78 + mov r1, r4, lsl #2 + add r0, r7, r4, lsl #2 + strh r2, [r7, r1] + strb r6, [r0, #2] + add r4, r4, #1 + add r5, r5, #1 +_02053E70: + cmp r5, #2 + blt _02053E3C +_02053E78: + mov r0, r4 + add sp, sp, #8 + ldmia sp!, {r4, r5, r6, r7, r8, pc} + .align 2, 0 +_02053E84: .word _020A3248 + arm_func_end GetEvoFamily + + arm_func_start GetEvolutions +GetEvolutions: ; 0x02053E88 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + mov sl, r0 + mov sb, r1 + mov r8, r2 + mov fp, r3 + mov r5, #0 + mov r6, #1 +_02053EA4: + mov r0, r6, lsl #0x10 + mov r7, r0, asr #0x10 + mov r0, r7 + bl GetMonsterPreEvolution + cmp sl, r0 + bne _02053EF4 + cmp r8, #0 + bne _02053EE0 + mov r0, sl + bl GetSpriteSize + mov r4, r0 + mov r0, r7 + bl GetSpriteSize + cmp r4, r0 + bne _02053EF4 +_02053EE0: + cmp fp, #0 + cmpeq r7, #0x140 + movne r0, r5, lsl #1 + strneh r7, [sb, r0] + addne r5, r5, #1 +_02053EF4: + ldr r0, _02053F0C ; =0x00000483 + add r6, r6, #1 + cmp r6, r0 + blt _02053EA4 + mov r0, r5 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_02053F0C: .word 0x00000483 + arm_func_end GetEvolutions + + arm_func_start sub_02053F10 +sub_02053F10: ; 0x02053F10 + stmdb sp!, {r4, r5, r6, r7, r8, lr} + sub sp, sp, #0x28 + mov r5, r0 + cmp r2, #0 + beq _02053F38 + mov r2, #1 + add r0, sp, #8 + rsb r3, r2, #0x3e8 + bl sub_02053B60 + b _02053F60 +_02053F38: + mov r0, r1 + bl FemaleToMaleForm + mov r4, #0 + mov r2, #1 + mov r1, r0 + str r4, [sp] + add r0, sp, #8 + rsb r3, r2, #0x3e8 + str r4, [sp, #4] + bl sub_02053904 +_02053F60: + mov r8, r0 + cmp r8, #0 + moveq r0, #0x198 + streqh r0, [sp, #8] + moveq r8, #1 + mov r4, #0 + add r7, sp, #8 + mov r6, #6 + b _02053F98 +_02053F84: + mla r0, r4, r6, r5 + mov r1, r4, lsl #1 + ldrh r1, [r7, r1] + bl GetInfoMoveGround + add r4, r4, #1 +_02053F98: + cmp r4, r8 + blt _02053F84 + mov r2, #0 + mov r0, #6 + b _02053FB8 +_02053FAC: + mul r1, r4, r0 + strb r2, [r5, r1] + add r4, r4, #1 +_02053FB8: + cmp r4, #4 + blt _02053FAC + add sp, sp, #0x28 + ldmia sp!, {r4, r5, r6, r7, r8, pc} + arm_func_end sub_02053F10 + + arm_func_start ShuffleHiddenPower +ShuffleHiddenPower: ; 0x02053FC8 + stmdb sp!, {r4, r5, r6, lr} + mov r6, r0 + mov r0, #0xa + bl RandIntSafe + ldr r1, _02054020 ; =HIDDEN_POWER_BASE_POWER_TABLE + mov r5, #0 + ldr r0, [r1, r0, lsl #2] + mov r4, #0x12 + strh r0, [r6] + b _02054008 +_02053FF0: + mov r0, r4 + bl RandIntSafe + strb r0, [r6, #2] + tst r0, #0xff + bne _02054010 + add r5, r5, #1 +_02054008: + cmp r5, #0x64 + blt _02053FF0 +_02054010: + cmp r5, #0x64 + moveq r0, #2 + streqb r0, [r6, #2] + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_02054020: .word HIDDEN_POWER_BASE_POWER_TABLE + arm_func_end ShuffleHiddenPower + + arm_func_start GetBaseForm +GetBaseForm: ; 0x02054024 + cmp r0, #0x17c + ldreq r0, _02054244 ; =0x0000017B + bxeq lr + ldr r3, _02054248 ; =0x0000017D + cmp r0, r3 + subeq r0, r3, #2 + bxeq lr + add r1, r3, #1 + cmp r0, r1 + subeq r0, r3, #2 + bxeq lr + cmp r0, #0x3d4 + rsbeq r0, r3, #0x550 + bxeq lr + add r1, r3, #0x258 + cmp r0, r1 + rsbeq r0, r3, #0x550 + bxeq lr + ldr r2, _0205424C ; =0x000003D6 + cmp r0, r2 + subeq r0, r2, #3 + bxeq lr + cmp r0, #0xca + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xcb + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xcc + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xcd + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xce + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xcf + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xd0 + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xd1 + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xd2 + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xd3 + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xd4 + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xd5 + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xd6 + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xd7 + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xd8 + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xd9 + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xda + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xdb + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xdc + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xdd + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xde + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xdf + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xe0 + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xe1 + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xe2 + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xe3 + moveq r0, #0xc9 + bxeq lr + cmp r0, #0xe4 + moveq r0, #0xc9 + bxeq lr + add r1, r3, #0x26 + cmp r0, r1 + subeq r0, r2, #0x234 + bxeq lr + cmp r0, #0x1a4 + subeq r0, r2, #0x234 + bxeq lr + add r1, r3, #0x28 + cmp r0, r1 + subeq r0, r2, #0x234 + bxeq lr + cmp r0, #0x1cc + moveq r0, #0x1cc + bxeq lr + add r1, r3, #0x50 + cmp r0, r1 + moveq r0, #0x1cc + bxeq lr + add r1, r2, #0x4e + cmp r0, r1 + moveq r0, r1 + bxeq lr + add r1, r2, #0x4f + cmp r0, r1 + addeq r0, r2, #0x4e + bxeq lr + add r1, r3, #0x9a + cmp r0, r1 + subeq r0, r2, #0x1c0 + bxeq lr + cmp r0, #0x218 + addeq r0, r3, #0x94 + bx lr + .align 2, 0 +_02054244: .word 0x0000017B +_02054248: .word 0x0000017D +_0205424C: .word 0x000003D6 + arm_func_end GetBaseForm + + arm_func_start GetBaseFormBurmyWormadamShellosGastrodonCherrim +GetBaseFormBurmyWormadamShellosGastrodonCherrim: ; 0x02054250 + ldr r2, _02054390 ; =0x000001BF + cmp r0, r2 + moveq r0, r2 + bxeq lr + cmp r0, #0x1c0 + moveq r0, r2 + bxeq lr + add r1, r2, #2 + cmp r0, r1 + moveq r0, r2 + bxeq lr + add r1, r2, #0x258 + cmp r0, r1 + moveq r0, r2 + bxeq lr + ldr r1, _02054394 ; =0x00000418 + cmp r0, r1 + moveq r0, r2 + bxeq lr + add r3, r1, #1 + cmp r0, r3 + moveq r0, r2 + bxeq lr + add r3, r2, #3 + cmp r0, r3 + moveq r0, r3 + bxeq lr + add r3, r2, #4 + cmp r0, r3 + addeq r0, r2, #3 + bxeq lr + cmp r0, #0x1c4 + addeq r0, r2, #3 + bxeq lr + add r3, r2, #0xf + cmp r0, r3 + moveq r0, r3 + bxeq lr + add r3, r2, #0x10 + cmp r0, r3 + addeq r0, r2, #0xf + bxeq lr + add r3, r1, #0xe + cmp r0, r3 + addeq r0, r2, #0xf + bxeq lr + add r3, r1, #0xf + cmp r0, r3 + addeq r0, r2, #0xf + bxeq lr + cmp r0, #0x1d0 + moveq r0, #0x1d0 + bxeq lr + add r3, r2, #0x12 + cmp r0, r3 + moveq r0, #0x1d0 + bxeq lr + add r3, r1, #0x10 + cmp r0, r3 + moveq r0, #0x1d0 + bxeq lr + add r3, r1, #0x11 + cmp r0, r3 + moveq r0, #0x1d0 + bxeq lr + cmp r0, #0x1cc + moveq r0, #0x1cc + bxeq lr + add r2, r2, #0xe + cmp r0, r2 + moveq r0, #0x1cc + bxeq lr + add r2, r1, #0xc + cmp r0, r2 + moveq r0, r2 + bxeq lr + add r2, r1, #0xd + cmp r0, r2 + addeq r0, r1, #0xc + bx lr + .align 2, 0 +_02054390: .word 0x000001BF +_02054394: .word 0x00000418 + arm_func_end GetBaseFormBurmyWormadamShellosGastrodonCherrim + + arm_func_start GetBaseFormCastformCherrimDeoxys +GetBaseFormCastformCherrimDeoxys: ; 0x02054398 + cmp r0, #0x17c + ldreq r0, _02054458 ; =0x0000017B + bxeq lr + ldr r3, _0205445C ; =0x0000017D + cmp r0, r3 + subeq r0, r3, #2 + bxeq lr + add r1, r3, #1 + cmp r0, r1 + subeq r0, r3, #2 + bxeq lr + cmp r0, #0x3d4 + rsbeq r0, r3, #0x550 + bxeq lr + add r1, r3, #0x258 + cmp r0, r1 + rsbeq r0, r3, #0x550 + bxeq lr + ldr r2, _02054460 ; =0x000003D6 + cmp r0, r2 + subeq r0, r2, #3 + bxeq lr + cmp r0, #0x1cc + moveq r0, #0x1cc + bxeq lr + add r1, r3, #0x50 + cmp r0, r1 + moveq r0, #0x1cc + bxeq lr + add r1, r2, #0x4e + cmp r0, r1 + moveq r0, r1 + bxeq lr + add r1, r2, #0x4f + cmp r0, r1 + addeq r0, r2, #0x4e + bxeq lr + add r1, r3, #0x26 + cmp r0, r1 + subeq r0, r2, #0x234 + bxeq lr + cmp r0, #0x1a4 + subeq r0, r2, #0x234 + bxeq lr + add r1, r3, #0x28 + cmp r0, r1 + subeq r0, r2, #0x234 + bx lr + .align 2, 0 +_02054458: .word 0x0000017B +_0205445C: .word 0x0000017D +_02054460: .word 0x000003D6 + arm_func_end GetBaseFormCastformCherrimDeoxys + + arm_func_start GetAllBaseForms +GetAllBaseForms: ; 0x02054464 + stmdb sp!, {r3, lr} + bl GetBaseForm + bl GetBaseFormBurmyWormadamShellosGastrodonCherrim + ldmia sp!, {r3, pc} + arm_func_end GetAllBaseForms + + arm_func_start GetDexNumberVeneer +GetDexNumberVeneer: ; 0x02054474 + ldr ip, _0205447C ; =GetDexNumber + bx ip + .align 2, 0 +_0205447C: .word GetDexNumber + arm_func_end GetDexNumberVeneer + + arm_func_start GetMonsterIdFromSpawnEntry +GetMonsterIdFromSpawnEntry: ; 0x02054480 + stmdb sp!, {r3, lr} + ldrsh r0, [r0, #6] + ldr r1, _0205449C ; =0x00000483 + bl _s32_div_f + mov r0, r1, lsl #0x10 + mov r0, r0, asr #0x10 + ldmia sp!, {r3, pc} + .align 2, 0 +_0205449C: .word 0x00000483 + arm_func_end GetMonsterIdFromSpawnEntry + + arm_func_start SetMonsterId +SetMonsterId: ; 0x020544A0 + strh r1, [r0, #6] + bx lr + arm_func_end SetMonsterId + + arm_func_start SetMonsterLevelAndId +SetMonsterLevelAndId: ; 0x020544A8 + mov r1, r1, lsl #9 + strh r1, [r0] + strh r2, [r0, #6] + bx lr + arm_func_end SetMonsterLevelAndId + + arm_func_start GetMonsterLevelFromSpawnEntry +GetMonsterLevelFromSpawnEntry: ; 0x020544B8 + ldrh r0, [r0] + mov r0, r0, asr #9 + and r0, r0, #0x7f + bx lr + arm_func_end GetMonsterLevelFromSpawnEntry + + arm_func_start sub_020544C8 +sub_020544C8: ; 0x020544C8 + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0x4c + mov sl, r0 + ldrb r0, [sl] + mov sb, r1 + mov fp, r2 + tst r0, #1 + movne r0, #1 + moveq r0, #0 + tst r0, #0xff + beq _020546DC + ldrb r0, [sl, #1] + add r6, r0, #1 + b _020546D4 +_02054500: + mov r0, sl + bl sub_020546E8 + ldrsh r0, [sl, #4] + bl FemaleToMaleForm + mov r1, #0 + str r1, [sp] + str r1, [sp, #4] + mov r1, r0 + ldrb r2, [sl, #1] + ldr r3, _020546E4 ; =0x000003E7 + add r0, sp, #0x2a + bl sub_02053904 + str r0, [sp, #8] + cmp r0, #0 + beq _020546D0 + mov r8, #0 + add r5, sl, #0x22 + add r4, sp, #0xc + b _020546C4 +_0205454C: + mov r1, #0 + mov r3, r8, lsl #1 + add r2, sp, #0x2a + mov r0, r1 + ldrh r3, [r2, r3] + b _02054598 +_02054564: + mov r2, #6 + mla r7, r0, r2, sl + ldrb r2, [r7, #0x22] + tst r2, #1 + movne r2, #1 + moveq r2, #0 + tst r2, #0xff + beq _02054594 + ldrh r2, [r7, #0x24] + cmp r2, r3 + moveq r1, #1 + beq _020545A0 +_02054594: + add r0, r0, #1 +_02054598: + cmp r0, #4 + blt _02054564 +_020545A0: + cmp r1, #0 + bne _020546C0 + mov r7, #0 + b _020545F0 +_020545B0: + mov r0, #6 + mul r1, r7, r0 + add r0, sl, r1 + ldrb r0, [r0, #0x22] + tst r0, #1 + movne r0, #1 + moveq r0, #0 + tst r0, #0xff + bne _020545EC + add r0, r5, r1 + mov r2, r8, lsl #1 + add r1, sp, #0x2a + ldrh r1, [r1, r2] + bl GetInfoMoveGround + b _020545F8 +_020545EC: + add r7, r7, #1 +_020545F0: + cmp r7, #4 + blt _020545B0 +_020545F8: + cmp fp, #0 + beq _020546C0 + cmp r7, #4 + bne _020546C0 + mov r1, r8, lsl #1 + add r0, sp, #0x2a + mov r7, #0 + ldrh r1, [r0, r1] + mov r3, r7 +_0205461C: + mov r0, #6 + mul lr, r3, r0 + add ip, sl, lr + ldrb r0, [ip, #0x22] + tst r0, #1 + movne r0, #1 + moveq r0, #0 + tst r0, #0xff + beq _02054660 + add r2, r4, lr + ldrh r0, [ip, #0x22] + add r7, r7, #1 + strh r0, [r4, lr] + ldrh r0, [ip, #0x24] + strh r0, [r2, #2] + ldrh r0, [ip, #0x26] + strh r0, [r2, #4] +_02054660: + add r3, r3, #1 + cmp r3, #4 + blt _0205461C + mov r0, #6 + mla r0, r3, r0, r4 + bl GetInfoMoveGround + mov r0, r4 + add r1, r7, #1 + bl sub_02015090 + mov r1, #0 + b _020546B8 +_0205468C: + mov r0, #6 + mul r2, r1, r0 + add r0, sl, r2 + add r3, r4, r2 + ldrh r2, [r4, r2] + add r1, r1, #1 + strh r2, [r0, #0x22] + ldrh r2, [r3, #2] + strh r2, [r0, #0x24] + ldrh r2, [r3, #4] + strh r2, [r0, #0x26] +_020546B8: + cmp r1, r7 + blt _0205468C +_020546C0: + add r8, r8, #1 +_020546C4: + ldr r0, [sp, #8] + cmp r8, r0 + blt _0205454C +_020546D0: + add r6, r6, #1 +_020546D4: + cmp r6, sb + ble _02054500 +_020546DC: + add sp, sp, #0x4c + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_020546E4: .word 0x000003E7 + arm_func_end sub_020544C8 + + arm_func_start sub_020546E8 +sub_020546E8: ; 0x020546E8 + stmdb sp!, {r3, r4, lr} + sub sp, sp, #0xc + mov r4, r0 + ldrb r2, [r4, #1] + ldrsh r1, [r4, #4] + add r0, sp, #0 + add r2, r2, #1 + bl GetLvlUpEntry + ldrb r1, [r4, #1] + add r0, r4, #0xa + add r1, r1, #1 + strb r1, [r4, #1] + ldr r1, [sp] + str r1, [r4, #0x10] + ldrh r1, [sp, #4] + bl sub_02054FB8 + ldrb r1, [sp, #6] + add r0, r4, #0xc + bl sub_02054FEC + ldrb r1, [sp, #7] + add r0, r4, #0xd + bl sub_02054FEC + ldrb r1, [sp, #8] + add r0, r4, #0xe + bl sub_02055020 + ldrb r1, [sp, #9] + add r0, r4, #0xf + bl sub_02055020 + add sp, sp, #0xc + ldmia sp!, {r3, r4, pc} + arm_func_end sub_020546E8 + + arm_func_start GetMonsterGenderVeneer +GetMonsterGenderVeneer: ; 0x02054760 + ldr ip, _02054768 ; =GetMonsterGender + bx ip + .align 2, 0 +_02054768: .word GetMonsterGender + arm_func_end GetMonsterGenderVeneer + + arm_func_start IsMonsterValid +IsMonsterValid: ; 0x0205476C + stmdb sp!, {r3, lr} + cmp r0, #0 + ble _02054798 + ldr r1, _020547C0 ; =0x00000229 + cmp r0, r1 + blt _0205478C + cmp r0, #0x258 + ble _02054798 +_0205478C: + ldr r1, _020547C4 ; =0x00000481 + cmp r0, r1 + blt _020547A0 +_02054798: + mov r0, #0 + ldmia sp!, {r3, pc} +_020547A0: + cmp r0, #0x258 + blt _020547B8 + bl GetMonsterGender + cmp r0, #2 + movne r0, #0 + ldmneia sp!, {r3, pc} +_020547B8: + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_020547C0: .word 0x00000229 +_020547C4: .word 0x00000481 + arm_func_end IsMonsterValid + + arm_func_start sub_020547C8 +sub_020547C8: ; 0x020547C8 + mov r1, #0 + strh r1, [r0] + str r1, [r0, #4] + bx lr + arm_func_end sub_020547C8 + + arm_func_start sub_020547D8 +sub_020547D8: ; 0x020547D8 + stmdb sp!, {r4, lr} + mov r4, r0 + mov r0, #0 + strh r0, [r4] + ldr r0, [r4, #4] + cmp r0, #0 + ldmeqia sp!, {r4, pc} + bl MemFree + mov r0, #0 + str r0, [r4, #4] + ldmia sp!, {r4, pc} + arm_func_end sub_020547D8 + + arm_func_start sub_02054804 +sub_02054804: ; 0x02054804 + stmdb sp!, {r3, lr} + ldr r2, _02054820 ; =_020A3248 + mov r1, #0 + ldr r2, [r2, #4] + str r2, [sp] + blx r2 + ldmia sp!, {r3, pc} + .align 2, 0 +_02054820: .word _020A3248 + arm_func_end sub_02054804 + + arm_func_start sub_02054824 +sub_02054824: ; 0x02054824 + stmdb sp!, {r3, lr} + ldr r2, _02054840 ; =_020A3248 + mov r1, #1 + ldr r2, [r2] + str r2, [sp] + blx r2 + ldmia sp!, {r3, pc} + .align 2, 0 +_02054840: .word _020A3248 + arm_func_end sub_02054824 + + arm_func_start sub_02054844 +sub_02054844: ; 0x02054844 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0xd0 + mov r3, #0 + mov sb, r0 + mov r8, r1 + mov r6, r3 + add r2, sp, #0x80 +_02054860: + add r0, r3, #1 + mov r0, r0, lsl #0x10 + str r6, [r2, r3, lsl #3] + add r1, r2, r3, lsl #3 + mov r3, r0, asr #0x10 + str r6, [r1, #4] + cmp r3, #0xa + blt _02054860 + ldr fp, _02054A50 ; =TEAM_MEMBER_TABLE_PTR + mov r7, r6 + add r5, sp, #0x80 + mov r4, #1 +_02054890: + mov r0, r7 + bl IsValidTeamMember + cmp r0, #0 + beq _0205493C + cmp r8, #0 + beq _020548C4 + ldr r1, [fp] + mov r0, #0x44 + smlabb r0, r7, r0, r1 + ldrsh r0, [r0, #4] + bl IsShaymin + cmp r0, #0 + bne _0205493C +_020548C4: + ldr r2, [fp] + mov r0, #0x44 + smlabb r0, r7, r0, r2 + ldrsh r0, [r0, #4] + mov r1, #1 + bl GetKeyM2NSwitch + mov r1, r0, asr #5 + add r1, r0, r1, lsr #26 + mov lr, r1, asr #6 + mov r2, r0, lsr #0x1f + rsb r0, r2, r0, lsl #26 + add r0, r2, r0, ror #26 + mov r1, #0 + add r2, r5, lr, lsl #3 + mov r1, r1, lsl r0 + rsb sl, r0, #0x20 + orr r1, r1, r4, lsr sl + sub sl, r0, #0x20 + ldr ip, [r5, lr, lsl #3] + ldr r3, [r2, #4] + orr r1, r1, r4, lsl sl + orr r1, r3, r1 + orr r0, ip, r4, lsl r0 + stmia r2, {r0, r1} + ldr r0, [r5, lr, lsl #3] + cmp r3, r1 + cmpeq ip, r0 + addne r0, r6, #1 + movne r0, r0, lsl #0x10 + movne r6, r0, asr #0x10 +_0205493C: + add r0, r7, #1 + mov r1, r0, lsl #0x10 + ldr r0, _02054A54 ; =0x0000022B + mov r7, r1, asr #0x10 + cmp r0, r1, asr #16 + bgt _02054890 + strh r6, [sb] + mov r0, r6, lsl #1 + mov r1, #0 + bl MemAlloc + str r0, [sb, #4] + ldr r0, _02054A58 ; =_020A32F8 + bl Debug_Print0 + mov r8, #0 + mov sl, r8 + mov r7, #1 + mov r5, r8 + add fp, sp, #0x80 + mov r4, r8 + b _02054A40 +_0205498C: + mov r1, sl, lsr #0x1f + rsb r0, r1, sl, lsl #26 + add r2, r1, r0, ror #26 + mov r0, sl, asr #5 + add r0, sl, r0, lsr #26 + mov r1, r0, asr #6 + add r0, fp, r1, lsl #3 + ldr r1, [fp, r1, lsl #3] + mov r3, r5, lsl r2 + rsb ip, r2, #0x20 + and r1, r1, r7, lsl r2 + orr r3, r3, r7, lsr ip + sub r2, r2, #0x20 + ldr r0, [r0, #4] + orr r3, r3, r7, lsl r2 + and r2, r3, r0 + mov r0, #0 + cmp r2, r0 + cmpeq r1, r4 + beq _02054A34 + mov r0, sl + mov r1, r7 + bl GetKeyN2MSwitch + ldr r1, [sb, #4] + mov r2, r8, lsl #1 + strh r0, [r1, r2] + ldr r1, [sb, #4] + add r0, sp, #0 + ldrsh r1, [r1, r2] + bl GetNameRaw + ldr r3, [sb, #4] + mov r2, r8, lsl #1 + ldrsh r2, [r3, r2] + ldr r0, _02054A5C ; =_020A3330 + mov r1, r8 + add r3, sp, #0 + bl Debug_Print0 + add r0, r8, #1 + mov r0, r0, lsl #0x10 + cmp r6, r0, asr #16 + mov r8, r0, asr #0x10 + ble _02054A48 +_02054A34: + add r0, sl, #1 + mov r0, r0, lsl #0x10 + mov sl, r0, asr #0x10 +_02054A40: + cmp sl, #0x280 + blt _0205498C +_02054A48: + add sp, sp, #0xd0 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_02054A50: .word TEAM_MEMBER_TABLE_PTR +_02054A54: .word 0x0000022B +_02054A58: .word _020A32F8 +_02054A5C: .word _020A3330 + arm_func_end sub_02054844 + + arm_func_start SprintfStatic__02054A60 +SprintfStatic__02054A60: ; 0x02054A60 + stmdb sp!, {r0, r1, r2, r3} + stmdb sp!, {r3, lr} + add r2, sp, #0xc + bic r2, r2, #3 + ldr r1, [sp, #0xc] + add r2, r2, #4 + bl vsprintf + ldmia sp!, {r3, lr} + add sp, sp, #0x10 + bx lr + arm_func_end SprintfStatic__02054A60 + + arm_func_start IsUnown +IsUnown: ; 0x02054A88 + cmp r0, #0xc9 + blt _02054A9C + cmp r0, #0xe4 + movle r0, #1 + bxle lr +_02054A9C: + mov r0, #0 + bx lr + arm_func_end IsUnown + + arm_func_start IsShaymin +IsShaymin: ; 0x02054AA4 + ldr r1, _02054AD0 ; =0xFFFFFDEA + add r0, r0, r1 + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + cmp r0, #1 + movls r0, #1 + movhi r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_02054AD0: .word 0xFFFFFDEA + arm_func_end IsShaymin + + arm_func_start IsCastform +IsCastform: ; 0x02054AD4 + ldr r2, _02054B24 ; =0x0000017B + cmp r0, r2 + cmpne r0, #0x17c + addne r1, r2, #2 + cmpne r0, r1 + addne r1, r2, #3 + cmpne r0, r1 + beq _02054B14 + ldr r1, _02054B28 ; =0xFFFFFC2D + add r0, r0, r1 + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + cmp r0, #3 + bhi _02054B1C +_02054B14: + mov r0, #1 + bx lr +_02054B1C: + mov r0, #0 + bx lr + .align 2, 0 +_02054B24: .word 0x0000017B +_02054B28: .word 0xFFFFFC2D + arm_func_end IsCastform + + arm_func_start IsCherrim +IsCherrim: ; 0x02054B2C + cmp r0, #0x1cc + ldrne r1, _02054B6C ; =0x000001CD + cmpne r0, r1 + beq _02054B5C + ldr r1, _02054B70 ; =0xFFFFFBDC + add r0, r0, r1 + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + cmp r0, #1 + bhi _02054B64 +_02054B5C: + mov r0, #1 + bx lr +_02054B64: + mov r0, #0 + bx lr + .align 2, 0 +_02054B6C: .word 0x000001CD +_02054B70: .word 0xFFFFFBDC + arm_func_end IsCherrim + + arm_func_start IsDeoxys +IsDeoxys: ; 0x02054B74 + ldr r1, _02054BA0 ; =0xFFFFFE5E + add r0, r0, r1 + mov r0, r0, lsl #0x10 + mov r0, r0, asr #0x10 + mov r0, r0, lsl #0x10 + mov r0, r0, lsr #0x10 + cmp r0, #3 + movls r0, #1 + movhi r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_02054BA0: .word 0xFFFFFE5E + arm_func_end IsDeoxys + + arm_func_start GetSecondFormIfValid +GetSecondFormIfValid: ; 0x02054BA4 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + bl GetMonsterGender + cmp r0, #1 + bne _02054BD8 + add r4, r5, #0x258 + mov r0, r4, lsl #0x10 + mov r0, r0, asr #0x10 + bl GetMonsterGender + cmp r0, #2 + moveq r0, r4, lsl #0x10 + moveq r0, r0, asr #0x10 + ldmeqia sp!, {r3, r4, r5, pc} +_02054BD8: + mov r0, r5 + ldmia sp!, {r3, r4, r5, pc} + arm_func_end GetSecondFormIfValid diff --git a/asm/overlay_31.s b/asm/overlay_31_02382FBC.s similarity index 93% rename from asm/overlay_31.s rename to asm/overlay_31_02382FBC.s index 46db6276..b8daadbc 100644 --- a/asm/overlay_31.s +++ b/asm/overlay_31_02382FBC.s @@ -1,577 +1,10 @@ .include "asm/macros.inc" - .include "overlay_31.inc" + .include "overlay_31002382FBC.inc" .text - arm_func_start EntryOverlay31 -EntryOverlay31: ; 0x02382820 - stmdb sp!, {r3, lr} - ldr r0, _0238285C ; =DUNGEON_WINDOW_PARAMS_3 - bl sub_020348E4 - cmp r0, #0 - ldmeqia sp!, {r3, pc} - mov r0, #0x10 - mov r1, #8 - bl MemAlloc - ldr r1, _02382860 ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - mov r2, #0 - str r0, [r1] - str r2, [r0, #4] - mov r0, #0xa - str r0, [r1, #4] - ldmia sp!, {r3, pc} - .align 2, 0 -_0238285C: .word DUNGEON_WINDOW_PARAMS_3 -_02382860: .word OVERLAY31_UNKNOWN_POINTER__NA_238A260 - arm_func_end EntryOverlay31 - - arm_func_start DrawDungeonMenuStatusWindow -DrawDungeonMenuStatusWindow: ; 0x02382864 -#ifdef JAPAN -#define DRAW_DUNGEON_MENU_STATUS_WINDOW_OFFSET -4 -#else -#define DRAW_DUNGEON_MENU_STATUS_WINDOW_OFFSET 0 -#endif - stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} - sub sp, sp, #0x254 - mov sl, r0 - bl GetLeader - ldr r4, [r0, #0xb4] - sub r2, sp, #4 - add r0, r4, #0x100 - ldrh r1, [r0, #0x46 + DRAW_DUNGEON_MENU_STATUS_WINDOW_OFFSET] - strh r1, [r2] - ldrh r0, [r0, #0x48 + DRAW_DUNGEON_MENU_STATUS_WINDOW_OFFSET] - strh r0, [r2, #2] - ldr r0, [r2] - bl CeilFixedPoint - str r0, [sp, #0x228] - add r0, r4, #0x100 - ldrh r1, [r0, #0x4a + DRAW_DUNGEON_MENU_STATUS_WINDOW_OFFSET] - sub r2, sp, #4 - strh r1, [r2] - ldrh r0, [r0, #0x4c + DRAW_DUNGEON_MENU_STATUS_WINDOW_OFFSET] - strh r0, [r2, #2] - ldr r0, [r2] - bl CeilFixedPoint - str r0, [sp, #0x22c] - ldr r0, _02382AA0 ; =0x000008B2 - bl StringFromId - add r1, sp, #0x204 - mov r2, r0 - str r1, [sp] - add r0, sp, #0x104 - mov r1, #0x100 - mov r3, #0 - bl PreprocessString - mov r0, sl - mov r1, #0x73 - mov r2, #0 - add r3, sp, #0x104 - bl DrawTextInWindow - bl GetMoneyCarried - str r0, [sp, #0x228] - ldr r0, _02382AA4 ; =0x000008B5 - bl StringFromId - add r1, sp, #0x204 - mov r2, r0 - str r1, [sp] - add r0, sp, #0x104 - mov r1, #0x100 - mov r3, #0 - bl PreprocessString - mov r0, sl - mov r1, #0x73 - mov r2, #0xc - add r3, sp, #0x104 - bl DrawTextInWindow - mov r0, #0 - bl GetApparentWeather - str r0, [sp, #0x204] - ldr r0, _02382AA8 ; =0x000008B6 - bl StringFromId - add r1, sp, #0x204 - mov r2, r0 - str r1, [sp] - add r0, sp, #0x104 - mov r1, #0x100 - mov r3, #0 - bl PreprocessString - add r3, sp, #0x104 - mov r0, sl - mov r1, #0x73 - mov r2, #0x18 - bl DrawTextInWindow - bl sub_0204F9E0 - str r0, [sp, #0x228] - ldr r0, _02382AAC ; =0x000008B7 - bl StringFromId - add r1, sp, #0x204 - mov r2, r0 - str r1, [sp] - ldr r3, _02382AB0 ; =0x0000C402 - add r0, sp, #0x104 - mov r1, #0x100 - bl PreprocessString - mov r0, sl - mov r1, #0x73 - mov r2, #0x24 - add r3, sp, #0x104 - bl DrawTextInWindow - mov r7, #0 - mov r8, r7 - add r6, sp, #4 - ldr r5, _02382AB4 ; =0x000003E7 - add r4, sp, #0x204 - ldr fp, _02382AB8 ; =DUNGEON_PTR - b _02382A88 -_023829D8: - ldr r0, [fp] - add r0, r0, r8, lsl #2 - add r0, r0, #0x12000 -#ifdef JAPAN - ldr r1, [r0, #0xa84] -#else - ldr r1, [r0, #0xb28] -#endif - cmp r1, #0 - moveq r0, #0 - beq _02382A08 - ldr r0, [r1] - cmp r0, #0 - movne r0, #1 - moveq r0, #0 - and r0, r0, #0xff -_02382A08: - cmp r0, #0 - beq _02382A84 - ldr sb, [r1, #0xb4] - mov r0, r6 - mov r2, #0 - bl ov29_022E2A78 - str r6, [sp, #0x23c] - ldrsh r0, [sb, #0x10] - str r0, [sp, #0x228] - ldrsh r1, [sb, #0x12] - ldrsh r0, [sb, #0x16] - add r0, r1, r0 - cmp r0, r5 - movgt r0, r5 - str r0, [sp, #0x22c] - ldr r0, _02382ABC ; =0x000008B8 - bl StringFromId - mov r2, r0 - add r0, sp, #0x104 - mov r1, #0x100 - mov r3, #0 - str r4, [sp] - bl PreprocessString - mov r0, sl - mov r1, #4 - mov r2, r7 - add r3, sp, #0x104 - bl DrawTextInWindow - add r7, r7, #0xc - cmp r7, #0x30 - bge _02382A90 -_02382A84: - add r8, r8, #1 -_02382A88: - cmp r8, #4 - blt _023829D8 -_02382A90: - mov r0, sl - bl UpdateWindow - add sp, sp, #0x254 - ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc} - .align 2, 0 -#ifdef JAPAN -#define DRAW_DUNGEON_MENU_STATUS_WINDOW_DATA_OFFSET 0x1458 -#else -#define DRAW_DUNGEON_MENU_STATUS_WINDOW_DATA_OFFSET 0 -#endif -_02382AA0: .word 0x000008B2 + DRAW_DUNGEON_MENU_STATUS_WINDOW_DATA_OFFSET -_02382AA4: .word 0x000008B5 + DRAW_DUNGEON_MENU_STATUS_WINDOW_DATA_OFFSET -_02382AA8: .word 0x000008B6 + DRAW_DUNGEON_MENU_STATUS_WINDOW_DATA_OFFSET -_02382AAC: .word 0x000008B7 + DRAW_DUNGEON_MENU_STATUS_WINDOW_DATA_OFFSET -_02382AB0: .word 0x0000C402 -_02382AB4: .word 0x000003E7 -_02382AB8: .word DUNGEON_PTR -_02382ABC: .word 0x000008B8 + DRAW_DUNGEON_MENU_STATUS_WINDOW_DATA_OFFSET - arm_func_end DrawDungeonMenuStatusWindow - - arm_func_start DungeonMenuSwitch -DungeonMenuSwitch: ; 0x02382AC0 - stmdb sp!, {r3, r4, r5, r6, lr} - sub sp, sp, #0x54 - ldr r1, _02382B4C ; =DUNGEON_PTR - mov r4, r0 - ldr r1, [r1] - ldrb r0, [r1, #0x748] - orr r0, r0, #0x40000 - str r0, [sp, #0x14] - ldrb r0, [r1, #0x749] - str r0, [sp, #0x28] - bl sub_02025888 - add r5, sp, #4 - ldr r2, _02382B50 ; =ov31_02389E14 - mov r1, #0x400 - mov r3, #0 - mov r6, r0 - str r5, [sp] - bl PreprocessString - mov r0, r4 - bl GetWindow - mov r5, r0 - mov r0, r6 - bl sub_020265A8 - ldrb r1, [r5, #6] - mov r3, r6 - mov r2, #2 - rsb r0, r0, r1, lsl #3 - add r0, r0, r0, lsr #31 - mov r1, r0, asr #1 - mov r0, r4 - bl DrawTextInWindow - mov r0, r4 - bl UpdateWindow - add sp, sp, #0x54 - ldmia sp!, {r3, r4, r5, r6, pc} - .align 2, 0 -_02382B4C: .word DUNGEON_PTR -_02382B50: .word ov31_02389E14 - arm_func_end DungeonMenuSwitch - - arm_func_start ov31_02382B54 -ov31_02382B54: ; 0x02382B54 - stmdb sp!, {lr} - sub sp, sp, #0x9c - ldr r0, _02382D8C ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r2, [r0] - ldr r1, [r2, #4] - cmp r1, #3 - addls pc, pc, r1, lsl #2 - b _02382D80 -_02382B74: ; jump table - b _02382B84 ; case 0 - b _02382B90 ; case 1 - b _02382C6C ; case 2 - b _02382D58 ; case 3 -_02382B84: - add r0, r1, #1 - str r0, [r2, #4] - b _02382D80 -_02382B90: - mov r3, #0 - mov r2, r3 -_02382B98: - ldr r1, [r0] - add r1, r1, r3 - add r3, r3, #1 - strb r2, [r1, #8] - cmp r3, #7 - blt _02382B98 - bl GetLeader - mov r1, #1 - bl ShouldMonsterRunAwayVariation - cmp r0, #0 - beq _02382BEC - ldr r0, _02382D8C ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - mov r2, #3 - ldr r1, [r0] - strb r2, [r1, #8] - ldr r1, [r0] - strb r2, [r1, #9] - ldr r1, [r0] - strb r2, [r1, #0xa] - ldr r0, [r0] - strb r2, [r0, #0xc] -_02382BEC: - ldr r1, _02382D8C ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - mov r0, #5 - ldr r1, [r1] - add r1, r1, #8 - str r1, [sp, #0x64] - bl Arm9LoadUnkFieldNa0x2029EC8 - str r0, [sp, #4] - ldr r0, _02382D90 ; =DUNGEON_WINDOW_PARAMS_1 - ldr r1, _02382D94 ; =0x00000233 - ldr r3, _02382D98 ; =DUNGEON_MAIN_MENU_ITEMS - add r2, sp, #4 - bl CreateParentMenuFromStringIds - ldr r2, _02382D8C ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r1, _02382D9C ; =DrawDungeonMenuStatusWindow - ldr r2, [r2] - strb r0, [r2] - ldr r0, _02382DA0 ; =DUNGEON_WINDOW_PARAMS_4 - bl CreateTextBox - ldr r2, _02382D8C ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r1, _02382DA4 ; =DungeonMenuSwitch - ldr r2, [r2] - strb r0, [r2, #2] - ldr r0, _02382DA8 ; =DUNGEON_WINDOW_PARAMS_2 - bl CreateTextBox - ldr r1, _02382D8C ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r2, [r1] - strb r0, [r2, #1] - ldr r1, [r1] - ldr r0, [r1, #4] - add r0, r0, #1 - str r0, [r1, #4] - b _02382D80 -_02382C6C: - ldrsb r0, [r2] - bl IsParentMenuActive - cmp r0, #0 - beq _02382D20 - ldr r0, _02382D8C ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r0, [r0] - ldrsb r0, [r0] - bl sub_0202AB80 - and r1, r0, #0xff - mov r0, #5 - bl Arm9StoreUnkFieldNa0x2029ED8 - add r1, sp, #0 - mov r0, #0 - bl GetPressedButtons - ldrh r0, [sp] - tst r0, #0x400 - beq _02382D80 - bl GetLeader - mov r1, #1 - bl ShouldMonsterRunAwayVariation - cmp r0, #0 - bne _02382D80 - ldr r0, _02382D8C ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - mov r1, #0 - ldr r0, [r0] - ldrsb r0, [r0] - bl sub_0202AB94 - ldr r0, _02382D8C ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r0, [r0] - ldrsb r0, [r0] - bl sub_0202B030 - ldr r0, _02382D8C ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r0, [r0] - ldrsb r0, [r0, #1] - bl sub_0202F954 - ldr r0, _02382D8C ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r0, [r0] - ldrsb r0, [r0, #2] - bl sub_0202F954 - ldr r0, _02382D8C ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r1, [r0] - ldr r0, [r1, #4] - add r0, r0, #1 - str r0, [r1, #4] - b _02382D80 -_02382D20: - ldr r0, _02382D8C ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r0, [r0] - ldrsb r0, [r0, #1] - bl sub_0202F954 - ldr r0, _02382D8C ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r0, [r0] - ldrsb r0, [r0, #2] - bl sub_0202F954 - ldr r0, _02382D8C ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r1, [r0] - ldr r0, [r1, #4] - add r0, r0, #1 - str r0, [r1, #4] - b _02382D80 -_02382D58: - ldrsb r0, [r2] - bl sub_0202ABB0 - ldr r1, _02382D8C ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - str r0, [r1, #4] - ldr r2, [r1] - mov r0, #4 - ldr r1, [r2, #4] - add r1, r1, #1 - str r1, [r2, #4] - b _02382D84 -_02382D80: - mov r0, #1 -_02382D84: - add sp, sp, #0x9c - ldmia sp!, {pc} - .align 2, 0 -_02382D8C: .word OVERLAY31_UNKNOWN_POINTER__NA_238A260 -_02382D90: .word DUNGEON_WINDOW_PARAMS_1 -_02382D94: .word 0x00000233 -_02382D98: .word DUNGEON_MAIN_MENU_ITEMS -_02382D9C: .word DrawDungeonMenuStatusWindow -_02382DA0: .word DUNGEON_WINDOW_PARAMS_4 -_02382DA4: .word DungeonMenuSwitch -_02382DA8: .word DUNGEON_WINDOW_PARAMS_2 - arm_func_end ov31_02382B54 - - arm_func_start ov31_02382DAC -ov31_02382DAC: ; 0x02382DAC - stmdb sp!, {r3, lr} - ldr r0, _02382E04 ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r0, [r0] - cmp r0, #0 - ldmeqia sp!, {r3, pc} - ldrsb r0, [r0, #1] - bl CloseTextBox - ldr r0, _02382E04 ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r0, [r0] - ldrsb r0, [r0, #2] - bl CloseTextBox - ldr r0, _02382E04 ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r0, [r0] - ldrsb r0, [r0] - bl CloseParentMenu - ldr r0, _02382E04 ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r0, [r0] - bl MemFree - ldr r0, _02382E04 ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - mov r1, #0 - str r1, [r0] - ldmia sp!, {r3, pc} - .align 2, 0 -_02382E04: .word OVERLAY31_UNKNOWN_POINTER__NA_238A260 - arm_func_end ov31_02382DAC - - arm_func_start ov31_02382E08 -ov31_02382E08: ; 0x02382E08 - ldr r0, _02382E14 ; =OVERLAY31_UNKNOWN_POINTER__NA_238A260 - ldr r0, [r0, #4] - bx lr - .align 2, 0 -_02382E14: .word OVERLAY31_UNKNOWN_POINTER__NA_238A260 - arm_func_end ov31_02382E08 - - arm_func_start ov31_02382E18 -ov31_02382E18: ; 0x02382E18 - stmdb sp!, {r4, r5, r6, r7, r8, lr} - mov r4, r0 - mov r8, r1 - mov r0, #6 - mov r1, #0 - bl ov29_022EA428 - mov r0, #0x62 - bl AdvanceFrame - mov r0, #0x62 - bl AdvanceFrame - mov r0, r4 - bl CreateStairsMenuState - mov r5, #0 - mov r6, #1 - mov r7, #0x62 - ldr r4, _02382ED0 ; =ov31_0238A2A0 - b _02382E64 -_02382E5C: - mov r0, r7 - bl AdvanceFrame -_02382E64: - ldr r0, [r4, #4] - cmp r0, #0 - movne r0, r6 - moveq r0, r5 - tst r0, #0xff - bne _02382E5C - mov r0, #0x62 - bl AdvanceFrame - bl ov29_022F0B9C - cmp r0, #0 - beq _02382EA0 - mov r0, #0xb - mov r1, #0 - bl ov29_022EA428 - b _02382EC4 -_02382EA0: - cmp r8, #0 - beq _02382EB8 - mov r0, #0xb - mov r1, #0 - bl ov29_022EA428 - b _02382EC4 -_02382EB8: - mov r0, #0 - mov r1, r0 - bl ov29_022EA428 -_02382EC4: - mov r0, #1 - bl ov29_022E0C2C - ldmia sp!, {r4, r5, r6, r7, r8, pc} - .align 2, 0 -_02382ED0: .word ov31_0238A2A0 - arm_func_end ov31_02382E18 - - arm_func_start CreateStairsMenuState -CreateStairsMenuState: ; 0x02382ED4 - stmdb sp!, {r3, r4, r5, lr} - mov r5, r0 - ldr r0, _02382F60 ; =OVERLAY31_UNKNOWN_STRUCT__NA_2389E30 - bl sub_020348E4 - cmp r0, #0 - ldmeqia sp!, {r3, r4, r5, pc} - mov r0, #0x18 - mov r1, #8 - bl MemAlloc - ldr r1, _02382F64 ; =ov31_0238A2A0 - mov r2, #0 - str r0, [r1, #4] - str r2, [r0, #4] - ldr r0, [r1, #4] - str r5, [r0, #8] - ldr r0, [r1, #4] - str r2, [r0, #0xc] - ldr r0, [r1, #4] - str r2, [r0, #0x10] - bl GetFloorType - mov r4, #0 - cmp r0, #2 - moveq r4, #2 - beq _02382F50 - cmp r0, #1 - moveq r4, #1 - beq _02382F50 - add r0, r5, #4 - bl PositionIsOnHiddenStairs - cmp r0, #0 - movne r4, #3 -_02382F50: - ldr r0, _02382F64 ; =ov31_0238A2A0 - ldr r0, [r0, #4] - str r4, [r0, #0x14] - ldmia sp!, {r3, r4, r5, pc} - .align 2, 0 -_02382F60: .word OVERLAY31_UNKNOWN_STRUCT__NA_2389E30 -_02382F64: .word ov31_0238A2A0 - arm_func_end CreateStairsMenuState - - arm_func_start StairsSubheadingCallback -StairsSubheadingCallback: ; 0x02382F68 - stmdb sp!, {r4, lr} - ldr r1, _02382FB4 ; =ov31_0238A2A0 - ldr r2, _02382FB8 ; =ov31_02389E22 - ldr r1, [r1, #4] - mov r4, r0 - ldr r0, [r1, #0x14] - mov r0, r0, lsl #2 - ldrh r0, [r2, r0] - bl StringFromId - mov r3, r0 - ldr ip, _02382FB4 ; =ov31_0238A2A0 - mov r0, r4 - mov r1, #0x10 - mov r2, #0x12 - str r3, [ip] - bl DrawTextInWindow - mov r0, r4 - bl UpdateWindow - ldmia sp!, {r4, pc} - .align 2, 0 -_02382FB4: .word ov31_0238A2A0 -_02382FB8: .word ov31_02389E22 - arm_func_end StairsSubheadingCallback - - arm_func_start HandleStairsMenu -HandleStairsMenu: ; 0x02382FBC + arm_func_start ov31_02382FBC +ov31_02382FBC: ; 0x02382FBC stmdb sp!, {r4, lr} sub sp, sp, #0x138 ldr r0, _02383218 ; =ov31_0238A2A0 @@ -9490,8 +8923,8 @@ DUNGEON_MAIN_MENU_ITEMS: .byte 0x05, 0x00, 0x00, 0x00 .word 0x8B4 + OV31_DATA_OFFSET .byte 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF - .global ov31_02389E14 -ov31_02389E14: + .global DUNGEON_MENU_SWITCH_STR1 +DUNGEON_MENU_SWITCH_STR1: .byte 0x5B, 0x64, 0x75, 0x6E, 0x67, 0x65, 0x6F, 0x6E, 0x3A, 0x30, 0x5D, 0x00 .global OVERLAY31_UNKNOWN_STRING_IDS OVERLAY31_UNKNOWN_STRING_IDS: diff --git a/common.mk b/common.mk index d199d91a..25b2f8c2 100644 --- a/common.mk +++ b/common.mk @@ -118,7 +118,7 @@ XMAP := $(NEF).xMAP EXCCFLAGS := -Cpp_exceptions off -MWCFLAGS = $(DEFINES) -enum int -lang c99 $(EXCCFLAGS) -gccext,on -proc $(PROC) -msgstyle gcc -gccinc -i ./include -i ./include/library -i $(WORK_DIR)/files -I$(WORK_DIR)/lib/include -interworking -inline on,noauto -char signed -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error +MWCFLAGS = $(DEFINES) -enum min -lang c99 $(EXCCFLAGS) -gccext,on -proc $(PROC) -msgstyle gcc -gccinc -i ./include -i ./include/library -i $(WORK_DIR)/files -I$(WORK_DIR)/lib/include -interworking -inline on,noauto -char signed -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error MWASFLAGS = $(DEFINES) -proc $(PROC_S) -gccinc -i . -i ./include -i $(WORK_DIR)/asm/include -i $(WORK_DIR)/files -i $(WORK_DIR)/lib/asm/include -i $(WORK_DIR)/lib/syscall/asm/include -I$(WORK_DIR)/lib/include -DSDK_ASM MWLDFLAGS := -proc $(PROC) -nopic -nopid -interworking -map closure,unused -symtab sort -m _start -msgstyle gcc diff --git a/include/dungeon.h b/include/dungeon.h new file mode 100644 index 00000000..8179d9ca --- /dev/null +++ b/include/dungeon.h @@ -0,0 +1,1743 @@ +#ifndef HEADERS_TYPES_DUNGEON_MODE_DUNGEON_H_ +#define HEADERS_TYPES_DUNGEON_MODE_DUNGEON_H_ + +#include "enums.h" + +// Dungeon state +struct dungeon { + undefined field_0x0; // 0x0: Initialized to 0x0. + // 0x1: Set to true with mission_destination_info::target_enemy_is_defeated. Used to ensure + // the mission complete message only shows once (ie: "Yes! Knocked out challenger + // [string:1]!". Set to false after the message is shown. + bool target_enemy_defeated_message; + // 0x2: Set to true when the hidden outlaw mission item is dropped. Appears to be used to check + // if the message "Huh?[K] [item:] was dropped![P]Yes![K][string:1] was the outlaw!" should + // be shown when target_enemy_defeated_message is true. + bool hidden_outlaw_defeated_message; + // 0x3: If true and there's an active mission on the floor, the message + // "You've reached a destination floor! But where is the target pokémon..." will be displayed. + bool target_monster_not_found_flag; + undefined field_0x4; + bool stepped_on_stairs; // 0x5: True if the leader just stepped on the stairs. + // 0x6: If equal to 1 or 2, the floor will be advanced at the end of the turn, + // unless the leader fainted. 2 is used for the leader falling through a pitfall + // trap. + u8 end_floor_flag; + // 0x7: If set in tandem with either end_floor_flag or end_floor_no_death_check_flag, + // a quicksave will occur instead of a floor advance. + bool quicksave_flag; + // 0x8: The floor will be advanced at the end of the turn. Set when quicksaving. + bool end_floor_no_death_check_flag; + // 0x9: If this is 0x0 (maybe false), appears to not initialize certain parts of the dungeon. + // Possibly a boolean for when loading from a quicksave or resuming after being rescued? + undefined field_0x9; + undefined field_0xa; + undefined field_0xb; + undefined field_0xc; // 0xC: Initialized to 0x0 + undefined field_0xd; // 0xD: Initialized to 0x0 + // 0xE: If true, artificial weather abilities will be activated on this turn. + // Set to false by TryActivateArtificialWeatherAbilities + bool activate_artificial_weather_flag; + // 0xF: True if an enemy has defeated an ally on this turn and should evolve as a result + // May also have a niche usage if an enemy gets enough experience to level up through + // something like the Joy Ribbon? + bool should_enemy_evolve; + undefined field_0x10; // 0x10: Initialized to 0x0. + // 0x11: True if the leader isn't doing anything right now. False if it's currently performing + // an action (such as walking or attacking) + bool no_action_in_progress; + bool iq_disabled; // 0x12: IQ skills won't work in the dungeon. + bool regular_attack_reveal_traps; // 0x13: Regular attacks will reveal traps. + // 0x14: If > 0, you get kicked out of the dungeon, usually because an important team member + // (such as your client) fainted. + enum forced_loss_reason forced_loss_reason; + // 0x18: Appears to be set to 1 when using the escape orb and set to 2 when completing + // a mission. dungeon::end_floor_no_death_check_flag gets set whenever this is changed. + u32 successful_exit_tracker; + // 0x1C: Increased once per frame until 0x64. Resets to 0 when the leader acts. + undefined field_0x1c; + undefined field_0x1d; + // 0x1E: Number of floors completed? (Guess). Initialized to 0. + // If this is a floor tracker, odd it is not a u16 like the others. + u8 number_completed_floors; + // 0x1F: Turn counter, Speed Boost triggers every 250 turns, then the counter is reset. + u8 speed_boost_counter; + // 0x20: Total amount of floors summed by all the previous dungeons in its group + u16 number_preceding_floors; + // 0x22: Total amount of floors passed including those in its group? (Guess) + // Set to dungeon::number_preceding_floors + dungeon::number_completed_floors + u16 total_floors_completed; + undefined field_0x24; + undefined field_0x25; + undefined field_0x26; + undefined field_0x27; + undefined field_0x28; + undefined field_0x29; + undefined field_0x2a; + undefined field_0x2b; + undefined field_0x2c; + undefined field_0x2d; + undefined field_0x2e; + undefined field_0x2f; + undefined field_0x30; + undefined field_0x31; + undefined field_0x32; + undefined field_0x33; + undefined field_0x34; + undefined field_0x35; + undefined field_0x36; + undefined field_0x37; + undefined field_0x38; + undefined field_0x39; + undefined field_0x3a; + undefined field_0x3b; + undefined field_0x3c; + undefined field_0x3d; + undefined field_0x3e; + undefined field_0x3f; + undefined field_0x40; + undefined field_0x41; + undefined field_0x42; + undefined field_0x43; + undefined field_0x44; + undefined field_0x45; + undefined field_0x46; + undefined field_0x47; + undefined field_0x48; + undefined field_0x49; + undefined field_0x4a; + undefined field_0x4b; + undefined field_0x4c; + undefined field_0x4d; + undefined field_0x4e; + undefined field_0x4f; + undefined field_0x50; + undefined field_0x51; + undefined field_0x52; + undefined field_0x53; + undefined field_0x54; + undefined field_0x55; + undefined field_0x56; + undefined field_0x57; + undefined field_0x58; + undefined field_0x59; + undefined field_0x5a; + undefined field_0x5b; + undefined field_0x5c; + undefined field_0x5d; + undefined field_0x5e; + undefined field_0x5f; + undefined field_0x60; + undefined field_0x61; + undefined field_0x62; + undefined field_0x63; + undefined field_0x64; + undefined field_0x65; + undefined field_0x66; + undefined field_0x67; + undefined field_0x68; + undefined field_0x69; + undefined field_0x6a; + undefined field_0x6b; + undefined field_0x6c; + undefined field_0x6d; + undefined field_0x6e; + undefined field_0x6f; + undefined field_0x70; + undefined field_0x71; + undefined field_0x72; + undefined field_0x73; + undefined field_0x74; + undefined field_0x75; + undefined field_0x76; + undefined field_0x77; + undefined field_0x78; + undefined field_0x79; + undefined field_0x7a; + undefined field_0x7b; + undefined field_0x7c; + undefined field_0x7d; + undefined field_0x7e; + undefined field_0x7f; + undefined field_0x80; + undefined field_0x81; + undefined field_0x82; + undefined field_0x83; + undefined field_0x84; + undefined field_0x85; + undefined field_0x86; + undefined field_0x87; + undefined field_0x88; + undefined field_0x89; + undefined field_0x8a; + undefined field_0x8b; + undefined field_0x8c; + undefined field_0x8d; + undefined field_0x8e; + undefined field_0x8f; + undefined field_0x90; + undefined field_0x91; + undefined field_0x92; + undefined field_0x93; + undefined field_0x94; + undefined field_0x95; + undefined field_0x96; + undefined field_0x97; + undefined field_0x98; + undefined field_0x99; + undefined field_0x9a; + undefined field_0x9b; + undefined field_0x9c; + undefined field_0x9d; + undefined field_0x9e; + undefined field_0x9f; + undefined field_0xa0; + undefined field_0xa1; + undefined field_0xa2; + undefined field_0xa3; + undefined field_0xa4; + undefined field_0xa5; + undefined field_0xa6; + undefined field_0xa7; + undefined field_0xa8; + undefined field_0xa9; + undefined field_0xaa; + undefined field_0xab; + undefined field_0xac; + undefined field_0xad; + undefined field_0xae; + undefined field_0xaf; + undefined field_0xb0; + undefined field_0xb1; + undefined field_0xb2; + undefined field_0xb3; + undefined field_0xb4; + undefined field_0xb5; + undefined field_0xb6; + undefined field_0xb7; + undefined field_0xb8; + undefined field_0xb9; + undefined field_0xba; + undefined field_0xbb; + undefined field_0xbc; + undefined field_0xbd; + undefined field_0xbe; + undefined field_0xbf; + undefined field_0xc0; + undefined field_0xc1; + undefined field_0xc2; + undefined field_0xc3; + // 0xC4: Pointer to the entity that is taking its turn right now + struct entity* current_active_entity; + // 0xC8: Pointer to the monster that will become the leader of the team after changing leaders + struct entity* new_leader; + // 0xCC: Entity struct of the item that was just thrown or dropped + struct entity thrown_item; + // 0x184: Info about the most recent damage calculation. Reset with each call to CalcDamage + struct damage_calc_diag last_damage_calc; + // 0x1D8: Somehow related to executing a monster's actions (including leader). + // Initialized to 0xFFFF + undefined2 field_0x1d8; + // 0x1DA: Somehow related to executing the leader's actions. Also maybe when leader opens + // some menus? Initialized to 0xFFFF + undefined2 field_0x1da; + undefined2 field_0x1dc; // 0x1DC: Initialized to 0xFFFF + undefined2 field_0x1de; // 0x1DE: Initialized to 0xFFFF + // 0x1E0: Color table. Used to apply a tint to the colors shown on screen. + // Changes depending on the current weather. + struct rgba color_table[256]; + // 0x5E0: Data for Kecleon shopkeeper spawns. It's weird that there's room for more than one; + // it seems like only the first entry should ever be filled + struct spawned_shopkeeper_data shopkeeper_spawns[8]; + // 0x610: Number of valid shopkeeper spawns + int shopkeeper_spawn_count; + undefined4 field_0x614; + // 0x618: Something related to animiations? Could be ID? + undefined4 unk1_animation1_value; + undefined4 unk2_animation1_value; + undefined4 unk3_animation1_value; + struct entity* animation1_entity; // 0x624: Monster pointer for the animation? + // 0x628: Something related to animiations? Could be ID? + undefined4 unk1_animation2_value; + undefined4 unk2_animation2_value; + undefined4 unk3_animation2_value; + struct entity* animation2_entity; // 0x634: Monster pointer for the animation? + // 0x638: Something related to animiations? Could be ID? + undefined4 unk1_animation3_value; + undefined4 unk2_animation3_value; + undefined4 unk3_animation3_value; + struct entity* animation3_entity; // 0x644: Monster pointer for the animation? + // 0x648: Some type of monster name related to fainting. Used for the partner, escort or + // accompanying monster, but may be be changed when any monster faints (but might not be + // used for them). + char unk_fainted_monster_name[10]; + undefined field_0x652; + undefined field_0x653; + undefined field_0x654; + undefined field_0x655; + undefined field_0x656; + undefined field_0x657; + undefined field_0x658; + undefined field_0x659; + undefined field_0x65a; + undefined field_0x65b; + undefined field_0x65c; + undefined field_0x65d; + undefined field_0x65e; + undefined field_0x65f; + undefined field_0x660; + undefined field_0x661; + undefined field_0x662; + undefined field_0x663; + undefined field_0x664; + undefined field_0x665; + undefined field_0x666; + undefined field_0x667; + undefined field_0x668; + undefined field_0x669; + undefined field_0x66a; + undefined field_0x66b; + undefined field_0x66c; + undefined field_0x66d; + undefined field_0x66e; + undefined field_0x66f; + undefined field_0x670; + undefined field_0x671; + undefined field_0x672; + undefined field_0x673; + undefined field_0x674; + undefined field_0x675; + undefined field_0x676; + undefined field_0x677; + undefined field_0x678; + undefined field_0x679; + undefined field_0x67a; + undefined field_0x67b; + undefined field_0x67c; + undefined field_0x67d; + undefined field_0x67e; + undefined field_0x67f; + undefined field_0x680; + undefined field_0x681; + undefined field_0x682; + undefined field_0x683; + undefined field_0x684; + undefined field_0x685; + undefined field_0x686; + undefined field_0x687; + undefined field_0x688; + undefined field_0x689; + undefined field_0x68a; + undefined field_0x68b; + undefined field_0x68c; + undefined field_0x68d; + undefined field_0x68e; + undefined field_0x68f; + undefined field_0x690; + undefined field_0x691; + undefined field_0x692; + undefined field_0x693; + undefined field_0x694; + undefined field_0x695; + undefined field_0x696; + undefined field_0x697; + undefined field_0x698; + undefined field_0x699; + undefined field_0x69a; + undefined field_0x69b; + undefined field_0x69c; + undefined field_0x69d; + undefined field_0x69e; + undefined field_0x69f; + undefined field_0x6a0; + undefined field_0x6a1; + undefined field_0x6a2; + undefined field_0x6a3; + undefined field_0x6a4; + undefined field_0x6a5; + undefined field_0x6a6; + undefined field_0x6a7; + undefined field_0x6a8; + undefined field_0x6a9; + undefined field_0x6aa; + undefined field_0x6ab; + undefined field_0x6ac; + undefined field_0x6ad; + undefined field_0x6ae; + undefined field_0x6af; + undefined field_0x6b0; + undefined field_0x6b1; + undefined field_0x6b2; + undefined field_0x6b3; + undefined field_0x6b4; + undefined field_0x6b5; + undefined field_0x6b6; + undefined field_0x6b7; + undefined field_0x6b8; + undefined field_0x6b9; + undefined field_0x6ba; + undefined field_0x6bb; + undefined field_0x6bc; + undefined field_0x6bd; + undefined field_0x6be; + undefined field_0x6bf; + undefined field_0x6c0; + undefined field_0x6c1; + undefined field_0x6c2; + undefined field_0x6c3; + undefined field_0x6c4; + undefined field_0x6c5; + undefined field_0x6c6; + undefined field_0x6c7; + undefined field_0x6c8; + undefined field_0x6c9; + undefined field_0x6ca; + undefined field_0x6cb; + undefined field_0x6cc; + undefined field_0x6cd; + undefined field_0x6ce; + undefined field_0x6cf; + undefined field_0x6d0; + undefined field_0x6d1; + undefined field_0x6d2; + undefined field_0x6d3; + undefined field_0x6d4; + undefined field_0x6d5; + undefined field_0x6d6; + undefined field_0x6d7; + undefined field_0x6d8; + undefined field_0x6d9; + undefined field_0x6da; + undefined field_0x6db; + undefined field_0x6dc; + undefined field_0x6dd; + undefined field_0x6de; + undefined field_0x6df; + undefined field_0x6e0; + undefined field_0x6e1; + undefined field_0x6e2; + undefined field_0x6e3; + undefined field_0x6e4; + undefined field_0x6e5; + undefined field_0x6e6; + undefined field_0x6e7; + undefined field_0x6e8; + undefined field_0x6e9; + undefined field_0x6ea; + undefined field_0x6eb; + undefined field_0x6ec; + undefined field_0x6ed; + undefined field_0x6ee; + undefined field_0x6ef; + undefined field_0x6f0; + undefined field_0x6f1; + undefined field_0x6f2; + undefined field_0x6f3; + undefined field_0x6f4; + undefined field_0x6f5; + undefined field_0x6f6; + undefined field_0x6f7; + undefined field_0x6f8; + undefined field_0x6f9; + undefined field_0x6fa; + undefined field_0x6fb; + undefined field_0x6fc; + undefined field_0x6fd; + undefined field_0x6fe; + undefined field_0x6ff; + undefined field_0x700; + undefined field_0x701; + undefined field_0x702; + undefined field_0x703; + undefined field_0x704; + undefined field_0x705; + undefined field_0x706; + undefined field_0x707; + undefined field_0x708; + undefined field_0x709; + undefined field_0x70a; + undefined field_0x70b; + undefined field_0x70c; + undefined field_0x70d; + undefined field_0x70e; + undefined field_0x70f; + undefined field_0x710; + undefined field_0x711; + undefined field_0x712; + undefined field_0x713; + undefined field_0x714; + undefined field_0x715; + undefined field_0x716; + undefined field_0x717; + undefined field_0x718; + undefined field_0x719; + undefined field_0x71a; + undefined field_0x71b; + undefined field_0x71c; + undefined field_0x71d; + undefined field_0x71e; + undefined field_0x71f; + undefined field_0x720; + undefined field_0x721; + undefined field_0x722; + undefined field_0x723; + undefined field_0x724; + undefined field_0x725; + undefined field_0x726; + undefined field_0x727; + undefined field_0x728; + undefined field_0x729; + undefined field_0x72a; + undefined field_0x72b; + undefined field_0x72c; + undefined field_0x72d; + undefined field_0x72e; + undefined field_0x72f; + undefined field_0x730; + undefined field_0x731; + undefined field_0x732; + undefined field_0x733; + undefined field_0x734; + undefined field_0x735; + undefined field_0x736; + undefined field_0x737; + undefined field_0x738; + undefined field_0x739; + undefined field_0x73a; + undefined field_0x73b; + undefined field_0x73c; + undefined field_0x73d; + undefined field_0x73e; + undefined field_0x73f; + undefined field_0x740; + undefined field_0x741; + undefined field_0x742; + undefined field_0x743; + undefined field_0x744; + undefined field_0x745; + undefined field_0x746; + undefined field_0x747; + // 0x748: Current dungeon ID. Is actually a dungeon_floor_pair struct that also contains + // the floor number. + enum dungeon_id id; + u8 floor; // 0x749: Current floor number + enum dungeon_group_id group_id; // 0x74A: Same for different segments of a dungeon + undefined field_0x74b; + // 0x74C: Used as an input to GetDungeonMode, and uses output to determine if the + // override fixed room should be loaded? + undefined2 field_0x74c; + undefined field_0x74e; + undefined field_0x74f; + // 0x750: A ldr instruction is used at this address? Maybe used for something else before + // the rescue floor number is set? + undefined field_0x750; + u8 rescue_floor; // 0x751: Floor number where the rescue point is, if applicable + undefined field_0x752; + undefined field_0x753; + // 0x754: Should also be prng_pressed_23_bit? dungeon_init::prng_preseed_23_bit gets copied + // here, but might not be used? + u32 prng_preseed_23_bit; + // 0x758: Whether the current floor should continue or end and why + enum floor_loop_status floor_loop_status; + bool recruiting_enabled; // 0x759: Recruitment is allowed in this dungeon + // 0x75A: If this is 0, the game wont use GetMonsterEvoStatus when gathering information for + // the monster's summary (in stuff like the team menu). + undefined field_0x75a; + // 0x75B: When the dungeon is initialized this value gets forced to true. Likely because this + // effect seems incomplete. When false the game will stop items from being added to the bag + // but monsters are still alloweed to hold onto items normally. However, it does not seem to + // properly add items picked up by team members to the treasure bag (making it impossible to + // remove through the item menu). Additionally, items already in the bag can be used normally? + bool bag_enabled; + bool nonstory_flag; // 0x75C: Allows leader changing and continuing without the partner + bool send_home_disabled; // 0x75D: Sending teammates home is not allowed in this dungeon + // 0x75E: Disables sending home/leader changing, lose if partner faints. Set for dungeons + // between DUNGEON_HIDDEN_LAND and DUNGEON_TEMPORAL_PINNACLE. + bool hidden_land_flag; + // 0x75F: If true, the message log won't be shown and the yellow beam animation won't + // appear over team members after the leader faints. It's enabled for dungeons where you don't + // get penalized for fainting, but it's not used to perform that check. + bool skip_faint_animation_flag; + // 0x760: Info about the next mission destination floor, if applicable + struct mission_destination_info mission_destination; + undefined field_0x77c; + undefined field_0x77d; + // 0x77E: Appears to track if the player has already been healed by Mime Jr. to change + // the dialogue. Initialized to 0 using MemZero? + bool bazaar_mime_jr_heal; + undefined field_0x77f; + // 0x780: Controls when a monster at a certain speed stage is able to act. + // Increased by 1-4 each turn, depending on the team leader's speed level: + // At normal speed, this will tick up by 4 each turn (can act when x % 4 == 3) + // At +1 speed, ticks up by 2 each turn (can act when x % 2 == 1) + // At +2 speed, ticks up by 1 or 2 each turn (can act when x % 4 != 0) + // At +3 speed, ticks up by 1 each turn (an act every tick) + // The counter is increased modulo 24, goes from 0x00 to 0x17 then starts over + u16 fractional_turn; + u16 enemy_spawn_counter; // 0x782: Counts from 0-35, spawns happen at 0 + s16 wind_turns; // 0x784: Countdown to the wind blowing you out of the dungeon + u16 enemy_density; // 0x786: If 0, prevents the enemy_spawn_counter for increasing + // 0x788: The genid of the next monster to be spawned. Ticks up with each spawn. + u16 next_spawn_genid; + undefined field_0x78a; // 0x78A: Initialized to 0x0. + // 0x78B: True if the leader is running. Causes the leader's action for the next turn + // to be set to action::ACTION_WALK until it hits an obstacle. + bool leader_running; + // 0x78C: Likely related to the actions of the leader because it is set to 0 in + // SetLeaderAction and this value gets bitwise or'd with 0x78B and then saved back to here. + undefined field_0x78c; + // 0x78D: This flag is set by the move 0x189 ("HP Gauge") which is the + // effect of the Identify Orb. If true, monsters not in the team that are + // holding an item will be marked by a blue exclamation mark icon. + bool identify_orb_flag; + bool pass_turn; // 0x78E: True if the leader has chosen to pass its turn + bool drought_orb_flag; // 0x78F: True if a drought orb has been used. + bool thief_alert; // 0x790: If you've stolen from Kecleon (actual dungeon state) + // 0x791: If you've stolen from Kecleon (triggers music and other events?) + bool thief_alert_event; + // 0x792: Can only be 0,1,2,3,4. Controls when to play certain special music tracks 0x7C + // (1), 0x7D (2), 0xA8 (3), 0xA9 (4). Used by the Gone Pebbble to play track 0xA8, + // challenge letter missions to play track 0x7C and dungeon failure to play 0xA9? + u8 unk_music_flag; + bool monster_house_triggered; // 0x793: You Entered a Monster House (actual dungeon state) + // 0x794: You entered a Monster House (triggers music and other events?) + bool monster_house_triggered_event; + undefined field_0x795; + // 0x796: Seems to often be 0x3E7 (999)? Somehow related to controlling or managing the + // playing music? + undefined2 field_0x796; + enum dungeon_objective dungeon_objective; // 0x798: Objective of the current dungeon + // 0x799: Determines which message to display when the leader's belly reaches 0. Goes up + // to 0x9 (9), but only displays a unique message for 0x1, 0x2, and 0x3. + u8 leader_hunger_message_tracker; + // 0x79A: Keeps track of which animation/message to display as the turn limit ticks down. This + // ensures that even if the number of turns given to a player is less than the number where an + // animation would play, it will still play. + u8 turn_limit_warning_tracker; + // 0x79B: Number of times you can be rescued in this dungeon + s8 rescue_attempts_left; + u32 prng_seed; // 0x79C: The dungeon PRNG seed, if set + u32 rescue_prng_preseed_23_bit; // 0x7A0: The 23 bit dungeon PRNG preseed for rescues? + undefined2 field_0x7a4; // 0x7A4: Initialized to 0x63. + undefined2 field_0x7a6; // 0x7A6: Initialized to 0x63. + // 0x7A8: Holds some data for a monster id to loads its sprite. If this value is non-zero, + // it gets loaded after loading the dungeon floor monster spawn entries. Maybe for monsters + // that need a specific item to spawn? + enum monster_id some_monster_sprite_to_load; + u8 some_monster_level; // 0x7AA: The level for dungeon::some_monster_sprite_to_load? + undefined field_0x7ab; + // 0x7AC: Second number in the default LCG sequence, used for computing the actual dungeon PRNG + // seed + u32 prng_preseed; + undefined field_0x7b0; + undefined field_0x7b1; + undefined field_0x7b2; + undefined field_0x7b3; + undefined field_0x7b4; + undefined field_0x7b5; + undefined field_0x7b6; + undefined field_0x7b7; + undefined field_0x7b8; + undefined field_0x7b9; + undefined field_0x7ba; + undefined field_0x7bb; + // 0x7BC: The amount of poke the items being bought are worth (By the player)? + u32 poke_buy_kecleon_shop; + // 0x7C0: The amount of poke the items being sold are worth (By the player)? + u32 poke_sold_kecleon_shop; + // 0x7C4: Uncertain what this tracks? This is definitely related to + // dungeon::poke_buy_kecleon_shop. Sometimes subtract dungeon::poke_buy_kecleon_shop from + // this, set this to dungeon::poke_buy_kecleon_shop, and sometimes compared to + // dungeon::poke_buy_kecleon_shop. + u32 unk_poke_kecleon_shop_tracker; + // 0x7C8: Leader standing on a Kecleon shop tile? + bool leader_standing_in_kecleon_shop; + // 0x7C9: You entered a Kecleon Shop (triggers music and maybe more?) + bool standing_in_kecleon_shop; + undefined field_0x7ca; + undefined field_0x7cb; + // 0x7CC: Controls which mappa file (Time/Darkness/Sky) to load for a dungeon. When time and + // darkness are selected their respective mappa files are loaded, the hidden stairs type + // will always return 0, treasure boxes will generate with only exclusive items that exist + // in time/darkness, use a multiple of 0x28 (40) for poke. If sky is selected, causes + // waza_p2.bin to be loaded over waza_p.bin. Because waza_p.bin is initally loaded into + // the move table and the check to load waza_p2.bin is later, waza_p2.bin can be deleted + // without causing the game to crash as the data from waza_p.bin is still loaded because + // it's not overwritten by loading waza_p2.bin + enum game_id dungeon_game_version_id; + // 0x7D0: Maybe a pointer to a spawn list or related to a spawn list? + // Possibly a 0x8 long array of a struct-like object? Each entry is 4 bytes, but maybe the + // last byte is unused?? + undefined field_0x7d0; + undefined field_0x7d1; + undefined field_0x7d2; + undefined field_0x7d3; + undefined field_0x7d4; + undefined field_0x7d5; + undefined field_0x7d6; + undefined field_0x7d7; + undefined field_0x7d8; + undefined field_0x7d9; + undefined field_0x7da; + undefined field_0x7db; + undefined field_0x7dc; + undefined field_0x7dd; + undefined field_0x7de; + undefined field_0x7df; + undefined field_0x7e0; + undefined field_0x7e1; + undefined field_0x7e2; + undefined field_0x7e3; + undefined field_0x7e4; + undefined field_0x7e5; + undefined field_0x7e6; + undefined field_0x7e7; + undefined field_0x7e8; + undefined field_0x7e9; + undefined field_0x7ea; + undefined field_0x7eb; + undefined field_0x7ec; + undefined field_0x7ed; + undefined field_0x7ee; + undefined field_0x7ef; + // 0x7F0: Somehow related to dungeon::0x7D0? + undefined2 field_0x7f0; + // 0x7F2: May always just be a copy of dungeon::some_monster_sprite_to_load, but may also + // have another purpose. + enum monster_id some_monster_sprite; + struct monster monsters[20]; // 0x7F4: Info for all the monsters currently in the dungeon + // 0x34F4: Array that contains the spawn stats for enemies, which are only calculated + // once at the start of the floor. + // Since the enemy spawn list of a floor can only have a maximum of 16 entries, + // the remaining 48 are unused. + struct enemy_spawn_stats enemy_spawn_stats[64]; + // 0x3974: Monsters that can be spawned on the floor. + // Read when spawning enemies, at initialization the one at 0x2C964 is used. + // The number of valid entries is stored in monster_spawn_table_length. + // The last 2 entries of the table are always Kecleon (0x17F) and the dummy (0x229). + struct monster_spawn_entry spawn_entries[16]; + undefined field_0x39f4; + undefined field_0x39f5; + undefined field_0x39f6; + undefined field_0x39f7; + undefined field_0x39f8; + undefined field_0x39f9; + undefined field_0x39fa; + undefined field_0x39fb; + undefined field_0x39fc; + undefined field_0x39fd; + undefined field_0x39fe; + undefined field_0x39ff; + undefined field_0x3a00; + undefined field_0x3a01; + undefined field_0x3a02; + undefined field_0x3a03; + undefined field_0x3a04; + undefined field_0x3a05; + undefined field_0x3a06; + undefined field_0x3a07; + undefined field_0x3a08; + undefined field_0x3a09; + undefined field_0x3a0a; + undefined field_0x3a0b; + undefined field_0x3a0c; + undefined field_0x3a0d; + undefined field_0x3a0e; + undefined field_0x3a0f; + undefined field_0x3a10; + undefined field_0x3a11; + undefined field_0x3a12; + undefined field_0x3a13; + undefined field_0x3a14; + undefined field_0x3a15; + undefined field_0x3a16; + undefined field_0x3a17; + undefined field_0x3a18; + undefined field_0x3a19; + undefined field_0x3a1a; + undefined field_0x3a1b; + undefined field_0x3a1c; + undefined field_0x3a1d; + undefined field_0x3a1e; + undefined field_0x3a1f; + undefined field_0x3a20; + undefined field_0x3a21; + undefined field_0x3a22; + undefined field_0x3a23; + undefined field_0x3a24; + undefined field_0x3a25; + undefined field_0x3a26; + undefined field_0x3a27; + undefined field_0x3a28; + undefined field_0x3a29; + undefined field_0x3a2a; + undefined field_0x3a2b; + undefined field_0x3a2c; + undefined field_0x3a2d; + undefined field_0x3a2e; + undefined field_0x3a2f; + undefined field_0x3a30; + undefined field_0x3a31; + undefined field_0x3a32; + undefined field_0x3a33; + undefined field_0x3a34; + undefined field_0x3a35; + undefined field_0x3a36; + undefined field_0x3a37; + undefined field_0x3a38; + undefined field_0x3a39; + undefined field_0x3a3a; + undefined field_0x3a3b; + undefined field_0x3a3c; + undefined field_0x3a3d; + undefined field_0x3a3e; + undefined field_0x3a3f; + undefined field_0x3a40; + undefined field_0x3a41; + undefined field_0x3a42; + undefined field_0x3a43; + undefined field_0x3a44; + undefined field_0x3a45; + undefined field_0x3a46; + undefined field_0x3a47; + undefined field_0x3a48; + undefined field_0x3a49; + undefined field_0x3a4a; + undefined field_0x3a4b; + undefined field_0x3a4c; + undefined field_0x3a4d; + undefined field_0x3a4e; + undefined field_0x3a4f; + undefined field_0x3a50; + undefined field_0x3a51; + undefined field_0x3a52; + undefined field_0x3a53; + undefined field_0x3a54; + undefined field_0x3a55; + undefined field_0x3a56; + undefined field_0x3a57; + undefined field_0x3a58; + undefined field_0x3a59; + undefined field_0x3a5a; + undefined field_0x3a5b; + undefined field_0x3a5c; + undefined field_0x3a5d; + undefined field_0x3a5e; + undefined field_0x3a5f; + undefined field_0x3a60; + undefined field_0x3a61; + undefined field_0x3a62; + undefined field_0x3a63; + undefined field_0x3a64; + undefined field_0x3a65; + undefined field_0x3a66; + undefined field_0x3a67; + undefined field_0x3a68; + undefined field_0x3a69; + undefined field_0x3a6a; + undefined field_0x3a6b; + undefined field_0x3a6c; + undefined field_0x3a6d; + undefined field_0x3a6e; + undefined field_0x3a6f; + undefined field_0x3a70; + undefined field_0x3a71; + undefined field_0x3a72; + undefined field_0x3a73; + undefined field_0x3a74; + undefined field_0x3a75; + undefined field_0x3a76; + undefined field_0x3a77; + undefined field_0x3a78; + undefined field_0x3a79; + undefined field_0x3a7a; + undefined field_0x3a7b; + undefined field_0x3a7c; + undefined field_0x3a7d; + undefined field_0x3a7e; + undefined field_0x3a7f; + undefined field_0x3a80; + undefined field_0x3a81; + undefined field_0x3a82; + undefined field_0x3a83; + undefined field_0x3a84; + undefined field_0x3a85; + undefined field_0x3a86; + undefined field_0x3a87; + undefined field_0x3a88; + undefined field_0x3a89; + undefined field_0x3a8a; + undefined field_0x3a8b; + undefined field_0x3a8c; + undefined field_0x3a8d; + undefined field_0x3a8e; + undefined field_0x3a8f; + undefined field_0x3a90; + undefined field_0x3a91; + undefined field_0x3a92; + undefined field_0x3a93; + undefined field_0x3a94; + undefined field_0x3a95; + undefined field_0x3a96; + undefined field_0x3a97; + undefined field_0x3a98; + undefined field_0x3a99; + undefined field_0x3a9a; + undefined field_0x3a9b; + undefined field_0x3a9c; + undefined field_0x3a9d; + undefined field_0x3a9e; + undefined field_0x3a9f; + undefined field_0x3aa0; + undefined field_0x3aa1; + undefined field_0x3aa2; + undefined field_0x3aa3; + undefined field_0x3aa4; + undefined field_0x3aa5; + undefined field_0x3aa6; + undefined field_0x3aa7; + undefined field_0x3aa8; + undefined field_0x3aa9; + undefined field_0x3aaa; + undefined field_0x3aab; + undefined field_0x3aac; + undefined field_0x3aad; + undefined field_0x3aae; + undefined field_0x3aaf; + undefined field_0x3ab0; + undefined field_0x3ab1; + undefined field_0x3ab2; + undefined field_0x3ab3; + undefined field_0x3ab4; + undefined field_0x3ab5; + undefined field_0x3ab6; + undefined field_0x3ab7; + undefined field_0x3ab8; + undefined field_0x3ab9; + undefined field_0x3aba; + undefined field_0x3abb; + undefined field_0x3abc; + undefined field_0x3abd; + undefined field_0x3abe; + undefined field_0x3abf; + undefined field_0x3ac0; + undefined field_0x3ac1; + undefined field_0x3ac2; + undefined field_0x3ac3; + undefined field_0x3ac4; + undefined field_0x3ac5; + undefined field_0x3ac6; + undefined field_0x3ac7; + undefined field_0x3ac8; + undefined field_0x3ac9; + undefined field_0x3aca; + undefined field_0x3acb; + undefined field_0x3acc; + undefined field_0x3acd; + undefined field_0x3ace; + undefined field_0x3acf; + undefined field_0x3ad0; + undefined field_0x3ad1; + undefined field_0x3ad2; + undefined field_0x3ad3; + undefined field_0x3ad4; + undefined field_0x3ad5; + undefined field_0x3ad6; + undefined field_0x3ad7; + undefined field_0x3ad8; + undefined field_0x3ad9; + undefined field_0x3ada; + undefined field_0x3adb; + undefined field_0x3adc; + undefined field_0x3add; + undefined field_0x3ade; + undefined field_0x3adf; + undefined field_0x3ae0; + undefined field_0x3ae1; + undefined field_0x3ae2; + undefined field_0x3ae3; + undefined field_0x3ae4; + undefined field_0x3ae5; + undefined field_0x3ae6; + undefined field_0x3ae7; + undefined field_0x3ae8; + undefined field_0x3ae9; + undefined field_0x3aea; + undefined field_0x3aeb; + undefined field_0x3aec; + undefined field_0x3aed; + undefined field_0x3aee; + undefined field_0x3aef; + undefined field_0x3af0; + undefined field_0x3af1; + undefined field_0x3af2; + undefined field_0x3af3; + undefined field_0x3af4; + undefined field_0x3af5; + undefined field_0x3af6; + undefined field_0x3af7; + undefined field_0x3af8; + undefined field_0x3af9; + undefined field_0x3afa; + undefined field_0x3afb; + undefined field_0x3afc; + undefined field_0x3afd; + undefined field_0x3afe; + undefined field_0x3aff; + undefined field_0x3b00; + undefined field_0x3b01; + undefined field_0x3b02; + undefined field_0x3b03; + undefined field_0x3b04; + undefined field_0x3b05; + undefined field_0x3b06; + undefined field_0x3b07; + undefined field_0x3b08; + undefined field_0x3b09; + undefined field_0x3b0a; + undefined field_0x3b0b; + undefined field_0x3b0c; + undefined field_0x3b0d; + undefined field_0x3b0e; + undefined field_0x3b0f; + undefined field_0x3b10; + undefined field_0x3b11; + undefined field_0x3b12; + undefined field_0x3b13; + undefined field_0x3b14; + undefined field_0x3b15; + undefined field_0x3b16; + undefined field_0x3b17; + undefined field_0x3b18; + undefined field_0x3b19; + undefined field_0x3b1a; + undefined field_0x3b1b; + undefined field_0x3b1c; + undefined field_0x3b1d; + undefined field_0x3b1e; + undefined field_0x3b1f; + undefined field_0x3b20; + undefined field_0x3b21; + undefined field_0x3b22; + undefined field_0x3b23; + undefined field_0x3b24; + undefined field_0x3b25; + undefined field_0x3b26; + undefined field_0x3b27; + undefined field_0x3b28; + undefined field_0x3b29; + undefined field_0x3b2a; + undefined field_0x3b2b; + undefined field_0x3b2c; + undefined field_0x3b2d; + undefined field_0x3b2e; + undefined field_0x3b2f; + undefined field_0x3b30; + undefined field_0x3b31; + undefined field_0x3b32; + undefined field_0x3b33; + undefined field_0x3b34; + undefined field_0x3b35; + undefined field_0x3b36; + undefined field_0x3b37; + undefined field_0x3b38; + undefined field_0x3b39; + undefined field_0x3b3a; + undefined field_0x3b3b; + undefined field_0x3b3c; + undefined field_0x3b3d; + undefined field_0x3b3e; + undefined field_0x3b3f; + undefined field_0x3b40; + undefined field_0x3b41; + undefined field_0x3b42; + undefined field_0x3b43; + undefined field_0x3b44; + undefined field_0x3b45; + undefined field_0x3b46; + undefined field_0x3b47; + undefined field_0x3b48; + undefined field_0x3b49; + undefined field_0x3b4a; + undefined field_0x3b4b; + undefined field_0x3b4c; + undefined field_0x3b4d; + undefined field_0x3b4e; + undefined field_0x3b4f; + undefined field_0x3b50; + undefined field_0x3b51; + undefined field_0x3b52; + undefined field_0x3b53; + undefined field_0x3b54; + undefined field_0x3b55; + undefined field_0x3b56; + undefined field_0x3b57; + undefined field_0x3b58; + undefined field_0x3b59; + undefined field_0x3b5a; + undefined field_0x3b5b; + undefined field_0x3b5c; + undefined field_0x3b5d; + undefined field_0x3b5e; + undefined field_0x3b5f; + undefined field_0x3b60; + undefined field_0x3b61; + undefined field_0x3b62; + undefined field_0x3b63; + undefined field_0x3b64; + undefined field_0x3b65; + undefined field_0x3b66; + undefined field_0x3b67; + undefined field_0x3b68; + undefined field_0x3b69; + undefined field_0x3b6a; + undefined field_0x3b6b; + undefined field_0x3b6c; + undefined field_0x3b6d; + undefined field_0x3b6e; + undefined field_0x3b6f; + undefined field_0x3b70; + undefined field_0x3b71; + undefined field_0x3b72; + undefined field_0x3b73; + // 0x3B74: Unknown array, likely one entry per monster species. This might be related to + // the IQ skill Exp. Go-Getter so the AI knows which monsters to prioritize. + u8 unknown_array_0x3B74[600]; + // 0x3DCC: Appears to be a table that holds the statuses::statuses_unique_id value for + // the monsters. Maybe just for convenience to avoid loading it from every monster? + u32 monster_unique_id[20]; + // 0x3E1C: Appears to be be an index inside or length for + // dungeon::active_monsters_unique_statuses_ids. + u32 unique_id_index; + // 0x3E20: Number of valid monster spawn entries (see spawn_entries). + int monster_spawn_entries_length; + undefined field_0x3e24; + undefined field_0x3e25; + undefined field_0x3e26; + undefined field_0x3e27; + // 0x3E28: Related in some way to the spawn entries on the floor. Does something about them + // if false, then set to true. + bool unk_spawn_entry_id_check; + undefined field_0x3e29; + undefined field_0x3e2a; + undefined field_0x3e2b; + // 0x3E2C: Appears to be a counter that is saved into statuses::unique_id so that every + // monster has a different id for tracking statuses such as Leech Seed and Destiny Bond, and the + // abilities Storm Drain and Lightning Rod. Initialized to 0x400 (1024) + u32 monster_unique_id_counter; + // 0x3E30: Appears to to be a counter that is used for both attacker and defender to figure + // out which pair of wrapper and wrapped are connected. This number is saved into + // statuses::wrap_pair_unique_id. Initialized to 0xA (10) + u32 monster_unique_wrap_counter; + bool plus_is_active[2]; // 0x3E34: A monster on the {enemy, team} side has the ability Plus + bool minus_is_active[2]; // 0x3E36: A monster on the {enemy, team} side has the ability Minus + // 0x3E38: If true, a monster on the floor is a decoy. + bool decoy_is_active; + // 0x3E39: If true, a monster with id 0x97 (Mew) cannot be spawned on the floor. + bool mew_cannot_spawn; + // 0x3E3A: Holds the monster ID for the Deoxys form randomly selected for this floor. + enum monster_id deoxys_floor_id; + // 0x3E3C: Gets set to true in ChangeShayminForme. Seems to also control which sprite to + // load for a Shaymin on the team? + bool shaymin_sky_form_loaded; + undefined field_0x3e3d; + undefined field_0x3e3e; + undefined field_0x3e3f; + struct item items[64]; // 0x3E40: Info for all the items on the ground + u16 n_items; // 0x3FC0: Number of active items in the above items array + undefined field_0x3fc2; + undefined field_0x3fc3; + struct trap traps[64]; // 0x3FC4: Info for all the traps on the floor + struct dungeon_generation_info gen_info; // 0x40C4: Stuff involved with dungeon generation + undefined field_0xccfc; + undefined field_0xccfd; + undefined field_0xccfe; + undefined field_0xccff; + undefined field_0xcd00; + undefined field_0xcd01; + undefined field_0xcd02; + undefined field_0xcd03; + undefined field_0xcd04; + undefined field_0xcd05; + undefined field_0xcd06; + undefined field_0xcd07; + undefined field_0xcd08; + undefined field_0xcd09; + undefined field_0xcd0a; + undefined field_0xcd0b; + // 0xCD0C: Appears to be an array for the team. Likely only the first 4 entries are used. + // Possibly related to dungeon_generation_info::individual_team_spawn_positions? Possibly the + // direction to spawn each team member in? + enum direction_id unk_team_direction_array[8]; + // Min x of the generated Kecleon shop, if it exists. This reflects the original generation, and + // is not updated if some shop tiles are deleted by later steps in floor generation + int kecleon_shop_min_x; // 0xCD14: inclusive + int kecleon_shop_min_y; // 0xCD18: inclusive + int kecleon_shop_max_x; // 0xCD1C: inclusive + int kecleon_shop_max_y; // 0xCD20: inclusive + // Coordinates for a non full floor fixed room? Uncertain if max values are inclusive. + int fixed_room_min_x; // 0xCD24: inclusive + int fixed_room_min_y; // 0xCD28: inclusive + int fixed_room_max_x; // 0xCD2C: inclusive? + int fixed_room_max_y; // 0xCD30: inclusive? + // 0xCD34: Width of the generated fixed room? + u16 fixed_room_width; + // 0xCD36: Height of the generated fixed room? + u16 fixed_room_height; + enum weather_id weather; // 0xCD38: current weather + // 0xCD39: Default weather on the floor that will be reverted to if the current weather is + // artificial and ends + enum weather_id natural_weather; + // 0xCD3A: Turns left for each weather type in enum weather_id (except WEATHER_RANDOM). If + // multiple of these are nonzero, the one with the highest number of turns left is chosen. + // Ties are broken in enum order + u16 weather_turns[8]; + // 0xCD4A: Turns left for artificial permaweather from weather-setting abilities like Drought, + // Sand Stream, Drizzle, and Snow Warning; one counter for each weather type in enum weather_id + // (except WEATHER_RANDOM). Any nonzero value triggers that weather condition (it's usually set + // to 1 or 0). If the weather's source is removed, this value becomes the normal number of turns + // left for that weather condition. Priority in the event of multiple nonzero counters is the + // same as with weather_turns. + u16 artificial_permaweather_turns[8]; + // 0xCD5A: For damaging weather conditions like sandstorm. Counts down from 9-0, damage on 9 + u8 weather_damage_counter; + u8 mud_sport_turns; // 0xCD5B: Number of turns left for the Mud Sport condition + u8 water_sport_turns; // 0xCD5C: Number of turns left for the Water Sport condition + bool nullify_weather; // 0xCD5D: Cloud Nine/Air Lock is in effect + undefined field_0xcd5e; + undefined field_0xcd5f; + // 0xCD60: Seems to be tile data for tiles within fixed rooms + struct tile fixed_room_tiles[8][8]; + undefined field_0xd260; + undefined field_0xd261; + undefined field_0xd262; + undefined field_0xd263; + undefined field_0xd264; + undefined field_0xd265; + undefined field_0xd266; + undefined field_0xd267; + undefined field_0xd268; + undefined field_0xd269; + undefined field_0xd26a; + undefined field_0xd26b; + undefined field_0xd26c; + undefined field_0xd26d; + undefined field_0xd26e; + undefined field_0xd26f; + undefined field_0xd270; + undefined field_0xd271; + undefined field_0xd272; + undefined field_0xd273; + undefined field_0xd274; + undefined field_0xd275; + undefined field_0xd276; + undefined field_0xd277; + undefined field_0xd278; + undefined field_0xd279; + undefined field_0xd27a; + undefined field_0xd27b; + undefined field_0xd27c; + undefined field_0xd27d; + undefined field_0xd27e; + undefined field_0xd27f; + undefined field_0xd280; + undefined field_0xd281; + undefined field_0xd282; + undefined field_0xd283; + undefined field_0xd284; + undefined field_0xd285; + undefined field_0xd286; + undefined field_0xd287; + undefined field_0xd288; + undefined field_0xd289; + undefined field_0xd28a; + undefined field_0xd28b; + undefined field_0xd28c; + undefined field_0xd28d; + undefined field_0xd28e; + undefined field_0xd28f; + undefined field_0xd290; + undefined field_0xd291; + undefined field_0xd292; + undefined field_0xd293; + undefined field_0xd294; + undefined field_0xd295; + undefined field_0xd296; + undefined field_0xd297; + undefined field_0xd298; + undefined field_0xd299; + undefined field_0xd29a; + undefined field_0xd29b; + undefined field_0xd29c; + undefined field_0xd29d; + undefined field_0xd29e; + undefined field_0xd29f; + undefined field_0xd2a0; + undefined field_0xd2a1; + undefined field_0xd2a2; + undefined field_0xd2a3; + undefined field_0xd2a4; + undefined field_0xd2a5; + undefined field_0xd2a6; + undefined field_0xd2a7; + undefined field_0xd2a8; + undefined field_0xd2a9; + undefined field_0xd2aa; + undefined field_0xd2ab; + undefined field_0xd2ac; + undefined field_0xd2ad; + undefined field_0xd2ae; + undefined field_0xd2af; + undefined field_0xd2b0; + undefined field_0xd2b1; + undefined field_0xd2b2; + undefined field_0xd2b3; + undefined field_0xd2b4; + undefined field_0xd2b5; + undefined field_0xd2b6; + undefined field_0xd2b7; + undefined field_0xd2b8; + undefined field_0xd2b9; + undefined field_0xd2ba; + undefined field_0xd2bb; + undefined field_0xd2bc; + undefined field_0xd2bd; + undefined field_0xd2be; + undefined field_0xd2bf; + undefined field_0xd2c0; + undefined field_0xd2c1; + undefined field_0xd2c2; + undefined field_0xd2c3; + undefined field_0xd2c4; + undefined field_0xd2c5; + undefined field_0xd2c6; + undefined field_0xd2c7; + undefined field_0xd2c8; + undefined field_0xd2c9; + undefined field_0xd2ca; + undefined field_0xd2cb; + undefined field_0xd2cc; + undefined field_0xd2cd; + undefined field_0xd2ce; + undefined field_0xd2cf; + undefined field_0xd2d0; + undefined field_0xd2d1; + undefined field_0xd2d2; + undefined field_0xd2d3; + undefined field_0xd2d4; + undefined field_0xd2d5; + undefined field_0xd2d6; + undefined field_0xd2d7; + undefined field_0xd2d8; + undefined field_0xd2d9; + undefined field_0xd2da; + undefined field_0xd2db; + undefined field_0xd2dc; + undefined field_0xd2dd; + undefined field_0xd2de; + undefined field_0xd2df; + // 0xD2E0: Appears to keep track of what tiles are the fixed room tiles when generating + // a fixed room that isn't the whole floor. + u8 fixed_room_room_index; + undefined field_0xd2e1; + undefined field_0xd2e2; + undefined field_0xd2e3; + // 0xD2E4: This is an array of pointers that point to the actual tile structs within the + // dungeon struct + struct tile* tile_ptrs[32][56]; + u8 n_rooms; // 0xEEE4: Number of rooms on the current floor + undefined field_0xeee5; // Uninitialized, likely padding + undefined field_0xeee6; // Uninitialized, likely padding + undefined field_0xeee7; // Uninitialized, likely padding + // 0xEEE8: Array of structs that contain data about the rooms on the current floor + struct room_data room_data[32]; + // 0xF268: Array that counts the amount of elements on each row of natural_junction_list + u16 natural_junction_list_counts[32]; + // 0xF2A8: Matrix that stores the positions of up to 32 natural junctions + // for each room on the floor. Each row represents a room. + struct position natural_junction_list[32][32]; + // 0x102A8: Buffer to store some file after being decompressed. + // The file that gets loaded depends on the tileset ID of the dungeon. + u8 unknown_file_buffer_0x102A8[7200]; + // 0x11EC8: Matrix related to tile graphics. + // Skipping the code that initializes it at the start of the dungeon causes all tiles + // to be shown as black squares. + u16 unknown_tile_matrix[9][34]; + // 0x1212C: Unknown matrix, probably related to unknown_tile_matrix + // since they get initialized together. + u16 unknown_matrix_0x1212C[9][3]; + // 0x12162: Buffer to store some AT4PX file after being decompressed + // This is somehow related to tile::texture_id and tile variations? + u8 unknown_file_buffer_0x12162[2352]; + // 0x12A92: Unknown array, probably related to unknown_tile_matrix + // since they get initialized together. + u16 unknown_array_0x12A92[9]; + // 0x12AA4: Pointer to data about the fixed room such as width and height. Gets set after + // loading the data for a fixed room when generating a floor. Gets set back to null when + // done generating a floor. + undefined* unk_fixed_room_pointer; + // 0x12AA8: This flag is set by the move 0x191 ("Trapper") which is the effect + // of the Trapper Orb. If true, the game will try to spawn a trap. + bool trapper_orb_flag; + undefined field_0x12aa9; // Likely padding + // 0x12AAA: Location to spawn the trap by trapper_orb_flag. + struct position trapper_orb_trap_pos; + // 0x12AAE: Trap ID to spawn the trap by trapper_orb_flag. Notably, the game + // will always set this to 0x19, but could work with other values. + enum trap_id traper_orb_trap_id; + // 0x12AAF: Alignment to spawn the trap by trapper_orb_flag. + u8 trapper_orb_trap_team; + undefined field_0x12ab0; + undefined field_0x12ab1; + undefined field_0x12ab2; + undefined field_0x12ab3; + undefined field_0x12ab4; + undefined field_0x12ab5; + undefined field_0x12ab6; + undefined field_0x12ab7; + undefined field_0x12ab8; + undefined field_0x12ab9; + undefined field_0x12aba; + undefined field_0x12abb; + undefined field_0x12abc; + undefined field_0x12abd; + undefined field_0x12abe; + undefined field_0x12abf; + undefined field_0x12ac0; + undefined field_0x12ac1; + undefined field_0x12ac2; + undefined field_0x12ac3; + undefined field_0x12ac4; + undefined field_0x12ac5; + undefined field_0x12ac6; + undefined field_0x12ac7; + undefined field_0x12ac8; + undefined field_0x12ac9; + undefined field_0x12aca; + undefined field_0x12acb; + undefined field_0x12acc; + undefined field_0x12acd; + undefined field_0x12ace; + undefined field_0x12acf; + undefined field_0x12ad0; + undefined field_0x12ad1; + undefined field_0x12ad2; + undefined field_0x12ad3; + undefined field_0x12ad4; + undefined field_0x12ad5; + undefined field_0x12ad6; + undefined field_0x12ad7; + undefined field_0x12ad8; + undefined field_0x12ad9; + undefined field_0x12ada; + undefined field_0x12adb; + undefined field_0x12adc; + undefined field_0x12add; + undefined field_0x12ade; + undefined field_0x12adf; + undefined field_0x12ae0; + undefined field_0x12ae1; + undefined field_0x12ae2; + undefined field_0x12ae3; + undefined field_0x12ae4; + undefined field_0x12ae5; + undefined field_0x12ae6; + undefined field_0x12ae7; + undefined field_0x12ae8; + undefined field_0x12ae9; + undefined field_0x12aea; + undefined field_0x12aeb; + undefined field_0x12aec; + undefined field_0x12aed; + undefined field_0x12aee; + undefined field_0x12aef; + undefined field_0x12af0; + undefined field_0x12af1; + undefined field_0x12af2; + undefined field_0x12af3; + undefined field_0x12af4; + undefined field_0x12af5; + undefined field_0x12af6; + undefined field_0x12af7; + // 0x12AF8: The amount of items "sniffed" by the Acute Sniffer iq skill when a floor starts. + u16 acute_sniffer_item_count; + // 0x12AFA: Number of normal item spawns. Does not include monster held items and additional + // items in walls or Monster Houses + u16 n_normal_item_spawns; + bool gravity; // 0x12AFC: Gravity is in effect + undefined field_0x12afd; + // 0x12AFE: Victories on one floor counter. + s16 victory_counter; + undefined field_0x12b00; + undefined field_0x12b01; + undefined field_0x12b02; + undefined field_0x12b03; + undefined field_0x12b04; + undefined field_0x12b05; + undefined field_0x12b06; + undefined field_0x12b07; + undefined field_0x12b08; + undefined field_0x12b09; + undefined field_0x12b0a; + undefined field_0x12b0b; + undefined field_0x12b0c; + undefined field_0x12b0d; + undefined field_0x12b0e; + undefined field_0x12b0f; + undefined field_0x12b10; + undefined field_0x12b11; + undefined field_0x12b12; + undefined field_0x12b13; + undefined field_0x12b14; + undefined field_0x12b15; + undefined field_0x12b16; + undefined field_0x12b17; + undefined field_0x12b18; + undefined field_0x12b19; + undefined field_0x12b1a; + undefined field_0x12b1b; + undefined field_0x12b1c; + undefined field_0x12b1d; + undefined field_0x12b1e; + undefined field_0x12b1f; + // 0x12B20: Probably counts how many sprites or monster entries the fixed room wants + // loaded. + u32 fixed_room_monster_sprite_counter; + // 0x12B24: Whether or not the kecleon shop spawn chance be boosted for the floor + bool boost_kecleon_shop_spawn_chance; + // 0x12B25: Whether or not the hidden stairs spawn chance be boosted for the floor + // (by 20%; see HIDDEN_STAIRS_SPAWN_CHANCE_MULTIPLIER) + bool boost_hidden_stairs_spawn_chance; + undefined field_0x12b26; + undefined field_0x12b27; + + //struct entity_table entity_table; // 0x12B28: Table of all entities in the dungeon + // The pointers point into the entities array + // 0x12B28 / 0x0: A list of all monster pointers, whether they're used or not + union { + struct entity* party_members[4]; + struct entity* monster_slot_ptrs[20]; + }; + // 0x12B78 / 0x50: Null-terminated array of pointers to actually active monsters + struct entity* active_monster_ptrs[20]; + struct entity* item_ptrs[64]; // 0x12BC8 / 0xA0 + struct entity* trap_ptrs[64]; // 0x12CC8 / 0x1A0 + struct entity* hidden_stairs_ptr; // 0x12DC8 / 0x2A0 + struct entity entities[149]; // 0x12DCC / 0x2A4 : All the entities in a dungeon + + // 0x198E4: An ally monster related to storm drain/lightning rod and maybe other checks? + struct entity* unk_ally_monster1; + u32 unk_ally_monster_unique_id1; // 0x198E8: statuses::unique_id from that monster? + // 0x198EC: An ally monster related to storm drain/lightning rod and maybe other checks? + struct entity* unk_ally_monster2; + u32 unk_ally_monster_unique_id2; // 0x198F0: statuses::unique_id from that monster? + // 0x198F4: An enemy monster related to storm drain/lightning rod and maybe other checks? + struct entity* unk_enemy_monster1; + u32 unk_enemy_monster_unique_id1; // 0x198F8: statuses::unique_id from that monster? + // 0x198FC: An enemy monster related to storm drain/lightning rod and maybe other checks? + struct entity* unk_enemy_monster2; + u32 unk_enemy_monster_unique_id2; // 0x19900: statuses::unique_id from that monster? + // 0x19904: Pointer to the monster that will snatch the effect of a move. + struct entity* snatch_monster; + // 0x19908: Pointer to the entity to be spawned by the effect of Illuminate + struct entity* illuminate_spawn_entity; + // 0x1990C: Stores statuses::unique_id for the monster pointed to by dungeon::snatch_monster. + u32 snatch_status_unique_id; + // 0x19910: Spawn genid of the monster to be spawned by the effect of Illuminate + u16 illuminate_spawn_genid; + undefined field_0x19912; + undefined field_0x19913; + // 0x19914: List that matches monster IDs with their sprite index on this floor + enum monster_id sprite_indexes[1155]; + undefined field_0x1a21a; + undefined field_0x1a21b; + // 0x1A21C: Data about the map, the camera and the touchscreen numbers + struct display_data display_data; + struct minimap_display_data minimap_display_data; // 0x1A264: Data used to display the minimap + // 0x286B0: Initialized to 0xFF, then set to a copy of dungeon::group_id + enum dungeon_group_id group_id_copy; + // 0x286B1: Initialized to 0xFF, then set to a copy of dungeon::0x74B + undefined field_0x286b1; + struct floor_properties floor_properties; // 0x286B2: Properties about the current floor + // 0x286D2: Maybe a 0x10 long array? + undefined2 field_0x286d2; + undefined2 field_0x286d4; + undefined2 field_0x286d6; + undefined2 field_0x286d8; + undefined2 field_0x286da; + undefined2 field_0x286dc; + undefined2 field_0x286de; + undefined2 field_0x286e0; + undefined2 field_0x286e2; + undefined2 field_0x286e4; + undefined2 field_0x286e6; + undefined2 field_0x286e8; + undefined2 field_0x286ea; + undefined2 field_0x286ec; + undefined2 field_0x286ee; + undefined2 field_0x286f0; + // 0x286F2: Spawn weights for regular items. It's the unrolled form of this floor's regular + // item spawn list. + // It has enough space to hold 1416 entries (1400 items + 16 categories), but only the + // first 0x16C slots are used since spawn lists can't encode item IDs larger than that. + u16 regular_item_weights[1416]; + // 0x29202: Spawn weights for Kecleon shop items. Same format as regular_item_weights. + u16 kecleon_item_weights[1416]; + // 0x29D12: Spawn weights for monster house items. Same format as regular_item_weights. + u16 monster_house_item_weights[1416]; + // 0x2A822: Spawn weights for buried items. Same format as regular_item_weights. + u16 buried_item_weights[1416]; + // 0x2B332: Spawn weights for bazaar grab bag items. Same format as regular_item_weights. + u16 grab_bag_item_weights[1416]; + // 0x2BE42: Spawn weights for secret room items in treasure boxes. + // Same format as regular_item_weights? For some reason the weights for the secret rooms + // are of a different length than the other item weight lists before it. The trap weights + // appear to overlap what would be entries 1400-1415. + u16 secret_room_item_weights[1400]; + // 0x2C932: Spawn weights for traps. + u16 trap_weights[25]; + // 0x2C964: List of spawn entries on this floor + // This is used during initialization, enemies are spawned using the copy at 0x3974 + struct monster_spawn_entry spawn_entries_master[16]; + // 0x2C9E4: The total number of spawn entries loaded or to be loaded? + u16 number_sprites_loaded; + // 0x2C9E6: Highest level among all the enemies that spawn on this floor + u16 highest_enemy_level; + // 0x2C9E8: ID of an item guaranteed to spawn on the floor, if applicable + // (e.g., certain mission types) + enum item_id guaranteed_item_id; + // 0x2C9EA: List of the indices in the complete monster spawn table for this floor that were + // chosen to spawn on it. It gets rerandomized at the start of each new floor. + u16 spawn_table_entries_chosen[16]; + undefined field_0x2ca0a; + undefined field_0x2ca0b; + // 0x2CA0C: Holds the name for the entity that caused the faint. The exact size is a guess. + // Likely larger because of entities like the Explosion Trap. + char fainted_monster_cause_entity_name[10]; + undefined field_0x2ca16; + undefined field_0x2ca17; + undefined field_0x2ca18; + undefined field_0x2ca19; + undefined field_0x2ca1a; + undefined field_0x2ca1b; + undefined field_0x2ca1c; + undefined field_0x2ca1d; + undefined field_0x2ca1e; + undefined field_0x2ca1f; + undefined field_0x2ca20; + undefined field_0x2ca21; + undefined field_0x2ca22; + undefined field_0x2ca23; + undefined field_0x2ca24; + undefined field_0x2ca25; + undefined field_0x2ca26; + undefined field_0x2ca27; + undefined field_0x2ca28; + undefined field_0x2ca29; + // 0x2CA2A: Holds the name for the monster that fainted. The exact size is a guess. + char fainted_monster_name[10]; + undefined field_0x2ca34; + undefined field_0x2ca35; + undefined field_0x2ca36; + undefined field_0x2ca37; + undefined field_0x2ca38; + undefined field_0x2ca39; + undefined field_0x2ca3a; + undefined field_0x2ca3b; + undefined field_0x2ca3c; + undefined field_0x2ca3d; + undefined field_0x2ca3e; + undefined field_0x2ca3f; + undefined field_0x2ca40; + undefined field_0x2ca41; + undefined field_0x2ca42; + undefined field_0x2ca43; + undefined field_0x2ca44; + undefined field_0x2ca45; + undefined field_0x2ca46; + undefined field_0x2ca47; + // 0x2CA48: A monster name that is copied from dungeon::unk_fainted_monster_name. Maybe for + // situations where the player loses because the partner, escort, or accompanying monster + // fainted? Another poossible use is when leaving a dungeon after a mission? Exact size is + // a guess. + char loss_related_monster_name[10]; + undefined field_0x2ca52; + undefined field_0x2ca53; + undefined field_0x2ca54; + undefined field_0x2ca55; + undefined field_0x2ca56; + undefined field_0x2ca57; + undefined field_0x2ca58; + undefined field_0x2ca59; + undefined field_0x2ca5a; + undefined field_0x2ca5b; + undefined field_0x2ca5c; + undefined field_0x2ca5d; + undefined field_0x2ca5e; + undefined field_0x2ca5f; + undefined field_0x2ca60; + undefined field_0x2ca61; + undefined field_0x2ca62; + undefined field_0x2ca63; + undefined field_0x2ca64; + undefined field_0x2ca65; + // 0x02CA66: The cause of the mission over. Identical to the damage source in HandleFaint, + // but can be set to some non-damage related reasons manually by the game. IE: "cleared the + // dungeon." and "succeeded in the rescue mission." + union damage_source fainted_monster_dungeon_end_reason; + enum dungeon_id fainted_id; // 0x2CA68: Copied from dungeon::id, upon fainting. + u8 fainted_floor; // 0x2CA69: Copied from dungeon::floor, upon fainting. + // 0x2CA6A: Copy of the fainted monster's held item. + struct item fainted_monster_held_item; + int fainted_monster_exp; // 0x2CA70: Copy of fainted monster's experience. + // 0x2CA74: Copy of the fainted monster's ACTUAL max hp (monster::max_hp_stat + + // monster::max_hp_boost) + s16 fainted_monster_max_hp; + // 0x2CA76: Copy of the fainted monster's offensive stats. + u8 fainted_monster_offensive_stats[2]; + // 0x2CA78: Copy of the fainted monster's defenive stats. + u8 fainted_monster_defensive_stats[2]; + u8 fainted_monster_level; // 0x2CA7A: Copy of fainted monster's level. + undefined field_0x2ca7b; + // 0x2CA7C: This is a monster summary related to the menu when leaving a dungeon. When + // succesfully exiting a dungeon it is the leader. May be other allies when they faint? + struct monster_summary getout_monster_summary; + // 0x2CAF4: One more than the maximum number of floors in the current dungeon + u8 n_floors_plus_one; + undefined field_0x2caf5; + undefined field_0x2caf6; + undefined field_0x2caf7; + // 0x2CAF8: Related to playing dungeon music? Initialized to 0x4. + undefined4 field_0x2caf8; + // Related to playing dungeon music? + undefined field_0x2cafc; + undefined field_0x2cafd; + undefined field_0x2cafe; + undefined field_0x2caff; + // Related to playing dungeon music? + undefined2 field_0x2cb00; + // Related to playing dungeon music? + undefined2 field_0x2cb02; + // 0x2CB04: Related to playing dungeon music? + undefined2 field_0x2cb04; + // 0x2CB06: Current Dunegon Music ID + enum music_id dungeon_music_playing_id; + undefined field_0x2cb08; + undefined field_0x2cb09; + undefined field_0x2cb0a; + undefined field_0x2cb0b; + undefined field_0x2cb0c; + undefined field_0x2cb0d; + undefined field_0x2cb0e; + undefined field_0x2cb0f; + // 0x2CB10: Somehow related to display_data::hallucinating and seems to maybe control + // the sleeping animations when the camera is pointed away from a hallucinating monster? + // Initialized to 0x1. + bool unk_camera_tracker; + undefined field_0x2cb11; + undefined field_0x2cb12; + undefined field_0x2cb13; +}; + + +#endif diff --git a/include/dungeon_mode.h b/include/dungeon_mode.h index 8d60214c..f1d112a4 100644 --- a/include/dungeon_mode.h +++ b/include/dungeon_mode.h @@ -1,7 +1,10 @@ #ifndef PMDSKY_DUNGEON_MODE_H #define PMDSKY_DUNGEON_MODE_H +#include "util.h" +#include "enums.h" #include "graphics.h" +#include "dungeon_mode_common.h" // Used in various contexts, like with entity positions in the dungeon struct position { @@ -16,6 +19,810 @@ struct pixel_position { u32 y; }; +// Dungeon data +/* struct dungeon { */ +/* u8 PAD1[1864]; */ +/* u8 dungeon; // 0x748 */ +/* u8 floor; // 0x749 */ +/* u8 PAD2[74554]; */ +/* #ifndef JAPAN */ +/* u8 PAD3[164]; */ +/* #endif */ +/* struct entity* party_members[4]; // 0x12B28 */ +/* // Possibly more stuff */ +/* }; */ + +// Item info +struct item { + // 0x0: flags: 1-byte bitfield + //u8 flags_0x0; + bool f_exists : 1; // Validity flag + bool f_in_shop : 1; // In a Kecleon Shop + bool f_unpaid : 1; // Picked up from a Kecleon Shop but not paid for yet + bool f_sticky : 1; // Sticky + bool f_set : 1; // Usable by L+R + bool flag_unk5 : 1; + // For stolen items to recover from outlaws (has red X)? Could be for other items for other + // types of missions? (Uncertain) + bool f_unk_mission_item1 : 1; + // For stolen items to recover from outlaws (has red X)? Could be for other items for other + // types of missions? (Uncertain) Definitely used temporarily when sorting the items in + // storage. + bool f_unk_mission_item2 : 1; + // 0x1: For bag items. 0 for none, 1 if held by the leader, 2 for the second party member, etc. + u8 held_by; + // 0x2: Only for stackable items. Will be 0 if unapplicable. For Poké, this is an "amount code" + // rather than the literal amount (see MONEY_QUANTITY_TABLE) + u16 quantity; + enum item_id id; // 0x4 +}; + +// Monster stat modifier info +struct monster_stat_modifiers { + // Stages go from 0-20 inclusive, with normal being 10 + s16 offensive_stages[2]; // 0x0: {atk, sp_atk} + s16 defensive_stages[2]; // 0x4: {def, sp_def} + s16 hit_chance_stages[2]; // 0x8: {accuracy, evasion} + s16 flash_fire_boost; // 0xC: can be 0, 1, or 2 + undefined field_0xe; + undefined field_0xf; + // Some moves like Screech affect the damage calculation differently than, e.g., Leer + // 0x10: binary fixed-point (8 fraction bits), {atk, sp_atk}; from Charm, Memento, etc. + fx32_8 offensive_multipliers[2]; + // 0x18: binary fixed-point (8 fraction bits), {def, sp_def}; from Screech, etc. + fx32_8 defensive_multipliers[2]; +}; + +// Monster statuses +// Many fields are indexes that select from a group of status conditions. These fields are named +// by the FIRST status in the list (when the index is 1, since 0 usually means no status). For other +// statuses in the group, see the subsequent enum values in enum status_id after the first status. +struct statuses { + bool roost; + // 0x1: The typing in entity::types before the flying type is removed for statuses::roost + // and restored to entity::types after statuses::roost ends. + enum type_id original_types[2]; + // 0x3: The move id to be used if statuses::bide is 1. + u8 bide_move_id; + undefined field_0x4; + undefined field_0x5; + undefined field_0x6; + // 0x7: Unique number given to the monster when spawning to differentiate it from other + // monsters and to properly keep track of a monster. Likely used because a monster could be + // spawned into the same slot as an old monster and using a pointer alone could cause some + // issues. Used for Leech Seed, Destiny Bond, Storm Drain, Lightning Rod (probably more). + u32 unique_id; + // 0xB: Unique number between the wrapped and wrapping target to connect them. + u32 wrap_pair_unique_id; + // 0xF: Tracks the damage taken to deal when bide status ends. Max 0x3E7 (999). + u32 bide_damage_tally; + enum monster_behavior monster_behavior : 8; // 0x13 + u8 sleep; // 0x14: STATUS_SLEEP if 1 + u8 sleep_turns; // 0x15: Turns left for the status in statuses::sleep + u8 burn; // 0x16: STATUS_BURN if 1 + u8 burn_turns; // 0x17: Turns left for the status in statuses::burn + // 0x18: Turns left until residual damage for the status in statuses::burn, if applicable + u8 burn_damage_countdown; + // 0x19: The number of times the statuses::burn_damage_countdown has reached 0. Only used + // when badly poisoned. Determines how much damage the badly poisoned status condition + // will deal. There is no noticable difference because the table this value is looked up + // on is filled with 0x6 + u8 badly_poisoned_damage_count; + undefined field_0x1a; + u8 freeze; // 0x1B: STATUS_FROZEN if 1 + undefined field_0x1c; + undefined field_0x1d; + undefined field_0x1e; + // 0x1F: Controls the animation that plays when taking damage from the constriction status. + // For some reason this is initalized to 0x22 (34)? Which is the animation used by + // the exclusive item Nether Veil. + u32 constriction_animation; + u8 freeze_turns; // 0x23: Turns left for the status in statuses::freeze + // 0x24: Turns left until residual damage for the status in statuses::freeze, if applicable + u8 freeze_damage_countdown; + undefined field_0x25; + undefined field_0x26; + u8 cringe; // 0x27: STATUS_CRINGE if 1 + u8 cringe_turns; // 0x28: Turns left for the status in statuses::cringe + u8 bide; // 0x29: STATUS_BIDE if 1 + u8 bide_turns; // 0x2A: Turns left for the status in statuses::bide + u8 bide_move_slot; // 0x2B: Slot in the user's move list + u8 reflect; // 0x2C: STATUS_REFLECT if 1 + u8 reflect_turns; // 0x2D: Turns left for the status in statuses::reflect + // 0x2E: Turns left until residual healing for the status in statuses::reflect, if applicable + u8 reflect_damage_countdown; + u8 curse; // 0x2F: STATUS_CURSED if 1 + // 0x30: Set to monster::is_not_team_member of the attacker (the one causing the decoy status). + u8 curse_applier_non_team_member_flag; + // 0x31: Set to 1 on a Pokemon when inflicted with the Decoy status. + undefined unk_decoy_tracker; + u8 curse_turns; // 0x32: Turns left for the status in statuses::curse + // 0x33: Turns left until residual damage for the status in statuses::curse, if applicable + u8 curse_damage_countdown; + undefined field_0x34; + undefined field_0x35; + undefined field_0x36; + u8 leech_seed; // 0x37: STATUS_LEECH_SEED if 1 + undefined field_0x38; + undefined field_0x39; + undefined field_0x3a; + // 0x3B: Used to track the statuses::statuses_unique_id of the relevant monster for + // statuses like Leech Seed and Destiny Bond. + u32 statuses_applier_id; + // 0x3F: Index into entity_table_hdr::monster_slot_ptrs in the dungeon that the user + // (drainer) is held. + u8 leech_seed_source_monster_index; + u8 leech_seed_turns; // 0x40: Turns left for the status in statuses::leech_seed + // 0x41: Turns left until residual damage for the status in statuses::leech_seed, if applicable. + // Behaves weirdly without an afflictor + u8 leech_seed_damage_countdown; + undefined field_0x42; + u8 sure_shot; // 0x43: STATUS_SURE_SHOT if 1 + u8 sure_shot_turns; // 0x44: Turns left for the status in statuses::sure_shot + u8 long_toss; // 0x45: STATUS_LONG_TOSS if 1 + u8 invisible; // 0x46: STATUS_INVISIBLE if 1 + u8 invisible_turns; // 0x47: Turns left for the status in statuses::invisible + u8 blinded; // 0x48: STATUS_BLINKER if 1 + u8 blinded_turns; // 0x49: Turns left for the status in statuses::blinded + u8 muzzled; // 0x4A: STATUS_MUZZLED if 1 + u8 muzzled_turns; // 0x4B: Turns left for the status in statuses::muzzled + u8 miracle_eye; // 0x4C: STATUS_MIRACLE_EYE if 1 + u8 miracle_eye_turns; // 0x4D: Turns left for the status in statuses::miracle_eye + u8 magnet_rise; // 0x4E: STATUS_MAGNET_RISE if 1 + u8 magnet_rise_turns; // 0x4F: Turns left for the status in statuses::magnet_rise + bool power_ears; // 0x50: STATUS_POWER_EARS + bool scanning; // 0x51: STATUS_SCANNING + bool stair_spotter; // 0x52: STATUS_STAIR_SPOTTER + // 0x53: Set when initally spawning a team member with the ability Pickup. + bool pickup_flag; + bool grudge; // 0x54: STATUS_GRUDGE + bool exposed; // 0x55: STATUS_EXPOSED (Foresight/Odor Sleuth) + bool type_changed; // 0x56: Flag for if the monster's type has been changed + bool boss_flag; // 0x57: Seems to be true for boss monsters + // 0x58: Appears to be a flag for when a monster increasces their speed. Maybe only used + // by the RunLeaderTurn function to know if the leader has changed their speed stage partway + // through the function? + undefined unk_sped_up_tracker; + // 0x59: Maybe related to being a team member and new recruit? Set to 1 in TryRecruit + // and 0 in SpawnTeam. Also checked in EnemyEvolution to be 0 before evolving. Maybe to + // prevent a recently recruited ally from evolving after and or to add a monster to the + // assembly after the completion of a dungeon? + undefined field_0x59; +#ifndef JAPAN + // 0x5A: Possibly a flag while in action. Could also be a flag to cause the burn from + // lava, heal a burn from water, and decrease hunger in the walls. + bool in_action; +#endif + // 0x5B: STATUS_TERRIFIED, interestingly, appears to use 0x1 for the Foe-Fear Orb but + // 0x2 for the ability Stench. The distinction only seems to exist for the game to use + // a special message for when terrified from stench ends. + u8 terrified; + u8 terrified_turns; // 0x5C: Turns left for the terrified status + u8 perish_song_turns; // 0x5D: Turns left before Perish Song takes effect + // 0x5E: Increases progressively while the No-Slip Cap is held. Capped at 0x13 + // Used to calculate the chance of an item becoming sticky, resets to 0 when that happens + u8 no_slip_cap_counter; + // 0x5F: Determines how much experience the monster will reward after being defeated + // 0 = 0.5x, 1 = 1.0x, 2 = 1.5x + u8 exp_yield; + // 0x60: Appears to be set when the held item of the monster is going to be used? + bool unk_item_use_action; + // 0x61: Is initalized to 0x63 (99). Changing it from this value causes the monster to + // begin rendering differently? For example, it causes entity::0xB3 to be 1 and forces + // entity::0x28 to be 0. + undefined field_0x61; + // 0x62: Flag for two-turn moves that haven't concluded yet. This is also a graphical flag. + // A value of 1 mean "high up" (Fly/Bounce). A value of 2 means some other condition like + // Dig, Shadow Force, etc. Other values are treated as invalid. Also used for the move + // Seismic Toss when throwing up the target. + u8 two_turn_move_invincible; + // 0x63: Related to handling AI when a decoy is present on the floor? + // Seems to only be 0, 1, 2 + undefined decoy_ai_tracker; +#ifndef JAPAN + undefined field_0x64; + undefined field_0x65; + undefined field_0x66; +#endif + // 0x67: 1 means normal. 0 means half speed. 2, 3, and 4 mean 2x, 3x, and 4x speed. + int speed_stage; + // Each counter ticks down to 0 turn by turn. The current speed_stage is calculated as: + // min(max({# nonzero speed_up_counters} - {# nonzero speed_down_counters}, 0), 4) + u8 speed_up_counters[5]; // 0x6B + u8 speed_down_counters[5]; // 0x70 + u8 stockpile_stage; // 0x75: Goes from 0-3. STATUS_STOCKPILING if nonzero +}; + +// A bitfield where every bit controls one of the icons that can appear on top of a monster's sprite +// to represent status effects. If multiple bits are set, the shown icon cycles through them. +struct status_icon_flags { + bool f_sleepless : 1; // Blue eye blinking yellow + bool f_burn : 1; // Red flame + bool f_poison : 1; // White skull + bool f_toxic : 1; // Purple skull + bool f_confused : 1; // Yellow birds + bool f_cowering : 1; // 2 green lines in circle (same as whiffer) + bool f_taunt : 1; // Fist icon + bool f_encore : 1; // Blue exclamation mark (same as low HP) + // Blue shield with white sparks. Also for counter, mini counter, mist, + // metal burst, aqua ring, and lucky chant + bool f_reflect : 1; + bool f_safeguard : 1; // Pink shield. Also for mirror coat + bool f_light_screen : 1; // Golden shield. Also for magic coat + bool f_protect : 1; // Green shield. Also for mirror move and vital throw + bool f_endure : 1; // Blue shield with red sparks + bool f_low_hp : 1; // Blue exclamation mark (same as encore) + bool f_curse : 1; // Red skull + bool f_embargo : 1; // Yellow exclamation mark. Also for gastro acid and snatch + bool f_sure_shot : 1; // Blue sword blinking yellow + bool f_whiffer : 1; // 2 green lines in circle (same as cowering) + bool f_set_damage : 1; // Blue sword blinking red + bool f_focus_energy : 1; // Red sword blinking yellow + bool f_blinded : 1; // Blue eye with an X + bool f_cross_eyed : 1; // Blue question mark + bool f_eyedrops : 1; // Blue eye blinking yellow with a circular wave + bool f_muzzled : 1; // Blinking red cross + bool f_grudge : 1; // Purple shield + bool f_exposed : 1; // Blue eye blinking red with a circular wave + bool f_sleep : 1; // Red Z's + bool f_lowered_stat : 1; // Yellow arrow pointing down + bool f_heal_block : 1; // Blinking green cross + bool f_miracle_eye : 1; // Blinking orange cross + bool f_red_exclamation_mark : 1; // Probably unused + bool f_magnet_rise : 1; // Purple arrow pointing up + + // The following 4 bytes appear to have a different meaning, maybe they are intended to + // represent icons that are always displayed and do not cycle (inferred from the difference + // between the ice block and the other icons). Except for the first bit, the others do not + // seem to have an effect, but the code stores the full 4 bytes as a bitwise OR of some of the + // flags (see UpdateStatusIconBitfield). + bool f_freeze : 1; // Ice block + u8 flags_unk2 : 7; + undefined field_0x5; + undefined field_0x6; + undefined field_0x7; +}; + +// Stores a parameter for an action taken by a monster +struct action_parameter { + // 0x0: Metadata for the action. + // E.g., this is the monster index when taking an action on a monster, the move index when + // using a move or a union item_index value when using an item. + u8 action_use_idx; + undefined field_0x1; + struct position item_pos; // 0x2: Position of the item to use when using an item on the floor +}; + +// Contains data used to describe an action taken by a monster. +struct action_data { + enum action action_id; // 0x0: Action ID + enum direction_id direction : 8; // 0x2: Direction in which the action will be performed + undefined field_0x3; + struct action_parameter action_parameters[2]; // 0x4: Parameters for the action + s16 field_0x10; + s16 field_0x12; +}; + + +// Monster info +struct monster { + // 0x0: flags: 2-byte bitfield + // If true, the AI will skip this monster's turn. There's also an unresearched + // check related to constriction that reads this flag + bool f_ai_unk : 1; + bool f_ai_skip_turn : 1; // If true, the AI will skip this monster's turn and reset the flag. + u8 flags_unk2 : 3; + bool f_swapping_places : 1; // Swapping places with another monster + u8 flags_unk6 : 2; + bool flags_unk8 : 1; + bool f_walking : 1; // Walking (but not dashing) + u8 flags_unk10 : 5; + bool f_swapping_places_petrified_ally : 1; // Swapping places with a petrified ally + + enum monster_id id : 16; // 0x2: + enum monster_id apparent_id : 16; // 0x4: What's outwardly displayed if Transformed + bool is_not_team_member; // 0x6: true for enemies and allied NPCs that aren't on the team + bool is_team_leader; // 0x7 + // 0x8: An ally is an NPC that isn't a normal team member, e.g. for story boss battles + bool is_ally; + enum shopkeeper_mode shopkeeper : 8; // 0x9 + u8 level; // 0xA + undefined field_0xb; + s16 team_index; // 0xC: In order by team lineup + s16 iq; // 0xE + s16 hp; // 0x10: Current HP + s16 max_hp_stat; // 0x12: Add to max_hp_boost for the actual max HP + undefined field_0x14; + undefined field_0x15; + s16 max_hp_boost; // 0x16: From Life Seeds, Sitrus Berries, etc. + undefined field_0x18; + undefined field_0x19; + u8 offensive_stats[2]; // 0x1A: {atk, sp_atk} + u8 defensive_stats[2]; // 0x1C: {def, sp_def} + u8 field_0x1e; + u8 field_0x1f; + s32 exp; // 0x20: Total Exp. Points + struct monster_stat_modifiers stat_modifiers; // 0x24 + s16 hidden_power_base_power; // 0x44 + enum type_id hidden_power_type : 8; // 0x46 + undefined field_0x47; + enum dungeon_id joined_at : 8; // 0x48: Also used as a unique identifier for special monsters + u8 joined_at_floor; // 0x49: Floor number of recruitment. 0 for special recruits + struct action_data action; // 0x4A: Determines the action the monster will take on this turn + enum type_id types[2]; // 0x5E + enum ability_id abilities[2]; // 0x60 + struct item held_item; // 0x62 + // 0x68: Previous held item. Used for whenever taking the X-Ray Specs or Y-Ray Specs on or off + // in order to update the camera and minimap. Changed to held_item.id after checking. + enum item_id previous_held_item_id; + // Previous position data is used by the AI + struct position prev_pos; // 0x6A: Position 1 turn ago + struct position prev_pos2; // 0x6E: Position 2 turns ago + struct position prev_pos3; // 0x72: Position 3 turns ago + struct position prev_pos4; // 0x76: Position 4 turns ago + undefined field_0x7a; + undefined field_0x7b; + enum ai_objective ai_objective : 8; // 0x7C + bool ai_not_next_to_target; // 0x7D: This NPC monster is not next to its current target + bool ai_targeting_enemy; // 0x7E: This NPC monster is targeting an enemy monster + bool ai_turning_around; // 0x7F: This NPC monster has decided to turn around + // 0x80: entity::spawn_genid of the entity currently being targeted + u16 ai_target_spawn_genid; + undefined field_0x82; + undefined field_0x83; + struct entity* ai_target; // 0x84: Current or most recent AI target + undefined field_0x88; + undefined field_0x89; + undefined field_0x8a; + undefined field_0x8b; + struct position ai_target_pos; // 0x8C: Position of the entity currently being targeted + // 0x90: Work array while updating skills in the menu. Same meaning as iq_skill_flags. + u32 iq_skill_menu_flags[3]; + // 0x9C: First 9 bytes contain bitfield data; the rest is presumably padding. + // Bitvector. See enum iq_skill_id for the meaning of each bit. + u32 iq_skill_flags[3]; + enum tactic_id tactic : 8; // 0xA8 + + //struct statuses statuses; // 0xA9 / Need to be inline for alignment + bool roost; + // 0xAA / 0x1: The typing in entity::types before the flying type is removed for statuses::roost + // and restored to entity::types after statuses::roost ends. + enum type_id original_types[2]; + // 0xAC / 0x3: The move id to be used if statuses::bide is 1. + u8 bide_move_id; + undefined field_0xad; + undefined field_0xae; + undefined field_0xaf; + // 0xB0 / 0x7: Unique number given to the monster when spawning to differentiate it from other + // monsters and to properly keep track of a monster. Likely used because a monster could be + // spawned into the same slot as an old monster and using a pointer alone could cause some + // issues. Used for Leech Seed, Destiny Bond, Storm Drain, Lightning Rod (probably more). + u32 unique_id; + // 0xB4 / 0xB: Unique number between the wrapped and wrapping target to connect them. + u32 wrap_pair_unique_id; + // 0xB8 / 0xF: Tracks the damage taken to deal when bide status ends. Max 0x3E7 (999). + u32 bide_damage_tally; + enum monster_behavior monster_behavior : 8; // 0xBC / 0x13 + u8 sleep; // 0xBD / 0x14: STATUS_SLEEP if 1 + u8 sleep_turns; // 0xBE / 0x15: Turns left for the status in statuses::sleep + u8 burn; // 0xBF / 0x16: STATUS_BURN if 1 + u8 burn_turns; // 0xC0 / 0x17: Turns left for the status in statuses::burn + // 0xC1 / 0x18: Turns left until residual damage for the status in statuses::burn, if applicable + u8 burn_damage_countdown; + // 0xC2 / 0x19: The number of times the statuses::burn_damage_countdown has reached 0. Only used + // when badly poisoned. Determines how much damage the badly poisoned status condition + // will deal. There is no noticable difference because the table this value is looked up + // on is filled with 0x6 + u8 badly_poisoned_damage_count; + undefined field_0xc3; + u8 freeze; // 0xc4 / 0x1B: STATUS_FROZEN if 1 + undefined field_0xc5; + undefined field_0xc6; + undefined field_0xc7; + // 0xC8 / 0x1F: Controls the animation that plays when taking damage from the constriction status. + // For some reason this is initalized to 0x22 (34)? Which is the animation used by + // the exclusive item Nether Veil. + u32 constriction_animation; + u8 freeze_turns; // 0xCC / 0x23: Turns left for the status in statuses::freeze + // 0xCD / 0x24: Turns left until residual damage for the status in statuses::freeze, if applicable + u8 freeze_damage_countdown; + undefined field_0xCE; + undefined field_0xCF; + u8 cringe; // 0xD0 / 0x27: STATUS_CRINGE if 1 + u8 cringe_turns; // 0xD1 / 0x28: Turns left for the status in statuses::cringe + u8 bide; // 0xD2 / 0x29: STATUS_BIDE if 1 + u8 bide_turns; // 0xD3 / 0x2A: Turns left for the status in statuses::bide + u8 bide_move_slot; // 0xD4 / 0x2B: Slot in the user's move list + u8 reflect; // 0xD5 / 0x2C: STATUS_REFLECT if 1 + u8 reflect_turns; // 0xD6 / 0x2D: Turns left for the status in statuses::reflect + // 0xD7 / 0x2E: Turns left until residual healing for the status in statuses::reflect, if applicable + u8 reflect_damage_countdown; + u8 curse; // 0xD8 / 0x2F: STATUS_CURSED if 1 + // 0xD9 / 0x30: Set to monster::is_not_team_member of the attacker (the one causing the decoy status). + u8 curse_applier_non_team_member_flag; + // 0xDA / 0x31: Set to 1 on a Pokemon when inflicted with the Decoy status. + undefined unk_decoy_tracker; + u8 curse_turns; // 0xDB / 0x32: Turns left for the status in statuses::curse + // 0xDC / 0x33: Turns left until residual damage for the status in statuses::curse, if applicable + u8 curse_damage_countdown; + undefined field_0xdd; + undefined field_0xde; + undefined field_0xdf; + u8 leech_seed; // 0xE0 / 0x37: STATUS_LEECH_SEED if 1 + undefined field_0xe1; + undefined field_0xe2; + undefined field_0xe3; + // 0xE4 / 0x3B: Used to track the statuses::statuses_unique_id of the relevant monster for + // statuses like Leech Seed and Destiny Bond. + u32 statuses_applier_id; + // 0xE8 / 0x3F: Index into entity_table_hdr::monster_slot_ptrs in the dungeon that the user + // (drainer) is held. + u8 leech_seed_source_monster_index; + u8 leech_seed_turns; // 0xE9 / 0x40: Turns left for the status in statuses::leech_seed + // 0xEA / 0x41: Turns left until residual damage for the status in statuses::leech_seed, if applicable. + // Behaves weirdly without an afflictor + u8 leech_seed_damage_countdown; + undefined field_0xEB; + u8 sure_shot; // 0xEC / 0x43: STATUS_SURE_SHOT if 1 + u8 sure_shot_turns; // 0xED / 0x44: Turns left for the status in statuses::sure_shot + u8 long_toss; // 0xEE / 0x45: STATUS_LONG_TOSS if 1 + u8 invisible; // 0xEF / 0x46: STATUS_INVISIBLE if 1 + u8 invisible_turns; // 0xF0 / 0x47: Turns left for the status in statuses::invisible + u8 blinded; // 0xF1 / 0x48: STATUS_BLINKER if 1 + u8 blinded_turns; // 0xF2 / 0x49: Turns left for the status in statuses::blinded + u8 muzzled; // 0xF3 / 0x4A: STATUS_MUZZLED if 1 + u8 muzzled_turns; // 0xF4 / 0x4B: Turns left for the status in statuses::muzzled + u8 miracle_eye; // 0xF5 / 0x4C: STATUS_MIRACLE_EYE if 1 + u8 miracle_eye_turns; // 0xF6 / 0x4D: Turns left for the status in statuses::miracle_eye + u8 magnet_rise; // 0xF7 / 0x4E: STATUS_MAGNET_RISE if 1 + u8 magnet_rise_turns; // 0xF8 / 0x4F: Turns left for the status in statuses::magnet_rise + bool power_ears; // 0xF9 / 0x50: STATUS_POWER_EARS + bool scanning; // 0xFA / 0x51: STATUS_SCANNING + bool stair_spotter; // 0xFB / 0x52: STATUS_STAIR_SPOTTER + // 0xFC / 0x53: Set when initally spawning a team member with the ability Pickup. + bool pickup_flag; + bool grudge; // 0xFD / 0x54: STATUS_GRUDGE + bool exposed; // 0xFE / 0x55: STATUS_EXPOSED (Foresight/Odor Sleuth) + bool type_changed; // 0xFF / 0x56: Flag for if the monster's type has been changed + bool boss_flag; // 0x100 / 0x57: Seems to be true for boss monsters + // 0x101 / 0x58: Appears to be a flag for when a monster increasces their speed. Maybe only used + // by the RunLeaderTurn function to know if the leader has changed their speed stage partway + // through the function? + undefined unk_sped_up_tracker; + // 0x102 / 0x59: Maybe related to being a team member and new recruit? Set to 1 in TryRecruit + // and 0 in SpawnTeam. Also checked in EnemyEvolution to be 0 before evolving. Maybe to + // prevent a recently recruited ally from evolving after and or to add a monster to the + // assembly after the completion of a dungeon? + undefined field_0x102; +#ifndef JAPAN + // 0x103 / 0x5A: Possibly a flag while in action. Could also be a flag to cause the burn from + // lava, heal a burn from water, and decrease hunger in the walls. + bool in_action; +#endif + // 0x104 / 0x5B: STATUS_TERRIFIED, interestingly, appears to use 0x1 for the Foe-Fear Orb but + // 0x2 for the ability Stench. The distinction only seems to exist for the game to use + // a special message for when terrified from stench ends. + u8 terrified; + u8 terrified_turns; // 0x105 / 0x5C: Turns left for the terrified status + u8 perish_song_turns; // 0x106 / 0x5D: Turns left before Perish Song takes effect + // 0x107 / 0x5E: Increases progressively while the No-Slip Cap is held. Capped at 0x13 + // Used to calculate the chance of an item becoming sticky, resets to 0 when that happens + u8 no_slip_cap_counter; + // 0x108 / 0x5F: Determines how much experience the monster will reward after being defeated + // 0 = 0.5x, 1 = 1.0x, 2 = 1.5x + u8 exp_yield; + // 0x109 / 0x60: Appears to be set when the held item of the monster is going to be used? + bool unk_item_use_action; + // 0x10A / 0x61: Is initalized to 0x63 (99). Changing it from this value causes the monster to + // begin rendering differently? For example, it causes entity::0xB3 to be 1 and forces + // entity::0x28 to be 0. + undefined field_0x10a; + // 0x10B / 0x62: Flag for two-turn moves that haven't concluded yet. This is also a graphical flag. + // A value of 1 mean "high up" (Fly/Bounce). A value of 2 means some other condition like + // Dig, Shadow Force, etc. Other values are treated as invalid. Also used for the move + // Seismic Toss when throwing up the target. + u8 two_turn_move_invincible; + // 0x10C / 0x63: Related to handling AI when a decoy is present on the floor? + // Seems to only be 0, 1, 2 + undefined decoy_ai_tracker; +#ifndef JAPAN + undefined field_0x10d; + undefined field_0x10e; + undefined field_0x10f; +#endif + // 0x110 / 0x67: 1 means normal. 0 means half speed. 2, 3, and 4 mean 2x, 3x, and 4x speed. + int speed_stage; + // Each counter ticks down to 0 turn by turn. The current speed_stage is calculated as: + // min(max({# nonzero speed_up_counters} - {# nonzero speed_down_counters}, 0), 4) + u8 speed_up_counters[5]; // 0x114 / 0x6B + u8 speed_down_counters[5]; // 0x119 / 0x70 + u8 stockpile_stage; // 0x11E / 0x75: Goes from 0-3. STATUS_STOCKPILING if nonzero + + + undefined field_0x11f; + // 0x120: If zero, when the monster is standing in a room, the AI will make it head towards a + // random exit. If nonzero, the monster will instead move in a random direction every turn. + int random_movement; + struct move moves[4]; // 0x124 + u8 move_flags; // 0x144: 1-byte bitfield + undefined field_0x145; + struct fixed_point belly; // 0x146 + struct fixed_point max_belly; // 0x14A: + // 0x14E: If true and the monster is an ally, the AI will skip it. False for enemies. + bool ai_ally_skip; + bool ai_next_to_target; // 0x14F: This NPC monster is next to its current target + // 0x150: Set if monster::is_team_leader is true and belly is empty. + bool famished; + undefined field_0x151; + // 0x152: Seems to be true if the monster has already acted this turn: attacked, used an item, + // or seemingly anything other than moving/resting. Also true when the monster faints. + bool already_acted; + // 0x153: True if this enemy should evolve. It is not enough to set this flag to evolve + // an enemy monster. You also need to set dungeon::should_enemy_evolve. + bool should_evolve; + // 0x154: True if using a charged move. Changed together with statuses::bide. + bool using_charged_move; + // 0x155: True if the target attacked a Pokemon that has STATUS_GRUDGE. + bool hit_grudge_monster; + undefined field_0x156; // 0 when the monster faints + undefined field_0x157; + // 0x158: General-purpose bitflags tracking different bits of volatile state. + // Together with prev_state_bitflags, this is typically used to determine whether + // to log a message on a state change. + u16 state_flags; + // 0x15A: The previous value of state_bitflags before the last update + u16 prev_state_flags; + // 0x15C: Appears to control if flash fire should activate. + bool apply_flash_fire_boost; + // 0x15D: Appears to be a counter for how many times rollout has hit. Likely to be able to + // determine how much extra damage consecutive rollout hits should deal. + u8 rollout_hit_counter; + // 0x15E: If true, the monster is warped after completing its move. + bool memento_warp_flag; + // 0x15F: If true, the monster's special attack is dropped after the completing its move. + bool overheat_special_attack_drop_flag; + // 0x160: If true, the monster's shadow is drawn. This value is initalized to 1 for every + // monster except Diglett and Dugtrio. + bool display_shadow; + // 0x161: If true, prevents giving items to this monster. Might have a broader meaning, + // such as whether the monster is a guest pokémon. + bool cannot_give_items; + // 0x162: Related to using a move and either missing or fainting. Set to 1 right before + // the function for a move is called and set to 0 (sometimes) in ApplyDamage. Gets set + // when the monster faints sometimes with field 0x156. When false, causes random + // outcomes with the monster to fail. + bool field_0x162; + // 0x163: Related to controlling the number of attacks per move use. Possibly to account + // for two-turn moves? + bool field_0x163; + bool took_damage_flag; // 0x164: Set after the monster took damage. + // 0x165: Appears to be some sort of validity check? Where 0 is valid and 1 is invalid. + // HandleFaint sets this number to 1. Also set to 1 if IsMonsterIdInNormalRange is false. + bool field_0x165; + // 0x166: Set after the monster attacks (true if the attack missed, false otherwise). If true + // when the monster attacks, Practice Swinger will activate. + bool practice_swinger_flag; + // 0x167: Set to true when the monster receives a critical hit. If true when the monster + // attacks, Anger Point will activate. Set to false after the monster attacks. + bool anger_point_flag; + undefined field_0x168; + undefined field_0x169; + // 0x16A: When not DIR_NONE, monster will turn in the specified direction and + // its AI will be forced to target the tile next to it in that direction. + // Used to prevent bosses from turning towards team members the moment the boss fight + // starts (which would override their intended starting facing direction). + enum direction_id force_turn : 8; + undefined field_0x16b; + undefined field_0x16c; + undefined field_0x16d; + undefined field_0x16e; + undefined field_0x16f; + // 0x170: Set to make the monster disappear when using the move U-turn. + bool uturn_hide_monster_flag; + // 0x171: Some kind of visual flag? Gets set to 0 temporarily when changing Shaymin form + // or when using the Gone Pebble? Also hardcoded to be set to 0 for monsters that generally + // tend to float? Otherwise 1? + bool field_0x171; + // 0x172: Set when the leader and falling through a pitfall trap. + bool pitfall_trap_flag_0x172; + // 0x173: Some kind of visual flag? + bool field_0x173; + // 0x174: Set when the leader and falling through a pitfall trap. + bool pitfall_trap_flag_0x174; + undefined field_0x175; + undefined field_0x176; + // 0x177: Appears to be the direction for using sleep talk? Set to DIR_NONE when awake. + enum direction_id sleep_talk_direction : 8; + // 0x178: Appears to be the direction for using snore? Set to DIR_NONE when awake. + enum direction_id snore_direction : 8; + // 0x179: Seems to be set to 4 when the monster initally throws something and probably + // related to direction somehow. Checked in a loop for every monster. + u8 field_0x179; + // 0x17A: Somehow related to sprite size? + undefined field_0x17a; + // 0x17B: Somehow related to sprite size? + undefined field_0x17b; + undefined field_0x17c; + undefined field_0x17d; + struct position target_pos; // 0x17E: The AI's target's position on screen + struct position pixel_pos; // 0x182: The monster's graphical position on screen? + undefined field_0x186; + undefined field_0x187; + undefined field_0x188; + undefined field_0x189; + undefined field_0x18a; + undefined field_0x18b; + // 0x18C: Bitflags that cause non-damaging exclusive items to trigger on the + // attacker after they have completed their move. For example, the Eclipse Robe + // (Darkrai exclusive item) may afflict attacking enemies with the nightmare + // status condition. (Only uses first 21 bits). + u32 exclusive_item_trigger_bitflags; + // 0x190: Appears to be related to the item name of the exclusive item that + // caused the effect to trigger. + s16 field_0x190; + // 0x192: Bitflags that cause non-damaging abilities to trigger on the attacker + // after they have completed their move. Abilites like magnet pull, cute charm, + // static, and flame body. (Only uses first 11 bits). One exception is the move + // Rapid Spin which sets one of the flags for the user. + u16 contact_ability_trigger_bitflags; + undefined field_0x194; + undefined field_0x195; + undefined field_0x196; + undefined field_0x197; + undefined field_0x198; + undefined field_0x199; + undefined field_0x19a; + undefined field_0x19b; + struct position pos; // 0x19C: Mirror of the position on the entity struct + undefined field_0x1a0; + undefined field_0x1a1; + undefined field_0x1a2; + undefined field_0x1a3; + undefined field_0x1a4; + undefined field_0x1a5; + undefined field_0x1a6; + undefined field_0x1a7; + undefined field_0x1a8; + undefined field_0x1a9; + undefined field_0x1aa; + undefined field_0x1ab; + undefined field_0x1ac; + undefined field_0x1ad; + undefined field_0x1ae; + undefined field_0x1af; + undefined field_0x1b0; + undefined field_0x1b1; + undefined field_0x1b2; + undefined field_0x1b3; + u16 walk_anim_frames_left; // 0x1B4: Number of frames left in walking animation? + undefined field_0x1b6; + undefined field_0x1b7; + undefined field_0x1b8; + undefined field_0x1b9; + undefined field_0x1ba; + undefined field_0x1bb; + undefined field_0x1bc; + undefined field_0x1bd; + undefined field_0x1be; + undefined field_0x1bf; + undefined field_0x1c0; + undefined field_0x1c1; + undefined field_0x1c2; + undefined field_0x1c3; + undefined field_0x1c4; + undefined field_0x1c5; + undefined field_0x1c6; + undefined field_0x1c7; + undefined field_0x1c8; + undefined field_0x1c9; + undefined field_0x1ca; + undefined field_0x1cb; + undefined field_0x1cc; + undefined field_0x1cd; + undefined field_0x1ce; + undefined field_0x1cf; + undefined field_0x1d0; + undefined field_0x1d1; + undefined field_0x1d2; + undefined field_0x1d3; + undefined field_0x1d4; + undefined field_0x1d5; + undefined field_0x1d6; + undefined field_0x1d7; + undefined field_0x1d8; + undefined field_0x1d9; + undefined field_0x1da; + undefined field_0x1db; + undefined field_0x1dc; + undefined field_0x1dd; + undefined field_0x1de; + undefined field_0x1df; + undefined field_0x1e0; + undefined field_0x1e1; + undefined field_0x1e2; + undefined field_0x1e3; + undefined field_0x1e4; + undefined field_0x1e5; + undefined field_0x1e6; + undefined field_0x1e7; + undefined field_0x1e8; + undefined field_0x1e9; + undefined field_0x1ea; + undefined field_0x1eb; + undefined field_0x1ec; + undefined field_0x1ed; + undefined field_0x1ee; + undefined field_0x1ef; + undefined field_0x1f0; + undefined field_0x1f1; + undefined field_0x1f2; + undefined field_0x1f3; + undefined field_0x1f4; + undefined field_0x1f5; + undefined field_0x1f6; + undefined field_0x1f7; + undefined field_0x1f8; + undefined field_0x1f9; + undefined field_0x1fa; + undefined field_0x1fb; + undefined field_0x1fc; + undefined field_0x1fd; + undefined field_0x1fe; + undefined field_0x1ff; + undefined field_0x200; + undefined field_0x201; + undefined field_0x202; + undefined field_0x203; + undefined field_0x204; + undefined field_0x205; + undefined field_0x206; + undefined field_0x207; + undefined field_0x208; + undefined field_0x209; + undefined field_0x20a; + undefined field_0x20b; + undefined field_0x20c; + undefined field_0x20d; + undefined field_0x20e; + undefined field_0x20f; + u8 hp_fractional; // 0x210: 200 * fractional_part(HP) + undefined field_0x211; + undefined field_0x212; + undefined field_0x213; + // 0x214: Somehow related to gaining exp through a joy ribbon. Set to 0 after + // gaining or losing a level. Also checked and set to 0 when an enemy evolves. + // Maybe for a specific scenario of leveling up with exp from a joy ribbon? + u32 unk_exp_tracker; + // 0x218: Status icons displayed on top of the monster's sprite + struct status_icon_flags status_icons; + // 0x220: Seems to be related in some way to shadow size and being a water tileset. So + // probably controls when the ripple effect when standing on water. + u8 water_shadow_ripple_tracker; + // 0x221: Set if the current move being used was copied by Me First + bool me_first_flag; + undefined field_0x222; + undefined field_0x223; + // Stat boosts from exclusive items with EXCLUSIVE_EFF_STAT_BOOST + u8 exclusive_item_offense_boosts[2]; // 0x224: {atk, sp_atk} + u8 exclusive_item_defense_boosts[2]; // 0x226: {def, sp_def} + // 0x228: Bitvector. See enum exclusive_item_effect_id for the meaning of each bit + u32 exclusive_item_effect_flags[5]; + // 0x23C: Initialized to 0. Probably menu related only, seems to be set to true through the + // menu. + bool field_0x23c; + // 0x23F: When reviving a monster, temporarily set to true. Probably a visual indicator + // of some kind? + bool unk_revive_visual_tracker; + // 0x23E: Gets set to 0 before using an attack and gets set to 1 in LevelUp. Seems to stop + // the rest of the attacks (ie from Swift Swim) from continuing. Possibly to avoid the + // the monster leveling up and trying to use a move that was just overwritten by a new move? + undefined field_0x23e; + // 0x23F: Gets set to 1 when the move used won't use up any PP. Used to check if the + // monster should lose extra PP from the ability Pressure. + bool should_not_lose_pp; +}; + + // Entity type. This is used to tag generic entity pointers. enum entity_type { ENTITY_NOTHING = 0, @@ -26,6 +833,7 @@ enum entity_type { // Used when a temporary instance of this struct is created to pass it to some // function that requires it as a parameter ENTITY_TEMPORARY = 6, + ENTITY_PAD = 0xffffffff, // To Force on 32 bits }; // Generic entity data @@ -68,4 +876,611 @@ struct entity { void* info; // 0xB4: Points to info struct for monster/item/trap }; -#endif //PMDSKY_DUNGEON_MODE_H \ No newline at end of file +// Used in menus and the post-dungeon summary. +struct monster_summary { + enum monster_id id; // 0x0 + u8 monster_name[10]; // 0x2 + undefined field_0xC; + undefined field_0xD; + undefined field_0xE; + undefined field_0xF; + undefined field_0x10; + undefined field_0x11; + undefined field_0x12; + undefined field_0x13; + undefined field_0x14; + undefined field_0x15; + enum type_id types[2]; // 0x16 + enum ability_id abilities[2]; // 0x18 + enum dungeon_id joined_at; // 0x1A + u8 joined_at_floor; // 0x1B + struct item held_item; // 0x1C + undefined field_0x22; + undefined field_0x23; + s32 hp; // 0x24: Current HP + s32 max_hp; // 0x28: Actual max HP (hp + hp boost) + u32 level; // 0x2C + s32 exp; // 0x30 + u8 offensive_stats[2]; // 0x34: {atk, sp_atk} + u8 defensive_stats[2]; // 0x36: {def, sp_def} + bool is_team_leader; // 0x38 + u8 attack_boost; // 0x39: from things like Power Band, Munch Belt + u8 special_attack_boost; // 0x3A + u8 defense_boost; // 0x3B + u8 special_defense_boost; // 0x3C + undefined field_0x3D; + s16 iq; // 0x3E + undefined field_0x40; + undefined field_0x41; + // 0x42: Level upon first evolution. Set to 0 in dungeon mode. + u8 level_at_first_evo; + // 0x43: Level upon first evolution. Set to 0 in dungeon mode. + u8 level_at_second_evo; + // 0x44: Evolution status. In ground_mode, accounts for luminous spring being unlocked. + u8 evo_status; + bool inflicted_with_gastro_acid; // 0x45 + undefined field_0x46; + undefined field_0x47; + u32 iq_skill_flags[3]; // 0x48 + enum tactic_id tactic; // 0x54 + undefined field_0x55; + undefined field_0x56; + undefined field_0x57; + // 0x58: Appears to be a list of all the currently inflicted statues in their enum form. The + // last entry (30th) appears to always be STATUS_NONE to serve as a terminator for the list. + // While in ground mode, it's always filled with STATUS_NONE. + enum status_id active_statuses[30]; + undefined2 _padding_0x76; +}; + +// Info about a mission destination floor +struct mission_destination_info { + bool is_destination_floor; // 0x0: Whether or not the current floor is a mission destination + enum mission_type type; // 0x1: + // 0x2: The meaning of this field depends on the type field; see union mission_subtype. + u8 subtype; + // 0x3: The index of the mission in the job list? + u8 mission_job_list_idx; + // 0x4: Item to retrieve, if this is an item-retrieval mission + enum item_id item_to_retrieve; + enum item_id item_to_deliver; // 0x6: Item to deliver to the client, if relevant + enum item_id special_target_item; // 0x8: For Sealed Chamber and Treasure Memo missions + enum monster_id client; // 0xA: The client on the mission listing + enum monster_id rescue_target; // 0xC: The monster to be rescued + // 0xE: Usually just the target to defeat. If an outlaw has minions, the monster IDs will be + // listed in subsequent entries. Note that there can be multiple minions of the same species, + // which is not reflected here. + enum monster_id enemy_species[3]; + u8 n_enemy_species; // 0x14: Length of the preceding array + undefined field_0x15; + // 0x16: Fixed room ID of the destination floor, if relevant + // (e.g., Chambers, Challenge Letters, etc.) + enum fixed_room_id fixed_room_id; + // 0x17: Related to missions where you have to obtain an item? Possibly related to the item + // being picked up and/or destroyed? + bool unk_mission_item_tracker1; + undefined field_0x18; + undefined field_0x19; + // 0x1A: Related to missions where you have to obtain an item? Possibly related to the item + // being picked up and/or destroyed? + bool unk_mission_item_tracker2; + // 0x1B: Will be set after the target enemy has been defeated. + // If there are minions, this flag applies just to the main outlaw. + bool target_enemy_is_defeated; +}; + +// Contains data about a monster that spawns in a dungeon +struct monster_spawn_entry { + u16 level_mult_512; // 0x0: Spawn level << 9 + // 0x2: Incremental spawn weight of this entry for normal spawns + u16 incremental_spawn_weight; + // 0x4: Incremental spawn weight of this entry for monster house spawns + u16 incremental_spawn_weight_monster_house; + // 0x6: Monster id. Depending on where this struct is used, it can have values above 600 + // to list secondary gender entries. + enum monster_id id; +}; + +// Dungeon floor properties +struct floor_properties { + enum floor_layout layout; // 0x0 + // 0x1: Affects the number of rooms to be generated. If it's positive, a slight random variation + // (between -2 and +1) is applied to the value (the final value must be at least 1). If it's + // negative, its absolute value is used without adding a random variation. + s8 room_density; + u8 tileset; // 0x2 + // 0x3: Indexes into the music ID table in overlay 10 to determine the floor's music track. + // See the relevant descriptions in the overlay 10 symbols for more information. + u8 music_table_idx; + enum weather_id weather; // 0x4 + // 0x5: Controls how many connections will be made between grid cells + u8 floor_connectivity; + // 0x6: Controls how many enemies will be spawned. If 0, no enemies will spawn, even as the + // player walks. + // The final value will be 0 in the special case that density is 0. Otherwise, the final value + // will be randomized between density / 2 and density - 1, but no lower than 1. + // The code seems to imply that the value was meant to be signed, since it contains a section + // that takes the absolute value of the density while skipping the random variation, similar to + // room_density. + u8 enemy_density; + u8 kecleon_shop_spawn_chance; // 0x7: Percentage chance from 0-100 + u8 monster_house_spawn_chance; // 0x8: Percentage chance from 0-100 + u8 maze_room_chance; // 0x9: Percentage chance from 0-100 + u8 sticky_item_chance; // 0xA + // 0xB: Whether or not dead ends are allowed in the floor layout. If false, dead ends will be + // corrected during floor generation (or rather, they should be, but the implementation is + // buggy) + bool allow_dead_ends; + // 0xC: Maximum number of secondary structures that can be generated on the floor + u8 max_secondary_structures; + // 0xD: room_flags: 1-byte bitfield + bool f_secondary_structures : 1; // Whether secondary structures are allowed + u8 room_flags_unk1 : 1; + bool f_room_imperfections : 1; // Whether room imperfections are allowed + u8 room_flags_unk3 : 5; + + undefined field_0xe; + u8 item_density; // 0xF: Controls how many items will be spawned + u8 trap_density; // 0x10: Controls how many traps will be spawned + u8 floor_number; // 0x11: The current floor number within the overall dungeon + enum fixed_room_id fixed_room_id; // 0x12 + u8 extra_hallways; // 0x13: Number of extra hallways to generate + u8 buried_item_density; // 0x14: Controls how many buried items (in walls) will be spawned + // 0x15: Controls how much secondary terrain (water, lava, and this actually applies to chasms + // too) will be spawned + u8 secondary_terrain_density; + // 0x16: Vision range (in tiles) when standing on a hallway. + // A value of 0 means no limit, a value > 0 enables darkness on the floor. + u8 visibility_range; + u8 max_money_amount_div_5; // 0x17: 1/5 the maximum amount for Poké spawns + // 0x18: Chance of an item spawning on each tile in a Kecleon shop + enum shop_item_positions shop_item_positions; + // 0x19: Chance that a Monster House will be an itemless one + u8 itemless_monster_house_chance; + // 0x1A: Values are shifted relative to enum hidden_stairs_type. + // 0 means HIDDEN_STAIRS_SECRET_BAZAAR, 1 means HIDDEN_STAIRS_SECRET_ROOM, and + // 255 still means HIDDEN_STAIRS_RANDOM_SECRET_BAZAAR_OR_SECRET_ROOM. + u8 hidden_stairs_type; + u8 hidden_stairs_spawn_chance; // 0x1B + u8 enemy_iq; // 0x1C: IQ stat of enemies + u8 iq_booster_value; // 0x1E: IQ increase from the IQ booster item upon entering the floor +}; + +// Contains the data required to display a tile on the minimap +struct minimap_display_tile { + undefined4 field_0x0; + undefined4 field_0x4; + undefined4 field_0x8; + undefined4 field_0x0C; + undefined4 field_0x10; + undefined4 field_0x14; + undefined4 field_0x18; + undefined4 field_0x1C; + undefined4 field_0x20; + undefined4 field_0x24; + undefined4 field_0x28; + undefined4 field_0x2C; + undefined4 field_0x30; + undefined4 field_0x34; + undefined4 field_0x38; + undefined4 field_0x3C; +}; + +// Contains the graphical representation of minimap tiles +struct minimap_display_data { + // 0x0: Matrix that contains tile display data. Each chunk of 4x4 tiles shares + // a single entry in this matrix. (To calculate which entry corresponds to a + // given (x,y) coordinate, simply divide both x and y by 2 and drop decimals) + struct minimap_display_tile tile_matrix_1[16][28]; + // 0x7000: Another matrix just like the first one + struct minimap_display_tile tile_matrix_2[16][28]; + // 0xE000: Weird byte matrix. + // The code that initializes this matrix fills 56 bytes + // per row, which seems like an oversight. + // On top of that, starting at 0xE1C0 there's a pointer table that gets overwritten every time + // this matrix is rebuilt, only to be restored later. There's probably + // an union involved somewhere, but right now there's not enough information + // to know where exactly. + undefined field_0xE000[32][28]; + undefined overwritten_extra_bytes[28]; // 0xE380 + undefined4 field_0xE39C[41]; // 0xE39C: Array of pointers + undefined4 field_0xE440; + undefined field_0xE444; + undefined field_0xE445; + undefined field_0xE446; + undefined field_0xE447; + undefined field_0xE448; + // Padding? + undefined field_0xE449; + undefined field_0xE44A; + undefined field_0xE44B; +}; + +// Struct that seems to hold data related to the map, the camera and the touchscreen numbers +struct display_data { + struct position camera_pos; // 0x0: Position of the tile the camera is currently pointing to + // 0x4: Copy of 0x0. Used to detect changes in the camera's position. + struct position camera_pos_mirror; + // 0x8: Pixel position of the tile the camera is currently pointing to + struct position camera_pixel_pos; + struct position camera_pixel_pos_mirror; // 0xC: Mirror of 0x8 + // 0x10: Entity currently being pointed by the camera, mostly used to + // control rendering of the dungeon, GUI, minimap, etc. + struct entity* camera_target; + // 0x14: Appears to be used to determine the offset to render the screen from normal when + // shaking. + u32 screen_shake_offset; + // 0x18: Appears to be the intensity value for when the screen shakes. Decremented by + // 0x1 until 0x0. + u32 screen_shake_intensity; + // 0x1C: Appears to be the value to set to display_data::screen_shake_intensity when it + // reaches 0x0. (This number is usually 0x0 so the screen stops shaking after.) + u32 screen_shake_intensity_reset; + undefined field_0x20; // 0x20: Initialized to 0x3. + // 0x21: Same as floor_properties::visibility_range + // Affects the number of map tiles around the player's position that get marked as + // "visited" while exploring, as well as how far away you can see enemies under non-illuminated + // conditions (outside of this range, enemies will not be visible on screen). + u8 visibility_range; + // 0x22: True if the pokémon currently pointed by the camera has + // the status_id::STATUS_BLINKER effect + bool blinded; + // 0x23: True after using a Luminous Orb or in floors where darkness is forcefully disabled + bool luminous; + // 0x24: If false and luminous is false as well, darkness will be displayed graphically. + // This is set in dungeons that aren't naturally dark, and also in some fixed room floors. + bool natural_lighting; + // 0x25: True if the pokémon currently pointed by the camera has the Map Surveyor IQ skill + // active + bool map_surveyor; + // 0x26: True if enemies should be shown on the map. + // Seems to be a dependent property computed as + // (leader has Power Ears status OR leader has X-Ray Specs equipped). + // This is NOT affected by the luminous flag. + bool can_see_enemies; + // 0x27: True if items are being shown on the map. Similar to can_see_enemies. + bool can_see_items; + // 0x28: True if traps are being shown on the map. Similar to can_see_enemies. + bool can_see_traps; + // 0x29: True if the pokémon currently pointed by the camera has the + // status_id::STATUS_CROSS_EYED effect. + // Causes all entities to be displayed as green circles on the map. + bool hallucinating; + bool can_see_stairs; // 0x2A: True if stairs are being shown on the map + undefined field_0x2B; // 0x2B: Initialized to 0 + undefined field_0x2C; + bool darkness; // 0x2D: True if there's darkness on the floor + undefined field_0x2E; // 0x2E: Initialized to 1 + // 0x2F: True if the leader is being pointed by the camera right now. If false, UI digits will + // be displayed in green. + bool leader_pointed; + undefined field_0x30; // 0x30: Initialized to 1 + // 0x31: Set to 1 when losing in a dungeon. Seems to cause display_data::0x38 to + // display_data::leader_max_hp_touch_screen to become 0xFFFF (-1). + bool unk_fade_to_black_tracker; + undefined field_0x32; // 0x32: Initialized to 0 + undefined field_0x33; // 0x33: Initialized to 0 + undefined field_0x34; // 0x34: Is used, related to lighting? + bool team_menu_or_grid; // 0x35: True when the team menu is opened or while Y is being held + // Derived from internal direction in leader info block + enum direction_id leader_target_direction; // 0x36 + enum direction_id leader_target_direction_mirror; // 0x37 + undefined2 field_0x38; // 0x38: Initialized to 0xFFFF (-1). + undefined2 field_0x3A; // 0x3A: Initialized to 0xFFFF (-1). + s16 floor_touch_screen; // 0x3C: Floor number displayed on the touch screen + s16 leader_level_touch_screen; // 0x3E: Leader's level displayed on the touch screen + s16 leader_hp_touch_screen; // 0x40: Leader's current HP displayed on the touch screen + s16 leader_max_hp_touch_screen; // 0x42: Leader's max HP displayed on the touch screen + undefined2 field_0x44; + // Padding? + undefined field_0x46; + undefined field_0x47; +}; + +// Used during floor generation to keep track of what entities should be spawned where +struct spawn_flags { + bool f_stairs : 1; + bool f_item : 1; + bool f_trap : 1; + bool f_monster : 1; + u8 spawn_flags_unk4 : 4; + u8 spawn_flags_unk8 : 8; +}; + +// Used during dungeon play to record the visibility of a tile. +struct visibility_flags { + // If f_revealed == true and f_visited == false, the tile will appear as gray on the map. + // This happens, e.g., when a Luminous Orb is used. + bool f_revealed : 1; // Revealed on the map. + bool f_visited : 1; // Visited by the player + u8 visibility_flags_unk2 : 6; + u8 visibility_flags_unk8 : 8; +}; + +// These flags seem to occupy the same memory location, so the meaning is context-dependent. +union spawn_or_visibility_flags { + struct spawn_flags spawn; + struct visibility_flags visibility; +}; + +// Information about the rooms on the current floor +struct room_data { + u8 room_id; + undefined field_0x1; // Initialized to 0 + struct position bottom_right_corner; // 0x2 + struct position top_left_corner; // 0x6 + undefined field_0xa; // Doesn't get initialized, likely padding + undefined field_0xb; // Doesn't get initialized, likely padding + undefined4 field_0xc; // Initialized to (bottom_right_corner.x - 1) * 0x1C + undefined4 field_0x10; // Initialized to (bottom_right_corner.y - 1) * 0x1C + undefined4 field_0x14; // Initialized to (top_left_corner.x + 1) * 0x1C + undefined4 field_0x18; // Initialized to (top_left_corner.y + 1) * 0x1C +}; + +// Tile data +struct tile { + // 0x0: terrain_flags: 2-byte bitfield + //u16 terrain_flags; + enum terrain_type terrain_type : 2; + // This tile can be corner-cut when walking. Seemingly only used during dungeon generation. + bool f_corner_cuttable : 1; + // Includes room tiles right next to a hallway, and branching points within corridors. + // Only applies to natural halls, not ones made by Absolute Mover, not "hallways" made of + // secondary terrain, etc. Used by the AI for navigation. + bool f_natural_junction : 1; + // This tile is impassable, even with Absolute Mover/Mobile Scarf. Used for the map border, + // key chamber walls, walls in boss battle rooms, etc. + bool f_impassable_wall : 1; + bool f_in_kecleon_shop : 1; // In a Kecleon Shop + bool f_in_monster_house : 1; // In a Monster House + bool terrain_flags_unk7 : 1; + // Cannot be broken by Absolute Mover. Set naturally on key doors. + bool f_unbreakable : 1; + // Tile is any type of "stairs" (normal stairs, Hidden Stairs, Warp Zone) + bool f_stairs : 1; + bool terrain_flags_unk10 : 1; + bool f_key_door : 1; // Tile is a key door + bool f_key_door_key_locked : 1; // Key door is locked and requires a Key to open + // Key door is locked and requires an escort to open (for Sealed Chamber missions) + bool f_key_door_escort_locked : 1; + bool terrain_flags_unk14 : 1; + // Tile is open terrain but unreachable from the stairs spawn point. Only set during dungeon + // generation. + bool f_unreachable_from_stairs : 1; + + // 0x2: Seems to be used for spawning entities during dungeon generation, and for visibility + // during dungeon play + union spawn_or_visibility_flags spawn_or_visibility_flags; + u16 texture_id; // 0x4: Maybe? Changing this causes the tile texture to change + undefined field_0x6; + // 0x7: Room index. 0xFF if not in a room, 0xFE on junctions during map generation (it gets set + // to 0xFF later). + u8 room; + // 0x8: Where a monster standing on this tile is allowed to move. + // Each element is a bitflag that corresponds to one of the first four values of + // enum mobility_type. Each bit in the bitflag corresponds to the values of enum direction, + // where 1 means a monster with that mobility type is allowed to walk in that direction. + u8 walkable_neighbor_flags[4]; + struct entity* monster; // 0xC: Pointer to a monster on this tile, if any + // 0x10: Pointer to an entity other than a monster on this tile (item/trap) + struct entity* object; +}; + +// Data related to dungeon generation +struct dungeon_generation_info { + // 0x0: Set if the floor layout is guaranteed to be a Monster House, or the dungeon generation + // algorithm fails + bool force_create_monster_house; + // 0x1: Set if the locked door on the floor has already been opened. + bool locked_door_opened; + // 0x2: Set if a kecleon shop was properly spawned. + bool kecleon_shop_spawned; + // 0x3: When a non-zero value, the one-room orb will fail. + undefined unk_one_room_flag; + bool dough_seed_extra_poke_flag; + // 0x5: Room index of Monster House on the floor. 0xFF if there's no Monster House + u8 monster_house_room; + // 0x6: Related to when a monster from a fixed room faints. Maybe to check if the floor + // should be over after knocking them out? + undefined unk_fixed_room_static_monster_tracker; + undefined field_0x7; + // 0x8: The type of the hidden stairs on the current floor. + enum hidden_stairs_type hidden_stairs_type; + // 0xC: Used to check to load the corresponding hidden fixed room and information for + // the corresponding type of hidden floor. + enum hidden_stairs_type hidden_floor_type; + s16 tileset_id; // 0x10 + // 0x12: Music table index (see the same field in struct floor_properties) + u16 music_table_idx; + // 0x14: Controls which trap graphics to use for the staircase. Usually 0x2B (27) and + // 0x2C (28) for down and up respectively. + u16 staircase_visual_idx; + enum fixed_room_id fixed_room_id; // 0x16 + undefined field_0x17; + undefined field_0x18; + undefined field_0x19; + u16 floor_generation_attempts; // 0x1A: Number of attempts at floor layout generation + struct tile tiles[32][56]; // 0x1C + struct position team_spawn_pos; // 0x8C1C: Position of the team spawn + struct position stairs_pos; // 0x8C20: Position of the stairs spawn + // 0x8C24: Position of the Hidden Stairs spawn, or (-1, -1) if no Hidden Stairs + struct position hidden_stairs_pos; + // 0x8C28: Spawn position of each of the team members + struct position individual_team_spawn_positions[4]; + // There's another 6 words that look like spawn positions right after these 4 +}; + +// Trap info +struct trap { + enum trap_id id; + // If 0 or 2, the trap will activate only when a team member steps on it. If 1, the trap will + // activate only when an enemy steps on it. Naturally, this seems to be 0 for traps and 2 for + // Wonder Tiles + u8 team; + + // 0x2: flags: 1-byte bitfield + //u8 flags; + bool f_unbreakable : 1; // If true, the trap can't be broken (for example, using a Trapbust Orb) + u8 flags_unk1 : 7; + + undefined field_0x3; +}; + +// Struct that contains some data used when spawning new enemies +struct enemy_spawn_stats { + enum monster_id id; // 0x0 + u16 level; // 0x2 + // 0x4: Spawn moves. Useless since each individual enemy gets its own when spawning. + enum move_id moves[4]; + u16 max_hp; // 0xC + u8 atk; // 0xE + u8 def; // 0xF + u8 sp_atk; // 0x10 + u8 sp_def; // 0x11 +}; + +// Contains the necessary information to spawn a Kecleon shopkeeper. +struct spawned_shopkeeper_data { + enum monster_id monster_id; // 0x0: The id of the monster to spawn + enum monster_behavior behavior; // 0x2: NPC behavior of the monster + bool valid; // 0x3: Indicates that this spawn data is valid + u8 pos_x; // 0x4 + u8 pos_y; // 0x5 +}; + +// Appears to contain diagnostic information related to the damage calculation routines. +struct damage_calc_diag { + enum type_id move_type; // 0x0: The type of the last move used + undefined field_0x1; + undefined field_0x2; + undefined field_0x3; + enum move_category move_category; // 0x4: The category of the last move used + // 0x8: The type matchup of the last move used against the individual types of the defender + enum type_matchup move_indiv_type_matchups[2]; + // 0xA: The modified offensive stat stage of the attacker for the last move used + u8 offensive_stat_stage; + // 0xB: The modified defensive stat stage of the defender for the last move used + u8 defensive_stat_stage; + // 0xC: The base offensive stat of the attacker for the last move used + u16 offensive_stat; + // 0xE: The base defensive stat of the defender for the last move used + u16 defensive_stat; + // 0x10: The Flash Fire boost of the attacker when a Fire move was last used + u16 flash_fire_boost; + // 0x12: The modified offense value calculated for the attacker for the last move used, + // prior to being clamped between 0 and 999 + u16 offense_calc; + // 0x14: The modified defense value calculated for the defender for the last move used + u16 defense_calc; + u16 attacker_level; // 0x16: The level of the attacker for the last move used + // 0x18: The intermediate quantity in the damage calculation called "AT" in debug logging, + // which corresponds to: round[ min(max(offense_calc, 0), 999) + power_calc ], + // where power_calc is a modified move power calculated as (intermediate rounding omitted): + // GetMovePower(...) * (offensive stat stage multipliers) * (offensive multipliers) + u16 damage_calc_at; + // 0x1A: An identical copy of defense_calc. This is probably a relic of development, + // when the final defense contribution to the damage formula might have been a different + // quantity computed from defense_calc, like how damage_calc_at is computed + // from offense_calc + u16 damage_calc_def; + // 0x1C: The intermediate quantity in the damage calculation called "FLV" in debug logging + // (effective level?), which corresponds to: round[ (offense_calc - defense_calc)/8 + level ] + u16 damage_calc_flv; + undefined field_0x1e; + undefined field_0x1f; + // 0x20: The result of the damage calculation after multiplying the base value by multipliers, + // but before applying random variation. There are also a couple stray multipliers applied + // after this result, including multipliers specific to the projectile move (the static 50%, + // and the Power Pitcher multiplier) and the Air Blade multiplier. + int damage_calc; + // 0x24: The intermediate quantity in the damage calculation resulting from the "base" damage + // calculation: the sum of the power, attack, defense, and level terms, modified by the + // non-team-member multiplier if relevant, and clamped between 1 and 999. + int damage_calc_base; + // 0x28: The random multiplier applied to the result of the damage calculation, as a + // percentage (so the actual factor, multiplied by 100), rounded to an integer. + int damage_calc_random_mult_pct; + // 0x2C: The calculated "static" damage multiplier applied to the output of the base damage + // calculation. "Static" in the sense that this part of the multiplier doesn't depend on + // variables like type-based effects, critical hits, and Reflect/Light Screen. Factors in + // the static damage multiplier include the argument to CalcDamage, the multiplier due to + // monster::me_first_flag, Reckless, and Iron Fist. + int static_damage_mult; + // 0x30: The net number of attack boosts to an attacker due to a Power Band or Munch Belt. + // It seems like there's a bug in the code; aura bows do not contribute to this field. + s8 item_atk_modifier; + // 0x31: The net number of special attack boosts to an attacker due to a Special Band, + // Munch Belt, or aura bow. It seems like there's a bug in the code; physical attack boosts + // from aura bows also contribute to this field. + s8 item_sp_atk_modifier; + // 0x32: The net number of offense boosts to an attacker due to Download, Rivalry, + // Flower Gift, and Solar Power + s8 ability_offense_modifier; + // 0x33: The net number of defense boosts to a defender due to Flower Gift + s8 ability_defense_modifier; + // 0x34: The net number of offense boosts to an attacker due to Aggressor, Defender, and + // Practice Swinger + s8 iq_skill_offense_modifier; + // 0x35: The net number of defense boosts to a defender due to Counter Basher, Aggressor, and + // Defender + s8 iq_skill_defense_modifier; + // 0x36: The net number of defense boosts to a defender due to a Def Scarf or aura bow. + // It seems like there's a bug in the code; special defense boosts from aura bows also + // contribute to this field. + s8 item_def_modifier; + // 0x37: The net number of special defense boosts to a defender due to a Zinc Band. + // It seems like there's a bug in the code; aura bows do not contribute to this field. + s8 item_sp_def_modifier; + // 0x38: Whether or not Scope Lens or Sharpshooter boosted the critical hit rate of a move + bool scope_lens_or_sharpshooter_activated; + // 0x39: Whether or not the Patsy Band boosted the critical hit rate of a move + bool patsy_band_activated; + // 0x3A: Whether or not Reflect or the Time Shield halved the damage from a physical move + bool half_physical_damage_activated; + // 0x3B: Whether or not Light Screen or the Aqua Mantle halved the damage from a special move + bool half_special_damage_activated; + // 0x3C: Whether or not the Enhanced critical-hit rate status maxed out the critical hit rate + // of a move + bool focus_energy_activated; + // 0x3D: Whether or not Type-Advantage Master boosted the critical hit rate of a move + bool type_advantage_master_activated; + // 0x3E: Whether or not a non-Normal-type move was dampened by Cloudy weather + bool cloudy_drop_activated; + // 0x3F: Whether or not a Fire or Water move was affected by Rainy weather + bool rain_multiplier_activated; + // 0x40: Whether or not a Fire or Water move was affected by Sunny weather + bool sunny_multiplier_activated; + // 0x41: Whether or a Fire move was dampened by Thick Fat or Heatproof + bool fire_move_ability_drop_activated; + // 0x42: Whether or not Flash Fire was activated at some point for Fire immunity + bool flash_fire_activated; + // 0x43: Whether or not Levitate was activated at some point for Ground immunity + bool levitate_activated; + bool torrent_boost_activated; // 0x44: Whether or not a Water move was boosted by Torrent + bool overgrow_boost_activated; // 0x45: Whether or not a Grass move was boosted by Overgrow + bool swarm_boost_activated; // 0x46: Whether or not a Bug move was boosted by Swarm + // 0x47: Whether or not a Fire move was boosted by either Blaze or Dry Skin + bool fire_move_ability_boost_activated; + // 0x48: Whether or not Scrappy was activated at some point to bypass immunity + bool scrappy_activated; + // 0x49: Whether or not Super Luck boosted the critical hit rate for a move + bool super_luck_activated; + // 0x4A: Whether or not Sniper boosted the critical hit damage multiplier for a move + bool sniper_activated; + bool stab_boost_activated; // 0x4B: Whether or not STAB was activated for a move + // 0x4C: Whether or not an Electric move was dampened by either Mud Sport or Fog + bool electric_move_dampened; + // 0x4D: Whether or not Water Sport was activated by a Fire move + bool water_sport_drop_activated; + bool charge_boost_activated; // 0x4E: Whether or not Charge was activated by an Electric move + undefined field_0x4f; + // 0x50: Whether or not a Ghost type's immunity to Normal/Fighting was activated at some point + bool ghost_immunity_activated; + // 0x51: Whether or not a defender took less damage due to the Charging Skull Bash status + bool skull_bash_defense_boost_activated; + undefined field_0x52; + undefined field_0x53; +}; + + +#endif //PMDSKY_DUNGEON_MODE_H diff --git a/include/dungeon_mode_common.h b/include/dungeon_mode_common.h new file mode 100644 index 00000000..851adc60 --- /dev/null +++ b/include/dungeon_mode_common.h @@ -0,0 +1,39 @@ +#ifndef HEADERS_TYPES_DUNGEON_MODE_COMMON_H_ +#define HEADERS_TYPES_DUNGEON_MODE_COMMON_H_ + +#include "enums.h" + +// Monster move info +struct move { + // 0x0: flags0: 1-byte bitfield + u8 flags0; + /* bool f_exists : 1; // This move will show up in the move list */ + /* bool f_subsequent_in_link_chain : 1; // This move is in a link chain, but not the first move */ + /* bool f_enabled_for_ai : 1; // AI can use this move */ + /* bool f_set : 1; // Usable by L+A */ + /* bool f_last_used : 1; // This move was the last one used (for things like Torment?) */ + /* bool f_disabled : 1; // For Torment (and maybe others) */ + /* u8 flags0_unk6 : 2; */ + + u8 field_0x1; + + // 0x2: flags2: 2-byte bitfield + u16 flags2; + /* bool f_sealed : 1; // Sealed by a Seal Trap. Also prevents AI from using this move */ + /* u16 flags2_unk1 : 2; */ + /* bool f_consume_pp : 1; // This move will consume PP this turn */ + /* bool f_consume_2_pp : 1; // Consume 2 PP this turn. No effect unless f_consume_pp is set */ + /* u16 flags2_unk5 : 1; */ + /* // Consume 4 PP this turn. No effect unless f_consume_pp is set, overrides f_consume_2_pp */ + /* bool f_consume_4_pp : 1; */ + /* u16 flags2_unk7 : 1; */ + /* u16 flags2_unk8 : 1; */ + /* bool f_exclusive_item_pp_boost : 1; // A PP-boosting exclusive item is in effect */ + /* u16 flags3_unk10 : 6; */ + + enum move_id id : 16; // 0x4 + u8 pp; // 0x6: Current PP + u8 ginseng; // 0x7: Ginseng boost +}; + +#endif diff --git a/include/enums.h b/include/enums.h new file mode 100644 index 00000000..fae47bf1 --- /dev/null +++ b/include/enums.h @@ -0,0 +1,4124 @@ +#ifndef PMDSKY_ENUMS_H +#define PMDSKY_ENUMS_H + +// Direction on the dungeon grid +enum direction_id { + DIR_NONE = -1, + DIR_DOWN = 0, + DIR_DOWN_RIGHT = 1, + DIR_RIGHT = 2, + DIR_UP_RIGHT = 3, + DIR_UP = 4, + DIR_UP_LEFT = 5, + DIR_LEFT = 6, + DIR_DOWN_LEFT = 7, + DIR_CURRENT = 8, // Current direction of an entity. Used as a special value in some functions +}; + +// Terrain type for a tile +enum terrain_type { + TERRAIN_WALL = 0, + TERRAIN_NORMAL = 1, + TERRAIN_SECONDARY = 2, // Water or lava + TERRAIN_CHASM = 3, +}; + +// Tactic ID. These are usually encoded as bitvectors. +enum tactic_id { + TACTIC_LETS_GO_TOGETHER = 0, + TACTIC_YOU_GO_THE_OTHER_WAY = 1, + TACTIC_GO_AFTER_FOES = 2, + TACTIC_AVOID_THE_FIRST_HIT = 3, + TACTIC_ALL_FOR_ONE = 4, + TACTIC_GROUP_SAFETY = 5, + TACTIC_AVOID_TROUBLE = 6, + TACTIC_BE_PATIENT = 7, + TACTIC_KEEP_YOUR_DISTANCE = 8, + TACTIC_WAIT_THERE = 9, + TACTIC_GET_AWAY_FROM_HERE = 10, + TACTIC_NONE = 11, // used as an empty placeholder in menus (and maybe other things). +}; + +// AI objective that controls how an AI acts in the moment. +// These were probably taken from Rescue Team; need to confirm validity in Explorers. +enum ai_objective { + AI_UNKNOWN = 0, + AI_CHASE_TARGET = 1, + AI_CHASE_REMEMBERED_TARGET = 2, // Chase a target using a previous position + AI_ROAM = 3, // Roam hallways + AI_LEAVE_ROOM = 4, // Get out of a room + AI_RUN_AWAY = 5, + AI_STAND_STILL = 6, + AI_TAKE_ITEM = 7, +}; + +// Item ID +enum item_id { + ITEM_NOTHING = 0, + ITEM_STICK = 1, + ITEM_IRON_THORN = 2, + ITEM_SILVER_SPIKE = 3, + ITEM_GOLD_FANG = 4, + ITEM_CACNEA_SPIKE = 5, + ITEM_CORSOLA_TWIG = 6, + ITEM_GRAVELEROCK = 7, + ITEM_GEO_PEBBLE = 8, + ITEM_GOLD_THORN = 9, + ITEM_RARE_FOSSIL = 10, + ITEM_UNNAMED_0xB = 11, + ITEM_UNNAMED_0xC = 12, + ITEM_NO_SLIP_CAP = 13, + ITEM_Y_RAY_SPECS = 14, + ITEM_GAGGLE_SPECS = 15, + ITEM_MOBILE_SCARF = 16, + ITEM_HEAL_RIBBON = 17, + ITEM_TWIST_BAND = 18, + ITEM_SCOPE_LENS = 19, + ITEM_PATSY_BAND = 20, + ITEM_NO_STICK_CAP = 21, + ITEM_PIERCE_BAND = 22, + ITEM_JOY_RIBBON = 23, + ITEM_X_RAY_SPECS = 24, + ITEM_PERSIM_BAND = 25, + ITEM_POWER_BAND = 26, + ITEM_PECHA_SCARF = 27, + ITEM_INSOMNISCOPE = 28, + ITEM_WARP_SCARF = 29, + ITEM_TIGHT_BELT = 30, + ITEM_SNEAK_SCARF = 31, + ITEM_GOLD_RIBBON = 32, + ITEM_GOGGLE_SPECS = 33, + ITEM_DIET_RIBBON = 34, + ITEM_TRAP_SCARF = 35, + ITEM_RACKET_BAND = 36, + ITEM_DEF_SCARF = 37, + ITEM_STAMINA_BAND = 38, + ITEM_PLAIN_RIBBON = 39, + ITEM_SPECIAL_BAND = 40, + ITEM_ZINC_BAND = 41, + ITEM_DETECT_BAND = 42, + ITEM_SPACE_GLOBE = 43, + ITEM_DODGE_SCARF = 44, + ITEM_BOUNCE_BAND = 45, + ITEM_CURVE_BAND = 46, + ITEM_WHIFF_SPECS = 47, + ITEM_NO_AIM_SCOPE = 48, + ITEM_LOCKON_SPECS = 49, + ITEM_MUNCH_BELT = 50, + ITEM_PASS_SCARF = 51, + ITEM_WEATHER_BAND = 52, + ITEM_FRIEND_BOW = 53, + ITEM_BEAUTY_SCARF = 54, + ITEM_SUN_RIBBON = 55, + ITEM_LUNAR_RIBBON = 56, + ITEM_GOLDEN_MASK = 57, + ITEM_AMBER_TEAR = 58, + ITEM_ICY_FLUTE = 59, + ITEM_FIERY_DRUM = 60, + ITEM_TERRA_CYMBAL = 61, + ITEM_AQUA_MONICA = 62, + ITEM_ROCK_HORN = 63, + ITEM_GRASS_CORNET = 64, + ITEM_SKY_MELODICA = 65, + ITEM_MIRACLE_CHEST = 66, + ITEM_WONDER_CHEST = 67, + ITEM_IQ_BOOSTER = 68, + ITEM_HEAL_SEED = 69, + ITEM_ORAN_BERRY = 70, + ITEM_SITRUS_BERRY = 71, + ITEM_EYEDROP_SEED = 72, + ITEM_REVIVER_SEED = 73, + ITEM_BLINKER_SEED = 74, + ITEM_DOOM_SEED = 75, + ITEM_X_EYE_SEED = 76, + ITEM_LIFE_SEED = 77, + ITEM_RAWST_BERRY = 78, + ITEM_HUNGER_SEED = 79, + ITEM_QUICK_SEED = 80, + ITEM_PECHA_BERRY = 81, + ITEM_CHERI_BERRY = 82, + ITEM_TOTTER_SEED = 83, + ITEM_SLEEP_SEED = 84, + ITEM_PLAIN_SEED = 85, + ITEM_WARP_SEED = 86, + ITEM_BLAST_SEED = 87, + ITEM_GINSENG = 88, + ITEM_JOY_SEED = 89, + ITEM_CHESTO_BERRY = 90, + ITEM_STUN_SEED = 91, + ITEM_GABITE_SCALE = 92, + ITEM_GOLDEN_SEED = 93, + ITEM_VILE_SEED = 94, + ITEM_PURE_SEED = 95, + ITEM_VIOLENT_SEED = 96, + ITEM_VANISH_SEED = 97, + ITEM_UNNAMED_0x62 = 98, + ITEM_MAX_ELIXIR = 99, + ITEM_PROTEIN = 100, + ITEM_CALCIUM = 101, + ITEM_IRON = 102, + ITEM_NECTAR = 103, + ITEM_DROPEYE_SEED = 104, + ITEM_REVISER_SEED = 105, + ITEM_SLIP_SEED = 106, + ITEM_VIA_SEED = 107, + ITEM_ZINC = 108, + ITEM_APPLE = 109, + ITEM_BIG_APPLE = 110, + ITEM_GRIMY_FOOD = 111, + ITEM_HUGE_APPLE = 112, + ITEM_UNNAMED_0x71 = 113, + ITEM_UNNAMED_0x72 = 114, + ITEM_GOLDEN_APPLE = 115, + ITEM_MIX_ELIXIR = 116, + ITEM_OREN_BERRY = 117, + ITEM_DOUGH_SEED = 118, + ITEM_WHITE_GUMMI = 119, + ITEM_RED_GUMMI = 120, + ITEM_BLUE_GUMMI = 121, + ITEM_GRASS_GUMMI = 122, + ITEM_YELLOW_GUMMI = 123, + ITEM_CLEAR_GUMMI = 124, + ITEM_ORANGE_GUMMI = 125, + ITEM_PINK_GUMMI = 126, + ITEM_BROWN_GUMMI = 127, + ITEM_SKY_GUMMI = 128, + ITEM_GOLD_GUMMI = 129, + ITEM_GREEN_GUMMI = 130, + ITEM_GRAY_GUMMI = 131, + ITEM_PURPLE_GUMMI = 132, + ITEM_ROYAL_GUMMI = 133, + ITEM_BLACK_GUMMI = 134, + ITEM_SILVER_GUMMI = 135, + ITEM_WONDER_GUMMI = 136, + ITEM_GRAVELYROCK = 137, + ITEM_UNNAMED_0x8A = 138, + ITEM_UPGRADE = 139, + ITEM_KINGS_ROCK = 140, + ITEM_THUNDERSTONE = 141, + ITEM_DEEPSEASCALE = 142, + ITEM_DEEPSEATOOTH = 143, + ITEM_SUN_STONE = 144, + ITEM_MOON_STONE = 145, + ITEM_FIRE_STONE = 146, + ITEM_WATER_STONE = 147, + ITEM_METAL_COAT = 148, + ITEM_LEAF_STONE = 149, + ITEM_DRAGON_SCALE = 150, + ITEM_LINK_CABLE = 151, + ITEM_DUBIOUS_DISC = 152, + ITEM_PROTECTOR = 153, + ITEM_REAPER_CLOTH = 154, + ITEM_RAZOR_FANG = 155, + ITEM_RAZOR_CLAW = 156, + ITEM_ELECTIRIZER = 157, + ITEM_MAGMARIZER = 158, + ITEM_OVAL_STONE = 159, + ITEM_DAWN_STONE = 160, + ITEM_SHINY_STONE = 161, + ITEM_DUSK_STONE = 162, + ITEM_CORONET_ROCK = 163, + ITEM_MOSSY_ROCK = 164, + ITEM_FROZEN_ROCK = 165, + ITEM_UNNAMED_0xA6 = 166, + ITEM_GONE_PEBBLE = 167, + ITEM_WANDER_GUMMI = 168, + ITEM_PRIZE_TICKET = 169, + ITEM_SILVER_TICKET = 170, + ITEM_GOLD_TICKET = 171, + ITEM_PRISM_TICKET = 172, + ITEM_MYSTERY_PART = 173, + ITEM_SECRET_SLAB = 174, + ITEM_UNNAMED_0xAF = 175, + ITEM_UNNAMED_0xB0 = 176, + ITEM_UNNAMED_0xB1 = 177, + ITEM_WONDER_EGG = 178, + ITEM_GRACIDEA = 179, + ITEM_SKY_GIFT = 180, + ITEM_UNNAMED_0xB5 = 181, + ITEM_KEY = 182, + ITEM_POKE = 183, + ITEM_UNNAMED_0xB8 = 184, + ITEM_UNNAMED_0xB9 = 185, + ITEM_LOST_LOOT = 186, + ITEM_TM_USED_TM = 187, + ITEM_TM_FOCUS_PUNCH = 188, + ITEM_TM_DRAGON_CLAW = 189, + ITEM_TM_WATER_PULSE = 190, + ITEM_TM_CALM_MIND = 191, + ITEM_TM_ROAR = 192, + ITEM_TM_TOXIC = 193, + ITEM_TM_HAIL = 194, + ITEM_TM_BULK_UP = 195, + ITEM_TM_BULLET_SEED = 196, + ITEM_TM_HIDDEN_POWER = 197, + ITEM_UNNAMED_0xC6 = 198, + ITEM_TM_TAUNT = 199, + ITEM_TM_ICE_BEAM = 200, + ITEM_TM_BLIZZARD = 201, + ITEM_TM_HYPER_BEAM = 202, + ITEM_TM_LIGHT_SCREEN = 203, + ITEM_TM_PROTECT = 204, + ITEM_UNNAMED_0xCD = 205, + ITEM_TM_GIGA_DRAIN = 206, + ITEM_TM_SAFEGUARD = 207, + ITEM_TM_FRUSTRATION = 208, + ITEM_TM_SOLARBEAM = 209, + ITEM_TM_IRON_TAIL = 210, + ITEM_TM_THUNDERBOLT = 211, + ITEM_TM_THUNDER = 212, + ITEM_TM_EARTHQUAKE = 213, + ITEM_TM_RETURN = 214, + ITEM_TM_DIG = 215, + ITEM_TM_PSYCHIC = 216, + ITEM_TM_SHADOW_BALL = 217, + ITEM_TM_BRICK_BREAK = 218, + ITEM_UNNAMED_0xDB = 219, + ITEM_TM_REFLECT = 220, + ITEM_TM_SHOCK_WAVE = 221, + ITEM_TM_FLAMETHROWER = 222, + ITEM_TM_SLUDGE_BOMB = 223, + ITEM_UNNAMED_0xE0 = 224, + ITEM_TM_FIRE_BLAST = 225, + ITEM_UNNAMED_0xE2 = 226, + ITEM_TM_AERIAL_ACE = 227, + ITEM_TM_TORMENT = 228, + ITEM_TM_FACADE = 229, + ITEM_TM_SECRET_POWER = 230, + ITEM_TM_REST = 231, + ITEM_TM_ATTRACT = 232, + ITEM_TM_THIEF = 233, + ITEM_TM_STEEL_WING = 234, + ITEM_TM_SKILL_SWAP = 235, + ITEM_UNNAMED_0xEC = 236, + ITEM_TM_OVERHEAT = 237, + ITEM_TM_ROOST = 238, + ITEM_TM_FOCUS_BLAST = 239, + ITEM_TM_ENERGY_BALL = 240, + ITEM_TM_FALSE_SWIPE = 241, + ITEM_TM_BRINE = 242, + ITEM_TM_FLING = 243, + ITEM_TM_CHARGE_BEAM = 244, + ITEM_TM_ENDURE = 245, + ITEM_TM_DRAGON_PULSE = 246, + ITEM_TM_DRAIN_PUNCH = 247, + ITEM_TM_WILL_O_WISP = 248, + ITEM_TM_SILVER_WIND = 249, + ITEM_TM_EMBARGO = 250, + ITEM_TM_EXPLOSION = 251, + ITEM_TM_SHADOW_CLAW = 252, + ITEM_TM_PAYBACK = 253, + ITEM_TM_RECYCLE = 254, + ITEM_TM_GIGA_IMPACT = 255, + ITEM_TM_ROCK_POLISH = 256, + ITEM_TM_WIDE_SLASH = 257, + ITEM_UNNAMED_0x102 = 258, + ITEM_UNNAMED_0x103 = 259, + ITEM_TM_VACUUM_CUT = 260, + ITEM_TM_DIVE = 261, + ITEM_TM_FLASH = 262, + ITEM_TM_STONE_EDGE = 263, + ITEM_TM_AVALANCHE = 264, + ITEM_TM_THUNDER_WAVE = 265, + ITEM_TM_GYRO_BALL = 266, + ITEM_TM_SWORDS_DANCE = 267, + ITEM_TM_STEALTH_ROCK = 268, + ITEM_TM_PSYCH_UP = 269, + ITEM_TM_CAPTIVATE = 270, + ITEM_TM_DARK_PULSE = 271, + ITEM_TM_ROCK_SLIDE = 272, + ITEM_TM_X_SCISSOR = 273, + ITEM_TM_SLEEP_TALK = 274, + ITEM_TM_NATURAL_GIFT = 275, + ITEM_TM_POISON_JAB = 276, + ITEM_TM_DREAM_EATER = 277, + ITEM_TM_GRASS_KNOT = 278, + ITEM_TM_SWAGGER = 279, + ITEM_TM_PLUCK = 280, + ITEM_TM_U_TURN = 281, + ITEM_TM_SUBSTITUTE = 282, + ITEM_TM_FLASH_CANNON = 283, + ITEM_TM_TRICK_ROOM = 284, + ITEM_TM_CUT = 285, + ITEM_TM_FLY = 286, + ITEM_TM_SURF = 287, + ITEM_TM_STRENGTH = 288, + ITEM_TM_DEFOG = 289, + ITEM_TM_ROCK_SMASH = 290, + ITEM_TM_WATERFALL = 291, + ITEM_TM_ROCK_CLIMB = 292, + ITEM_UNNAMED_0x125 = 293, + ITEM_UNNAMED_0x126 = 294, + ITEM_UNNAMED_0x127 = 295, + ITEM_UNNAMED_0x128 = 296, + ITEM_UNNAMED_0x129 = 297, + ITEM_UNNAMED_0x12A = 298, + ITEM_UNNAMED_0x12B = 299, + ITEM_UNNAMED_0x12C = 300, + ITEM_HAIL_ORB = 301, + ITEM_SUNNY_ORB = 302, + ITEM_RAINY_ORB = 303, + ITEM_EVASION_ORB = 304, + ITEM_SANDY_ORB = 305, + ITEM_ROCKY_ORB = 306, + ITEM_SNATCH_ORB = 307, + ITEM_SEE_TRAP_ORB = 308, + ITEM_MUG_ORB = 309, + ITEM_REBOUND_ORB = 310, + ITEM_LOB_ORB = 311, + ITEM_SWITCHER_ORB = 312, + ITEM_BLOWBACK_ORB = 313, + ITEM_WARP_ORB = 314, + ITEM_TRANSFER_ORB = 315, + ITEM_SLOW_ORB = 316, + ITEM_QUICK_ORB = 317, + ITEM_LUMINOUS_ORB = 318, + ITEM_PETRIFY_ORB = 319, + ITEM_STAYAWAY_ORB = 320, + ITEM_POUNCE_ORB = 321, + ITEM_TRAWL_ORB = 322, + ITEM_CLEANSE_ORB = 323, + ITEM_UNNAMED_0x144 = 324, + ITEM_DECOY_ORB = 325, + ITEM_SLUMBER_ORB = 326, + ITEM_TOTTER_ORB = 327, + ITEM_TWO_EDGE_ORB = 328, + ITEM_SILENCE_ORB = 329, + ITEM_ESCAPE_ORB = 330, + ITEM_SCANNER_ORB = 331, + ITEM_RADAR_ORB = 332, + ITEM_DROUGHT_ORB = 333, + ITEM_TRAPBUST_ORB = 334, + ITEM_ROLLCALL_ORB = 335, + ITEM_INVISIFY_ORB = 336, + ITEM_ONE_SHOT_ORB = 337, + ITEM_IDENTIFY_ORB = 338, + ITEM_UNNAMED_0x153 = 339, + ITEM_SHOCKER_ORB = 340, + ITEM_SIZEBUST_ORB = 341, + ITEM_ONE_ROOM_ORB = 342, + ITEM_FILL_IN_ORB = 343, + ITEM_TRAPPER_ORB = 344, + ITEM_UNNAMED_0x159 = 345, + ITEM_ITEMIZER_ORB = 346, + ITEM_HURL_ORB = 347, + ITEM_MOBILE_ORB = 348, + ITEM_UNNAMED_0x15D = 349, + ITEM_STAIRS_ORB = 350, + ITEM_LONGTOSS_ORB = 351, + ITEM_PIERCE_ORB = 352, + ITEM_UNNAMED_0x161 = 353, + ITEM_SPURN_ORB = 354, + ITEM_FOE_HOLD_ORB = 355, + ITEM_ALL_MACH_ORB = 356, + ITEM_FOE_FEAR_ORB = 357, + ITEM_ALL_HIT_ORB = 358, + ITEM_FOE_SEAL_ORB = 359, + ITEM_UNNAMED_0x168 = 360, + ITEM_UNNAMED_0x169 = 361, + ITEM_LINK_BOX = 362, + ITEM_UNNAMED_0x16B = 363, + ITEM_GORGEOUS_BOX_1 = 364, + ITEM_GORGEOUS_BOX_2 = 365, + ITEM_GORGEOUS_BOX_3 = 366, + ITEM_HEAVY_BOX_1 = 367, + ITEM_HEAVY_BOX_2 = 368, + ITEM_HEAVY_BOX_3 = 369, + ITEM_SHINY_BOX_1 = 370, + ITEM_SHINY_BOX_2 = 371, + ITEM_SHINY_BOX_3 = 372, + ITEM_NIFTY_BOX_1 = 373, + ITEM_NIFTY_BOX_2 = 374, + ITEM_NIFTY_BOX_3 = 375, + ITEM_DAINTY_BOX_1 = 376, + ITEM_DAINTY_BOX_2 = 377, + ITEM_DAINTY_BOX_3 = 378, + ITEM_GLITTERY_BOX_1 = 379, + ITEM_GLITTERY_BOX_2 = 380, + ITEM_GLITTERY_BOX_3 = 381, + ITEM_PRETTY_BOX_1 = 382, + ITEM_PRETTY_BOX_2 = 383, + ITEM_PRETTY_BOX_3 = 384, + ITEM_DELUXE_BOX_1 = 385, + ITEM_DELUXE_BOX_2 = 386, + ITEM_DELUXE_BOX_3 = 387, + ITEM_LIGHT_BOX_1 = 388, + ITEM_LIGHT_BOX_2 = 389, + ITEM_LIGHT_BOX_3 = 390, + ITEM_CUTE_BOX_1 = 391, + ITEM_CUTE_BOX_2 = 392, + ITEM_CUTE_BOX_3 = 393, + ITEM_HARD_BOX_1 = 394, + ITEM_HARD_BOX_2 = 395, + ITEM_HARD_BOX_3 = 396, + ITEM_SINISTER_BOX_1 = 397, + ITEM_SINISTER_BOX_2 = 398, + ITEM_SINISTER_BOX_3 = 399, + ITEM_A_STONE = 400, + ITEM_B_STONE = 401, + ITEM_C_STONE = 402, + ITEM_D_STONE = 403, + ITEM_E_STONE = 404, + ITEM_F_STONE = 405, + ITEM_G_STONE = 406, + ITEM_H_STONE = 407, + ITEM_I_STONE = 408, + ITEM_J_STONE = 409, + ITEM_K_STONE = 410, + ITEM_L_STONE = 411, + ITEM_M_STONE = 412, + ITEM_N_STONE = 413, + ITEM_O_STONE = 414, + ITEM_P_STONE = 415, + ITEM_Q_STONE = 416, + ITEM_R_STONE = 417, + ITEM_S_STONE = 418, + ITEM_T_STONE = 419, + ITEM_U_STONE = 420, + ITEM_V_STONE = 421, + ITEM_W_STONE = 422, + ITEM_X_STONE = 423, + ITEM_Y_STONE = 424, + ITEM_Z_STONE = 425, + ITEM_EXCLAMATION_STONE = 426, + ITEM_QUESTION_STONE = 427, + ITEM_SILVER_BOW = 428, + ITEM_BROWN_BOW = 429, + ITEM_RED_BOW = 430, + ITEM_PINK_BOW = 431, + ITEM_ORANGE_BOW = 432, + ITEM_YELLOW_BOW = 433, + ITEM_LIME_BOW = 434, + ITEM_GREEN_BOW = 435, + ITEM_VIRIDIAN_BOW = 436, + ITEM_MINTY_BOW = 437, + ITEM_SKY_BLUE_BOW = 438, + ITEM_BLUE_BOW = 439, + ITEM_COBALT_BOW = 440, + ITEM_PURPLE_BOW = 441, + ITEM_VIOLET_BOW = 442, + ITEM_FUCHSIA_BOW = 443, + ITEM_PRISM_RUFF = 444, + ITEM_AQUA_COLLAR = 445, + ITEM_VOLT_COLLAR = 446, + ITEM_FIRE_COLLAR = 447, + ITEM_LIGHT_COLLAR = 448, + ITEM_DUSK_COLLAR = 449, + ITEM_VIRID_COLLAR = 450, + ITEM_ICY_COLLAR = 451, + ITEM_PEP_SASH = 452, + ITEM_COUNTER_RUFF = 453, + ITEM_VICTORY_BELT = 454, + ITEM_POWER_BANGLE = 455, + ITEM_THUNDERSHARD = 456, + ITEM_FALLEN_STAR = 457, + ITEM_FLUFF_DUST = 458, + ITEM_EGG_SHARD = 459, + ITEM_HEROIC_MEDAL = 460, + ITEM_CHIC_SHARD = 461, + ITEM_YELLOW_JEWEL = 462, + ITEM_RED_JEWEL = 463, + ITEM_BLUE_JEWEL = 464, + ITEM_LAUGH_DUST = 465, + ITEM_GUARD_SAND = 466, + ITEM_PURPLE_JEWEL = 467, + ITEM_WHITE_JEWEL = 468, + ITEM_BRAVE_DUST = 469, + ITEM_HEAL_DEW = 470, + ITEM_MARINE_CACHE = 471, + ITEM_FREEZE_VEIL = 472, + ITEM_THUNDER_VEIL = 473, + ITEM_FIRE_VEIL = 474, + ITEM_HAVOC_ROBE = 475, + ITEM_LIFE_RING = 476, + ITEM_BOLT_FANG = 477, + ITEM_FLARE_FANG = 478, + ITEM_AQUA_MANTLE = 479, + ITEM_SILVER_VEIL = 480, + ITEM_RAINBOW_VEIL = 481, + ITEM_CHRONO_VEIL = 482, + ITEM_ROCK_SASH = 483, + ITEM_ICE_SASH = 484, + ITEM_STEEL_SASH = 485, + ITEM_HEART_BROOCH = 486, + ITEM_EON_VEIL = 487, + ITEM_SEABED_VEIL = 488, + ITEM_TERRA_RING = 489, + ITEM_SKYHIGH_VEIL = 490, + ITEM_WISH_MANTLE = 491, + ITEM_REVIVE_ROBE = 492, + ITEM_SHADOW_VEIL = 493, + ITEM_PLASMA_VEIL = 494, + ITEM_EDIFY_ROBE = 495, + ITEM_CHARITY_ROBE = 496, + ITEM_HOPE_ROBE = 497, + ITEM_TIME_SHIELD = 498, + ITEM_AIR_BLADE = 499, + ITEM_SEARING_RING = 500, + ITEM_ANCIENT_RING = 501, + ITEM_NETHER_VEIL = 502, + ITEM_LUNAR_VEIL = 503, + ITEM_TIDAL_CAPE = 504, + ITEM_ECLIPSE_ROBE = 505, + ITEM_WHITE_SILK = 506, + ITEM_NORMAL_DUST = 507, + ITEM_WHITE_GEM = 508, + ITEM_JOY_GLOBE = 509, + ITEM_RED_SILK = 510, + ITEM_FIRE_DUST = 511, + ITEM_FIERY_GEM = 512, + ITEM_FIERY_GLOBE = 513, + ITEM_BLUE_SILK = 514, + ITEM_WATER_DUST = 515, + ITEM_AQUA_GEM = 516, + ITEM_AQUA_GLOBE = 517, + ITEM_GRASS_SILK = 518, + ITEM_GRASS_DUST = 519, + ITEM_GRASS_GEM = 520, + ITEM_SOOTHE_GLOBE = 521, + ITEM_YELLOW_SILK = 522, + ITEM_THUNDER_DUST = 523, + ITEM_THUNDER_GEM = 524, + ITEM_VOLT_GLOBE = 525, + ITEM_CLEAR_SILK = 526, + ITEM_ICY_DUST = 527, + ITEM_ICY_GEM = 528, + ITEM_ICY_GLOBE = 529, + ITEM_ORANGE_SILK = 530, + ITEM_COURAGE_DUST = 531, + ITEM_FIGHT_GEM = 532, + ITEM_POWER_GLOBE = 533, + ITEM_PINK_SILK = 534, + ITEM_POISON_DUST = 535, + ITEM_POISON_GEM = 536, + ITEM_POISON_GLOBE = 537, + ITEM_BROWN_SILK = 538, + ITEM_GROUND_DUST = 539, + ITEM_EARTH_GEM = 540, + ITEM_TERRA_GLOBE = 541, + ITEM_SKY_SILK = 542, + ITEM_SKY_DUST = 543, + ITEM_SKY_GEM = 544, + ITEM_SKY_GLOBE = 545, + ITEM_GOLD_SILK = 546, + ITEM_PSYCHE_DUST = 547, + ITEM_PSYCHE_GEM = 548, + ITEM_PSYCHE_GLOBE = 549, + ITEM_GREEN_SILK = 550, + ITEM_WONDER_DUST = 551, + ITEM_GUARD_GEM = 552, + ITEM_DEFEND_GLOBE = 553, + ITEM_GRAY_SILK = 554, + ITEM_ROCK_DUST = 555, + ITEM_STONE_GEM = 556, + ITEM_ROCK_GLOBE = 557, + ITEM_PURPLE_SILK = 558, + ITEM_SHADY_DUST = 559, + ITEM_SHADOW_GEM = 560, + ITEM_NETHER_GLOBE = 561, + ITEM_ROYAL_SILK = 562, + ITEM_DRAGON_DUST = 563, + ITEM_DRAGON_GEM = 564, + ITEM_DRAGON_GLOBE = 565, + ITEM_BLACK_SILK = 566, + ITEM_DARK_DUST = 567, + ITEM_DARK_GEM = 568, + ITEM_DUSK_GLOBE = 569, + ITEM_IRON_SILK = 570, + ITEM_STEEL_DUST = 571, + ITEM_METAL_GEM = 572, + ITEM_STEEL_GLOBE = 573, + ITEM_BULBA_CLAW = 574, + ITEM_BULBA_FANG = 575, + ITEM_GRASS_GUARD = 576, + ITEM_LEAFY_TIE = 577, + ITEM_IVY_CLAW = 578, + ITEM_IVY_FANG = 579, + ITEM_IVY_CREST = 580, + ITEM_PLANT_TORC = 581, + ITEM_VENUS_CLAW = 582, + ITEM_VENUS_FANG = 583, + ITEM_VENUS_SEAL = 584, + ITEM_SOLAR_SASH = 585, + ITEM_CHAR_CLAW = 586, + ITEM_CHAR_FANG = 587, + ITEM_FIERY_HEART = 588, + ITEM_HEAT_ARMLET = 589, + ITEM_CHARME_CLAW = 590, + ITEM_CHARME_FANG = 591, + ITEM_CHARME_CREST = 592, + ITEM_KINDLE_SCARF = 593, + ITEM_CHARIZ_CLAW = 594, + ITEM_CHARIZ_FANG = 595, + ITEM_CHARIZ_SEAL = 596, + ITEM_FLAME_BANGLE = 597, + ITEM_SQUIRT_FOAM = 598, + ITEM_SQUIRT_CARD = 599, + ITEM_WATER_GUARD = 600, + ITEM_AQUA_TIE = 601, + ITEM_WARTOR_CLAW = 602, + ITEM_WARTOR_FANG = 603, + ITEM_WARTOR_CREST = 604, + ITEM_BUBBLEBANGLE = 605, + ITEM_BLASTO_CLAW = 606, + ITEM_BLASTO_CARD = 607, + ITEM_BLASTO_SEAL = 608, + ITEM_HYDRO_BAND = 609, + ITEM_PICHU_HAIR = 610, + ITEM_PICHU_CARD = 611, + ITEM_EXPRESS_TAG = 612, + ITEM_SHOCKER_CAPE = 613, + ITEM_PIKACHU_HAIR = 614, + ITEM_PIKACHU_CARD = 615, + ITEM_VOLT_CHARM = 616, + ITEM_VOLT_TORC = 617, + ITEM_RAICHU_HAIR = 618, + ITEM_RAICHU_CARD = 619, + ITEM_RAICHU_CREST = 620, + ITEM_ZAPPER_SCARF = 621, + ITEM_MEOWTH_CLAW = 622, + ITEM_MEOWTH_FANG = 623, + ITEM_COIN_CHARM = 624, + ITEM_BLING_RUFF = 625, + ITEM_PERSIAN_CLAW = 626, + ITEM_PERSIAN_FANG = 627, + ITEM_INSIGHT_ROCK = 628, + ITEM_NOBLE_SCARF = 629, + ITEM_CHIKO_CLAW = 630, + ITEM_CHIKO_CARD = 631, + ITEM_DAWN_JEWEL = 632, + ITEM_FRESH_BOW = 633, + ITEM_BAYLEEF_CLAW = 634, + ITEM_BAYLEEF_CARD = 635, + ITEM_BAYLEEF_SEAL = 636, + ITEM_SPICE_BOW = 637, + ITEM_MEGANI_CLAW = 638, + ITEM_MEGANI_CARD = 639, + ITEM_SHINY_CHARM = 640, + ITEM_BRIGHT_VEIL = 641, + ITEM_CYNDA_HAIR = 642, + ITEM_CYNDA_CLAW = 643, + ITEM_BLAZING_ROCK = 644, + ITEM_STORM_SASH = 645, + ITEM_QUILA_HAIR = 646, + ITEM_QUILA_CARD = 647, + ITEM_QUILA_CREST = 648, + ITEM_VOLCANO_TORC = 649, + ITEM_TYPHLO_GASP = 650, + ITEM_TYPHLO_FANG = 651, + ITEM_TYPHLO_SEAL = 652, + ITEM_BLAST_BANGLE = 653, + ITEM_TOTODI_DEW = 654, + ITEM_TOTODI_FANG = 655, + ITEM_WATER_HEART = 656, + ITEM_WASH_BOW = 657, + ITEM_CROCO_FANG = 658, + ITEM_CROCO_CARD = 659, + ITEM_SWIRL_ROCK = 660, + ITEM_ANGER_SCARF = 661, + ITEM_FERAL_CLAW = 662, + ITEM_FERAL_FANG = 663, + ITEM_FERAL_CREST = 664, + ITEM_HYDRO_JAW = 665, + ITEM_TREECK_THORN = 666, + ITEM_TREECK_CARD = 667, + ITEM_FOREST_ORE = 668, + ITEM_GUARD_RING = 669, + ITEM_GROVY_SHOOT = 670, + ITEM_GROVY_CARD = 671, + ITEM_JUNGLE_TAG = 672, + ITEM_GRASS_BLADE = 673, + ITEM_SCEPT_CLAW = 674, + ITEM_SCEPT_CARD = 675, + ITEM_SCEPT_SEAL = 676, + ITEM_DRAIN_BANGLE = 677, + ITEM_TORCHIC_HAIR = 678, + ITEM_TORCHIC_CARD = 679, + ITEM_HOT_PEBBLE = 680, + ITEM_FIRE_CAPE = 681, + ITEM_COMBUS_SWEAT = 682, + ITEM_COMBUS_CLAW = 683, + ITEM_CHARGE_TAG = 684, + ITEM_GUTSY_BAND = 685, + ITEM_BLAZI_CLAW = 686, + ITEM_BLAZI_CARD = 687, + ITEM_BLAZI_SEAL = 688, + ITEM_BLAZE_TORC = 689, + ITEM_MUDKIP_MUD = 690, + ITEM_MUDKIP_CARD = 691, + ITEM_MUD_JEWEL = 692, + ITEM_SPEED_SCARF = 693, + ITEM_MARSH_MUD = 694, + ITEM_MARSH_CARD = 695, + ITEM_MARSH_CREST = 696, + ITEM_MARSH_TORC = 697, + ITEM_SWAMP_MUD = 698, + ITEM_SWAMP_CARD = 699, + ITEM_SWAMP_SEAL = 700, + ITEM_SWAMP_BANGLE = 701, + ITEM_SKITTY_FANG = 702, + ITEM_SKITTY_CARD = 703, + ITEM_SMILE_PEBBLE = 704, + ITEM_HEAL_PENDANT = 705, + ITEM_DELCAT_HAIR = 706, + ITEM_DELCAT_FANG = 707, + ITEM_PRIM_PEBBLE = 708, + ITEM_GUARD_COLLAR = 709, + ITEM_LUCKY_LEAF = 710, + ITEM_TURTWIG_CARD = 711, + ITEM_SPROUT_ROCK = 712, + ITEM_LEAFY_HAT = 713, + ITEM_GROTLE_TWIG = 714, + ITEM_GROTLE_CLAW = 715, + ITEM_GROTLE_CREST = 716, + ITEM_WOODY_SCARF = 717, + ITEM_TORT_CLAW = 718, + ITEM_TORT_HORN = 719, + ITEM_TORT_SEAL = 720, + ITEM_FOREST_TORC = 721, + ITEM_CHIM_HAIR = 722, + ITEM_CHIM_FANG = 723, + ITEM_NIMBLE_CHARM = 724, + ITEM_EMBER_CAP = 725, + ITEM_MONFER_HAIR = 726, + ITEM_MONFER_FANG = 727, + ITEM_MONFER_CREST = 728, + ITEM_BURST_SASH = 729, + ITEM_INFERN_HAIR = 730, + ITEM_INFERN_FANG = 731, + ITEM_INFERN_SEAL = 732, + ITEM_BLAZING_RUFF = 733, + ITEM_PIPLUP_FOAM = 734, + ITEM_PIPLUP_CARD = 735, + ITEM_SEA_ORE = 736, + ITEM_WATER_CAPE = 737, + ITEM_PRIN_FOAM = 738, + ITEM_PRIN_CARD = 739, + ITEM_PRIN_CREST = 740, + ITEM_AQUA_BLADE = 741, + ITEM_EMPOL_CLAW = 742, + ITEM_EMPOL_HORN = 743, + ITEM_EMPOL_SEAL = 744, + ITEM_MARINE_CROWN = 745, + ITEM_MUNCH_DROOL = 746, + ITEM_MUNCH_CLAW = 747, + ITEM_TUMMY_CHARM = 748, + ITEM_GLUTTON_CAPE = 749, + ITEM_SNORLAX_GASP = 750, + ITEM_SNORLAX_FANG = 751, + ITEM_VALOR_CHARM = 752, + ITEM_GLEE_SCARF = 753, + ITEM_SCYTHER_FANG = 754, + ITEM_SCYTHER_CARD = 755, + ITEM_AMBUSH_ROCK = 756, + ITEM_STRIKE_RUFF = 757, + ITEM_SCIZOR_WING = 758, + ITEM_SCIZOR_CARD = 759, + ITEM_STEEL_CHARM = 760, + ITEM_RED_ARMLET = 761, + ITEM_LAPRAS_SONG = 762, + ITEM_LAPRAS_CARD = 763, + ITEM_WAVY_CHARM = 764, + ITEM_MYSTIC_SCARF = 765, + ITEM_EEVEE_TAIL = 766, + ITEM_EEVEE_CARD = 767, + ITEM_EVOLVE_CHARM = 768, + ITEM_EEVEE = 769, + ITEM_CLEFFA_DEW = 770, + ITEM_CLEFFA_CARD = 771, + ITEM_STARRY_ORE = 772, + ITEM_COMET_RING = 773, + ITEM_CLEF_CLAW = 774, + ITEM_CLEF_FANG = 775, + ITEM_MOON_JEWEL = 776, + ITEM_MOON_SCARF = 777, + ITEM_CLEFA_CLAW = 778, + ITEM_CLEFA_CARD = 779, + ITEM_MOON_ROCK = 780, + ITEM_FAIRY_BOW = 781, + ITEM_IGGLY_DEW = 782, + ITEM_IGGLY_CARD = 783, + ITEM_BOUNCY_CHARM = 784, + ITEM_PRETTY_BOW = 785, + ITEM_JIGGLY_SONG = 786, + ITEM_JIGGLY_CARD = 787, + ITEM_SLUMBER_ROCK = 788, + ITEM_SNOOZE_RING = 789, + ITEM_WIGGLY_HAIR = 790, + ITEM_WIGGLY_CARD = 791, + ITEM_BUDDY_ROCK = 792, + ITEM_FRIEND_TORC = 793, + ITEM_TOGEPI_DEW = 794, + ITEM_TOGEPI_CARD = 795, + ITEM_PURE_HEART = 796, + ITEM_ANGEL_SCARF = 797, + ITEM_TOGETIC_WING = 798, + ITEM_TOGETIC_CARD = 799, + ITEM_HAPPY_ROCK = 800, + ITEM_LUCK_BROOCH = 801, + ITEM_TOGEK_WING = 802, + ITEM_TOGEK_CARD = 803, + ITEM_OVATION_ROCK = 804, + ITEM_GLITTER_ROBE = 805, + ITEM_SNEASEL_CLAW = 806, + ITEM_SNEASEL_CARD = 807, + ITEM_DUSK_JEWEL = 808, + ITEM_CRUEL_RING = 809, + ITEM_WEAVILE_CLAW = 810, + ITEM_WEAVILE_FANG = 811, + ITEM_VILE_TAG = 812, + ITEM_RUIN_ARMLET = 813, + ITEM_TEDDI_CLAW = 814, + ITEM_TEDDI_CARD = 815, + ITEM_HONEY_ROCK = 816, + ITEM_HEAL_SCARF = 817, + ITEM_URSA_CLAW = 818, + ITEM_URSA_FANG = 819, + ITEM_CALMING_ROCK = 820, + ITEM_HIBER_SCARF = 821, + ITEM_TYRO_SWEAT = 822, + ITEM_TYRO_CARD = 823, + ITEM_MUSCLE_CHARM = 824, + ITEM_TYROGUE = 825, + ITEM_SMOOCH_SONG = 826, + ITEM_SMOOCH_CARD = 827, + ITEM_KISS_CHARM = 828, + ITEM_HEART_TIARA = 829, + ITEM_JYNX_SONG = 830, + ITEM_JYNX_CARD = 831, + ITEM_FROZEN_ORE = 832, + ITEM_RUIN_SCARF = 833, + ITEM_ELEKID_CLAW = 834, + ITEM_ELEKID_CARD = 835, + ITEM_JOLT_CHARM = 836, + ITEM_CURRENT_RING = 837, + ITEM_ELECTA_CLAW = 838, + ITEM_ELECTA_FANG = 839, + ITEM_CHARGE_SEAL = 840, + ITEM_VOLT_BANGLE = 841, + ITEM_ELECTI_CLAW = 842, + ITEM_ELECTI_CARD = 843, + ITEM_VOLTAIC_ROCK = 844, + ITEM_VOLTAIC_BAND = 845, + ITEM_MAGBY_CLAW = 846, + ITEM_MAGBY_CARD = 847, + ITEM_EMBER_JEWEL = 848, + ITEM_COAL_RING = 849, + ITEM_MAGMAR_CLAW = 850, + ITEM_MAGMAR_CARD = 851, + ITEM_ERUPT_ORE = 852, + ITEM_MAGMA_SCARF = 853, + ITEM_MAGMOR_CLAW = 854, + ITEM_MAGMOR_CARD = 855, + ITEM_VULCAN_ROCK = 856, + ITEM_BURNING_TORC = 857, + ITEM_AZURI_DEW = 858, + ITEM_AZURI_CARD = 859, + ITEM_FOUNT_CHARM = 860, + ITEM_WATER_FLOAT = 861, + ITEM_MARILL_DEW = 862, + ITEM_MARILL_CARD = 863, + ITEM_SURFER_ROCK = 864, + ITEM_BRINE_SCARF = 865, + ITEM_AZUMA_DEW = 866, + ITEM_AZUMA_CARD = 867, + ITEM_STREAM_CHARM = 868, + ITEM_DOTTED_SCARF = 869, + ITEM_PLUSLE_TAIL = 870, + ITEM_PLUSLE_CARD = 871, + ITEM_CHEER_ROCK = 872, + ITEM_PULSE_BOW = 873, + ITEM_MINUN_TAIL = 874, + ITEM_MINUN_CARD = 875, + ITEM_VOLT_HEART = 876, + ITEM_SPARK_TIE = 877, + ITEM_CAST_DEW = 878, + ITEM_CAST_CARD = 879, + ITEM_CLOUD_ROCK = 880, + ITEM_WEATHER_CAPE = 881, + ITEM_WYNAUT_TAIL = 882, + ITEM_WYNAUT_CARD = 883, + ITEM_GRIN_CHARM = 884, + ITEM_CHEERY_SCARF = 885, + ITEM_WOBBU_SWEAT = 886, + ITEM_WOBBU_CARD = 887, + ITEM_ENDURE_ROCK = 888, + ITEM_SUFFER_SCARF = 889, + ITEM_BIDOOF_TOOTH = 890, + ITEM_BIDOOF_CARD = 891, + ITEM_FALL_CHARM = 892, + ITEM_STOLID_SCARF = 893, + ITEM_BIBA_TOOTH = 894, + ITEM_BIBA_CARD = 895, + ITEM_RIVER_CHARM = 896, + ITEM_DAM_SCARF = 897, + ITEM_SHINX_CLAW = 898, + ITEM_SHINX_FANG = 899, + ITEM_FLASH_TAG = 900, + ITEM_ENERGY_SCARF = 901, + ITEM_LUXIO_CLAW = 902, + ITEM_LUXIO_FANG = 903, + ITEM_SPARK_TAG = 904, + ITEM_SPARK_SCARF = 905, + ITEM_LUXRAY_CLAW = 906, + ITEM_LUXRAY_FANG = 907, + ITEM_GLARE_TAG = 908, + ITEM_GLARE_SASH = 909, + ITEM_PACHI_TOOTH = 910, + ITEM_PACHI_CARD = 911, + ITEM_ROUSE_CHARM = 912, + ITEM_MIRACLE_BOW = 913, + ITEM_BUIZEL_FANG = 914, + ITEM_BUIZEL_CARD = 915, + ITEM_SWIMMER_ROCK = 916, + ITEM_SCREW_TORC = 917, + ITEM_FLOAT_FANG = 918, + ITEM_FLOAT_CARD = 919, + ITEM_RESCUE_ROCK = 920, + ITEM_FLOAT_AID = 921, + ITEM_DRIFLOO_GASP = 922, + ITEM_DRIFLOO_CARD = 923, + ITEM_WIND_HEART = 924, + ITEM_DRAFT_RING = 925, + ITEM_DRIFBLI_GASP = 926, + ITEM_DRIFBLI_CARD = 927, + ITEM_EASY_CHARM = 928, + ITEM_BREEZE_SCARF = 929, + ITEM_CHERUBI_SEED = 930, + ITEM_CHERUBI_CARD = 931, + ITEM_CUTE_ORE = 932, + ITEM_CHARM_BOW = 933, + ITEM_CHERRIM_DEW = 934, + ITEM_CHERRIM_CARD = 935, + ITEM_SWEET_AROMA = 936, + ITEM_PETAL_DRESS = 937, + ITEM_BONSLY_DEW = 938, + ITEM_BONSLY_CARD = 939, + ITEM_ARID_TAG = 940, + ITEM_TEARY_CAPE = 941, + ITEM_SUDO_SWEAT = 942, + ITEM_SUDO_CARD = 943, + ITEM_DRAIN_ROCK = 944, + ITEM_FAKE_TORC = 945, + ITEM_JUNIOR_BEAM = 946, + ITEM_JUNIOR_CARD = 947, + ITEM_MIMIC_PEBBLE = 948, + ITEM_COPY_MASK = 949, + ITEM_MIME_KEY = 950, + ITEM_MIME_CARD = 951, + ITEM_BULWARK_ROCK = 952, + ITEM_BARRIER_BOW = 953, + ITEM_HAPPINY_DEW = 954, + ITEM_HAPPINY_CARD = 955, + ITEM_PLAY_TAG = 956, + ITEM_NURTURE_CAPE = 957, + ITEM_CHANSEY_SONG = 958, + ITEM_CHANSEY_CARD = 959, + ITEM_LUCKY_CHARM = 960, + ITEM_LUCKY_SCARF = 961, + ITEM_BLISSEY_SONG = 962, + ITEM_BLISSEY_CARD = 963, + ITEM_AMITY_ROCK = 964, + ITEM_FAITH_RING = 965, + ITEM_GIBLE_FANG = 966, + ITEM_GIBLE_CARD = 967, + ITEM_DRAGON_JEWEL = 968, + ITEM_DRAGON_TIE = 969, + ITEM_GABITE_CLAW = 970, + ITEM_GABITE_FANG = 971, + ITEM_STAR_ROCK = 972, + ITEM_METEOR_TORC = 973, + ITEM_GAR_CLAW = 974, + ITEM_GAR_FANG = 975, + ITEM_SPEED_TAG = 976, + ITEM_MACH_SCARF = 977, + ITEM_RIOLU_TAIL = 978, + ITEM_RIOLU_CARD = 979, + ITEM_VALIANT_ROCK = 980, + ITEM_EMIT_RING = 981, + ITEM_LUCARIO_FANG = 982, + ITEM_LUCARIO_CARD = 983, + ITEM_PLEDGE_ROCK = 984, + ITEM_RAVAGE_RING = 985, + ITEM_MANTYKE_BEAM = 986, + ITEM_MANTYKE_CARD = 987, + ITEM_WAFT_ROCK = 988, + ITEM_OCEAN_BOW = 989, + ITEM_MANTINE_FOAM = 990, + ITEM_MANTINE_CARD = 991, + ITEM_SUNSET_ROCK = 992, + ITEM_HORIZON_BOW = 993, + ITEM_PHIONE_SONG = 994, + ITEM_PHIONE_CARD = 995, + ITEM_WAVE_JEWEL = 996, + ITEM_RIPPLE_CAPE = 997, + ITEM_VULPIX_TAIL = 998, + ITEM_VULPIX_CARD = 999, + ITEM_VULPIX_TAG = 1000, + ITEM_GLOWING_BOW = 1001, + ITEM_NINE_HAIR = 1002, + ITEM_NINE_CARD = 1003, + ITEM_NINE_SEAL = 1004, + ITEM_AFIRE_COLLAR = 1005, + ITEM_PHANPY_CLAW = 1006, + ITEM_PHANPY_CARD = 1007, + ITEM_PHANPY_TAG = 1008, + ITEM_VALUE_RUFF = 1009, + ITEM_DONPHAN_FANG = 1010, + ITEM_DONPHAN_CARD = 1011, + ITEM_DON_CREST = 1012, + ITEM_ARMOR_SCARF = 1013, + ITEM_CATER_BELT = 1014, + ITEM_DEFENSE_BOW = 1015, + ITEM_GLITTERY_BOW = 1016, + ITEM_WEEDLE_BOW = 1017, + ITEM_KAKUNA_SCARF = 1018, + ITEM_CHARGE_SCARF = 1019, + ITEM_PIDGEY_BOW = 1020, + ITEM_PIDGEO_SCARF = 1021, + ITEM_PIDGEOT_TORC = 1022, + ITEM_RATTA_SCARF = 1023, + ITEM_OVERCOME_BOW = 1024, + ITEM_QUIRKY_BOW = 1025, + ITEM_WING_SCARF = 1026, + ITEM_LEASH_BOW = 1027, + ITEM_SHOCK_RUFF = 1028, + ITEM_SAND_SCARF = 1029, + ITEM_SANDY_TORC = 1030, + ITEM_POINTY_SCARF = 1031, + ITEM_RETURN_SCARF = 1032, + ITEM_IMPACT_TORC = 1033, + ITEM_HALVE_SCARF = 1034, + ITEM_THORNY_SCARF = 1035, + ITEM_KING_SASH = 1036, + ITEM_DODGE_BOW = 1037, + ITEM_ABSORB_SCARF = 1038, + ITEM_ODD_BOW = 1039, + ITEM_GUARD_HAT = 1040, + ITEM_AROMA_SCARF = 1041, + ITEM_MOVING_SCARF = 1042, + ITEM_FIRM_HAT = 1043, + ITEM_GAZE_GOGGLES = 1044, + ITEM_VENOMOTH_BOW = 1045, + ITEM_DIGLETT_HAT = 1046, + ITEM_DUGTRIO_BOW = 1047, + ITEM_PSYDUCK_HAT = 1048, + ITEM_PADDLE_SCARF = 1049, + ITEM_MANKEY_TORC = 1050, + ITEM_NULLIFY_BELT = 1051, + ITEM_GROWL_SCARF = 1052, + ITEM_LEGEND_BOW = 1053, + ITEM_DAMP_BOW = 1054, + ITEM_POLI_BOW = 1055, + ITEM_BOLD_BELT = 1056, + ITEM_PREDICT_TORC = 1057, + ITEM_PSYCHIC_TORC = 1058, + ITEM_SPARKLE_RUFF = 1059, + ITEM_IMPISH_BAND = 1060, + ITEM_STRONG_BELT = 1061, + ITEM_MACHAMP_BELT = 1062, + ITEM_BELL_BOW = 1063, + ITEM_DIGEST_SCARF = 1064, + ITEM_VICTREE_TORC = 1065, + ITEM_TANGLE_BOW = 1066, + ITEM_TENTA_CAPE = 1067, + ITEM_GEODUDE_TORC = 1068, + ITEM_ROCKY_TORC = 1069, + ITEM_RUGGED_SASH = 1070, + ITEM_HEATED_BOW = 1071, + ITEM_SUNLIGHT_BOW = 1072, + ITEM_SLOWPOKE_HAT = 1073, + ITEM_SLOW_SCARF = 1074, + ITEM_MAGNE_TORC = 1075, + ITEM_MAGNETON_BOW = 1076, + ITEM_BULLSEYE_BOW = 1077, + ITEM_BUDDY_TORC = 1078, + ITEM_FIGHT_TORC = 1079, + ITEM_GENTLE_BOW = 1080, + ITEM_NORTH_TORC = 1081, + ITEM_GRIMY_SCARF = 1082, + ITEM_SLIMY_BOW = 1083, + ITEM_SHELL_TORC = 1084, + ITEM_COVER_ARMOR = 1085, + ITEM_GASTLY_VEIL = 1086, + ITEM_SLIP_SCARF = 1087, + ITEM_SUNGLASSES = 1088, + ITEM_TRUST_BROOCH = 1089, + ITEM_DROWZEE_TIE = 1090, + ITEM_DREAM_COIN = 1091, + ITEM_KRABBY_BOW = 1092, + ITEM_SUPER_SASH = 1093, + ITEM_BALL_SCARF = 1094, + ITEM_ELECTRO_BOW = 1095, + ITEM_REPEL_SCARF = 1096, + ITEM_EXEGGU_SASH = 1097, + ITEM_CUBONE_SCARF = 1098, + ITEM_MAROWAK_TORC = 1099, + ITEM_LICKY_SCARF = 1100, + ITEM_KOFFING_BOW = 1101, + ITEM_WEEZ_SCARF = 1102, + ITEM_SOLID_SHIELD = 1103, + ITEM_PIERCE_DRILL = 1104, + ITEM_STICKY_BOW = 1105, + ITEM_KANG_APRON = 1106, + ITEM_HORSEA_BOW = 1107, + ITEM_SWIRL_SCARF = 1108, + ITEM_GOLDEEN_BOW = 1109, + ITEM_SEAKING_BOW = 1110, + ITEM_RECOVER_TORC = 1111, + ITEM_STARMIE_BELT = 1112, + ITEM_PINSIR_SASH = 1113, + ITEM_RUSHING_BOW = 1114, + ITEM_MAGIKARP_BOW = 1115, + ITEM_TEMPEST_SASH = 1116, + ITEM_DITTO_TORC = 1117, + ITEM_AI_BROOCH = 1118, + ITEM_SPIKE_BROOCH = 1119, + ITEM_AGED_SCARF = 1120, + ITEM_KABUTO_HAT = 1121, + ITEM_KABU_TORC = 1122, + ITEM_OLD_BROOCH = 1123, + ITEM_DRAGON_SASH = 1124, + ITEM_ALOFT_MANTLE = 1125, + ITEM_MIRAGE_CAPE = 1126, + ITEM_SENTRET_RUFF = 1127, + ITEM_BODY_COLLAR = 1128, + ITEM_EXPOSE_SPECS = 1129, + ITEM_NOCTOWL_TORC = 1130, + ITEM_MORNING_BOW = 1131, + ITEM_LEDIAN_BOW = 1132, + ITEM_SPINA_SCARF = 1133, + ITEM_ARIADOS_BOW = 1134, + ITEM_SLASH_BOW = 1135, + ITEM_SHINE_TORC = 1136, + ITEM_LANTURN_BOW = 1137, + ITEM_LIVELY_SCARF = 1138, + ITEM_XATU_BOW = 1139, + ITEM_WOOL_BOW = 1140, + ITEM_FLUFFY_SCARF = 1141, + ITEM_SACRED_SCARF = 1142, + ITEM_BRIGHT_TIARA = 1143, + ITEM_RAIN_CROWN = 1144, + ITEM_ZEPHYR_BOW = 1145, + ITEM_SKIP_SCARF = 1146, + ITEM_COTTON_TORC = 1147, + ITEM_REVENGE_RUFF = 1148, + ITEM_HASTY_BOW = 1149, + ITEM_SUN_SCARF = 1150, + ITEM_CHITIN_BOW = 1151, + ITEM_WOOPER_BOW = 1152, + ITEM_QUAG_TORC = 1153, + ITEM_MURKROW_HAT = 1154, + ITEM_KING_CAP = 1155, + ITEM_MISDREA_CAPE = 1156, + ITEM_CRYPTIC_SASH = 1157, + ITEM_REVERSE_BOW = 1158, + ITEM_ROBUST_BOW = 1159, + ITEM_DENSE_PONCHO = 1160, + ITEM_ESCAPE_SCARF = 1161, + ITEM_TAKEOFF_RUFF = 1162, + ITEM_QUARTZ_TORC = 1163, + ITEM_SNUB_CAPE = 1164, + ITEM_STERN_SASH = 1165, + ITEM_QWILFISH_BOW = 1166, + ITEM_SHUCKLE_BOW = 1167, + ITEM_HORN_TORC = 1168, + ITEM_LAVA_BOW = 1169, + ITEM_TORRID_SCARF = 1170, + ITEM_FRIGID_BOW = 1171, + ITEM_FROST_TORC = 1172, + ITEM_EAGER_BROOCH = 1173, + ITEM_REACH_BOW = 1174, + ITEM_PSY_BOW = 1175, + ITEM_SNOW_BROOCH = 1176, + ITEM_SKAR_CAPE = 1177, + ITEM_DARK_CHOKER = 1178, + ITEM_PIT_FANG = 1179, + ITEM_TORNADO_BOW = 1180, + ITEM_VIRTUAL_BOW = 1181, + ITEM_DELUSION_BOW = 1182, + ITEM_PAINT_SCARF = 1183, + ITEM_MILKY_SCARF = 1184, + ITEM_LARVITAR_BOW = 1185, + ITEM_PUPITA_SCARF = 1186, + ITEM_CRASH_CLAW = 1187, + ITEM_POOCH_COLLAR = 1188, + ITEM_DARK_FANG = 1189, + ITEM_MERRY_SCARF = 1190, + ITEM_LINOONE_RUFF = 1191, + ITEM_WURMPLE_BOW = 1192, + ITEM_TOUGH_SCARF = 1193, + ITEM_VIVID_SILK = 1194, + ITEM_GUARD_BOW = 1195, + ITEM_DUSTOX_BOW = 1196, + ITEM_KELP_HAT = 1197, + ITEM_JOLLY_SCARF = 1198, + ITEM_LUDICOLO_HAT = 1199, + ITEM_SEEDOT_HAT = 1200, + ITEM_NUZLEAF_BOW = 1201, + ITEM_SHIFTRY_BELT = 1202, + ITEM_TAILLOW_BOW = 1203, + ITEM_MIDAIR_SCARF = 1204, + ITEM_WINGULL_BOW = 1205, + ITEM_STOCK_SCARF = 1206, + ITEM_SENSING_HAT = 1207, + ITEM_MAGICAL_BOW = 1208, + ITEM_CARING_SCARF = 1209, + ITEM_BLISS_SCARF = 1210, + ITEM_BLOCKING_BOW = 1211, + ITEM_MOBILE_BOW = 1212, + ITEM_THWART_BOW = 1213, + ITEM_SLAK_SCARF = 1214, + ITEM_VIGOR_SASH = 1215, + ITEM_LAZY_RUFF = 1216, + ITEM_NOVICE_SCARF = 1217, + ITEM_NINJA_RUFF = 1218, + ITEM_AWE_MANTLE = 1219, + ITEM_GOOD_EARRING = 1220, + ITEM_NICE_BANGLE = 1221, + ITEM_GREAT_TORC = 1222, + ITEM_MAKUHIT_BELT = 1223, + ITEM_THRUST_BELT = 1224, + ITEM_NOSE_TORC = 1225, + ITEM_SABLE_SCOPE = 1226, + ITEM_DECEIT_MASK = 1227, + ITEM_IRON_TORC = 1228, + ITEM_METAL_BANGLE = 1229, + ITEM_IRON_HELMET = 1230, + ITEM_INTUIT_BOW = 1231, + ITEM_PONDER_SASH = 1232, + ITEM_PUNISH_TORC = 1233, + ITEM_PROTECT_MASK = 1234, + ITEM_NEON_SCARF = 1235, + ITEM_EVENING_BOW = 1236, + ITEM_THORNED_TORC = 1237, + ITEM_GULPIN_BOW = 1238, + ITEM_SWALOT_BELT = 1239, + ITEM_CARVA_SASH = 1240, + ITEM_VICIOUS_BOW = 1241, + ITEM_SPOUT_SCARF = 1242, + ITEM_HUGE_BOW = 1243, + ITEM_NUMEL_BOW = 1244, + ITEM_ERUPT_SCARF = 1245, + ITEM_SOOTY_SASH = 1246, + ITEM_SPRING_BOW = 1247, + ITEM_SCHEME_SCARF = 1248, + ITEM_HULA_BOW = 1249, + ITEM_DESERT_BOW = 1250, + ITEM_VIBRA_SCARF = 1251, + ITEM_RED_GLASSES = 1252, + ITEM_DESERT_SASH = 1253, + ITEM_CACTURNE_HAT = 1254, + ITEM_TUFT_BOW = 1255, + ITEM_CLOUD_RUFF = 1256, + ITEM_STRONG_SASH = 1257, + ITEM_SEVIPER_BOW = 1258, + ITEM_LUNATON_TORC = 1259, + ITEM_SOLROCK_BOW = 1260, + ITEM_SOAK_SCARF = 1261, + ITEM_WHISCASH_BOW = 1262, + ITEM_BOSSY_SCARF = 1263, + ITEM_COWER_SASH = 1264, + ITEM_BAL_BROOCH = 1265, + ITEM_CLAYDOL_TORC = 1266, + ITEM_BIND_SCARF = 1267, + ITEM_CRADILY_BOW = 1268, + ITEM_GUARD_CLAW = 1269, + ITEM_RIGID_CAPE = 1270, + ITEM_ADMIRE_SCARF = 1271, + ITEM_GRACE_SCARF = 1272, + ITEM_KECLEON_TORC = 1273, + ITEM_SHUPPET_CAPE = 1274, + ITEM_OMINOUS_TORC = 1275, + ITEM_DUSKULL_RUFF = 1276, + ITEM_ILLUSION_BOW = 1277, + ITEM_TROPIUS_BOW = 1278, + ITEM_CHIME_SCARF = 1279, + ITEM_PERISH_TORC = 1280, + ITEM_CHILLY_HAT = 1281, + ITEM_HAIL_SCARF = 1282, + ITEM_SLEET_BOW = 1283, + ITEM_SAFE_SCARF = 1284, + ITEM_WALREIN_TORC = 1285, + ITEM_CLAM_BROOCH = 1286, + ITEM_DEEP_TORC = 1287, + ITEM_GORE_SCARF = 1288, + ITEM_RELI_TORC = 1289, + ITEM_LUVDISC_TORC = 1290, + ITEM_CRAG_HELMET = 1291, + ITEM_OUTLAST_BOW = 1292, + ITEM_SALA_CAPE = 1293, + ITEM_BELDUM_TORC = 1294, + ITEM_METANG_SCARF = 1295, + ITEM_META_TORC = 1296, + ITEM_STARLY_BOW = 1297, + ITEM_REGRET_TORC = 1298, + ITEM_GUTS_SASH = 1299, + ITEM_STILL_BOW = 1300, + ITEM_KRICKE_TORC = 1301, + ITEM_BUDEW_SCARF = 1302, + ITEM_BOUQUET_CAPE = 1303, + ITEM_HARD_HELMET = 1304, + ITEM_SKULL_HELMET = 1305, + ITEM_REBOUND_BOW = 1306, + ITEM_BLOCK_BROOCH = 1307, + ITEM_STRAW_CAPE = 1308, + ITEM_WORMA_BOW = 1309, + ITEM_MOTHIM_BOW = 1310, + ITEM_NECTAR_BOW = 1311, + ITEM_VESPI_TORC = 1312, + ITEM_AWAKE_BOW = 1313, + ITEM_GASTRO_TORC = 1314, + ITEM_AMBIPOM_BOW = 1315, + ITEM_DEFROST_RUFF = 1316, + ITEM_ALLURE_COAT = 1317, + ITEM_MAGIC_HAT = 1318, + ITEM_HONCH_CAPE = 1319, + ITEM_GLAMEOW_BOW = 1320, + ITEM_SCARY_BELT = 1321, + ITEM_CHING_TORC = 1322, + ITEM_STINKY_SCARF = 1323, + ITEM_STENCH_SASH = 1324, + ITEM_IMAGE_BROOCH = 1325, + ITEM_MIRROR_TORC = 1326, + ITEM_CHATOT_SCARF = 1327, + ITEM_THICK_SCARF = 1328, + ITEM_GRIT_VEIL = 1329, + ITEM_SKORUPI_BOW = 1330, + ITEM_DUST_SCARF = 1331, + ITEM_CROA_TORC = 1332, + ITEM_TOXI_BELT = 1333, + ITEM_CARNI_BOW = 1334, + ITEM_SWIM_BOW = 1335, + ITEM_LUMI_TORC = 1336, + ITEM_SNOWY_TORC = 1337, + ITEM_FROZEN_CAPE = 1338, + ITEM_BUILDER_SASH = 1339, + ITEM_FLABBY_BELT = 1340, + ITEM_RHYPERI_TORC = 1341, + ITEM_CLINGING_BOW = 1342, + ITEM_YANMEGA_BOW = 1343, + ITEM_GLISCOR_CAPE = 1344, + ITEM_GLACIER_CAPE = 1345, + ITEM_BEST_SCARF = 1346, + ITEM_GALLANT_TORC = 1347, + ITEM_PROBO_HAT = 1348, + ITEM_UNLUCKY_SASH = 1349, + ITEM_FROSLASS_BOW = 1350, + ITEM_PURIFY_VEIL = 1351, + ITEM_UNNAMED_0x548 = 1352, + ITEM_UNNAMED_0x549 = 1353, + ITEM_UNNAMED_0x54A = 1354, + ITEM_UNNAMED_0x54B = 1355, + ITEM_UNNAMED_0x54C = 1356, + ITEM_UNNAMED_0x54D = 1357, + ITEM_UNNAMED_0x54E = 1358, + ITEM_UNNAMED_0x54F = 1359, + ITEM_UNNAMED_0x550 = 1360, + ITEM_UNNAMED_0x551 = 1361, + ITEM_UNNAMED_0x552 = 1362, + ITEM_UNNAMED_0x553 = 1363, + ITEM_UNNAMED_0x554 = 1364, + ITEM_UNNAMED_0x555 = 1365, + ITEM_UNNAMED_0x556 = 1366, + ITEM_UNNAMED_0x557 = 1367, + ITEM_UNNAMED_0x558 = 1368, + ITEM_UNNAMED_0x559 = 1369, + ITEM_UNNAMED_0x55A = 1370, + ITEM_UNNAMED_0x55B = 1371, + ITEM_UNNAMED_0x55C = 1372, + ITEM_UNNAMED_0x55D = 1373, + ITEM_UNNAMED_0x55E = 1374, + ITEM_UNNAMED_0x55F = 1375, + ITEM_UNNAMED_0x560 = 1376, + ITEM_UNNAMED_0x561 = 1377, + ITEM_UNNAMED_0x562 = 1378, + ITEM_UNNAMED_0x563 = 1379, + ITEM_UNNAMED_0x564 = 1380, + ITEM_UNNAMED_0x565 = 1381, + ITEM_UNNAMED_0x566 = 1382, + ITEM_UNNAMED_0x567 = 1383, + ITEM_UNNAMED_0x568 = 1384, + ITEM_UNNAMED_0x569 = 1385, + ITEM_UNNAMED_0x56A = 1386, + ITEM_UNNAMED_0x56B = 1387, + ITEM_UNNAMED_0x56C = 1388, + ITEM_UNNAMED_0x56D = 1389, + ITEM_UNNAMED_0x56E = 1390, + ITEM_UNNAMED_0x56F = 1391, + ITEM_UNNAMED_0x570 = 1392, + ITEM_UNNAMED_0x571 = 1393, + ITEM_UNNAMED_0x572 = 1394, + ITEM_UNNAMED_0x573 = 1395, + ITEM_UNNAMED_0x574 = 1396, + ITEM_UNNAMED_0x575 = 1397, + ITEM_UNNAMED_0x576 = 1398, + ITEM_UNNAMED_0x577 = 1399, +}; + + +// Move ID +enum move_id { + MOVE_NOTHING = 0, + MOVE_IRON_TAIL = 1, + MOVE_ICE_BALL = 2, + MOVE_YAWN = 3, + MOVE_LOVELY_KISS = 4, + MOVE_NIGHTMARE = 5, + MOVE_MORNING_SUN = 6, + MOVE_VITAL_THROW = 7, + MOVE_DIG = 8, + MOVE_THRASH = 9, + MOVE_SWEET_SCENT = 10, + MOVE_CHARM = 11, + MOVE_RAIN_DANCE = 12, + MOVE_CONFUSE_RAY = 13, + MOVE_HAIL = 14, + MOVE_AROMATHERAPY = 15, + MOVE_BUBBLE = 16, + MOVE_ENCORE = 17, + MOVE_CUT = 18, + MOVE_RAGE = 19, + MOVE_SUPER_FANG = 20, + MOVE_PAIN_SPLIT = 21, + MOVE_TORMENT = 22, + MOVE_STRING_SHOT = 23, + MOVE_SWAGGER = 24, + MOVE_SNORE = 25, + MOVE_HEAL_BELL = 26, + MOVE_SCREECH = 27, + MOVE_ROCK_THROW = 28, + MOVE_ROCK_SMASH = 29, + MOVE_ROCK_SLIDE = 30, + MOVE_WEATHER_BALL = 31, + MOVE_WHIRLPOOL = 32, + MOVE_FAKE_TEARS = 33, + MOVE_SING = 34, + MOVE_SPITE = 35, + MOVE_AIR_CUTTER = 36, + MOVE_SMOKESCREEN = 37, + MOVE_PURSUIT = 38, + MOVE_DOUBLESLAP = 39, + MOVE_MIRROR_MOVE = 40, + MOVE_OVERHEAT = 41, + MOVE_AURORA_BEAM = 42, + MOVE_MEMENTO = 43, + MOVE_OCTAZOOKA = 44, + MOVE_FLATTER = 45, + MOVE_ASTONISH = 46, + MOVE_WILL_O_WISP = 47, + MOVE_RETURN = 48, + MOVE_GRUDGE = 49, + MOVE_STRENGTH = 50, + MOVE_COUNTER = 51, + MOVE_FLAME_WHEEL = 52, + MOVE_FLAMETHROWER = 53, + MOVE_ODOR_SLEUTH = 54, + MOVE_SHARPEN = 55, + MOVE_DOUBLE_TEAM = 56, + MOVE_GUST = 57, + MOVE_HARDEN = 58, + MOVE_DISABLE = 59, + MOVE_RAZOR_WIND = 60, + MOVE_BIDE = 61, + MOVE_CRUNCH = 62, + MOVE_BITE = 63, + MOVE_THUNDER = 64, + MOVE_THUNDERPUNCH = 65, + MOVE_ENDEAVOR = 66, + MOVE_FACADE = 67, + MOVE_KARATE_CHOP = 68, + MOVE_CLAMP = 69, + MOVE_WITHDRAW = 70, + MOVE_CONSTRICT = 71, + MOVE_BRICK_BREAK = 72, + MOVE_ROCK_TOMB = 73, + MOVE_FOCUS_ENERGY = 74, + MOVE_FOCUS_PUNCH = 75, + MOVE_GIGA_DRAIN = 76, + MOVE_REVERSAL = 77, + MOVE_SMELLINGSALT = 78, + MOVE_SPORE = 79, + MOVE_LEECH_LIFE = 80, + MOVE_SLASH = 81, + MOVE_SILVER_WIND = 82, + MOVE_METAL_SOUND = 83, + MOVE_GRASSWHISTLE = 84, + MOVE_TICKLE = 85, + MOVE_SPIDER_WEB = 86, + MOVE_CRABHAMMER = 87, + MOVE_HAZE = 88, + MOVE_MEAN_LOOK = 89, + MOVE_CROSS_CHOP = 90, + MOVE_OUTRAGE = 91, + MOVE_LOW_KICK = 92, + MOVE_ANCIENTPOWER = 93, + MOVE_SYNTHESIS = 94, + MOVE_AGILITY = 95, + MOVE_RAPID_SPIN = 96, + MOVE_ICY_WIND = 97, + MOVE_MIND_READER = 98, + MOVE_COSMIC_POWER = 99, + MOVE_SKY_ATTACK = 100, + MOVE_POWDER_SNOW = 101, + MOVE_FOLLOW_ME = 102, + MOVE_METEOR_MASH = 103, + MOVE_ENDURE = 104, + MOVE_ROLLOUT = 105, + MOVE_SCARY_FACE = 106, + MOVE_PSYBEAM = 107, + MOVE_PSYWAVE = 108, + MOVE_PSYCHIC = 109, + MOVE_PSYCHO_BOOST = 110, + MOVE_HYPNOSIS = 111, + MOVE_UPROAR = 112, + MOVE_WATER_SPOUT = 113, + MOVE_SIGNAL_BEAM = 114, + MOVE_PSYCH_UP = 115, + MOVE_SUBMISSION = 116, + MOVE_RECOVER = 117, + MOVE_EARTHQUAKE = 118, + MOVE_NATURE_POWER = 119, + MOVE_LICK = 120, + MOVE_FLAIL = 121, + MOVE_TAIL_WHIP = 122, + MOVE_SELFDESTRUCT = 123, + MOVE_STUN_SPORE = 124, + MOVE_BIND = 125, + MOVE_SHADOW_PUNCH = 126, + MOVE_SHADOW_BALL = 127, + MOVE_CHARGE = 128, + MOVE_THUNDERBOLT = 129, + MOVE_MIST = 130, + MOVE_FISSURE = 131, + MOVE_EXTREMESPEED = 132, + MOVE_EXTRASENSORY = 133, + MOVE_SAFEGUARD = 134, + MOVE_ABSORB = 135, + MOVE_SKY_UPPERCUT = 136, + MOVE_SKILL_SWAP = 137, + MOVE_SKETCH = 138, + MOVE_HEADBUTT = 139, + MOVE_DOUBLE_EDGE = 140, + MOVE_SANDSTORM = 141, + MOVE_SAND_ATTACK = 142, + MOVE_SAND_TOMB = 143, + MOVE_SPARK = 144, + MOVE_SWIFT = 145, + MOVE_KINESIS = 146, + MOVE_SMOG = 147, + MOVE_GROWTH = 148, + MOVE_SACRED_FIRE = 149, + MOVE_SHEER_COLD = 150, + MOVE_SOLARBEAM = 151, + MOVE_SONICBOOM = 152, + MOVE_FLY = 153, + MOVE_TACKLE = 154, + MOVE_EXPLOSION = 155, + MOVE_DIVE = 156, + MOVE_FIRE_BLAST = 157, + MOVE_WATERFALL = 158, + MOVE_MUDDY_WATER = 159, + MOVE_STOCKPILE = 160, + MOVE_SLAM = 161, + MOVE_TWISTER = 162, + MOVE_BULLET_SEED = 163, + MOVE_TWINEEDLE = 164, + MOVE_SOFTBOILED = 165, + MOVE_EGG_BOMB = 166, + MOVE_FAINT_ATTACK = 167, + MOVE_BARRAGE = 168, + MOVE_MINIMIZE = 169, + MOVE_SEISMIC_TOSS = 170, + MOVE_SUPERSONIC = 171, + MOVE_TAUNT = 172, + MOVE_MOONLIGHT = 173, + MOVE_PECK = 174, + MOVE_ARM_THRUST = 175, + MOVE_HORN_ATTACK = 176, + MOVE_HORN_DRILL = 177, + MOVE_WING_ATTACK = 178, + MOVE_AERIAL_ACE = 179, + MOVE_ICICLE_SPEAR = 180, + MOVE_SWORDS_DANCE = 181, + MOVE_VINE_WHIP = 182, + MOVE_CONVERSION = 183, + MOVE_CONVERSION_2 = 184, + MOVE_HELPING_HAND = 185, + MOVE_IRON_DEFENSE = 186, + MOVE_TELEPORT = 187, + MOVE_THUNDERSHOCK = 188, + MOVE_SHOCK_WAVE = 189, + MOVE_QUICK_ATTACK = 190, + MOVE_SWEET_KISS = 191, + MOVE_THUNDER_WAVE = 192, + MOVE_ZAP_CANNON = 193, + MOVE_BLOCK = 194, + MOVE_HOWL = 195, + MOVE_POISON_GAS = 196, + MOVE_TOXIC = 197, + MOVE_POISON_FANG = 198, + MOVE_POISONPOWDER = 199, + MOVE_POISON_STING = 200, + MOVE_SPIKE_CANNON = 201, + MOVE_ACID_ARMOR = 202, + MOVE_TAKE_DOWN = 203, + MOVE_JUMP_KICK = 204, + MOVE_BOUNCE = 205, + MOVE_HI_JUMP_KICK = 206, + MOVE_TRI_ATTACK = 207, + MOVE_DRAGON_CLAW = 208, + MOVE_TRICK = 209, + MOVE_TRIPLE_KICK = 210, + MOVE_DRILL_PECK = 211, + MOVE_MUD_SPORT = 212, + MOVE_MUD_SLAP = 213, + MOVE_THIEF = 214, + MOVE_AMNESIA = 215, + MOVE_NIGHT_SHADE = 216, + MOVE_GROWL = 217, + MOVE_SLACK_OFF = 218, + MOVE_SURF = 219, + MOVE_ROLE_PLAY = 220, + MOVE_NEEDLE_ARM = 221, + MOVE_DOUBLE_KICK = 222, + MOVE_SUNNY_DAY = 223, + MOVE_LEER = 224, + MOVE_WISH = 225, + MOVE_FAKE_OUT = 226, + MOVE_SLEEP_TALK = 227, + MOVE_PAY_DAY = 228, + MOVE_ASSIST = 229, + MOVE_HEAT_WAVE = 230, + MOVE_SLEEP_POWDER = 231, + MOVE_REST = 232, + MOVE_INGRAIN = 233, + MOVE_CONFUSION = 234, + MOVE_BODY_SLAM = 235, + MOVE_SWALLOW = 236, + MOVE_CURSE = 237, + MOVE_FRENZY_PLANT = 238, + MOVE_HYDRO_CANNON = 239, + MOVE_HYDRO_PUMP = 240, + MOVE_HYPER_VOICE = 241, + MOVE_HYPER_BEAM = 242, + MOVE_SUPERPOWER = 243, + MOVE_STEEL_WING = 244, + MOVE_SPIT_UP = 245, + MOVE_DYNAMICPUNCH = 246, + MOVE_GUILLOTINE = 247, + MOVE_VICEGRIP = 248, + MOVE_KNOCK_OFF = 249, + MOVE_POUND = 250, + MOVE_RAZOR_LEAF = 251, + MOVE_BATON_PASS = 252, + MOVE_PETAL_DANCE = 253, + MOVE_SPLASH = 254, + MOVE_BUBBLEBEAM = 255, + MOVE_DOOM_DESIRE = 256, + MOVE_BELLY_DRUM = 257, + MOVE_BARRIER = 258, + MOVE_LIGHT_SCREEN = 259, + MOVE_SCRATCH = 260, + MOVE_HYPER_FANG = 261, + MOVE_EMBER = 262, + MOVE_SECRET_POWER = 263, + MOVE_DIZZY_PUNCH = 264, + MOVE_BULK_UP = 265, + MOVE_IMPRISON = 266, + MOVE_FEATHERDANCE = 267, + MOVE_WHIRLWIND = 268, + MOVE_BEAT_UP = 269, + MOVE_BLIZZARD = 270, + MOVE_STOMP = 271, + MOVE_BLAST_BURN = 272, + MOVE_FLASH = 273, + MOVE_TEETER_DANCE = 274, + MOVE_CRUSH_CLAW = 275, + MOVE_BLAZE_KICK = 276, + MOVE_PRESENT = 277, + MOVE_ERUPTION = 278, + MOVE_SLUDGE = 279, + MOVE_SLUDGE_BOMB = 280, + MOVE_GLARE = 281, + MOVE_TRANSFORM = 282, + MOVE_POISON_TAIL = 283, + MOVE_ROAR = 284, + MOVE_BONE_RUSH = 285, + MOVE_CAMOUFLAGE = 286, + MOVE_COVET = 287, + MOVE_TAIL_GLOW = 288, + MOVE_BONE_CLUB = 289, + MOVE_BONEMERANG = 290, + MOVE_FIRE_SPIN = 291, + MOVE_FIRE_PUNCH = 292, + MOVE_PERISH_SONG = 293, + MOVE_WRAP = 294, + MOVE_SPIKES = 295, + MOVE_MAGNITUDE = 296, + MOVE_MAGICAL_LEAF = 297, + MOVE_MAGIC_COAT = 298, + MOVE_MUD_SHOT = 299, + MOVE_MACH_PUNCH = 300, + MOVE_PROTECT = 301, + MOVE_DEFENSE_CURL = 302, + MOVE_ROLLING_KICK = 303, + MOVE_SUBSTITUTE = 304, + MOVE_DETECT = 305, + MOVE_PIN_MISSILE = 306, + MOVE_WATER_SPORT = 307, + MOVE_WATER_GUN = 308, + MOVE_MIST_BALL = 309, + MOVE_WATER_PULSE = 310, + MOVE_FURY_ATTACK = 311, + MOVE_FURY_SWIPES = 312, + MOVE_DESTINY_BOND = 313, + MOVE_FALSE_SWIPE = 314, + MOVE_FORESIGHT = 315, + MOVE_MIRROR_COAT = 316, + MOVE_FUTURE_SIGHT = 317, + MOVE_MILK_DRINK = 318, + MOVE_CALM_MIND = 319, + MOVE_MEGA_DRAIN = 320, + MOVE_MEGA_KICK = 321, + MOVE_MEGA_PUNCH = 322, + MOVE_MEGAHORN = 323, + MOVE_HIDDEN_POWER = 324, + MOVE_METAL_CLAW = 325, + MOVE_ATTRACT = 326, + MOVE_MIMIC = 327, + MOVE_FRUSTRATION = 328, + MOVE_LEECH_SEED = 329, + MOVE_METRONOME = 330, + MOVE_DREAM_EATER = 331, + MOVE_ACID = 332, + MOVE_MEDITATE = 333, + MOVE_SNATCH = 334, + MOVE_LUSTER_PURGE = 335, + MOVE_LEAF_BLADE = 336, + MOVE_RECYCLE = 337, + MOVE_REFLECT = 338, + MOVE_REFRESH = 339, + MOVE_REVENGE = 340, + MOVE_DRAGON_RAGE = 341, + MOVE_DRAGONBREATH = 342, + MOVE_DRAGON_DANCE = 343, + MOVE_ICE_PUNCH = 344, + MOVE_ICE_BEAM = 345, + MOVE_FURY_CUTTER = 346, + MOVE_COMET_PUNCH = 347, + MOVE_SKULL_BASH = 348, + MOVE_LOCK_ON = 349, + MOVE_ROCK_BLAST = 350, + MOVE_COTTON_SPORE = 351, + MOVE_STRUGGLE = 352, + MOVE_AEROBLAST = 353, + MOVE_VOLT_TACKLE = 354, + MOVE_REGULAR_ATTACK = 355, + MOVE_IS_WATCHING = 356, + MOVE_BIDE_UNLEASH = 357, + MOVE_REVENGE_UNLEASH = 358, + MOVE_AVALANCHE_UNLEASH = 359, + MOVE_WIDE_SLASH = 360, + MOVE_UNNAMED_0x169 = 361, + MOVE_UNNAMED_0x16A = 362, + MOVE_SEE_TRAP = 363, + MOVE_TAKEAWAY = 364, + MOVE_REBOUND = 365, + MOVE_BLOOP_SLASH = 366, + MOVE_SWITCHER = 367, + MOVE_BLOWBACK = 368, + MOVE_WARP = 369, + MOVE_TRANSFER = 370, + MOVE_SLOW_DOWN = 371, + MOVE_SPEED_BOOST = 372, + MOVE_SEARCHLIGHT = 373, + MOVE_PETRIFY = 374, + MOVE_STAY_AWAY = 375, + MOVE_POUNCE = 376, + MOVE_TRAWL = 377, + MOVE_CLEANSE = 378, + MOVE_OBSERVER = 379, + MOVE_DECOY_MAKER = 380, + MOVE_SIESTA = 381, + MOVE_TOTTER = 382, + MOVE_TWO_EDGE = 383, + MOVE_NO_MOVE = 384, + MOVE_ESCAPE = 385, + MOVE_SCAN = 386, + MOVE_POWER_EARS = 387, + MOVE_DROUGHT = 388, + MOVE_TRAP_BUSTER = 389, + MOVE_WILD_CALL = 390, + MOVE_INVISIFY = 391, + MOVE_ONE_SHOT = 392, + MOVE_HP_GAUGE = 393, + MOVE_VACUUM_CUT = 394, + MOVE_REVIVER = 395, + MOVE_SHOCKER = 396, + MOVE_ECHO = 397, + MOVE_FAMISH = 398, + MOVE_ONE_ROOM = 399, + MOVE_FILL_IN = 400, + MOVE_TRAPPER = 401, + MOVE_POSSESS = 402, + MOVE_ITEMIZE = 403, + MOVE_TAG_0x194 = 404, + MOVE_PROJECTILE = 405, + MOVE_HURL = 406, + MOVE_MOBILE = 407, + MOVE_ITEM_TOSS = 408, + MOVE_SEE_STAIRS = 409, + MOVE_LONG_TOSS = 410, + MOVE_TAG_0x19B = 411, + MOVE_PIERCE = 412, + MOVE_TAG_0x19D = 413, + MOVE_TAG_0x19E = 414, + MOVE_TAG_0x19F = 415, + MOVE_TAG_0x1A0 = 416, + MOVE_TAG_0x1A1 = 417, + MOVE_TAG_0x1A2 = 418, + MOVE_TAG_0x1A3 = 419, + MOVE_TAG_0x1A4 = 420, + MOVE_TAG_0x1A5 = 421, + MOVE_TAG_0x1A6 = 422, + MOVE_TAG_0x1A7 = 423, + MOVE_TAG_0x1A8 = 424, + MOVE_TAG_0x1A9 = 425, + MOVE_TAG_0x1AA = 426, + MOVE_TAG_0x1AB = 427, + MOVE_TAG_0x1AC = 428, + MOVE_TAG_0x1AD = 429, + MOVE_HAMMER_ARM = 430, + MOVE_IRON_HEAD = 431, + MOVE_AQUA_JET = 432, + MOVE_AQUA_TAIL = 433, + MOVE_AQUA_RING = 434, + MOVE_SPACIAL_REND = 435, + MOVE_DARK_PULSE = 436, + MOVE_OMINOUS_WIND = 437, + MOVE_GASTRO_ACID = 438, + MOVE_HEALING_WISH = 439, + MOVE_CLOSE_COMBAT = 440, + MOVE_WOOD_HAMMER = 441, + MOVE_AIR_SLASH = 442, + MOVE_ENERGY_BALL = 443, + MOVE_TAILWIND = 444, + MOVE_PUNISHMENT = 445, + MOVE_CHATTER = 446, + MOVE_LUCKY_CHANT = 447, + MOVE_GUARD_SWAP = 448, + MOVE_HEAL_ORDER = 449, + MOVE_HEAL_BLOCK = 450, + MOVE_SHADOW_SNEAK = 451, + MOVE_THUNDER_FANG = 452, + MOVE_ROCK_WRECKER = 453, + MOVE_FOCUS_BLAST = 454, + MOVE_GIGA_IMPACT = 455, + MOVE_DEFOG = 456, + MOVE_TRUMP_CARD = 457, + MOVE_GRASS_KNOT = 458, + MOVE_CROSS_POISON = 459, + MOVE_ATTACK_ORDER = 460, + MOVE_ICE_FANG = 461, + MOVE_ICE_SHARD = 462, + MOVE_PSYCHO_CUT = 463, + MOVE_PSYCHO_SHIFT = 464, + MOVE_ME_FIRST = 465, + MOVE_EMBARGO = 466, + MOVE_JUDGMENT = 467, + MOVE_SEED_FLARE = 468, + MOVE_BRINE = 469, + MOVE_X_SCISSOR = 470, + MOVE_NATURAL_GIFT = 471, + MOVE_PAYBACK = 472, + MOVE_ZEN_HEADBUTT = 473, + MOVE_WRING_OUT = 474, + MOVE_GYRO_BALL = 475, + MOVE_SHADOW_CLAW = 476, + MOVE_SHADOW_FORCE = 477, + MOVE_GRAVITY = 478, + MOVE_VACUUM_WAVE = 479, + MOVE_STEALTH_ROCK = 480, + MOVE_STONE_EDGE = 481, + MOVE_SWITCHEROO = 482, + MOVE_DARK_VOID = 483, + MOVE_EARTH_POWER = 484, + MOVE_GUNK_SHOT = 485, + MOVE_SEED_BOMB = 486, + MOVE_DOUBLE_HIT = 487, + MOVE_ASSURANCE = 488, + MOVE_CHARGE_BEAM = 489, + MOVE_PLUCK = 490, + MOVE_NIGHT_SLASH = 491, + MOVE_ACUPRESSURE = 492, + MOVE_MAGNET_RISE = 493, + MOVE_ROAR_OF_TIME = 494, + MOVE_POISON_JAB = 495, + MOVE_TOXIC_SPIKES = 496, + MOVE_LAST_RESORT = 497, + MOVE_DRAGON_RUSH = 498, + MOVE_TRICK_ROOM = 499, + MOVE_DRAIN_PUNCH = 500, + MOVE_MUD_BOMB = 501, + MOVE_U_TURN = 502, + MOVE_FLING = 503, + MOVE_WORRY_SEED = 504, + MOVE_CRUSH_GRIP = 505, + MOVE_HEART_SWAP = 506, + MOVE_FORCE_PALM = 507, + MOVE_AURA_SPHERE = 508, + MOVE_ROOST = 509, + MOVE_BULLET_PUNCH = 510, + MOVE_POWER_WHIP = 511, + MOVE_POWER_GEM = 512, + MOVE_POWER_SWAP = 513, + MOVE_POWER_TRICK = 514, + MOVE_SUCKER_PUNCH = 515, + MOVE_FEINT = 516, + MOVE_FLARE_BLITZ = 517, + MOVE_BRAVE_BIRD = 518, + MOVE_LAVA_PLUME = 519, + MOVE_DEFEND_ORDER = 520, + MOVE_DISCHARGE = 521, + MOVE_FIRE_FANG = 522, + MOVE_MAGNET_BOMB = 523, + MOVE_MAGMA_STORM = 524, + MOVE_COPYCAT = 525, + MOVE_LUNAR_DANCE = 526, + MOVE_MIRROR_SHOT = 527, + MOVE_MIRACLE_EYE = 528, + MOVE_BUG_BITE = 529, + MOVE_BUG_BUZZ = 530, + MOVE_WAKE_UP_SLAP = 531, + MOVE_METAL_BURST = 532, + MOVE_HEAD_SMASH = 533, + MOVE_CAPTIVATE = 534, + MOVE_AVALANCHE = 535, + MOVE_FLASH_CANNON = 536, + MOVE_LEAF_STORM = 537, + MOVE_DRACO_METEOR = 538, + MOVE_DRAGON_PULSE = 539, + MOVE_ROCK_POLISH = 540, + MOVE_ROCK_CLIMB = 541, + MOVE_NASTY_PLOT = 542, + MOVE_TAG_0x21F = 543, + MOVE_TAG_0x220 = 544, + MOVE_TAG_0x221 = 545, + MOVE_TAG_0x222 = 546, + MOVE_TAG_0x223 = 547, + MOVE_TAG_0x224 = 548, + MOVE_TAG_0x225 = 549, + MOVE_TAG_0x226 = 550, + MOVE_TAG_0x227 = 551, + MOVE_TAG_0x228 = 552, + MOVE_TAG_0x229 = 553, + MOVE_TAG_0x22A = 554, + MOVE_TAG_0x22B = 555, + MOVE_TAG_0x22C = 556, + MOVE_TAG_0x22D = 557, + MOVE_TAG_0x22E = 558, +}; + +// Affects the chance of items spawning on each tile in a Kecleon Shop +// The chances (in %) of each tile (in a 3x3 area at the center of the shop) +// having an item are listed below. +enum shop_item_positions { + // 30 30 30 + // 100 100 30 + // 30 30 30 + SHOP_POSITION_0 = 0, + // 30 30 30 + // 100 30 30 + // 30 100 30 + SHOP_POSITION_1 = 1, + // 30 30 30 + // 100 30 30 + // 30 30 100 + SHOP_POSITION_2 = 2, + // 100 30 30 + // 30 30 100 + // 30 30 30 + SHOP_POSITION_3 = 3, + // 100 30 100 + // 30 30 30 + // 30 30 30 + SHOP_POSITION_4 = 4, + // 30 30 30 + // 30 30 100 + // 100 30 30 + SHOP_POSITION_5 = 5, + // 30 30 30 + // 100 30 100 + // 30 30 30 + // The rest of the entries all have the same layout + SHOP_POSITION_6 = 6, + SHOP_POSITION_7 = 7, + SHOP_POSITION_8 = 8, + SHOP_POSITION_9 = 9, + SHOP_POSITION_A = 10, + SHOP_POSITION_B = 11, + SHOP_POSITION_C = 12, + SHOP_POSITION_D = 13, + SHOP_POSITION_E = 14, + SHOP_POSITION_F = 15, +}; + +// Ability ID +enum ability_id { + ABILITY_UNKNOWN = 0, + ABILITY_STENCH = 1, + ABILITY_THICK_FAT = 2, + ABILITY_RAIN_DISH = 3, + ABILITY_DRIZZLE = 4, + ABILITY_ARENA_TRAP = 5, + ABILITY_INTIMIDATE = 6, + ABILITY_ROCK_HEAD = 7, + ABILITY_AIR_LOCK = 8, + ABILITY_HYPER_CUTTER = 9, + ABILITY_SHADOW_TAG = 10, + ABILITY_SPEED_BOOST = 11, + ABILITY_BATTLE_ARMOR = 12, + ABILITY_STURDY = 13, + ABILITY_SUCTION_CUPS = 14, + ABILITY_CLEAR_BODY = 15, + ABILITY_TORRENT = 16, + ABILITY_GUTS = 17, + ABILITY_ROUGH_SKIN = 18, + ABILITY_SHELL_ARMOR = 19, + ABILITY_NATURAL_CURE = 20, + ABILITY_DAMP = 21, + ABILITY_LIMBER = 22, + ABILITY_MAGNET_PULL = 23, + ABILITY_WHITE_SMOKE = 24, + ABILITY_SYNCHRONIZE = 25, + ABILITY_OVERGROW = 26, + ABILITY_SWIFT_SWIM = 27, + ABILITY_SAND_STREAM = 28, + ABILITY_SAND_VEIL = 29, + ABILITY_KEEN_EYE = 30, + ABILITY_INNER_FOCUS = 31, + ABILITY_STATIC = 32, + ABILITY_SHED_SKIN = 33, + ABILITY_HUGE_POWER = 34, + ABILITY_VOLT_ABSORB = 35, + ABILITY_WATER_ABSORB = 36, + ABILITY_FORECAST = 37, + ABILITY_SERENE_GRACE = 38, + ABILITY_POISON_POINT = 39, + ABILITY_TRACE = 40, + ABILITY_OBLIVIOUS = 41, + ABILITY_TRUANT = 42, + ABILITY_RUN_AWAY = 43, + ABILITY_STICKY_HOLD = 44, + ABILITY_CLOUD_NINE = 45, + ABILITY_ILLUMINATE = 46, + ABILITY_EARLY_BIRD = 47, + ABILITY_HUSTLE = 48, + ABILITY_DROUGHT = 49, + ABILITY_LIGHTNINGROD = 50, + ABILITY_COMPOUNDEYES = 51, + ABILITY_MARVEL_SCALE = 52, + ABILITY_WONDER_GUARD = 53, + ABILITY_INSOMNIA = 54, + ABILITY_LEVITATE = 55, + ABILITY_PLUS = 56, + ABILITY_PRESSURE = 57, + ABILITY_LIQUID_OOZE = 58, + ABILITY_COLOR_CHANGE = 59, + ABILITY_SOUNDPROOF = 60, + ABILITY_EFFECT_SPORE = 61, + ABILITY_FLAME_BODY = 62, + ABILITY_MINUS = 63, + ABILITY_OWN_TEMPO = 64, + ABILITY_MAGMA_ARMOR = 65, + ABILITY_WATER_VEIL = 66, + ABILITY_SWARM = 67, + ABILITY_CUTE_CHARM = 68, + ABILITY_IMMUNITY = 69, + ABILITY_BLAZE = 70, + ABILITY_PICKUP = 71, + ABILITY_FLASH_FIRE = 72, + ABILITY_VITAL_SPIRIT = 73, + ABILITY_CHLOROPHYLL = 74, + ABILITY_PURE_POWER = 75, + ABILITY_SHIELD_DUST = 76, + ABILITY_ICE_BODY = 77, + ABILITY_STALL = 78, + ABILITY_ANGER_POINT = 79, + ABILITY_TINTED_LENS = 80, + ABILITY_HYDRATION = 81, + ABILITY_FRISK = 82, + ABILITY_MOLD_BREAKER = 83, + ABILITY_UNBURDEN = 84, + ABILITY_DRY_SKIN = 85, + ABILITY_ANTICIPATION = 86, + ABILITY_SCRAPPY = 87, + ABILITY_SUPER_LUCK = 88, + ABILITY_GLUTTONY = 89, + ABILITY_SOLAR_POWER = 90, + ABILITY_SKILL_LINK = 91, + ABILITY_RECKLESS = 92, + ABILITY_SNIPER = 93, + ABILITY_SLOW_START = 94, + ABILITY_HEATPROOF = 95, + ABILITY_DOWNLOAD = 96, + ABILITY_SIMPLE = 97, + ABILITY_TANGLED_FEET = 98, + ABILITY_ADAPTABILITY = 99, + ABILITY_TECHNICIAN = 100, + ABILITY_IRON_FIST = 101, + ABILITY_MOTOR_DRIVE = 102, + ABILITY_UNAWARE = 103, + ABILITY_RIVALRY = 104, + ABILITY_BAD_DREAMS = 105, + ABILITY_NO_GUARD = 106, + ABILITY_NORMALIZE = 107, + ABILITY_SOLID_ROCK = 108, + ABILITY_QUICK_FEET = 109, + ABILITY_FILTER = 110, + ABILITY_KLUTZ = 111, + ABILITY_STEADFAST = 112, + ABILITY_FLOWER_GIFT = 113, + ABILITY_POISON_HEAL = 114, + ABILITY_MAGIC_GUARD = 115, + ABILITY_MULTITYPE = 116, // Named "$$$" in game in NA/EU + ABILITY_HONEY_GATHER = 117, + ABILITY_AFTERMATH = 118, + ABILITY_SNOW_CLOAK = 119, + ABILITY_SNOW_WARNING = 120, + ABILITY_FOREWARN = 121, + ABILITY_STORM_DRAIN = 122, + ABILITY_LEAF_GUARD = 123, +}; + +// Dungeon ID. +// Each "section" of what we would normally consider "one dungeon" has its own ID. Many of the +// later dungeon IDs are not actual dungeons, and are used for the "Joined at" field for teammates +enum dungeon_id { + DUNGEON_TEST_DUNGEON = 0, + DUNGEON_BEACH_CAVE = 1, + DUNGEON_BEACH_CAVE_PIT = 2, + DUNGEON_DRENCHED_BLUFF = 3, + DUNGEON_MT_BRISTLE = 4, + DUNGEON_MT_BRISTLE_PEAK = 5, + DUNGEON_WATERFALL_CAVE = 6, + DUNGEON_APPLE_WOODS = 7, + DUNGEON_CRAGGY_COAST = 8, + DUNGEON_SIDE_PATH = 9, + DUNGEON_MT_HORN = 10, + DUNGEON_ROCK_PATH = 11, + DUNGEON_FOGGY_FOREST = 12, + DUNGEON_FOREST_PATH = 13, + DUNGEON_STEAM_CAVE = 14, + DUNGEON_UPPER_STEAM_CAVE = 15, + DUNGEON_STEAM_CAVE_PEAK = 16, + DUNGEON_AMP_PLAINS = 17, + DUNGEON_FAR_AMP_PLAINS = 18, + DUNGEON_AMP_CLEARING = 19, + DUNGEON_NORTHERN_DESERT = 20, + DUNGEON_QUICKSAND_CAVE = 21, + DUNGEON_QUICKSAND_PIT = 22, + DUNGEON_UNDERGROUND_LAKE = 23, + DUNGEON_CRYSTAL_CAVE = 24, + DUNGEON_CRYSTAL_CROSSING = 25, + DUNGEON_CRYSTAL_LAKE = 26, + DUNGEON_CHASM_CAVE = 27, + DUNGEON_DARK_HILL = 28, + DUNGEON_SEALED_RUIN = 29, + DUNGEON_DEEP_SEALED_RUIN = 30, + DUNGEON_SEALED_RUIN_PIT = 31, + DUNGEON_DUSK_FOREST = 32, + DUNGEON_DEEP_DUSK_FOREST = 33, + DUNGEON_TREESHROUD_FOREST = 34, + DUNGEON_BRINE_CAVE = 35, + DUNGEON_LOWER_BRINE_CAVE = 36, + DUNGEON_BRINE_CAVE_PIT = 37, + DUNGEON_HIDDEN_LAND = 38, + DUNGEON_HIDDEN_HIGHLAND = 39, + DUNGEON_OLD_RUINS = 40, + DUNGEON_TEMPORAL_TOWER = 41, + DUNGEON_TEMPORAL_SPIRE = 42, + DUNGEON_TEMPORAL_PINNACLE = 43, + DUNGEON_MYSTIFYING_FOREST = 44, + DUNGEON_MYSTIFYING_FOREST_CLEARING = 45, + DUNGEON_BLIZZARD_ISLAND = 46, + DUNGEON_CREVICE_CAVE = 47, + DUNGEON_LOWER_CREVICE_CAVE = 48, + DUNGEON_CREVICE_CAVE_PIT = 49, + DUNGEON_SURROUNDED_SEA = 50, + DUNGEON_MIRACLE_SEA = 51, + DUNGEON_DEEP_MIRACLE_SEA = 52, + DUNGEON_MIRACLE_SEABED = 53, + DUNGEON_ICE_AEGIS_CAVE = 54, + DUNGEON_REGICE_CHAMBER = 55, + DUNGEON_ROCK_AEGIS_CAVE = 56, + DUNGEON_REGIROCK_CHAMBER = 57, + DUNGEON_STEEL_AEGIS_CAVE = 58, + DUNGEON_REGISTEEL_CHAMBER = 59, + DUNGEON_AEGIS_CAVE_PIT = 60, + DUNGEON_REGIGIGAS_CHAMBER = 61, + DUNGEON_MT_TRAVAIL = 62, + DUNGEON_THE_NIGHTMARE = 63, + DUNGEON_SPACIAL_RIFT = 64, + DUNGEON_DEEP_SPACIAL_RIFT = 65, + DUNGEON_SPACIAL_RIFT_BOTTOM = 66, + DUNGEON_DARK_CRATER = 67, + DUNGEON_DEEP_DARK_CRATER = 68, + DUNGEON_DARK_CRATER_PIT = 69, + DUNGEON_CONCEALED_RUINS = 70, + DUNGEON_DEEP_CONCEALED_RUINS = 71, + DUNGEON_MARINE_RESORT = 72, + DUNGEON_BOTTOMLESS_SEA = 73, + DUNGEON_BOTTOMLESS_SEA_DEPTHS = 74, + DUNGEON_SHIMMER_DESERT = 75, + DUNGEON_SHIMMER_DESERT_PIT = 76, + DUNGEON_MT_AVALANCHE = 77, + DUNGEON_MT_AVALANCHE_PEAK = 78, + DUNGEON_GIANT_VOLCANO = 79, + DUNGEON_GIANT_VOLCANO_PEAK = 80, + DUNGEON_WORLD_ABYSS = 81, + DUNGEON_WORLD_ABYSS_PIT = 82, + DUNGEON_SKY_STAIRWAY = 83, + DUNGEON_SKY_STAIRWAY_APEX = 84, + DUNGEON_MYSTERY_JUNGLE = 85, + DUNGEON_DEEP_MYSTERY_JUNGLE = 86, + DUNGEON_SERENITY_RIVER = 87, + DUNGEON_LANDSLIDE_CAVE = 88, + DUNGEON_LUSH_PRAIRIE = 89, + DUNGEON_TINY_MEADOW = 90, + DUNGEON_LABYRINTH_CAVE = 91, + DUNGEON_ORAN_FOREST = 92, + DUNGEON_LAKE_AFAR = 93, + DUNGEON_HAPPY_OUTLOOK = 94, + DUNGEON_MY_MISTRAL = 95, + DUNGEON_SHIMMER_HILL = 96, + DUNGEON_LOST_WILDERNESS = 97, + DUNGEON_MIDNIGHT_FOREST = 98, + DUNGEON_ZERO_ISLE_NORTH = 99, + DUNGEON_ZERO_ISLE_EAST = 100, + DUNGEON_ZERO_ISLE_WEST = 101, + DUNGEON_ZERO_ISLE_SOUTH = 102, + DUNGEON_ZERO_ISLE_CENTER = 103, + DUNGEON_DESTINY_TOWER = 104, + DUNGEON_DUMMY_0x69 = 105, + DUNGEON_DUMMY_0x6A = 106, + DUNGEON_OBLIVION_FOREST = 107, + DUNGEON_TREACHEROUS_WATERS = 108, + DUNGEON_SOUTHEASTERN_ISLANDS = 109, + DUNGEON_INFERNO_CAVE = 110, + DUNGEON_1ST_STATION_PASS = 111, + DUNGEON_2ND_STATION_PASS = 112, + DUNGEON_3RD_STATION_PASS = 113, + DUNGEON_4TH_STATION_PASS = 114, + DUNGEON_5TH_STATION_PASS = 115, + DUNGEON_6TH_STATION_PASS = 116, + DUNGEON_7TH_STATION_PASS = 117, + DUNGEON_8TH_STATION_PASS = 118, + DUNGEON_9TH_STATION_PASS = 119, + DUNGEON_SKY_PEAK_SUMMIT_PASS = 120, + DUNGEON_5TH_STATION_CLEARING = 121, + DUNGEON_SKY_PEAK_SUMMIT = 122, + DUNGEON_STAR_CAVE_SE1 = 123, + DUNGEON_DEEP_STAR_CAVE = 124, + DUNGEON_DEEP_STAR_CAVE_TEAM_ROGUE = 125, + DUNGEON_STAR_CAVE_DEPTHS = 126, + DUNGEON_STAR_CAVE_PIT = 127, + DUNGEON_MURKY_FOREST = 128, + DUNGEON_EASTERN_CAVE = 129, + DUNGEON_FORTUNE_RAVINE = 130, + DUNGEON_FORTUNE_RAVINE_DEPTHS = 131, + DUNGEON_FORTUNE_RAVINE_PIT = 132, + DUNGEON_BARREN_VALLEY = 133, + DUNGEON_DEEP_BARREN_VALLEY = 134, + DUNGEON_BARREN_VALLEY_CLEARING = 135, + DUNGEON_DARK_WASTELAND = 136, + DUNGEON_TEMPORAL_TOWER_SE5 = 137, + DUNGEON_TEMPORAL_SPIRE_SE5 = 138, + DUNGEON_DUSK_FOREST_SE5 = 139, + DUNGEON_BLACK_SWAMP = 140, + DUNGEON_SPACIAL_CLIFFS = 141, + DUNGEON_DARK_ICE_MOUNTAIN = 142, + DUNGEON_DARK_ICE_MOUNTAIN_PEAK = 143, + DUNGEON_DARK_ICE_MOUNTAIN_PINNACLE = 144, + DUNGEON_ICICLE_FOREST = 145, + DUNGEON_VAST_ICE_MOUNTAIN = 146, + DUNGEON_VAST_ICE_MOUNTAIN_PEAK = 147, + DUNGEON_VAST_ICE_MOUNTAIN_PINNACLE = 148, + DUNGEON_SOUTHERN_JUNGLE = 149, + DUNGEON_BOULDER_QUARRY = 150, + DUNGEON_DEEP_BOULDER_QUARRY = 151, + DUNGEON_BOULDER_QUARRY_CLEARING = 152, + DUNGEON_RIGHT_CAVE_PATH = 153, + DUNGEON_LEFT_CAVE_PATH = 154, + DUNGEON_LIMESTONE_CAVERN = 155, + DUNGEON_DEEP_LIMESTONE_CAVERN = 156, + DUNGEON_LIMESTONE_CAVERN_DEPTHS = 157, + DUNGEON_SPRING_CAVE = 158, + DUNGEON_UPPER_SPRING_CAVE_HAUNTER = 159, + DUNGEON_UPPER_SPRING_CAVE = 160, + DUNGEON_MIDDLE_SPRING_CAVE = 161, + DUNGEON_LOWER_SPRING_CAVE = 162, + DUNGEON_SPRING_CAVE_DEPTHS = 163, + DUNGEON_SPRING_CAVE_PIT = 164, + DUNGEON_LITTLE_PLAINS = 165, + DUNGEON_MT_CLEAR = 166, + DUNGEON_CHALLENGE_RIVER = 167, + DUNGEON_TRIAL_FOREST = 168, + DUNGEON_GUIDING_SEA = 169, + DUNGEON_HIDDEN_SHOPKEEPER_VILLAGE = 170, + DUNGEON_DUMMY_0xAB = 171, + DUNGEON_DUMMY_0xAC = 172, + DUNGEON_DUMMY_0xAD = 173, + DUNGEON_STAR_CAVE = 174, + DUNGEON_SHAYMIN_VILLAGE = 175, + DUNGEON_ARMALDOS_SHELTER = 176, + DUNGEON_LUMINOUS_SPRING = 177, + DUNGEON_HOT_SPRING = 178, + DUNGEON_RESCUE = 179, + DUNGEON_NORMAL_FLY_MAZE = 180, + DUNGEON_DARK_FIRE_MAZE = 181, + DUNGEON_ROCK_WATER_MAZE = 182, + DUNGEON_GRASS_MAZE = 183, + DUNGEON_ELEC_STEEL_MAZE = 184, + DUNGEON_ICE_GROUND_MAZE = 185, + DUNGEON_FIGHT_PSYCH_MAZE = 186, + DUNGEON_POISON_BUG_MAZE = 187, + DUNGEON_DRAGON_MAZE = 188, + DUNGEON_GHOST_MAZE = 189, + DUNGEON_EXPLORER_MAZE = 190, + DUNGEON_FINAL_MAZE = 191, + DUNGEON_DOJO_0xC0 = 192, + DUNGEON_DOJO_0xC1 = 193, + DUNGEON_DOJO_0xC2 = 194, + DUNGEON_DOJO_0xC3 = 195, + DUNGEON_DOJO_0xC4 = 196, + DUNGEON_DOJO_0xC5 = 197, + DUNGEON_DOJO_0xC6 = 198, + DUNGEON_DOJO_0xC7 = 199, + DUNGEON_DOJO_0xC8 = 200, + DUNGEON_DOJO_0xC9 = 201, + DUNGEON_DOJO_0xCA = 202, + DUNGEON_DOJO_0xCB = 203, + DUNGEON_DOJO_0xCC = 204, + DUNGEON_DOJO_0xCD = 205, + DUNGEON_DOJO_0xCE = 206, + DUNGEON_DOJO_0xCF = 207, + DUNGEON_DOJO_0xD0 = 208, + DUNGEON_DOJO_0xD1 = 209, + DUNGEON_DOJO_0xD2 = 210, + DUNGEON_DOJO_0xD3 = 211, + DUNGEON_RESCUE_DUNGEON = 212, + DUNGEON_BASE = 213, + DUNGEON_JOINED_AT_QUESTION_MARKS = 214, // Joined at ??? + DUNGEON_BEACH = 215, + DUNGEON_JOINED_AT_UNKNOWN = 216, + DUNGEON_JOINED_AT_BIDOOF = 217, + DUNGEON_JOINED_AT_GROVYLE = 218, + DUNGEON_JOINED_AT_CELEBI = 219, + DUNGEON_JOINED_AT_CHATOT = 220, + DUNGEON_JOINED_AT_CRESSELIA = 221, // As a guest member during the story + DUNGEON_DUMMY_0xDE = 222, + DUNGEON_DUMMY_0xDF = 223, + DUNGEON_DUMMY_0xE0 = 224, + DUNGEON_DUMMY_0xE1 = 225, + DUNGEON_DUMMY_0xE2 = 226, + DUNGEON_DUMMY_0xE3 = 227, + DUNGEON_DUMMY_0xE4 = 228, + DUNGEON_DUMMY_0xE5 = 229, + DUNGEON_DUMMY_0xE6 = 230, + DUNGEON_DUMMY_0xE7 = 231, + DUNGEON_DUMMY_0xE8 = 232, + DUNGEON_DUMMY_0xE9 = 233, + DUNGEON_DUMMY_0xEA = 234, + DUNGEON_DUMMY_0xEB = 235, + DUNGEON_DUMMY_0xEC = 236, + DUNGEON_DUMMY_0xED = 237, + DUNGEON_DUMMY_0xEE = 238, + DUNGEON_DUMMY_0xEF = 239, + DUNGEON_DUMMY_0xF0 = 240, + DUNGEON_JOINED_AT_MANAPHY_RECRUITED = 241, // When recruited + DUNGEON_JOINED_AT_CRESSELIA_RECRUITED = 242, // When recruited + DUNGEON_JOINED_AT_SHAYMIN_LAND_RECRUITED = 243, // When recruited + DUNGEON_DUMMY_0xF4 = 244, + DUNGEON_DUMMY_0xF5 = 245, + DUNGEON_DUMMY_0xF6 = 246, + DUNGEON_TREASURE_TOWN_0xF7 = 247, + DUNGEON_TREASURE_TOWN_0xF8 = 248, + DUNGEON_OUTSIDE = 249, + DUNGEON_CLIENT = 250, + DUNGEON_DUMMY_0xFB = 251, + DUNGEON_DUMMY_0xFC = 252, + DUNGEON_DUMMY_0xFD = 253, + DUNGEON_DUMMY_0xFE = 254, + DUNGEON_DUMMY_0xFF = 255, +}; + +// Dungeon group ID. +// This is more in line with what we would think of as a "whole dungeon". +// A single dungeon group might encompass multiple dungeon IDs. +enum dungeon_group_id { + DGROUP_TEST_DUNGEON = 0, + DGROUP_BEACH_CAVE = 1, + DGROUP_DRENCHED_BLUFF = 2, + DGROUP_MT_BRISTLE = 3, + DGROUP_WATERFALL_CAVE = 4, + DGROUP_APPLE_WOODS = 5, + DGROUP_CRAGGY_COAST = 6, + DGROUP_SIDE_PATH = 7, + DGROUP_MT_HORN = 8, + DGROUP_ROCK_PATH = 9, + DGROUP_FOGGY_FOREST = 10, + DGROUP_FOREST_PATH = 11, + DGROUP_STEAM_CAVE = 12, + DGROUP_AMP_PLAINS = 13, + DGROUP_NORTHERN_DESERT = 14, + DGROUP_QUICKSAND_CAVE = 15, + DGROUP_CRYSTAL_CAVE = 16, + DGROUP_CRYSTAL_CROSSING = 17, + DGROUP_CHASM_CAVE = 18, + DGROUP_DARK_HILL = 19, + DGROUP_SEALED_RUIN = 20, + DGROUP_DUSK_FOREST = 21, + DGROUP_DEEP_DUSK_FOREST = 22, + DGROUP_TREESHROUD_FOREST = 23, + DGROUP_BRINE_CAVE = 24, + DGROUP_HIDDEN_LAND = 25, + DGROUP_TEMPORAL_TOWER = 26, + DGROUP_MYSTIFYING_FOREST = 27, + DGROUP_MIDNIGHT_FOREST = 28, + DGROUP_LAKE_AFAR = 29, + DGROUP_MT_MISTRAL = 30, + DGROUP_SHIMMER_HILL = 31, + DGROUP_BOTTOMLESS_SEA = 32, + DGROUP_SURROUNDED_SEA = 33, + DGROUP_MIRACLE_SEA = 34, + DGROUP_CONCEALED_RUINS = 35, + DGROUP_LOST_WILDERNESS = 36, + DGROUP_MYSTERY_JUNGLE = 37, + DGROUP_HAPPY_OUTLOOK = 38, + DGROUP_SERENITY_RIVER = 39, + DGROUP_LANDSLIDE_CAVE = 40, + DGROUP_BLIZZARD_ISLAND = 41, + DGROUP_SHIMMER_DESERT = 42, + DGROUP_CREVICE_CAVE = 43, + DGROUP_MT_AVALANCHE = 44, + DGROUP_GIANT_VOLCANO = 45, + DGROUP_WORLD_ABYSS = 46, + DGROUP_LUSH_PRAIRIE = 47, + DGROUP_TINY_MEADOW = 48, + DGROUP_LABYRINTH_CAVE = 49, + DGROUP_ORAN_FOREST = 50, + DGROUP_SKY_STAIRWAY = 51, + DGROUP_AEGIS_CAVE = 52, + DGROUP_MAROWAK_DOJO = 53, + DGROUP_DARK_CRATER = 54, + DGROUP_MARINE_RESORT = 55, + DGROUP_MT_TRAVAIL = 56, + DGROUP_THE_NIGHTMARE = 57, + DGROUP_SPACIAL_RIFT = 58, + DGROUP_ZERO_ISLE_NORTH = 59, + DGROUP_ZERO_ISLE_WEST = 60, + DGROUP_ZERO_ISLE_EAST = 61, + DGROUP_ZERO_ISLE_SOUTH = 62, + DGROUP_RESCUE = 63, + DGROUP_ZERO_ISLE_CENTER = 64, + DGROUP_DESTINY_TOWER = 65, + DGROUP_DUMMY_0x42 = 66, + DGROUP_DUMMY_0x43 = 67, + DGROUP_OBLIVION_FOREST = 68, + DGROUP_TREACHEROUS_WATERS = 69, + DGROUP_SOUTHEASTERN_ISLANDS = 70, + DGROUP_INFERNO_CAVE = 71, + DGROUP_SKY_PEAK = 72, + DGROUP_STAR_CAVE_SE1 = 73, + DGROUP_MURKY_FOREST = 74, + DGROUP_EASTERN_CAVE = 75, + DGROUP_FORTUNE_RAVINE = 76, + DGROUP_BARREN_VALLEY = 77, + DGROUP_DARK_WASTELAND = 78, + DGROUP_TEMPORAL_TOWER_SE5 = 79, + DGROUP_DUSK_FOREST_SE5 = 80, + DGROUP_SPACIAL_CLIFFS = 81, + DGROUP_DARK_ICE_MOUNTAIN = 82, + DGROUP_ICICLE_FOREST = 83, + DGROUP_VAST_ICE_MOUNTAIN = 84, + DGROUP_SOUTHERN_JUNGLE = 85, + DGROUP_BOULDER_QUARRY = 86, + DGROUP_RIGHT_CAVE_PATH = 87, + DGROUP_LEFT_CAVE_PATH = 88, + DGROUP_LIMESTONE_CAVERN = 89, + DGROUP_SPRING_CAVE = 90, + DGROUP_STAR_CAVE = 91, + DGROUP_LITTLE_PLAINS = 92, + DGROUP_MT_CLEAR = 93, + DGROUP_CHALLENGE_RIVER = 94, + DGROUP_TRIAL_FOREST = 95, + DGROUP_GUIDING_SEA = 96, + DGROUP_HIDDEN_SHOPKEEPER_VILLAGE = 97, + DGROUP_DUMMY_0x62 = 98, + DGROUP_DUMMY_0x63 = 99, +}; + +// Controls whether the loop that runs until the current floor ends should continue +// iterating or not and why +enum floor_loop_status { + FLOOR_LOOP_CONTINUE = 0, // The floor loop keeps executing as normal + FLOOR_LOOP_LEADER_FAINTED = 1, // The floor loop exits because the leader fainted + FLOOR_LOOP_NEXT_FLOOR = 2, // The floor loop exits because the floor is over +}; + +// Type IDx +enum type_id { + TYPE_NONE = 0, + TYPE_NORMAL = 1, + TYPE_FIRE = 2, + TYPE_WATER = 3, + TYPE_GRASS = 4, + TYPE_ELECTRIC = 5, + TYPE_ICE = 6, + TYPE_FIGHTING = 7, + TYPE_POISON = 8, + TYPE_GROUND = 9, + TYPE_FLYING = 10, + TYPE_PSYCHIC = 11, + TYPE_BUG = 12, + TYPE_ROCK = 13, + TYPE_GHOST = 14, + TYPE_DRAGON = 15, + TYPE_DARK = 16, + TYPE_STEEL = 17, + TYPE_NEUTRAL = 18, +}; + +// Modes related to shopkeeper behavior +enum shopkeeper_mode { + SHOPKEEPER_MODE_NORMAL = 0, + SHOPKEEPER_MODE_SHOPKEEPER = 1, + SHOPKEEPER_MODE_ATTACK_ENEMIES = 2, + SHOPKEEPER_MODE_ATTACK_TEAM = 3, +}; + +// Some macro shenanigans to define the monster secondary gender labels neatly. +#define _MONSTER_ID_GENDERED(name, base_value) \ + MONSTER_##name = base_value, MONSTER_##name##_SECONDARY = base_value + 600 + +// Monster ID. Add 600 to the base value to get secondary genders (typically female). +enum monster_id { + _MONSTER_ID_GENDERED(NONE, 0), + _MONSTER_ID_GENDERED(BULBASAUR, 1), + _MONSTER_ID_GENDERED(IVYSAUR, 2), + _MONSTER_ID_GENDERED(VENUSAUR, 3), + _MONSTER_ID_GENDERED(CHARMANDER, 4), + _MONSTER_ID_GENDERED(CHARMELEON, 5), + _MONSTER_ID_GENDERED(CHARIZARD, 6), + _MONSTER_ID_GENDERED(SQUIRTLE, 7), + _MONSTER_ID_GENDERED(WARTORTLE, 8), + _MONSTER_ID_GENDERED(BLASTOISE, 9), + _MONSTER_ID_GENDERED(CATERPIE, 10), + _MONSTER_ID_GENDERED(METAPOD, 11), + _MONSTER_ID_GENDERED(BUTTERFREE, 12), + _MONSTER_ID_GENDERED(WEEDLE, 13), + _MONSTER_ID_GENDERED(KAKUNA, 14), + _MONSTER_ID_GENDERED(BEEDRILL, 15), + _MONSTER_ID_GENDERED(PIDGEY, 16), + _MONSTER_ID_GENDERED(PIDGEOTTO, 17), + _MONSTER_ID_GENDERED(PIDGEOT, 18), + _MONSTER_ID_GENDERED(RATTATA, 19), + _MONSTER_ID_GENDERED(RATICATE, 20), + _MONSTER_ID_GENDERED(SPEAROW, 21), + _MONSTER_ID_GENDERED(FEAROW, 22), + _MONSTER_ID_GENDERED(EKANS, 23), + _MONSTER_ID_GENDERED(ARBOK, 24), + _MONSTER_ID_GENDERED(PIKACHU, 25), + _MONSTER_ID_GENDERED(RAICHU, 26), + _MONSTER_ID_GENDERED(SANDSHREW, 27), + _MONSTER_ID_GENDERED(SANDSLASH, 28), + _MONSTER_ID_GENDERED(NIDORAN_F, 29), + _MONSTER_ID_GENDERED(NIDORINA, 30), + _MONSTER_ID_GENDERED(NIDOQUEEN, 31), + _MONSTER_ID_GENDERED(NIDORAN_M, 32), + _MONSTER_ID_GENDERED(NIDORINO, 33), + _MONSTER_ID_GENDERED(NIDOKING, 34), + _MONSTER_ID_GENDERED(CLEFAIRY, 35), + _MONSTER_ID_GENDERED(CLEFABLE, 36), + _MONSTER_ID_GENDERED(VULPIX, 37), + _MONSTER_ID_GENDERED(NINETALES, 38), + _MONSTER_ID_GENDERED(JIGGLYPUFF, 39), + _MONSTER_ID_GENDERED(WIGGLYTUFF, 40), + _MONSTER_ID_GENDERED(ZUBAT, 41), + _MONSTER_ID_GENDERED(GOLBAT, 42), + _MONSTER_ID_GENDERED(ODDISH, 43), + _MONSTER_ID_GENDERED(GLOOM, 44), + _MONSTER_ID_GENDERED(VILEPLUME, 45), + _MONSTER_ID_GENDERED(PARAS, 46), + _MONSTER_ID_GENDERED(PARASECT, 47), + _MONSTER_ID_GENDERED(VENONAT, 48), + _MONSTER_ID_GENDERED(VENOMOTH, 49), + _MONSTER_ID_GENDERED(DIGLETT, 50), + _MONSTER_ID_GENDERED(DUGTRIO, 51), + _MONSTER_ID_GENDERED(MEOWTH, 52), + _MONSTER_ID_GENDERED(PERSIAN, 53), + _MONSTER_ID_GENDERED(PSYDUCK, 54), + _MONSTER_ID_GENDERED(GOLDUCK, 55), + _MONSTER_ID_GENDERED(MANKEY, 56), + _MONSTER_ID_GENDERED(PRIMEAPE, 57), + _MONSTER_ID_GENDERED(GROWLITHE, 58), + _MONSTER_ID_GENDERED(ARCANINE, 59), + _MONSTER_ID_GENDERED(POLIWAG, 60), + _MONSTER_ID_GENDERED(POLIWHIRL, 61), + _MONSTER_ID_GENDERED(POLIWRATH, 62), + _MONSTER_ID_GENDERED(ABRA, 63), + _MONSTER_ID_GENDERED(KADABRA, 64), + _MONSTER_ID_GENDERED(ALAKAZAM, 65), + _MONSTER_ID_GENDERED(MACHOP, 66), + _MONSTER_ID_GENDERED(MACHOKE, 67), + _MONSTER_ID_GENDERED(MACHAMP, 68), + _MONSTER_ID_GENDERED(BELLSPROUT, 69), + _MONSTER_ID_GENDERED(WEEPINBELL, 70), + _MONSTER_ID_GENDERED(VICTREEBEL, 71), + _MONSTER_ID_GENDERED(TENTACOOL, 72), + _MONSTER_ID_GENDERED(TENTACRUEL, 73), + _MONSTER_ID_GENDERED(GEODUDE, 74), + _MONSTER_ID_GENDERED(GRAVELER, 75), + _MONSTER_ID_GENDERED(GOLEM, 76), + _MONSTER_ID_GENDERED(PONYTA, 77), + _MONSTER_ID_GENDERED(RAPIDASH, 78), + _MONSTER_ID_GENDERED(SLOWPOKE, 79), + _MONSTER_ID_GENDERED(SLOWBRO, 80), + _MONSTER_ID_GENDERED(MAGNEMITE, 81), + _MONSTER_ID_GENDERED(MAGNETON, 82), + _MONSTER_ID_GENDERED(FARFETCHD, 83), + _MONSTER_ID_GENDERED(DODUO, 84), + _MONSTER_ID_GENDERED(DODRIO, 85), + _MONSTER_ID_GENDERED(SEEL, 86), + _MONSTER_ID_GENDERED(DEWGONG, 87), + _MONSTER_ID_GENDERED(GRIMER, 88), + _MONSTER_ID_GENDERED(MUK, 89), + _MONSTER_ID_GENDERED(SHELLDER, 90), + _MONSTER_ID_GENDERED(CLOYSTER, 91), + _MONSTER_ID_GENDERED(GASTLY, 92), + _MONSTER_ID_GENDERED(HAUNTER, 93), + _MONSTER_ID_GENDERED(GENGAR, 94), + _MONSTER_ID_GENDERED(ONIX, 95), + _MONSTER_ID_GENDERED(DROWZEE, 96), + _MONSTER_ID_GENDERED(HYPNO, 97), + _MONSTER_ID_GENDERED(KRABBY, 98), + _MONSTER_ID_GENDERED(KINGLER, 99), + _MONSTER_ID_GENDERED(VOLTORB, 100), + _MONSTER_ID_GENDERED(ELECTRODE, 101), + _MONSTER_ID_GENDERED(EXEGGCUTE, 102), + _MONSTER_ID_GENDERED(EXEGGUTOR, 103), + _MONSTER_ID_GENDERED(CUBONE, 104), + _MONSTER_ID_GENDERED(MAROWAK, 105), + _MONSTER_ID_GENDERED(HITMONLEE, 106), + _MONSTER_ID_GENDERED(HITMONCHAN, 107), + _MONSTER_ID_GENDERED(LICKITUNG, 108), + _MONSTER_ID_GENDERED(KOFFING, 109), + _MONSTER_ID_GENDERED(WEEZING, 110), + _MONSTER_ID_GENDERED(RHYHORN, 111), + _MONSTER_ID_GENDERED(RHYDON, 112), + _MONSTER_ID_GENDERED(CHANSEY, 113), + _MONSTER_ID_GENDERED(TANGELA, 114), + _MONSTER_ID_GENDERED(KANGASKHAN, 115), + _MONSTER_ID_GENDERED(HORSEA, 116), + _MONSTER_ID_GENDERED(SEADRA, 117), + _MONSTER_ID_GENDERED(GOLDEEN, 118), + _MONSTER_ID_GENDERED(SEAKING, 119), + _MONSTER_ID_GENDERED(STARYU, 120), + _MONSTER_ID_GENDERED(STARMIE, 121), + _MONSTER_ID_GENDERED(MR_MIME, 122), + _MONSTER_ID_GENDERED(SCYTHER, 123), + _MONSTER_ID_GENDERED(JYNX, 124), + _MONSTER_ID_GENDERED(ELECTABUZZ, 125), + _MONSTER_ID_GENDERED(MAGMAR, 126), + _MONSTER_ID_GENDERED(PINSIR, 127), + _MONSTER_ID_GENDERED(TAUROS, 128), + _MONSTER_ID_GENDERED(MAGIKARP, 129), + _MONSTER_ID_GENDERED(GYARADOS, 130), + _MONSTER_ID_GENDERED(LAPRAS, 131), + _MONSTER_ID_GENDERED(DITTO, 132), + _MONSTER_ID_GENDERED(EEVEE, 133), + _MONSTER_ID_GENDERED(VAPOREON, 134), + _MONSTER_ID_GENDERED(JOLTEON, 135), + _MONSTER_ID_GENDERED(FLAREON, 136), + _MONSTER_ID_GENDERED(PORYGON, 137), + _MONSTER_ID_GENDERED(OMANYTE, 138), + _MONSTER_ID_GENDERED(OMASTAR, 139), + _MONSTER_ID_GENDERED(KABUTO, 140), + _MONSTER_ID_GENDERED(KABUTOPS, 141), + _MONSTER_ID_GENDERED(AERODACTYL, 142), + _MONSTER_ID_GENDERED(SNORLAX, 143), + _MONSTER_ID_GENDERED(ARTICUNO, 144), + _MONSTER_ID_GENDERED(ZAPDOS, 145), + _MONSTER_ID_GENDERED(MOLTRES, 146), + _MONSTER_ID_GENDERED(DRATINI, 147), + _MONSTER_ID_GENDERED(DRAGONAIR, 148), + _MONSTER_ID_GENDERED(DRAGONITE, 149), + _MONSTER_ID_GENDERED(MEWTWO, 150), + _MONSTER_ID_GENDERED(MEW, 151), + _MONSTER_ID_GENDERED(CHIKORITA, 152), + _MONSTER_ID_GENDERED(BAYLEEF, 153), + _MONSTER_ID_GENDERED(MEGANIUM, 154), + _MONSTER_ID_GENDERED(CYNDAQUIL, 155), + _MONSTER_ID_GENDERED(QUILAVA, 156), + _MONSTER_ID_GENDERED(TYPHLOSION, 157), + _MONSTER_ID_GENDERED(TOTODILE, 158), + _MONSTER_ID_GENDERED(CROCONAW, 159), + _MONSTER_ID_GENDERED(FERALIGATR, 160), + _MONSTER_ID_GENDERED(SENTRET, 161), + _MONSTER_ID_GENDERED(FURRET, 162), + _MONSTER_ID_GENDERED(HOOTHOOT, 163), + _MONSTER_ID_GENDERED(NOCTOWL, 164), + _MONSTER_ID_GENDERED(LEDYBA, 165), + _MONSTER_ID_GENDERED(LEDIAN, 166), + _MONSTER_ID_GENDERED(SPINARAK, 167), + _MONSTER_ID_GENDERED(ARIADOS, 168), + _MONSTER_ID_GENDERED(CROBAT, 169), + _MONSTER_ID_GENDERED(CHINCHOU, 170), + _MONSTER_ID_GENDERED(LANTURN, 171), + _MONSTER_ID_GENDERED(PICHU, 172), + _MONSTER_ID_GENDERED(CLEFFA, 173), + _MONSTER_ID_GENDERED(IGGLYBUFF, 174), + _MONSTER_ID_GENDERED(TOGEPI, 175), + _MONSTER_ID_GENDERED(TOGETIC, 176), + _MONSTER_ID_GENDERED(NATU, 177), + _MONSTER_ID_GENDERED(XATU, 178), + _MONSTER_ID_GENDERED(MAREEP, 179), + _MONSTER_ID_GENDERED(FLAAFFY, 180), + _MONSTER_ID_GENDERED(AMPHAROS, 181), + _MONSTER_ID_GENDERED(BELLOSSOM, 182), + _MONSTER_ID_GENDERED(MARILL, 183), + _MONSTER_ID_GENDERED(AZUMARILL, 184), + _MONSTER_ID_GENDERED(SUDOWOODO, 185), + _MONSTER_ID_GENDERED(POLITOED, 186), + _MONSTER_ID_GENDERED(HOPPIP, 187), + _MONSTER_ID_GENDERED(SKIPLOOM, 188), + _MONSTER_ID_GENDERED(JUMPLUFF, 189), + _MONSTER_ID_GENDERED(AIPOM, 190), + _MONSTER_ID_GENDERED(SUNKERN, 191), + _MONSTER_ID_GENDERED(SUNFLORA, 192), + _MONSTER_ID_GENDERED(YANMA, 193), + _MONSTER_ID_GENDERED(WOOPER, 194), + _MONSTER_ID_GENDERED(QUAGSIRE, 195), + _MONSTER_ID_GENDERED(ESPEON, 196), + _MONSTER_ID_GENDERED(UMBREON, 197), + _MONSTER_ID_GENDERED(MURKROW, 198), + _MONSTER_ID_GENDERED(SLOWKING, 199), + _MONSTER_ID_GENDERED(MISDREAVUS, 200), + _MONSTER_ID_GENDERED(UNOWN_A, 201), + _MONSTER_ID_GENDERED(UNOWN_B, 202), + _MONSTER_ID_GENDERED(UNOWN_C, 203), + _MONSTER_ID_GENDERED(UNOWN_D, 204), + _MONSTER_ID_GENDERED(UNOWN_E, 205), + _MONSTER_ID_GENDERED(UNOWN_F, 206), + _MONSTER_ID_GENDERED(UNOWN_G, 207), + _MONSTER_ID_GENDERED(UNOWN_H, 208), + _MONSTER_ID_GENDERED(UNOWN_I, 209), + _MONSTER_ID_GENDERED(UNOWN_J, 210), + _MONSTER_ID_GENDERED(UNOWN_K, 211), + _MONSTER_ID_GENDERED(UNOWN_L, 212), + _MONSTER_ID_GENDERED(UNOWN_M, 213), + _MONSTER_ID_GENDERED(UNOWN_N, 214), + _MONSTER_ID_GENDERED(UNOWN_O, 215), + _MONSTER_ID_GENDERED(UNOWN_P, 216), + _MONSTER_ID_GENDERED(UNOWN_Q, 217), + _MONSTER_ID_GENDERED(UNOWN_R, 218), + _MONSTER_ID_GENDERED(UNOWN_S, 219), + _MONSTER_ID_GENDERED(UNOWN_T, 220), + _MONSTER_ID_GENDERED(UNOWN_U, 221), + _MONSTER_ID_GENDERED(UNOWN_V, 222), + _MONSTER_ID_GENDERED(UNOWN_W, 223), + _MONSTER_ID_GENDERED(UNOWN_X, 224), + _MONSTER_ID_GENDERED(UNOWN_Y, 225), + _MONSTER_ID_GENDERED(UNOWN_Z, 226), + _MONSTER_ID_GENDERED(UNOWN_EXCLAMATION, 227), + _MONSTER_ID_GENDERED(UNOWN_QUESTION, 228), + _MONSTER_ID_GENDERED(WOBBUFFET, 229), + _MONSTER_ID_GENDERED(GIRAFARIG, 230), + _MONSTER_ID_GENDERED(PINECO, 231), + _MONSTER_ID_GENDERED(FORRETRESS, 232), + _MONSTER_ID_GENDERED(DUNSPARCE, 233), + _MONSTER_ID_GENDERED(GLIGAR, 234), + _MONSTER_ID_GENDERED(STEELIX, 235), + _MONSTER_ID_GENDERED(SNUBBULL, 236), + _MONSTER_ID_GENDERED(GRANBULL, 237), + _MONSTER_ID_GENDERED(QWILFISH, 238), + _MONSTER_ID_GENDERED(SCIZOR, 239), + _MONSTER_ID_GENDERED(SHUCKLE, 240), + _MONSTER_ID_GENDERED(HERACROSS, 241), + _MONSTER_ID_GENDERED(SNEASEL, 242), + _MONSTER_ID_GENDERED(TEDDIURSA, 243), + _MONSTER_ID_GENDERED(URSARING, 244), + _MONSTER_ID_GENDERED(SLUGMA, 245), + _MONSTER_ID_GENDERED(MAGCARGO, 246), + _MONSTER_ID_GENDERED(SWINUB, 247), + _MONSTER_ID_GENDERED(PILOSWINE, 248), + _MONSTER_ID_GENDERED(CORSOLA, 249), + _MONSTER_ID_GENDERED(REMORAID, 250), + _MONSTER_ID_GENDERED(OCTILLERY, 251), + _MONSTER_ID_GENDERED(DELIBIRD, 252), + _MONSTER_ID_GENDERED(MANTINE, 253), + _MONSTER_ID_GENDERED(SKARMORY, 254), + _MONSTER_ID_GENDERED(HOUNDOUR, 255), + _MONSTER_ID_GENDERED(HOUNDOOM, 256), + _MONSTER_ID_GENDERED(KINGDRA, 257), + _MONSTER_ID_GENDERED(PHANPY, 258), + _MONSTER_ID_GENDERED(DONPHAN, 259), + _MONSTER_ID_GENDERED(PORYGON2, 260), + _MONSTER_ID_GENDERED(STANTLER, 261), + _MONSTER_ID_GENDERED(SMEARGLE, 262), + _MONSTER_ID_GENDERED(TYROGUE, 263), + _MONSTER_ID_GENDERED(HITMONTOP, 264), + _MONSTER_ID_GENDERED(SMOOCHUM, 265), + _MONSTER_ID_GENDERED(ELEKID, 266), + _MONSTER_ID_GENDERED(MAGBY, 267), + _MONSTER_ID_GENDERED(MILTANK, 268), + _MONSTER_ID_GENDERED(BLISSEY, 269), + _MONSTER_ID_GENDERED(RAIKOU, 270), + _MONSTER_ID_GENDERED(ENTEI, 271), + _MONSTER_ID_GENDERED(SUICUNE, 272), + _MONSTER_ID_GENDERED(LARVITAR, 273), + _MONSTER_ID_GENDERED(PUPITAR, 274), + _MONSTER_ID_GENDERED(TYRANITAR, 275), + _MONSTER_ID_GENDERED(LUGIA, 276), + _MONSTER_ID_GENDERED(HO_OH, 277), + _MONSTER_ID_GENDERED(CELEBI, 278), + _MONSTER_ID_GENDERED(SHINY_CELEBI, 279), + _MONSTER_ID_GENDERED(TREECKO, 280), + _MONSTER_ID_GENDERED(GROVYLE, 281), + _MONSTER_ID_GENDERED(SCEPTILE, 282), + _MONSTER_ID_GENDERED(TORCHIC, 283), + _MONSTER_ID_GENDERED(COMBUSKEN, 284), + _MONSTER_ID_GENDERED(BLAZIKEN, 285), + _MONSTER_ID_GENDERED(MUDKIP, 286), + _MONSTER_ID_GENDERED(MARSHTOMP, 287), + _MONSTER_ID_GENDERED(SWAMPERT, 288), + _MONSTER_ID_GENDERED(POOCHYENA, 289), + _MONSTER_ID_GENDERED(MIGHTYENA, 290), + _MONSTER_ID_GENDERED(ZIGZAGOON, 291), + _MONSTER_ID_GENDERED(LINOONE, 292), + _MONSTER_ID_GENDERED(WURMPLE, 293), + _MONSTER_ID_GENDERED(SILCOON, 294), + _MONSTER_ID_GENDERED(BEAUTIFLY, 295), + _MONSTER_ID_GENDERED(CASCOON, 296), + _MONSTER_ID_GENDERED(DUSTOX, 297), + _MONSTER_ID_GENDERED(LOTAD, 298), + _MONSTER_ID_GENDERED(LOMBRE, 299), + _MONSTER_ID_GENDERED(LUDICOLO, 300), + _MONSTER_ID_GENDERED(SEEDOT, 301), + _MONSTER_ID_GENDERED(NUZLEAF, 302), + _MONSTER_ID_GENDERED(SHIFTRY, 303), + _MONSTER_ID_GENDERED(TAILLOW, 304), + _MONSTER_ID_GENDERED(SWELLOW, 305), + _MONSTER_ID_GENDERED(WINGULL, 306), + _MONSTER_ID_GENDERED(PELIPPER, 307), + _MONSTER_ID_GENDERED(RALTS, 308), + _MONSTER_ID_GENDERED(KIRLIA, 309), + _MONSTER_ID_GENDERED(GARDEVOIR, 310), + _MONSTER_ID_GENDERED(SURSKIT, 311), + _MONSTER_ID_GENDERED(MASQUERAIN, 312), + _MONSTER_ID_GENDERED(SHROOMISH, 313), + _MONSTER_ID_GENDERED(BRELOOM, 314), + _MONSTER_ID_GENDERED(SLAKOTH, 315), + _MONSTER_ID_GENDERED(VIGOROTH, 316), + _MONSTER_ID_GENDERED(SLAKING, 317), + _MONSTER_ID_GENDERED(NINCADA, 318), + _MONSTER_ID_GENDERED(NINJASK, 319), + _MONSTER_ID_GENDERED(SHEDINJA, 320), + _MONSTER_ID_GENDERED(WHISMUR, 321), + _MONSTER_ID_GENDERED(LOUDRED, 322), + _MONSTER_ID_GENDERED(EXPLOUD, 323), + _MONSTER_ID_GENDERED(MAKUHITA, 324), + _MONSTER_ID_GENDERED(HARIYAMA, 325), + _MONSTER_ID_GENDERED(AZURILL, 326), + _MONSTER_ID_GENDERED(NOSEPASS, 327), + _MONSTER_ID_GENDERED(SKITTY, 328), + _MONSTER_ID_GENDERED(DELCATTY, 329), + _MONSTER_ID_GENDERED(SABLEYE, 330), + _MONSTER_ID_GENDERED(MAWILE, 331), + _MONSTER_ID_GENDERED(ARON, 332), + _MONSTER_ID_GENDERED(LAIRON, 333), + _MONSTER_ID_GENDERED(AGGRON, 334), + _MONSTER_ID_GENDERED(MEDITITE, 335), + _MONSTER_ID_GENDERED(MEDICHAM, 336), + _MONSTER_ID_GENDERED(ELECTRIKE, 337), + _MONSTER_ID_GENDERED(MANECTRIC, 338), + _MONSTER_ID_GENDERED(PLUSLE, 339), + _MONSTER_ID_GENDERED(MINUN, 340), + _MONSTER_ID_GENDERED(VOLBEAT, 341), + _MONSTER_ID_GENDERED(ILLUMISE, 342), + _MONSTER_ID_GENDERED(ROSELIA, 343), + _MONSTER_ID_GENDERED(GULPIN, 344), + _MONSTER_ID_GENDERED(SWALOT, 345), + _MONSTER_ID_GENDERED(CARVANHA, 346), + _MONSTER_ID_GENDERED(SHARPEDO, 347), + _MONSTER_ID_GENDERED(WAILMER, 348), + _MONSTER_ID_GENDERED(WAILORD, 349), + _MONSTER_ID_GENDERED(NUMEL, 350), + _MONSTER_ID_GENDERED(CAMERUPT, 351), + _MONSTER_ID_GENDERED(TORKOAL, 352), + _MONSTER_ID_GENDERED(SPOINK, 353), + _MONSTER_ID_GENDERED(GRUMPIG, 354), + _MONSTER_ID_GENDERED(SPINDA, 355), + _MONSTER_ID_GENDERED(TRAPINCH, 356), + _MONSTER_ID_GENDERED(VIBRAVA, 357), + _MONSTER_ID_GENDERED(FLYGON, 358), + _MONSTER_ID_GENDERED(CACNEA, 359), + _MONSTER_ID_GENDERED(CACTURNE, 360), + _MONSTER_ID_GENDERED(SWABLU, 361), + _MONSTER_ID_GENDERED(ALTARIA, 362), + _MONSTER_ID_GENDERED(ZANGOOSE, 363), + _MONSTER_ID_GENDERED(SEVIPER, 364), + _MONSTER_ID_GENDERED(LUNATONE, 365), + _MONSTER_ID_GENDERED(SOLROCK, 366), + _MONSTER_ID_GENDERED(BARBOACH, 367), + _MONSTER_ID_GENDERED(WHISCASH, 368), + _MONSTER_ID_GENDERED(CORPHISH, 369), + _MONSTER_ID_GENDERED(CRAWDAUNT, 370), + _MONSTER_ID_GENDERED(BALTOY, 371), + _MONSTER_ID_GENDERED(CLAYDOL, 372), + _MONSTER_ID_GENDERED(LILEEP, 373), + _MONSTER_ID_GENDERED(CRADILY, 374), + _MONSTER_ID_GENDERED(ANORITH, 375), + _MONSTER_ID_GENDERED(ARMALDO, 376), + _MONSTER_ID_GENDERED(FEEBAS, 377), + _MONSTER_ID_GENDERED(MILOTIC, 378), + _MONSTER_ID_GENDERED(CASTFORM_NORMAL, 379), + _MONSTER_ID_GENDERED(CASTFORM_SNOWY, 380), + _MONSTER_ID_GENDERED(CASTFORM_SUNNY, 381), + _MONSTER_ID_GENDERED(CASTFORM_RAINY, 382), + _MONSTER_ID_GENDERED(KECLEON, 383), + _MONSTER_ID_GENDERED(PURPLE_KECLEON, 384), + _MONSTER_ID_GENDERED(SHUPPET, 385), + _MONSTER_ID_GENDERED(BANETTE, 386), + _MONSTER_ID_GENDERED(DUSKULL, 387), + _MONSTER_ID_GENDERED(DUSCLOPS, 388), + _MONSTER_ID_GENDERED(TROPIUS, 389), + _MONSTER_ID_GENDERED(CHIMECHO, 390), + _MONSTER_ID_GENDERED(ABSOL, 391), + _MONSTER_ID_GENDERED(WYNAUT, 392), + _MONSTER_ID_GENDERED(SNORUNT, 393), + _MONSTER_ID_GENDERED(GLALIE, 394), + _MONSTER_ID_GENDERED(SPHEAL, 395), + _MONSTER_ID_GENDERED(SEALEO, 396), + _MONSTER_ID_GENDERED(WALREIN, 397), + _MONSTER_ID_GENDERED(CLAMPERL, 398), + _MONSTER_ID_GENDERED(HUNTAIL, 399), + _MONSTER_ID_GENDERED(GOREBYSS, 400), + _MONSTER_ID_GENDERED(RELICANTH, 401), + _MONSTER_ID_GENDERED(LUVDISC, 402), + _MONSTER_ID_GENDERED(BAGON, 403), + _MONSTER_ID_GENDERED(SHELGON, 404), + _MONSTER_ID_GENDERED(SALAMENCE, 405), + _MONSTER_ID_GENDERED(BELDUM, 406), + _MONSTER_ID_GENDERED(METANG, 407), + _MONSTER_ID_GENDERED(METAGROSS, 408), + _MONSTER_ID_GENDERED(REGIROCK, 409), + _MONSTER_ID_GENDERED(REGICE, 410), + _MONSTER_ID_GENDERED(REGISTEEL, 411), + _MONSTER_ID_GENDERED(LATIAS, 412), + _MONSTER_ID_GENDERED(LATIOS, 413), + _MONSTER_ID_GENDERED(KYOGRE, 414), + _MONSTER_ID_GENDERED(GROUDON, 415), + _MONSTER_ID_GENDERED(RAYQUAZA, 416), + _MONSTER_ID_GENDERED(JIRACHI, 417), + _MONSTER_ID_GENDERED(DEOXYS_NORMAL, 418), + _MONSTER_ID_GENDERED(DEOXYS_ATTACK, 419), + _MONSTER_ID_GENDERED(DEOXYS_DEFENSE, 420), + _MONSTER_ID_GENDERED(DEOXYS_SPEED, 421), + _MONSTER_ID_GENDERED(TURTWIG, 422), + _MONSTER_ID_GENDERED(GROTLE, 423), + _MONSTER_ID_GENDERED(TORTERRA, 424), + _MONSTER_ID_GENDERED(CHIMCHAR, 425), + _MONSTER_ID_GENDERED(MONFERNO, 426), + _MONSTER_ID_GENDERED(INFERNAPE, 427), + _MONSTER_ID_GENDERED(PIPLUP, 428), + _MONSTER_ID_GENDERED(PRINPLUP, 429), + _MONSTER_ID_GENDERED(EMPOLEON, 430), + _MONSTER_ID_GENDERED(STARLY, 431), + _MONSTER_ID_GENDERED(STARAVIA, 432), + _MONSTER_ID_GENDERED(STARAPTOR, 433), + _MONSTER_ID_GENDERED(BIDOOF, 434), + _MONSTER_ID_GENDERED(BIBAREL, 435), + _MONSTER_ID_GENDERED(KRICKETOT, 436), + _MONSTER_ID_GENDERED(KRICKETUNE, 437), + _MONSTER_ID_GENDERED(SHINX, 438), + _MONSTER_ID_GENDERED(LUXIO, 439), + _MONSTER_ID_GENDERED(LUXRAY, 440), + _MONSTER_ID_GENDERED(BUDEW, 441), + _MONSTER_ID_GENDERED(ROSERADE, 442), + _MONSTER_ID_GENDERED(CRANIDOS, 443), + _MONSTER_ID_GENDERED(RAMPARDOS, 444), + _MONSTER_ID_GENDERED(SHIELDON, 445), + _MONSTER_ID_GENDERED(BASTIODON, 446), + _MONSTER_ID_GENDERED(BURMY_SANDY, 447), + _MONSTER_ID_GENDERED(BURMY_PLANT, 448), + _MONSTER_ID_GENDERED(BURMY_TRASH, 449), + _MONSTER_ID_GENDERED(WORMADAM_SANDY, 450), + _MONSTER_ID_GENDERED(WORMADAM_PLANT, 451), + _MONSTER_ID_GENDERED(WORMADAM_TRASH, 452), + _MONSTER_ID_GENDERED(MOTHIM, 453), + _MONSTER_ID_GENDERED(COMBEE, 454), + _MONSTER_ID_GENDERED(VESPIQUEN, 455), + _MONSTER_ID_GENDERED(PACHIRISU, 456), + _MONSTER_ID_GENDERED(BUIZEL, 457), + _MONSTER_ID_GENDERED(FLOATZEL, 458), + _MONSTER_ID_GENDERED(CHERUBI, 459), + _MONSTER_ID_GENDERED(CHERRIM_OVERCAST, 460), + _MONSTER_ID_GENDERED(CHERRIM_SUNSHINE, 461), + _MONSTER_ID_GENDERED(SHELLOS_EAST, 462), + _MONSTER_ID_GENDERED(SHELLOS_WEST, 463), + _MONSTER_ID_GENDERED(GASTRODON_EAST, 464), + _MONSTER_ID_GENDERED(GASTRODON_WEST, 465), + _MONSTER_ID_GENDERED(AMBIPOM, 466), + _MONSTER_ID_GENDERED(DRIFLOON, 467), + _MONSTER_ID_GENDERED(DRIFBLIM, 468), + _MONSTER_ID_GENDERED(BUNEARY, 469), + _MONSTER_ID_GENDERED(LOPUNNY, 470), + _MONSTER_ID_GENDERED(MISMAGIUS, 471), + _MONSTER_ID_GENDERED(HONCHKROW, 472), + _MONSTER_ID_GENDERED(GLAMEOW, 473), + _MONSTER_ID_GENDERED(PURUGLY, 474), + _MONSTER_ID_GENDERED(CHINGLING, 475), + _MONSTER_ID_GENDERED(STUNKY, 476), + _MONSTER_ID_GENDERED(SKUNTANK, 477), + _MONSTER_ID_GENDERED(BRONZOR, 478), + _MONSTER_ID_GENDERED(BRONZONG, 479), + _MONSTER_ID_GENDERED(BONSLY, 480), + _MONSTER_ID_GENDERED(MIME_JR, 481), + _MONSTER_ID_GENDERED(HAPPINY, 482), + _MONSTER_ID_GENDERED(CHATOT, 483), + _MONSTER_ID_GENDERED(SPIRITOMB, 484), + _MONSTER_ID_GENDERED(GIBLE, 485), + _MONSTER_ID_GENDERED(GABITE, 486), + _MONSTER_ID_GENDERED(GARCHOMP, 487), + _MONSTER_ID_GENDERED(MUNCHLAX, 488), + _MONSTER_ID_GENDERED(RIOLU, 489), + _MONSTER_ID_GENDERED(LUCARIO, 490), + _MONSTER_ID_GENDERED(HIPPOPOTAS, 491), + _MONSTER_ID_GENDERED(HIPPOWDON, 492), + _MONSTER_ID_GENDERED(SKORUPI, 493), + _MONSTER_ID_GENDERED(DRAPION, 494), + _MONSTER_ID_GENDERED(CROAGUNK, 495), + _MONSTER_ID_GENDERED(TOXICROAK, 496), + _MONSTER_ID_GENDERED(CARNIVINE, 497), + _MONSTER_ID_GENDERED(FINNEON, 498), + _MONSTER_ID_GENDERED(LUMINEON, 499), + _MONSTER_ID_GENDERED(MANTYKE, 500), + _MONSTER_ID_GENDERED(SNOVER, 501), + _MONSTER_ID_GENDERED(ABOMASNOW, 502), + _MONSTER_ID_GENDERED(WEAVILE, 503), + _MONSTER_ID_GENDERED(MAGNEZONE, 504), + _MONSTER_ID_GENDERED(LICKILICKY, 505), + _MONSTER_ID_GENDERED(RHYPERIOR, 506), + _MONSTER_ID_GENDERED(TANGROWTH, 507), + _MONSTER_ID_GENDERED(ELECTIVIRE, 508), + _MONSTER_ID_GENDERED(MAGMORTAR, 509), + _MONSTER_ID_GENDERED(TOGEKISS, 510), + _MONSTER_ID_GENDERED(YANMEGA, 511), + _MONSTER_ID_GENDERED(LEAFEON, 512), + _MONSTER_ID_GENDERED(GLACEON, 513), + _MONSTER_ID_GENDERED(GLISCOR, 514), + _MONSTER_ID_GENDERED(MAMOSWINE, 515), + _MONSTER_ID_GENDERED(PORYGON_Z, 516), + _MONSTER_ID_GENDERED(GALLADE, 517), + _MONSTER_ID_GENDERED(PROBOPASS, 518), + _MONSTER_ID_GENDERED(DUSKNOIR, 519), + _MONSTER_ID_GENDERED(FROSLASS, 520), + _MONSTER_ID_GENDERED(ROTOM, 521), + _MONSTER_ID_GENDERED(UXIE, 522), + _MONSTER_ID_GENDERED(MESPRIT, 523), + _MONSTER_ID_GENDERED(AZELF, 524), + _MONSTER_ID_GENDERED(DIALGA, 525), + _MONSTER_ID_GENDERED(PALKIA, 526), + _MONSTER_ID_GENDERED(HEATRAN, 527), + _MONSTER_ID_GENDERED(REGIGIGAS, 528), + _MONSTER_ID_GENDERED(GIRATINA_ALTERED, 529), + _MONSTER_ID_GENDERED(CRESSELIA, 530), + _MONSTER_ID_GENDERED(PHIONE, 531), + _MONSTER_ID_GENDERED(MANAPHY, 532), + _MONSTER_ID_GENDERED(DARKRAI, 533), + _MONSTER_ID_GENDERED(SHAYMIN_LAND, 534), + _MONSTER_ID_GENDERED(SHAYMIN_SKY, 535), + _MONSTER_ID_GENDERED(GIRATINA_ORIGIN, 536), + _MONSTER_ID_GENDERED(UNNAMED_0x219, 537), + _MONSTER_ID_GENDERED(UNNAMED_0x21A, 538), + _MONSTER_ID_GENDERED(UNNAMED_0x21B, 539), + _MONSTER_ID_GENDERED(UNNAMED_0x21C, 540), + _MONSTER_ID_GENDERED(UNNAMED_0x21D, 541), + _MONSTER_ID_GENDERED(UNNAMED_0x21E, 542), + _MONSTER_ID_GENDERED(UNNAMED_0x21F, 543), + _MONSTER_ID_GENDERED(UNNAMED_0x220, 544), + _MONSTER_ID_GENDERED(UNNAMED_0x221, 545), + _MONSTER_ID_GENDERED(UNNAMED_0x222, 546), + _MONSTER_ID_GENDERED(UNNAMED_0x223, 547), + _MONSTER_ID_GENDERED(UNNAMED_0x224, 548), + _MONSTER_ID_GENDERED(UNNAMED_0x225, 549), + _MONSTER_ID_GENDERED(UNNAMED_0x226, 550), + _MONSTER_ID_GENDERED(UNNAMED_0x227, 551), + _MONSTER_ID_GENDERED(PRIMAL_DIALGA, 552), + _MONSTER_ID_GENDERED(DECOY, 553), + _MONSTER_ID_GENDERED(STATUE, 554), + MONSTER_WIGGLYTUFF_STORY = 555, + MONSTER_REGIGIGAS_STORY = 556, + MONSTER_BRONZONG_STORY = 557, + MONSTER_HITMONLEE_STORY = 558, + MONSTER_CHIMECHO_STORY = 559, + MONSTER_WIGGLYTUFF_STORY_2 = 560, + MONSTER_UXIE_STORY = 561, + MONSTER_AZELF_STORY = 562, + MONSTER_MESPRIT_STORY = 563, + MONSTER_SUNFLORA_STORY = 564, + MONSTER_DIGLETT_STORY = 565, + MONSTER_DUGTRIO_STORY = 566, + MONSTER_CORPHISH_STORY = 567, + MONSTER_LOUDRED_STORY = 568, + MONSTER_BIDOOF_STORY = 569, + MONSTER_CHATOT_STORY = 570, + MONSTER_GROVYLE_STORY = 571, + MONSTER_DUSKNOIR_STORY = 572, + MONSTER_SABLEYE_STORY = 573, + MONSTER_DARKRAI_STORY = 574, + MONSTER_MAMA = 575, + MONSTER_GROVYLE_STORY_2 = 576, + MONSTER_DUSKNOIR_STORY_2 = 577, + MONSTER_DUSKNOIR_STORY_3 = 578, + MONSTER_SENTRET_DITTO = 579, + MONSTER_BELLOSSOM_DITTO = 580, + MONSTER_RESERVE_27 = 581, + MONSTER_RESERVE_28 = 582, + MONSTER_RESERVE_29 = 583, + MONSTER_RESERVE_30 = 584, + MONSTER_RESERVE_31 = 585, + MONSTER_RESERVE_32 = 586, + MONSTER_RESERVE_33 = 587, + MONSTER_RESERVE_34 = 588, + MONSTER_RESERVE_35 = 589, + MONSTER_RESERVE_36 = 590, + MONSTER_RESERVE_37 = 591, + MONSTER_RESERVE_38 = 592, + MONSTER_RESERVE_39 = 593, + MONSTER_RESERVE_40 = 594, + MONSTER_RESERVE_41 = 595, + MONSTER_RESERVE_42 = 596, + MONSTER_RESERVE_43 = 597, + MONSTER_RESERVE_44 = 598, + MONSTER_RESERVE_45 = 599, +}; +#undef _MONSTER_ID_GENDERED + +// Actions that a monster can take on its turn +enum action { + ACTION_NOTHING = 0, // 0x0 + // 0x1: Pass turn. Enemies will print the "is watching carefully" message when performing this + // action + ACTION_PASS_TURN = 1, + ACTION_WALK = 2, // 0x2: Walk + ACTION_UNK_3 = 3, + ACTION_UNK_4 = 4, + ACTION_UNK_5 = 5, + ACTION_NEXT = 6, // 0x6: Switch to next Pokémon when viewing moves + ACTION_PREVIOUS = 7, // 0x7: Switch to previous Pokémon when viewing moves + ACTION_PLACE_ITEM = 8, // 0x8: Place an item on the floor + ACTION_PICK_UP_PLAYER = 9, // 0x9: Pick up an item from the floor (player) + ACTION_UNK_A = 10, + ACTION_THROW_ITEM_PLAYER = 11, // 0xB: Throw an item + ACTION_CHECK_ITEM_DESCRIPTION = 12, // 0xC: Check the description of an item + ACTION_EAT_BERRY_SEED_DRINK = 13, // 0xD: Each a berry or seed, or drink something + ACTION_EAT_GUMMI = 14, // 0xE: Eat a gummi + ACTION_UNK_F = 15, + ACTION_USE_TM = 16, // 0x10: Use a TM + ACTION_UNK_11 = 17, + ACTION_USE_ITEM = 18, // 0x12: Use an item + ACTION_TALK_FIELD = 19, // 0x13: Talk to a teammate by facing them and pressing A + ACTION_USE_MOVE_PLAYER = 20, // 0x14: Use a move (player) + ACTION_USE_MOVE_AI = 21, // 0x15: Use a move (AI) + ACTION_UNK_16 = 22, + ACTION_STRUGGLE = 23, // 0x17: Use Struggle + ACTION_UNK_18 = 24, + ACTION_CHECK_MOVES = 25, // 0x19: Check the list of moves + ACTION_CHANGE_TACTICS = 26, // 0x1A: Change a teammate's tactic + ACTION_CHECK_SUMMARY = 27, // 0x1B: Check a pokémon's summary + ACTION_TALK_MENU = 28, // 0x1C: Talk to a teammate by using the in-menu option + ACTION_UNK_1D = 29, + ACTION_SET_MOVE = 30, // 0x1E: Set a move + ACTION_SWITCH_MOVE = 31, // 0x1F: Switch a move on or off + ACTION_UNK_20 = 32, + ACTION_UNK_21 = 33, + ACTION_UNK_22 = 34, + ACTION_EAT_AI = 35, // 0x23: Eat item (AI) + ACTION_THROW_ITEM_AI = 36, // 0x24: Throw an item (AI) + ACTION_UNK_25 = 37, + ACTION_USE_STAIRS = 38, // 0x26: Use the stairs + ACTION_THROW_STRAIGHT_PLAYER = 39, // 0x27: Throw a straight-line item (player) + ACTION_UNK_28 = 40, + ACTION_UNK_29 = 41, + ACTION_UNK_2A = 42, + ACTION_QUICKSAVE = 43, // 0x2B: Quicksave + ACTION_USE_LINK_BOX = 44, // 0x2C: Use a Link Box + ACTION_UNK_2D = 45, + ACTION_GIVE_UP = 46, // 0x2E: Give up + ACTION_UNK_2F = 47, + ACTION_VIEW_IQ = 48, // 0x30: Open the IQ skills menu + ACTION_USE_ORB = 49, // 0x31: Use an orb + ACTION_REGULAR_ATTACK = 50, // 0x32: Regular Attack + ACTION_UNSET_MOVE = 51, // 0x33: Unset a move + ACTION_SEND_HOME = 52, // 0x34: Send a pokémon home + ACTION_UNK_35 = 53, + ACTION_GIVE_ITEM = 54, // 0X36: Give held item + ACTION_TAKE_ITEM = 35, // 0x37: Take a held item + ACTION_UNK_38 = 36, + // 0x39: had second thoughts! - Used as a failsafe when trying to take an illegal + // action + ACTION_SECOND_THOUGHTS = 37, + ACTION_SWAP_ITEM = 38, // 0x3A: Swapping an item + ACTION_CHANGE_LEADER = 39, // 0x3B: Change the team's leader + ACTION_SET_ITEM = 40, // 0x3C: Set item + ACTION_UNSET_ITEM = 41, // 0x3D: Unset item + ACTION_UNK_3E = 42, + ACTION_PICK_UP_AI = 43, // 0x3F: Pick up an item (AI) + ACTION_UNK_40 = 44, + ACTION_THROW_ARC_PLAYER = 45, // 0x41: Throw a Gravelerock or a similar item (player) + ACTION_PAD = 0xffff, // To force the enum on 16 bits +}; + +// Behavior type of NPC monsters +enum monster_behavior { + BEHAVIOR_NORMAL_ENEMY_0x0 = 0, + BEHAVIOR_OUTLAW = 1, + BEHAVIOR_HIDDEN_OUTLAW = 2, + BEHAVIOR_FLEEING_OUTLAW = 3, + BEHAVIOR_OUTLAW_TEAM_LEADER = 4, + BEHAVIOR_OUTLAW_TEAM_MINION = 5, + BEHAVIOR_FIXED_ENEMY = 6, + BEHAVIOR_RESCUE_TARGET = 7, + BEHAVIOR_WANDERING_ENEMY_0x8 = 8, + BEHAVIOR_NORMAL_ENEMY_0x9 = 9, + BEHAVIOR_ALLY = 10, + BEHAVIOR_EXPLORER_MAZE_1 = 11, + BEHAVIOR_EXPLORER_MAZE_2 = 12, + BEHAVIOR_EXPLORER_MAZE_3 = 13, + BEHAVIOR_EXPLORER_MAZE_4 = 14, + BEHAVIOR_INVALID = 15, + BEHAVIOR_SECRET_BAZAAR_KIRLIA = 16, + BEHAVIOR_SECRET_BAZAAR_MIME_JR = 17, + BEHAVIOR_SECRET_BAZAAR_SWALOT = 18, + BEHAVIOR_SECRET_BAZAAR_LICKILICKY = 19, + BEHAVIOR_SECRETE_BAZAAR_SHEDINJA = 20, + BEHAVIOR_WANDERING_ENEMY_0x15 = 21, +}; + +// Music/song IDs. Some background SFX are also stored as "songs". +enum music_id { + MUSIC_NONE_0x0 = 0, + MUSIC_POKEMON_EXPLORATION_TEAM_THEME = 1, + MUSIC_TOP_MENU_THEME = 2, + MUSIC_MAROWAK_DOJO = 3, + MUSIC_THE_GATEKEEPERS = 4, + MUSIC_JOB_CLEAR = 5, + MUSIC_WELCOME_TO_THE_WORLD_OF_POKEMON = 6, + MUSIC_WIGGLYTUFFS_GUILD = 7, + MUSIC_WIGGLYTUFFS_GUILD_REMIX = 8, + MUSIC_TREASURE_TOWN = 9, + MUSIC_DO_YOUR_BEST_AS_ALWAYS = 10, + MUSIC_MONSTER_HOUSE = 11, + MUSIC_KECLEONS_SHOP = 12, + MUSIC_OUTLAW = 13, + MUSIC_IN_THE_DEPTHS_OF_THE_PIT = 14, + MUSIC_BOSS_BATTLE = 15, + MUSIC_DIALGAS_FIGHT_TO_THE_FINISH = 16, + MUSIC_BATTLE_AGAINST_DUSKNOIR = 17, + MUSIC_DEFY_THE_LEGENDS = 18, + MUSIC_MISSION_FAILURE = 19, + MUSIC_MISSION_SUCCESS = 20, + MUSIC_BEACH_CAVE = 21, + MUSIC_DRENCHED_BLUFF = 22, + MUSIC_MT_BRISTLE = 23, + MUSIC_WATERFALL_CAVE = 24, + MUSIC_APPLE_WOODS = 25, + MUSIC_CRAGGY_COAST = 26, + MUSIC_CAVE_AND_SIDE_PATH = 27, + MUSIC_MT_HORN = 28, + MUSIC_FOGGY_FOREST = 29, + MUSIC_STEAM_CAVE = 30, + MUSIC_UPPER_STEAM_CAVE = 31, + MUSIC_AMP_PLAINS = 32, + MUSIC_FAR_AMP_PLAINS = 33, + MUSIC_NORTHERN_DESERT = 34, + MUSIC_QUICKSAND_CAVE = 35, + MUSIC_QUICKSAND_PIT = 36, + MUSIC_CRYSTAL_CAVE = 37, + MUSIC_CRYSTAL_CROSSING = 38, + MUSIC_CHASM_CAVE = 39, + MUSIC_DARK_HILL = 40, + MUSIC_SEALED_RUIN = 41, + MUSIC_DEEP_SEALED_RUIN = 42, + MUSIC_DUSK_FOREST = 43, + MUSIC_DEEP_DUSK_FOREST = 44, + MUSIC_RANDOM_DUNGEON_THEME_2 = 45, + MUSIC_BRINE_CAVE = 46, + MUSIC_LOWER_BRINE_CAVE = 47, + MUSIC_HIDDEN_LAND = 48, + MUSIC_HIDDEN_HIGHLAND = 49, + MUSIC_TEMPORAL_TOWER = 50, + MUSIC_TEMPORAL_SPIRE = 51, + MUSIC_MYSTIFYING_FOREST = 52, + MUSIC_BLIZZARD_ISLAND_RESCUE_TEAM_MEDLEY = 53, + MUSIC_SURROUNDED_SEA = 54, + MUSIC_RANDOM_DUNGEON_THEME_1 = 55, + MUSIC_AEGIS_CAVE = 56, + MUSIC_CONCEALED_RUINS = 57, + MUSIC_MT_TRAVAIL = 58, + MUSIC_IN_THE_NIGHTMARE = 59, + MUSIC_MIRACLE_SEA = 60, + MUSIC_TREESHROUD_FOREST = 61, + MUSIC_DARK_CRATER = 62, + MUSIC_DEEP_DARK_CRATER = 63, + MUSIC_INTRO_ALTERNATE_UNUSED = 64, + MUSIC_PERFECT_SENTRY_DUTY = 65, + MUSIC_GOOD_SENTRY_DUTY = 66, + MUSIC_DECENT_SENTRY_DUTY = 67, + MUSIC_FAILED_SENTRY_DUTY = 68, + MUSIC_ON_THE_BEACH_AT_DUSK = 69, + MUSIC_GOODNIGHT = 70, + MUSIC_GOODNIGHT_ALTERNATE_UNUSED = 71, + MUSIC_AT_THE_END_OF_THE_DAY = 72, + MUSIC_GUILDMASTER_WIGGLYTUFF = 73, + MUSIC_GROWING_ANXIETY = 74, + MUSIC_THE_POWER_OF_DARKNESS = 75, + MUSIC_OH_NO = 76, + MUSIC_TIME_GEAR = 77, + MUSIC_TIME_GEAR_REMIX = 78, + MUSIC_I_SAW_SOMETHING_AGAIN = 79, + MUSIC_IN_THE_FUTURE = 80, + MUSIC_PLANETS_PARALYSIS = 81, + MUSIC_THROUGH_THE_SEA_OF_TIME = 82, + MUSIC_IN_THE_HANDS_OF_FATE = 83, + MUSIC_TIME_RESTORED = 84, + MUSIC_DONT_EVER_FORGET = 85, + MUSIC_A_WISH_FOR_PEACE = 86, + MUSIC_ON_THE_BEACH_AT_DUSK_INTRO_ONLY = 87, + MUSIC_MEMORIES_RETURNED = 88, + MUSIC_ENDING_THEME_INTRO = 89, + MUSIC_ENDING_THEME = 90, + MUSIC_EPILOGUE_THEME = 91, + MUSIC_TITLE_THEME_ALTERNATE_1_UNUSED = 92, + MUSIC_TITLE_THEME_ALTERNATE_2_UNUSED = 93, + MUSIC_MURKY_FOREST = 94, + MUSIC_SKY_PEAK_CAVE = 95, + MUSIC_SOUTHERN_JUNGLE = 96, + MUSIC_SKY_PEAK_COAST = 97, + MUSIC_SPRING_CAVE = 98, + MUSIC_LOWER_SPRING_CAVE = 99, + MUSIC_OCEAN_SFX = 100, + MUSIC_THUNDERSTORM_SFX = 101, + MUSIC_THUNDERSTORM_MUFFLED_SFX = 102, + MUSIC_RUMBLING_SFX = 103, + MUSIC_RUMBLING_LOUDER_SFX = 104, + MUSIC_RUMBLING_LOUDEST_SFX = 105, + MUSIC_RUNNING_HOT_WATER_SFX = 106, + MUSIC_TEMPORAL_PINNACLE_SFX = 107, + MUSIC_TEMPORAL_PINNACLE = 108, + MUSIC_NULL_0x6D = 109, + MUSIC_HEAVY_FOOTSTEPS_SFX = 110, + MUSIC_SINGLE_TONE_RINGING_SFX = 111, + MUSIC_ELECTRICITY_SFX_1 = 112, + MUSIC_ELECTRICITY_SFX_2 = 113, + MUSIC_ELECTRICITY_SFX_3 = 114, + MUSIC_FIRE_CRACKLING_SFX_1 = 115, + MUSIC_FIRE_CRACKLING_SFX_2 = 116, + MUSIC_RELIC_FRAGMENT_SFX = 117, + MUSIC_RAINBOW_STONESHIP_SFX = 118, + MUSIC_RAINBOW_STONESHIP_PREPARING_SFX = 119, + MUSIC_HUMMING_SFX = 120, + MUSIC_HAVE_TO_GET_HOME = 121, + MUSIC_FARTHER_AWAY = 122, + MUSIC_PALKIAS_ONSLAUGHT = 123, + MUSIC_NONE_0x7C = 124, + MUSIC_WATERFALL_SFX = 125, + MUSIC_EATING_SFX = 126, + MUSIC_OMINOUS_STRING_NOTE_SFX = 127, + MUSIC_FLOOD_SFX = 128, + MUSIC_PELIPPER_ISLAND = 129, + MUSIC_TITLE_THEME = 130, + MUSIC_HEARTWARMING = 131, + MUSIC_DOWN_A_DARK_PATH = 132, + MUSIC_RISING_FEAR = 133, + MUSIC_TEAM_SKULL = 134, + MUSIC_SYMPATHY = 135, + MUSIC_BEYOND_THE_DREAM = 136, + MUSIC_AIR_OF_UNEASE = 137, + MUSIC_ONE_FOR_ALL = 138, + MUSIC__ALL_FOR_ONE = 139, + MUSIC_BOULDER_QUARRY = 140, + MUSIC_SPRING_CAVE_DEPTHS = 141, + MUSIC_STAR_CAVE = 142, + MUSIC_DEEP_STAR_CAVE = 143, + MUSIC_LIMESTONE_CAVE = 144, + MUSIC_DEEP_LIMESTONE_CAVE = 145, + MUSIC_RANDOM_DUNGEON_THEME_3 = 146, + MUSIC_FORTUNE_RAVINE = 147, + MUSIC_FORTUNE_RAVINE_DEPTHS = 148, + MUSIC_BARREN_VALLEY = 149, + MUSIC_DARK_WASTELAND = 150, + MUSIC_SPACIAL_CLIFFS = 151, + MUSIC_DARK_ICE_MOUNTAIN = 152, + MUSIC_ICICLE_FOREST = 153, + MUSIC_VAST_ICE_MOUNTAIN = 154, + MUSIC_VAST_ICE_MOUNTAIN_PEAK = 155, + MUSIC_SKY_PEAK_FOREST = 156, + MUSIC_SKY_PEAK_PRAIRIE = 157, + MUSIC_SKY_PEAK_SNOWFIELD = 158, + MUSIC_SKY_PEAK_FINAL_PASS = 159, + MUSIC_SPINDAS_CAFE = 160, + MUSIC_LUDICOLO_DANCE = 161, + MUSIC_ILLUSION_STONE_CHAMBER = 162, + MUSIC_IT_CANT_BE = 163, + MUSIC_DEFEND_GLOBE = 164, + MUSIC_DEFEND_GLOBE_ENDING = 165, + MUSIC_TEAM_CHARMS_THEME = 166, + MUSIC_HERE_COMES_TEAM_CHARM = 167, + MUSIC_FOR_A_NEW_LIFE = 168, + MUSIC_LIVING_SPIRIT = 169, + MUSIC_PROUD_ACCOMPLISHMENT = 170, + MUSIC_IN_THE_MORNING_SUN = 171, + MUSIC_A_NEW_WORLD = 172, + MUSIC_THOUGHTS_FOR_FRIENDS = 173, + MUSIC_LIFE_GOES_ON_ENDING = 174, + MUSIC_ITS_NOT_A_MIRACLE = 175, + MUSIC_A_MESSAGE_ON_THE_WIND = 176, + MUSIC_A_FUN_EXPLORATION = 177, + MUSIC_SHAYMIN_VILLAGE = 178, + MUSIC_TEAM_CHARMS_THEME_INTRO_ONLY = 179, + MUSIC_RUMBLING_SFX_4 = 180, + MUSIC_RUMBLING_SFX_5 = 181, + MUSIC_OCEAN_MUFFLED_SFX = 182, + MUSIC_WIND_SFX_1 = 183, + MUSIC_LIMESTONE_CAVERN_DEPTHS_SFX = 184, + MUSIC_FIRE_CRACKLING_SFX_3 = 185, + MUSIC_SKY_PEAK_8TH_STATION_CLEARING_SFX = 186, + MUSIC_WIND_AND_RAIN_SFX = 187, + MUSIC_VAST_ICE_MOUNTAIN_PINNACLE_SFX = 188, + MUSIC_SPRING_CAVE_SFX = 189, + MUSIC_WIND_SFX_2 = 190, + MUSIC_SOUTHERN_JUNGLE_EXIT_SFX = 191, + MUSIC_BOULDER_QUARRY_CLEARING_SFX = 192, + MUSIC_WATERFALL_CAVE_VISION_SFX = 193, + MUSIC_WIND_SFX_3 = 194, + MUSIC_NULL_0xC2 = 195, + MUSIC_NULL_0xC3 = 196, + MUSIC_NULL_0xC4 = 197, + MUSIC_NULL_0xC5 = 198, + MUSIC_NULL_0xC6 = 199, + MUSIC_TEAM_CHARMS_THEME_ALTERNATE_1_UNUSED = 200, + MUSIC_TEAM_CHARM_JINGLE = 201, + MUSIC_TEAM_CHARMS_THEME_ALTERNATE_2_UNUSED = 202, + MUSIC_NONE_0x3E7 = 999, +}; + +// Status IDs +// While there seems to be a global status order, this enum isn't used exactly that way in +// practice. See the comments for struct status. +enum status_id { + STATUS_NONE = 0, // Called "-" internally + STATUS_SLEEP = 1, + STATUS_SLEEPLESS = 2, // Won't get sleepy + STATUS_NIGHTMARE = 3, // Caught in a nightmare + STATUS_YAWNING = 4, + STATUS_NAPPING = 5, + STATUS_LOW_HP = 6, // Low HP! Situation critical! + STATUS_BURN = 7, // Burned + STATUS_POISONED = 8, + STATUS_BADLY_POISONED = 9, + STATUS_PARALYSIS = 10, // Paralyzed + STATUS_IDENTIFYING = 11, + STATUS_FROZEN = 12, + STATUS_SHADOW_HOLD = 13, // Immobilized + STATUS_WRAP = 14, // Wrapped around foe + STATUS_WRAPPED = 15, // Wrapped by foe + STATUS_INGRAIN = 16, // Using Ingrain + STATUS_PETRIFIED = 17, + STATUS_CONSTRICTION = 18, // Being squeezed + STATUS_FAMISHED = 19, // About to drop from hunger + STATUS_CRINGE = 20, // Cringing + STATUS_CONFUSED = 21, + STATUS_PAUSED = 22, // Pausing + STATUS_COWERING = 23, + STATUS_TAUNTED = 24, + STATUS_ENCORE = 25, // Afflicted with Encore + STATUS_INFATUATED = 26, + STATUS_DOUBLE_SPEED = 27, // Sped up + STATUS_BIDE = 28, // Biding + STATUS_SOLARBEAM = 29, // Charging SolarBeam + STATUS_SKY_ATTACK = 30, // Charging Sky Attack + STATUS_RAZOR_WIND = 31, // Charging Razor Wind + STATUS_FOCUS_PUNCH = 32, // Charging Focus Punch + STATUS_SKULL_BASH = 33, // Charging Skull Bash + STATUS_FLYING = 34, // Flying high up + STATUS_BOUNCING = 35, + STATUS_DIVING = 36, // Hiding underwater + STATUS_DIGGING = 37, // Burrowing underground + STATUS_CHARGING = 38, // Using Charge + STATUS_ENRAGED = 39, // Shaking with rage + STATUS_SHADOW_FORCE = 40, // Hiding among shadows + STATUS_HALF_SPEED = 41, // Slowed down + STATUS_REFLECT = 42, // Protected by Reflect + STATUS_SAFEGUARD = 43, // Protected by Safeguard + STATUS_LIGHT_SCREEN = 44, // Protected by Light Screen + STATUS_COUNTER = 45, // Ready to counter + STATUS_MAGIC_COAT = 46, // Protected by Magic Coat + STATUS_WISH = 47, // Making a wish + STATUS_PROTECT = 48, // Protecting itself + STATUS_MIRROR_COAT = 49, // Protected by Mirror Coat + STATUS_ENDURING = 50, // Set to endure + STATUS_MINI_COUNTER = 51, // Ready to deliver mini counters + STATUS_MIRROR_MOVE = 52, // Using Mirror Move + STATUS_CONVERSION2 = 53, // Alt Using Conversion 2 + STATUS_VITAL_THROW = 54, // Ready to use Vital Throw + STATUS_MIST = 55, // Protected by Mist + STATUS_METAL_BURST = 56, // Protected by Metal Burst + STATUS_AQUA_RING = 57, // Cloaked by Aqua Ring + STATUS_LUCKY_CHANT = 58, // Lucky Chant in effect + STATUS_WEAKENED = 59, + STATUS_CURSED = 60, + STATUS_DECOY = 61, + STATUS_SNATCH = 62, // Ready to snatch moves + STATUS_GASTRO_ACID = 63, // Drenched with Gastro Acid + STATUS_HEAL_BLOCK = 64, // Prevented from healing + STATUS_EMBARGO = 65, // Under Embargo + STATUS_HUNGRY_PAL = 66, // Immobilized by hunger + STATUS_LEECH_SEED = 67, // Afflicted with Leech Seed + STATUS_DESTINY_BOND = 68, // Using Destiny Bond + STATUS_POWERED_UP = 69, + STATUS_SURE_SHOT = 70, // Total accuracy for moves + STATUS_WHIFFER = 71, // Afflicted with Smokescreen + STATUS_SET_DAMAGE = 72, // Inflicts set damage + STATUS_FOCUS_ENERGY = 73, // Enhanced critical-hit rate + STATUS_UNNAMED_0x4A = 74, // Called "-" internally + STATUS_LONG_TOSS = 75, // Throws thrown items far + STATUS_PIERCE = 76, // Pierces walls w/ thrown items + STATUS_UNNAMED_0x4D = 77, + STATUS_INVISIBLE = 78, + STATUS_TRANSFORMED = 79, // Transformed Pokemon + STATUS_MOBILE = 80, // Travel anywhere + STATUS_SLIP = 81, // Walk on water + STATUS_UNNAMED_0x52 = 82, + STATUS_BLINKER = 83, // Blinded + STATUS_CROSS_EYED = 84, // Hallucinating + STATUS_EYEDROPS = 85, // Seeing the unseeable + STATUS_DROPEYE = 86, // Poor vision + STATUS_UNNAMED_0x57 = 87, + STATUS_MUZZLED = 88, // Unable to use its mouth + STATUS_UNNAMED_0x59 = 89, + STATUS_MIRACLE_EYE = 90, // Exposed by Miracle Eye + STATUS_UNNAMED_0x5B = 91, + STATUS_MAGNET_RISE = 92, // Levitating with Magnet Rise + STATUS_STOCKPILING = 93, + STATUS_POWER_EARS = 94, // Can locate other Pokemon + STATUS_SCANNING = 95, // Can locate items + STATUS_GRUDGE = 96, // Bearing a grudge + STATUS_EXPOSED = 97, // Exposed to sight + STATUS_TERRIFIED = 98, + STATUS_PERISH_SONG = 99, // Received Perish Song + STATUS_DOUBLED_ATTACK = 100, // Has sped-up attacks + STATUS_STAIR_SPOTTER = 101, // Can locate stairs +}; + +// Mission type on a floor +enum mission_type { + MISSION_RESCUE_CLIENT = 0, + MISSION_RESCUE_TARGET = 1, + MISSION_ESCORT_TO_TARGET = 2, + MISSION_EXPLORE_WITH_CLIENT = 3, + MISSION_PROSPECT_WITH_CLIENT = 4, + MISSION_GUIDE_CLIENT = 5, + MISSION_FIND_ITEM = 6, + MISSION_DELIVER_ITEM = 7, + MISSION_SEARCH_FOR_TARGET = 8, + MISSION_TAKE_ITEM_FROM_OUTLAW = 9, + MISSION_ARREST_OUTLAW = 10, + MISSION_CHALLENGE_REQUEST = 11, + MISSION_TREASURE_MEMO = 12, + MISSION_TYPE_UNK_0xD = 13, + MISSION_SPECIAL_EPISODE = 14, +}; + +// Fixed room ID. Fixed rooms can be full floor layouts, like most end-of-dungeon boss chambers, +// multi-room layouts in the case of Treasure Memos, or single rooms within a larger floor layout +// like with key chambers. +enum fixed_room_id { + FIXED_NONE = 0, + FIXED_BEACH_CAVE_PIT = 1, + FIXED_MT_BRISTLE_PEAK = 2, + FIXED_STEAM_CAVE_PEAK = 3, + FIXED_AMP_CLEARING = 4, + FIXED_UNDERGROUND_LAKE = 5, + FIXED_CRYSTAL_LAKE = 6, + FIXED_SEALED_RUIN_PIT = 7, + FIXED_BRINE_CAVE_PIT = 8, + FIXED_OLD_RUINS = 9, + FIXED_TEMPORAL_PINNACLE = 10, + FIXED_MYSTIFYING_FOREST_CLEARING = 11, + FIXED_CREVICE_CAVE_PIT = 12, + FIXED_MIRACLE_SEABED = 13, + FIXED_REGICE_CHAMBER = 14, + FIXED_REGIROCK_CHAMBER = 15, + FIXED_REGISTEEL_CHAMBER = 16, + FIXED_REGIGIGAS_CHAMBER = 17, + FIXED_SPACIAL_RIFT_BOTTOM = 18, + FIXED_DARK_CRATER_PIT = 19, + FIXED_GIANT_VOLCANO_PEAK = 20, + FIXED_SHIMMER_DESERT_PIT = 21, + FIXED_MT_AVALANCHE_PEAK = 22, + FIXED_BOTTOMLESS_SEA_DEPTHS = 23, + FIXED_WORLD_ABYSS_PIT = 24, + FIXED_DEEP_MYSTERY_JUNGLE = 25, + FIXED_SKY_STAIRWAY_APEX = 26, + FIXED_EMPTY_OCTAGON = 27, + FIXED_SKY_PEAK_5TH_STATION_CLEARING = 28, + FIXED_SKY_PEAK_SUMMIT = 29, + FIXED_DEEP_STAR_CAVE_SE1 = 30, + FIXED_STAR_CAVE_PIT_SE1 = 31, + FIXED_FORTUNE_RAVINE_PIT = 32, + FIXED_BARREN_VALLEY_CLEARING = 33, + FIXED_BLACK_SWAMP = 34, + FIXED_DARK_ICE_MOUNTAIN_PINNACLE = 35, + FIXED_VAST_ICE_MOUNTAIN_PINNACLE = 36, + FIXED_BOULDER_QUARRY_CLEARING = 37, + FIXED_LIMESTONE_CAVERN_DEPTHS = 38, + FIXED_UPPER_SPRING_CAVE = 39, + FIXED_MIDDLE_SPRING_CAVE = 40, + FIXED_SPRING_CAVE_PIT = 41, + FIXED_DEEP_STAR_CAVE = 42, + FIXED_BARREN_VALLEY_CLEARING_REVISIT = 43, + FIXED_UNUSED_0x2C = 44, + FIXED_UNUSED_0x2D = 45, + FIXED_UNUSED_0x2E = 46, + FIXED_UNUSED_0x2F = 47, + FIXED_UNUSED_0x30 = 48, + FIXED_UNUSED_0x31 = 49, + FIXED_UNUSED_0x32 = 50, + FIXED_UNUSED_0x33 = 51, + FIXED_UNUSED_0x34 = 52, + FIXED_UNUSED_0x35 = 53, + FIXED_UNUSED_0x36 = 54, + FIXED_UNUSED_0x37 = 55, + FIXED_UNUSED_0x38 = 56, + FIXED_UNUSED_0x39 = 57, + FIXED_UNUSED_0x3A = 58, + FIXED_UNUSED_0x3B = 59, + FIXED_UNUSED_0x3C = 60, + FIXED_UNUSED_0x3D = 61, + FIXED_UNUSED_0x3E = 62, + FIXED_TEST = 63, + FIXED_EMPTY_RECTANGLE = 64, + FIXED_BEACH_CAVE_PIT_REVISIT = 65, + FIXED_MT_BRISTLE_PEAK_REVISIT = 66, + FIXED_STEAM_CAVE_PEAK_REVISIT = 67, + FIXED_AMP_CLEARING_REVISIT = 68, + FIXED_UNDERGROUND_LAKE_REVISIT = 69, + FIXED_CRYSTAL_LAKE_REVISIT = 70, + FIXED_SEALED_RUIN_PIT_REVISIT = 71, + FIXED_BRINE_CAVE_PIT_REVISIT = 72, + FIXED_OLD_RUINS_REVISIT = 73, + FIXED_TEMPORAL_PINNACLE_REVISIT = 74, + FIXED_REGIGIGAS_CHAMBER_REVISIT = 75, + FIXED_SPACIAL_RIFT_BOTTOM_REVISIT = 76, + FIXED_DARK_CRATER_PIT_REVISIT = 77, + FIXED_UNUSED_0x4E = 78, + FIXED_UNUSED_0x4F = 79, + FIXED_LABYRINTH_CAVE = 80, + FIXED_ZERO_ISLE_NORTH = 81, + FIXED_ZERO_ISLE_EAST = 82, + FIXED_ZERO_ISLE_WEST = 83, + FIXED_ZERO_ISLE_SOUTH = 84, + FIXED_ORAN_FOREST = 85, + FIXED_MARINE_RESORT = 86, + FIXED_SERENITY_RIVER = 87, + FIXED_LANDSLIDE_CAVE = 88, + FIXED_LUSH_PRAIRIE = 89, + FIXED_TINY_MEADOW = 90, + FIXED_SURROUNDED_SEA = 91, + FIXED_CONCEALED_RUINS = 92, + FIXED_LAKE_AFAR = 93, + FIXED_HAPPY_OUTLOOK = 94, + FIXED_MT_MISTRAL = 95, + FIXED_SHIMMER_HILL = 96, + FIXED_LOST_WILDERNESS = 97, + FIXED_MIDNIGHT_FOREST = 98, + FIXED_ZERO_ISLE_CENTER = 99, + FIXED_OBLIVION_FOREST = 100, + FIXED_TREACHEROUS_WATERS = 101, + FIXED_SOUTHEASTERN_ISLANDS = 102, + FIXED_INFERNO_CAVE = 103, + FIXED_MIDNIGHT_FOREST_COPY = 104, + FIXED_UNUSED_0x69 = 105, + FIXED_UNUSED_0x6A = 106, + FIXED_UNUSED_0x6B = 107, + FIXED_UNUSED_0x6C = 108, + FIXED_UNUSED_0x6D = 109, + FIXED_SUBSTITUTE_ROOM = 110, + FIXED_GOLDEN_CHAMBER = 111, + FIXED_SECRET_BAZAAR = 112, + FIXED_SECRET_ROOM = 113, + FIXED_TREASURE_MEMO_0 = 114, + FIXED_TREASURE_MEMO_1 = 115, + FIXED_TREASURE_MEMO_2 = 116, + FIXED_TREASURE_MEMO_3 = 117, + FIXED_TREASURE_MEMO_4 = 118, + FIXED_TREASURE_MEMO_5 = 119, + FIXED_TREASURE_MEMO_6 = 120, + FIXED_TREASURE_MEMO_7 = 121, + FIXED_TREASURE_MEMO_8 = 122, + FIXED_TREASURE_MEMO_9 = 123, + FIXED_TREASURE_MEMO_10 = 124, + FIXED_TREASURE_MEMO_11 = 125, + FIXED_TREASURE_MEMO_12 = 126, + FIXED_TREASURE_MEMO_13 = 127, + FIXED_TREASURE_MEMO_14 = 128, + FIXED_TREASURE_MEMO_15 = 129, + FIXED_TREASURE_MEMO_16 = 130, + FIXED_TREASURE_MEMO_17 = 131, + FIXED_TREASURE_MEMO_18 = 132, + FIXED_TREASURE_MEMO_19 = 133, + FIXED_TREASURE_MEMO_20 = 134, + FIXED_TREASURE_MEMO_21 = 135, + FIXED_TREASURE_MEMO_22 = 136, + FIXED_TREASURE_MEMO_23 = 137, + FIXED_TREASURE_MEMO_24 = 138, + FIXED_TREASURE_MEMO_25 = 139, + FIXED_TREASURE_MEMO_26 = 140, + FIXED_TREASURE_MEMO_27 = 141, + FIXED_TREASURE_MEMO_28 = 142, + FIXED_TREASURE_MEMO_29 = 143, + FIXED_TREASURE_MEMO_30 = 144, + FIXED_MEWTWO_CHALLENGE_FLOOR = 145, + FIXED_ENTEI_CHALLENGE_FLOOR = 146, + FIXED_RAIKOU_CHALLENGE_FLOOR = 147, + FIXED_SUICUNE_CHALLENGE_FLOOR = 148, + FIXED_STAR_CAVE_PIT = 149, + FIXED_CHALLENGE_LETTER_FLOOR_1 = 150, + FIXED_CHALLENGE_LETTER_FLOOR_2 = 151, + FIXED_CHALLENGE_LETTER_FLOOR_3 = 152, + FIXED_CHALLENGE_LETTER_FLOOR_4 = 153, + FIXED_CHALLENGE_LETTER_FLOOR_5 = 154, + FIXED_UNUSED_0x9B = 155, + FIXED_UNUSED_0x9C = 156, + FIXED_UNUSED_0x9D = 157, + FIXED_UNUSED_0x9E = 158, + FIXED_UNUSED_0x9F = 159, + FIXED_OUTLAW_TEAM_FLOOR_1 = 160, + FIXED_OUTLAW_TEAM_FLOOR_2 = 161, + FIXED_OUTLAW_TEAM_FLOOR_3 = 162, + FIXED_OUTLAW_TEAM_FLOOR_4 = 163, + FIXED_OUTLAW_TEAM_FLOOR_5 = 164, + FIXED_SEALED_CHAMBER = 165, + FIXED_UNUSED_0xA6 = 166, + FIXED_UNUSED_0xA7 = 167, + FIXED_UNUSED_0xA8 = 168, + FIXED_UNUSED_0xA9 = 169, + FIXED_CLEAR_SILK_CHAMBER = 170, + FIXED_ORANGE_SILK_CHAMBER = 171, + FIXED_GREEN_SILK_CHAMBER = 172, + FIXED_IRON_SILK_CHAMBER = 173, + FIXED_JOY_SEED_CHAMBER_6X = 174, + FIXED_FRIEND_BOW_CHAMBER = 175, + FIXED_PINK_SILK_CHAMBER = 176, + FIXED_GRAY_SILK_CHAMBER = 177, + FIXED_PURPLE_SILK_CHAMBER = 178, + FIXED_JOY_SEED_CHAMBER_1X = 179, + FIXED_ROYAL_SILK_CHAMBER = 180, + FIXED_MIRACLE_CHEST_CHAMBER = 181, + FIXED_BROWN_SILK_CHAMBER = 182, + FIXED_SKY_SILK_CHAMBER = 183, + FIXED_GOLD_SILK_CHAMBER = 184, + FIXED_BLACK_SILK_CHAMBER = 185, + FIXED_JOY_SEED_CHAMBER_2X = 186, + FIXED_WONDER_GUMMI_CHAMBER = 187, + FIXED_ITEM_CHAMBER_1 = 188, + FIXED_ITEM_CHAMBER_2 = 189, + FIXED_WONDER_CHEST_CHAMBER = 190, + FIXED_RED_SILK_CHAMBER = 191, + FIXED_BLUE_SILK_CHAMBER = 192, + FIXED_GRASS_SILK_CHAMBER = 193, + FIXED_YELLOW_SILK_CHAMBER = 194, + FIXED_REVIVER_SEED_CHAMBER_1 = 195, + FIXED_REVIVER_SEED_CHAMBER_2 = 196, + FIXED_EMPTY_SEALED_CHAMBER = 197, + FIXED_UNUSED_0xC6 = 198, + FIXED_UNUSED_0xC7 = 199, + FIXED_UNUSED_0xC8 = 200, + FIXED_UNUSED_0xC9 = 201, + FIXED_UNUSED_0xCA = 202, + FIXED_UNUSED_0xCB = 203, + FIXED_UNUSED_0xCC = 204, + FIXED_UNUSED_0xCD = 205, + FIXED_UNUSED_0xCE = 206, + FIXED_UNUSED_0xCF = 207, + FIXED_UNUSED_0xD0 = 208, + FIXED_UNUSED_0xD1 = 209, + FIXED_UNUSED_0xD2 = 210, + FIXED_UNUSED_0xD3 = 211, + FIXED_UNUSED_0xD4 = 212, + FIXED_UNUSED_0xD5 = 213, + FIXED_UNUSED_0xD6 = 214, + FIXED_UNUSED_0xD7 = 215, + FIXED_UNUSED_0xD8 = 216, + FIXED_UNUSED_0xD9 = 217, + FIXED_UNUSED_0xDA = 218, + FIXED_UNUSED_0xDB = 219, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_1 = 220, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_2 = 221, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_3 = 222, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_4 = 223, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_5 = 224, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_6 = 225, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_7 = 226, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_8 = 227, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_9 = 228, + FIXED_LEGENDARY_EXCLUSIVE_CHAMBER_10 = 229, + FIXED_UNUSED_0xE6 = 230, + FIXED_UNUSED_0xE7 = 231, + FIXED_UNUSED_0xE8 = 232, + FIXED_UNUSED_0xE9 = 233, + FIXED_UNUSED_0xEA = 234, + FIXED_UNUSED_0xEB = 235, + FIXED_UNUSED_0xEC = 236, + FIXED_UNUSED_0xED = 237, + FIXED_UNUSED_0xEE = 238, + FIXED_UNUSED_0xEF = 239, + FIXED_UNUSED_0xF0 = 240, + FIXED_UNUSED_0xF1 = 241, + FIXED_UNUSED_0xF2 = 242, + FIXED_UNUSED_0xF3 = 243, + FIXED_UNUSED_0xF4 = 244, + FIXED_UNUSED_0xF5 = 245, + FIXED_UNUSED_0xF6 = 246, + FIXED_UNUSED_0xF7 = 247, + FIXED_UNUSED_0xF8 = 248, + FIXED_UNUSED_0xF9 = 249, + FIXED_UNUSED_0xFA = 250, + FIXED_UNUSED_0xFB = 251, + FIXED_UNUSED_0xFC = 252, + FIXED_UNUSED_0xFD = 253, + FIXED_UNUSED_0xFE = 254, + FIXED_UNUSED_0xFF = 255, +}; + +// The cause of a monster taking damage, not including the move case. +// These codes should all be greater than any move ID. +// Some of the values are used as faint reasons or on the "The Last Outing" screen +// rather than as damage sources. +enum damage_source_non_move { + DAMAGE_SOURCE_TRANSFORM_FRIEND = 563, // "was transformed into a friend" + DAMAGE_SOURCE_NOT_BEFRIENDED = 564, // "left without being befriended" + DAMAGE_SOURCE_DEBUG_ATTACK = 565, + DAMAGE_SOURCE_JUMP_KICK = 566, + DAMAGE_SOURCE_HI_JUMP_KICK = 567, + DAMAGE_SOURCE_DESTINY_BOND = 568, + DAMAGE_SOURCE_SLUDGE = 569, + DAMAGE_SOURCE_POWERFUL_MOVE_1 = 570, + DAMAGE_SOURCE_POWERFUL_MOVE_2 = 571, + DAMAGE_SOURCE_RECOIL = 572, + DAMAGE_SOURCE_SPLASH = 573, + DAMAGE_SOURCE_ENERGY = 574, // "an enemy's pent-up energy" + DAMAGE_SOURCE_POWERFUL_MOVE_3 = 575, + DAMAGE_SOURCE_POWERFUL_MOVE_4 = 576, + DAMAGE_SOURCE_POWERFUL_MOVE_5 = 577, + DAMAGE_SOURCE_POWERFUL_MOVE_6 = 578, + DAMAGE_SOURCE_POWERFUL_MOVE_7 = 579, + DAMAGE_SOURCE_POWERFUL_MOVE_8 = 580, + DAMAGE_SOURCE_SPIKES = 581, + DAMAGE_SOURCE_DEBUG_DAMAGE = 582, + DAMAGE_SOURCE_BURN = 583, + DAMAGE_SOURCE_CONSTRICTION = 584, + DAMAGE_SOURCE_POISON = 585, + DAMAGE_SOURCE_WRAP = 586, + DAMAGE_SOURCE_CURSE = 587, + DAMAGE_SOURCE_LEECH_SEED = 588, + DAMAGE_SOURCE_PERISH_SONG = 589, + DAMAGE_SOURCE_NIGHTMARE = 590, + DAMAGE_SOURCE_THROWN_ROCK = 591, + DAMAGE_SOURCE_HUNGER = 592, + DAMAGE_SOURCE_EXPLODED = 593, // I think this one is only used for the monster that explodes. + // Other monsters that are hit by the explosion use + // DAMAGE_SOURCE_EXPLOSION. + DAMAGE_SOURCE_CHESTNUT_TRAP = 594, + DAMAGE_SOURCE_TRAP = 595, + DAMAGE_SOURCE_PITFALL_TRAP = 596, + DAMAGE_SOURCE_BLAST_SEED = 597, + DAMAGE_SOURCE_THROWN_ITEM = 598, + DAMAGE_SOURCE_TRANSFORM_ITEM = 599, + DAMAGE_SOURCE_KNOCKED_FLYING = 600, + DAMAGE_SOURCE_FLYING_MONSTER = 601, + DAMAGE_SOURCE_GAVE_UP = 602, // "gave up the exploration" + DAMAGE_SOURCE_DELETED = 603, // "was deleted for the sake of an event" + DAMAGE_SOURCE_WENT_AWAY = 604, // "went away" + DAMAGE_SOURCE_UNSEEN_FORCE = 605, + DAMAGE_SOURCE_PARTNER_FAINTED = 606, // "returned with the fallen partner" + DAMAGE_SOURCE_WEATHER = 607, + DAMAGE_SOURCE_POSSESS = 608, + DAMAGE_SOURCE_CLIENT_FAINTED = 609, // "failed to protect the client Pokémon" + DAMAGE_SOURCE_ITEM_ORB = 610, + DAMAGE_SOURCE_ITEM_NON_ORB = 611, + DAMAGE_SOURCE_UNK612 = 612, // "-" + DAMAGE_SOURCE_ESCORT_FAINTED = 613, // "failed to escort the client Pokémon" + DAMAGE_SOURCE_OTHER_MONSTER_FAINTED = 614, // "returned with the fallen [string:2]" + DAMAGE_SOURCE_BIDOOF_FAINTED = 615, + DAMAGE_SOURCE_GROVYLE_FAINTED = 616, + DAMAGE_SOURCE_CELEBI_FAINTED = 617, + DAMAGE_SOURCE_CHATOT_FAINTED = 618, + DAMAGE_SOURCE_CRESSELIA_FAINTED = 619, + DAMAGE_SOURCE_TOXIC_SPIKES = 620, + DAMAGE_SOURCE_STEALTH_ROCK = 621, + DAMAGE_SOURCE_BAD_DREAMS = 622, + DAMAGE_SOURCE_EXPLOSION = 623, + DAMAGE_SOURCE_OREN_BERRY = 624, + DAMAGE_SOURCE_DUMMY_625 = 625, + DAMAGE_SOURCE_DUMMY_626 = 626, + DAMAGE_SOURCE_DUMMY_627 = 627, + DAMAGE_SOURCE_DUMMY_628 = 628, + DAMAGE_SOURCE_DUMMY_629 = 629, + DAMAGE_SOURCE_DUMMY_630 = 630, + DAMAGE_SOURCE_DUMMY_631 = 631, + DAMAGE_SOURCE_DUMMY_632 = 632, + DAMAGE_SOURCE_ESCAPE = 633, // "Escaped in the middle of exploration" + DAMAGE_SOURCE_DUNGEON_CLEAR = 634, // "cleared the dungeon" + DAMAGE_SOURCE_RESCUE_SUCCESS = 635, // "succeeded in the rescue mission" + DAMAGE_SOURCE_MISSION_COMPLETE = 636, // "completed a mission! Impressive!" + DAMAGE_SOURCE_BEFRIEND_MEW = 637, // "befriended [CS:N]Mew[CR]!" +}; + +union damage_source { + enum move_id move; + enum damage_source_non_move other; +}; + +// Weather ID +enum weather_id { + WEATHER_CLEAR = 0, + WEATHER_SUNNY = 1, + WEATHER_SANDSTORM = 2, + WEATHER_CLOUDY = 3, + WEATHER_RAIN = 4, + WEATHER_HAIL = 5, + WEATHER_FOG = 6, + WEATHER_SNOW = 7, + WEATHER_RANDOM = 8, +}; + +// Floor layout type during floor generation +enum floor_layout { + LAYOUT_LARGE = 0, + LAYOUT_SMALL = 1, + LAYOUT_ONE_ROOM_MONSTER_HOUSE = 2, + LAYOUT_OUTER_RING = 3, + LAYOUT_CROSSROADS = 4, + LAYOUT_TWO_ROOMS_WITH_MONSTER_HOUSE = 5, + LAYOUT_LINE = 6, + LAYOUT_CROSS = 7, + LAYOUT_LARGE_0x8 = 8, + LAYOUT_BEETLE = 9, + LAYOUT_OUTER_ROOMS = 10, + LAYOUT_MEDIUM = 11, + LAYOUT_UNUSED_0xC = 12, + LAYOUT_UNUSED_0xD = 13, + LAYOUT_UNUSED_0xE = 14, + LAYOUT_UNUSED_0xF = 15, +}; + +// Trap ID +enum trap_id { + TRAP_NULL_TRAP = 0, + TRAP_MUD_TRAP = 1, + TRAP_STICKY_TRAP = 2, + TRAP_GRIMY_TRAP = 3, + TRAP_SUMMON_TRAP = 4, + TRAP_PITFALL_TRAP = 5, + TRAP_WARP_TRAP = 6, + TRAP_GUST_TRAP = 7, + TRAP_SPIN_TRAP = 8, + TRAP_SLUMBER_TRAP = 9, + TRAP_SLOW_TRAP = 10, + TRAP_SEAL_TRAP = 11, + TRAP_POISON_TRAP = 12, + TRAP_SELFDESTRUCT_TRAP = 13, + TRAP_EXPLOSION_TRAP = 14, + TRAP_PP_ZERO_TRAP = 15, + TRAP_CHESTNUT_TRAP = 16, + TRAP_WONDER_TILE = 17, + TRAP_POKEMON_TRAP = 18, + TRAP_SPIKED_TILE = 19, + TRAP_STEALTH_ROCK = 20, + TRAP_TOXIC_SPIKES = 21, + TRAP_TRIP_TRAP = 22, + TRAP_RANDOM_TRAP = 23, + TRAP_GRUDGE_TRAP = 24, + // Used in fixed room data to indicate that a trap shouldn't be placed on the current tile + // Also used to indicate a random non-wonder tile trap should be selected instead during play + TRAP_NONE = 25, + TRAP_0x1A = 26, + TRAP_0x1B = 27, + TRAP_0x1C = 28, + TRAP_0x1D = 29, + TRAP_0x1E = 30, + TRAP_0x1F = 31, + // Behaves identically to a normal pitfall trap, but uses the sprite where the grate is + // already broken. TRAP_PITFALL_TRAP becomes this one when something falls through. + TRAP_BROKEN_PITFALL_TRAP = 32, +}; + +// The type of hidden stairs (i.e. where it leads), if present +enum hidden_stairs_type { + HIDDEN_STAIRS_NONE = 0, + HIDDEN_STAIRS_SECRET_BAZAAR = 1, + HIDDEN_STAIRS_SECRET_ROOM = 2, + HIDDEN_STAIRS_RANDOM_SECRET_BAZAAR_OR_SECRET_ROOM = 255, + HIDDEN_STAIRS_PADDING = 0xffffffff, +}; + +// Used to determine which version of a dungeon to load. +enum game_id { + GAME_SKY = 0, + GAME_TIME = 1, + GAME_DARKNESS = 2, + GAME_PADDING = 0xffffffff, +}; + +// Objective while in a dungeon +enum dungeon_objective { + OBJECTIVE_STORY = 0, // This dungeon visit is part of the story + OBJECTIVE_NORMAL = 1, + OBJECTIVE_RESCUE = 2, // Rescuing another player + OBJECTIVE_UNK_GAME_MODE_5 = 3, // $GAME_MODE == 5 when entering the dungeon +}; + +// Move category +enum move_category { + CATEGORY_PHYSICAL = 0, + CATEGORY_SPECIAL = 1, + CATEGORY_STATUS = 2, + CATEGORY_NONE = 3, // this is a guess +}; + +enum type_matchup { + MATCHUP_IMMUNE = 0, + MATCHUP_NOT_VERY_EFFECTIVE = 1, + MATCHUP_NEUTRAL = 2, + MATCHUP_SUPER_EFFECTIVE = 3, +}; + +// List of reasons why you can get forcefully kicked out of a dungeon +enum forced_loss_reason { + FORCED_LOSS_NONE = 0, // You don't have to get kicked out of the dungeon + FORCED_LOSS_PARTNER_FAINTED = 1, // Your partner fainted (before postgame) + FORCED_LOSS_CLIENT_FAINTED = 2, // Your client fainted + FORCED_LOSS_ESCORT_FAINTED = 3, // The client you had to escort fainted + // "Your client [name:0] couldn't join you. Let's return to Treasure Town." + FORCED_LOSS_CLIENT_CANT_JOIN = 4, + FORCED_LOSS_PADDING = 0xffffffff, +}; + + +#endif //PMDSKY_ENUMS_H diff --git a/include/main_020348E4.h b/include/main_020348E4.h new file mode 100644 index 00000000..b865df97 --- /dev/null +++ b/include/main_020348E4.h @@ -0,0 +1,23 @@ +#ifndef PMDSKY_MAIN_020348E4_H +#define PMDSKY_MAIN_020348E4_H + +struct struct_1 { + s8 f[4]; // 0x0 + u32 a; // 0x4 + u8 b[7]; // 0x8 +}; + +struct struct_02AFDB8 { + u8 PAD1[16]; + u8 a; // 0x10 + u8 PAD2[3]; + struct struct_1 c; // 0x14 + u32 e; // 0x24 + u8 PAD3[152]; + u8 d; // 0xc4 + struct struct_1 b; // 0xc4 +}; + +u32 sub_020348E4(struct struct_1* dst); + +#endif //PMDSKY_MAIN_020348E4_H diff --git a/include/overlay_3102382820.h b/include/overlay_3102382820.h new file mode 100644 index 00000000..97ebe59a --- /dev/null +++ b/include/overlay_3102382820.h @@ -0,0 +1,93 @@ +#ifndef PMDSKY_OVERLAY_3102382820_H +#define PMDSKY_OVERLAY_3102382820_H + +#include "main_020348E4.h" +#include "util.h" +#include "preprocessString.h" +#include "dungeon_mode.h" +#include "dungeon.h" + +struct Window { + u8 PAD[6]; + u8 width; // 0x6: Window width in multiples of 8 pixels +}; + +void EntryOverlay31(void); + +#ifdef JAPAN +#define DRAW_DUNGEON_MENU_STATUS_WINDOW_DATA_OFFSET 0x1458 +#else +#define DRAW_DUNGEON_MENU_STATUS_WINDOW_DATA_OFFSET 0 +#endif + +#define DRAW_DUNGEON_MENU_STATUS_WINDOW_STR_ID_1 (0x000008B2 + DRAW_DUNGEON_MENU_STATUS_WINDOW_DATA_OFFSET) +#define DRAW_DUNGEON_MENU_STATUS_WINDOW_STR_ID_2 (0x000008B5 + DRAW_DUNGEON_MENU_STATUS_WINDOW_DATA_OFFSET) +#define DRAW_DUNGEON_MENU_STATUS_WINDOW_STR_ID_3 (0x000008B6 + DRAW_DUNGEON_MENU_STATUS_WINDOW_DATA_OFFSET) +#define DRAW_DUNGEON_MENU_STATUS_WINDOW_STR_ID_4 (0x000008B7 + DRAW_DUNGEON_MENU_STATUS_WINDOW_DATA_OFFSET) +#define DRAW_DUNGEON_MENU_STATUS_WINDOW_STR_ID_5 (0x000008B8 + DRAW_DUNGEON_MENU_STATUS_WINDOW_DATA_OFFSET) + +#define DRAW_DUNGEON_MENU_STATUS_WINDOW_CONST_1 (0x0000C402) +#define DRAW_DUNGEON_MENU_STATUS_WINDOW_CONST_2 (999) + +#define DRAW_DUNGEON_MENU_STATUS_WINDOW_BUFF_SIZE (256) + +#define LINE_HEIGHT 12 +#define X_OFFSET 115 +void DrawDungeonMenuStatusWindow(struct Window* window); +void DungeonMenuSwitch(struct Window* window); + +struct struct_2 { + u32 b; // 0x0 + u8 PAD1[92]; + u8* c; // 0x60 + u8 PAD2[50]; +}; + +struct struct_3 { + s8 e[4]; // 0x0 + u32 f; // 0x4 + struct entity* a; // 0x8 + u32 b; // 0xC + u32 c; // 0x10 + u32 d; // 0x14 +}; + +struct struct_5 { + u32 field_0x0; + u32 field_0x4; + u8 PAD1[172]; + struct struct_6* a; // 0xB4 +}; + +struct struct_6 { + u8 PAD[74]; + u16 a; // 0x4A + u16 field_0x4c; + u8 b; // 0x4E + u8 field_0x4f; + u16 c; // 0x50 + u16 d; // 0x52 + u8 e; // 0x54 + u8 field_0x55; + u16 f; // 0x56 + u16 g; // 0x58 +}; + +struct struct_4 { + u8* str; + struct struct_3* st3; +}; + +#define OV31_02382B54_CONST_1 (0x00000233) + +u32 ov31_02382B54(void); +void ov31_02382DAC(void); +struct struct_1* ov31_02382E08(void); +void ov31_02382E18(struct entity* arg_1, u32 arg_2); +void ov31_02382ED4(struct entity* arg_1); +void ov31_02382F68(struct Window* window); + + + + +#endif //PMDSKY_OVERLAY_3102382820_H diff --git a/include/preprocessString.h b/include/preprocessString.h new file mode 100644 index 00000000..bf3b974e --- /dev/null +++ b/include/preprocessString.h @@ -0,0 +1,35 @@ +#ifndef PREPROCESS_STRING_H +#define PREPROCESS_STRING_H + +struct PPStrValues { + u8* weather_0; // 0x0 + u32 field_0x4; + u32 field_0x8; + u32 field_0xB; + u32 dungeon_0; // 0xC + u32 field_0x10; + u32 field_0x14; + u32 field_0x18; + u32 field_0x1c; + union { // 0x20 + u32 digits_0; + u32 value_0; + u32 time_0; + u32 gold_left_0; + }; + union { // 0x24 + u32 digits_1; + u32 value_1; + }; + u32 field_0x28; + u32 field_0x2c; + u32 field_0x30; + u8* string0; // 0x34 + u32 field_0x38; + u32 field_0x3c; + u32 field_0x40; + u32 field_0x44; + u32 field_0x48; +}; + +#endif diff --git a/include/util.h b/include/util.h index 602a0ab6..404e77e5 100644 --- a/include/util.h +++ b/include/util.h @@ -1,6 +1,13 @@ #ifndef PMDSKY_UTIL_H #define PMDSKY_UTIL_H +typedef s32 fx32_8; // 32-bit signed fixed-point number with 8 fraction bits +typedef u32 ufx32_8; // 32-bit unsigned fixed-point number with 8 fraction bits +typedef u8 undefined; +typedef u16 undefined2; +typedef u32 undefined4; +typedef u8 bool; + // RGBA8 structure. Sometimes alpha is ignored and only used for padding struct rgba { u8 r; @@ -21,4 +28,13 @@ struct uvec2_16 { u16 y; }; -#endif //PMDSKY_UTIL_H \ No newline at end of file +// a (16b.16b) fixed-point rational +struct fixed_point { + u16 integer; + u16 fractional; +}; + +// Compares two numbers and return the minimum +#define MIN(A, B) ((A > B) ? B : A) + +#endif //PMDSKY_UTIL_H diff --git a/main.lsf b/main.lsf index 435ca4b2..2afefe1d 100644 --- a/main.lsf +++ b/main.lsf @@ -22,6 +22,8 @@ Static main Object asm/main_0200ED1C.o Object src/main_02025788.o Object asm/main_020257FC.o + Object src/main_020348E4.o + Object asm/main_02034974.o Object src/main_02054BE0.o Object asm/main_02054C24.o Object lib/DSE/src/dc_envelope.o @@ -326,7 +328,8 @@ Overlay OVY_30 Overlay OVY_31 { After OVY_29 - Object asm/overlay_31.o + Object src/overlay_31_02382820.o + Object asm/overlay_31_02382FBC.o } Overlay OVY_32 { diff --git a/src/main_020348E4.c b/src/main_020348E4.c new file mode 100644 index 00000000..170972f8 --- /dev/null +++ b/src/main_020348E4.c @@ -0,0 +1,20 @@ +#include "main_020348E4.h" + +extern struct struct_02AFDB8* _020AFDB8; +extern u32 sub_020347A0(struct struct_1*, struct struct_1*); + +u32 sub_020348E4(struct struct_1* src) +{ + if (sub_020347A0(src, &(_020AFDB8->b)) == 0) { + if (_020AFDB8->a != 0 && sub_020347A0(src, &(_020AFDB8->c))) { + return 0; + } + _020AFDB8->a = 1; + _020AFDB8->d = 0; + _020AFDB8->c = *src; + _020AFDB8->e = 0; + return 1; + } + return 0; +} + diff --git a/src/overlay_3102382820.c b/src/overlay_3102382820.c new file mode 100644 index 00000000..a96cab41 --- /dev/null +++ b/src/overlay_3102382820.c @@ -0,0 +1,308 @@ +#include "overlay_3102382820.h" + +extern struct dungeon* DUNGEON_PTR; + +extern const u8 DUNGEON_MENU_SWITCH_STR1[];// = "[dungeon:0]"; + +extern struct struct_1* OVERLAY31_UNKNOWN_POINTER__NA_238A260[2]; +extern u32 DUNGEON_WINDOW_PARAMS_1; +extern u32 DUNGEON_WINDOW_PARAMS_2; +extern struct struct_1 DUNGEON_WINDOW_PARAMS_3; +extern u32 DUNGEON_WINDOW_PARAMS_4; +extern u32 DUNGEON_MAIN_MENU_ITEMS; + +extern struct struct_4 ov31_0238A2A0; + +extern struct struct_1 OVERLAY31_UNKNOWN_STRUCT__NA_2389E30; + +extern u16 ov31_02389E22[]; + + +extern void* MemAlloc(u32 size, u32 nmemb); +//extern u32 sub_020348E4(struct struct_1*); + +extern struct entity* GetLeader(void); +extern s32 CeilFixedPoint(struct fixed_point); +extern u32 GetMoneyCarried(void); +extern void* GetApparentWeather(u32); +extern u32 sub_0204F9E0(void); +extern void ov29_022E2A78(u8*, void*, u32); // The third argument isn't actually used in the + // function (../asm/overlay_29_022E1A40.s#L1378) +extern u8* StringFromId(u32); +extern void PreprocessString(u8* dst, u32 dsize, const u8* src, u32 flags, struct PPStrValues* ptr); +extern void DrawTextInWindow(struct Window*, u32, u32, u8*); +extern void UpdateWindow(struct Window*); + +extern u8* sub_02025888(void); +extern struct Window* GetWindow(struct Window*); +extern s32 sub_020265A8(u8*); // Measures the text's width in pixels + +extern u32 ShouldMonsterRunAwayVariation(struct entity*, u32); +extern u32 Arm9LoadUnkFieldNa0x2029EC8(u32, u8*); +extern u8 CreateParentMenuFromStringIds(u32*, u32, struct struct_2*, u32*); +extern u8 CreateTextBox(u32*, void (*fun)(struct Window*)); +extern u32 IsParentMenuActive(s8); +extern u32 sub_0202AB80(s8); +extern void Arm9StoreUnkFieldNa0x2029ED8(u32, u8); +extern u32 GetPressedButtons(u32, u16*); +extern u32 ShouldMonsterRunAwayVariation(struct entity*, u32); +extern void sub_0202AB94(s8, u32); +extern void sub_0202B030(s8); +extern void sub_0202F954(s8); +extern struct struct_1* sub_0202ABB0(s8); + +extern void CloseTextBox(s8); +extern void CloseParentMenu(s8); +extern void MemFree(void*); + +extern void ov29_022EA428(u32, u32); +extern void AdvanceFrame(u8); +extern u32 ov29_022F0B9C(void); +extern void ov29_022E0C2C(u32); + +extern u32 GetFloorType(void); +extern u32 ov29_02338708(struct position*); + +void EntryOverlay31(void) { + struct struct_1* r0; + if (sub_020348E4(&DUNGEON_WINDOW_PARAMS_3) == 0) { + return; + } + r0 = (struct struct_1*)MemAlloc(16, 0x8); + OVERLAY31_UNKNOWN_POINTER__NA_238A260[0] = r0; + r0->a = 0; + OVERLAY31_UNKNOWN_POINTER__NA_238A260[1] = (struct struct_1*)0xa; +} + + +void DrawDungeonMenuStatusWindow(struct Window* window) +{ + struct PPStrValues str_values; + u8 str_buff[DRAW_DUNGEON_MENU_STATUS_WINDOW_BUFF_SIZE]; + u8 member_name_buffer[256]; + struct entity* leader; + struct monster* leader_info; + u8* str; + s32 line_offset; + u8 is_valid_member; + s32 i; + + leader = GetLeader(); + leader_info = (struct monster*)leader->info; + //str_values.dungeon_0 = leader_info->roost; + + str_values.digits_0 = CeilFixedPoint(leader_info->belly); + str_values.digits_1 = CeilFixedPoint(leader_info->max_belly); + + str = StringFromId(DRAW_DUNGEON_MENU_STATUS_WINDOW_STR_ID_1); + PreprocessString(str_buff, DRAW_DUNGEON_MENU_STATUS_WINDOW_BUFF_SIZE, str, 0, &str_values); + DrawTextInWindow(window, X_OFFSET, 0, str_buff); + + str_values.gold_left_0 = GetMoneyCarried(); + str = StringFromId(DRAW_DUNGEON_MENU_STATUS_WINDOW_STR_ID_2); + PreprocessString(str_buff, DRAW_DUNGEON_MENU_STATUS_WINDOW_BUFF_SIZE, str, 0, &str_values); + DrawTextInWindow(window, X_OFFSET, LINE_HEIGHT, str_buff); + + str_values.weather_0 = GetApparentWeather(0); + str = StringFromId(DRAW_DUNGEON_MENU_STATUS_WINDOW_STR_ID_3); + PreprocessString(str_buff, DRAW_DUNGEON_MENU_STATUS_WINDOW_BUFF_SIZE, str, 0, &str_values); + DrawTextInWindow(window, X_OFFSET, LINE_HEIGHT * 2, str_buff); + + str_values.time_0 = sub_0204F9E0(); + str = StringFromId(DRAW_DUNGEON_MENU_STATUS_WINDOW_STR_ID_4); + PreprocessString(str_buff, DRAW_DUNGEON_MENU_STATUS_WINDOW_BUFF_SIZE, str, DRAW_DUNGEON_MENU_STATUS_WINDOW_CONST_1, &str_values); + DrawTextInWindow(window, X_OFFSET, LINE_HEIGHT * 3, str_buff); + + line_offset = 0; + for (i = 0; i < 4; i++) { + struct entity* party_member = DUNGEON_PTR->party_members[i]; + if (party_member == NULL) { + is_valid_member = FALSE; + } else { + is_valid_member = (party_member->type != ENTITY_NOTHING); + } + if (is_valid_member) { + struct monster* member_info = party_member->info; + ov29_022E2A78(member_name_buffer, party_member, 0); + + str_values.string0 = member_name_buffer; + str_values.value_0 = member_info->hp; + + str_values.value_1 = MIN(member_info->max_hp_stat + member_info->max_hp_boost, + DRAW_DUNGEON_MENU_STATUS_WINDOW_CONST_2); + + str = StringFromId(DRAW_DUNGEON_MENU_STATUS_WINDOW_STR_ID_5); + PreprocessString(str_buff, DRAW_DUNGEON_MENU_STATUS_WINDOW_BUFF_SIZE, str, 0, &str_values); + DrawTextInWindow(window, 4, line_offset, str_buff); + + line_offset += 12; + if (line_offset >= 0x30) { + break; + } + } + } + + UpdateWindow(window); +} + +void DungeonMenuSwitch(struct Window* window) +{ + struct PPStrValues str_values; + str_values.dungeon_0 = DUNGEON_PTR->id | 0x40000; + str_values.digits_0 = DUNGEON_PTR->floor; + u8* str_buff = sub_02025888(); + PreprocessString(str_buff, 0x400, DUNGEON_MENU_SWITCH_STR1, 0, &str_values); + struct Window* window2 = GetWindow(window); + s32 text_width = sub_020265A8(str_buff); + s32 x_offset = (window2->width * 8 - text_width) / 2; + DrawTextInWindow(window, x_offset, 2, str_buff); + UpdateWindow(window); +} + +u32 ov31_02382B54(void) +{ + u16 pressed_buttons; + struct struct_2 sp; + struct entity* leader; + + switch (OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->a) { + case 0: + OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->a++; + break; + + case 1: + for (int i = 0; i<7; i++) { + OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->b[i] = 0; + } + leader = GetLeader(); + if (ShouldMonsterRunAwayVariation(leader, 1)) { + OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->b[0] = 3; + OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->b[1] = 3; + OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->b[2] = 3; + OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->b[4] = 3; + } + sp.c = OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->b; + sp.b = Arm9LoadUnkFieldNa0x2029EC8(5, sp.c); + + OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->f[0] = CreateParentMenuFromStringIds(&DUNGEON_WINDOW_PARAMS_1, OV31_02382B54_CONST_1, &sp, &DUNGEON_MAIN_MENU_ITEMS); + + OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->f[2] = CreateTextBox(&DUNGEON_WINDOW_PARAMS_4, DrawDungeonMenuStatusWindow); + OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->f[1] = CreateTextBox(&DUNGEON_WINDOW_PARAMS_2, DungeonMenuSwitch); + OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->a++; + break; + + case 2: + if (IsParentMenuActive(OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->f[0])) { + u8 tmp4 = sub_0202AB80(OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->f[0]); + + Arm9StoreUnkFieldNa0x2029ED8(5, tmp4); + + GetPressedButtons(0, &pressed_buttons); + if ((pressed_buttons & 0x400) == 0) + break; + + struct entity* leader = GetLeader(); + + if (ShouldMonsterRunAwayVariation(leader, 1)) + break; + + sub_0202AB94(OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->f[0], 0); + + sub_0202B030(OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->f[0]); + + sub_0202F954(OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->f[1]); + + sub_0202F954(OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->f[2]); + + OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->a++; + } else { + sub_0202F954(OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->f[1]); + + sub_0202F954(OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->f[2]); + OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->a++; + } + break; + + case 3: + OVERLAY31_UNKNOWN_POINTER__NA_238A260[1] = sub_0202ABB0(OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->f[0]); + OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->a++; + return 4; + break; + } + return 1; +} + +void ov31_02382DAC(void) +{ + if (OVERLAY31_UNKNOWN_POINTER__NA_238A260[0] == NULL) + return; + + CloseTextBox(OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->f[1]); + CloseTextBox(OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->f[2]); + CloseParentMenu(OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]->f[0]); + MemFree(OVERLAY31_UNKNOWN_POINTER__NA_238A260[0]); + OVERLAY31_UNKNOWN_POINTER__NA_238A260[0] = NULL; +} + +struct struct_1* ov31_02382E08(void) +{ + return OVERLAY31_UNKNOWN_POINTER__NA_238A260[1]; +} + +void ov31_02382E18(struct entity* arg_1, u32 arg_2) +{ + ov29_022EA428(6, 0); + AdvanceFrame(0x62); + AdvanceFrame(0x62); + ov31_02382ED4(arg_1); + + while ((u8)(ov31_0238A2A0.st3 != NULL)) { + AdvanceFrame(0x62); + } + + AdvanceFrame(0x62); + + if (ov29_022F0B9C()) { + ov29_022EA428(11, 0); + } else if (arg_2) { + ov29_022EA428(11, 0); + } else { + ov29_022EA428(0, 0); + } + ov29_022E0C2C(1); +} + +void ov31_02382ED4(struct entity* arg_1) +{ + struct struct_3* tmp1; + if (sub_020348E4(&OVERLAY31_UNKNOWN_STRUCT__NA_2389E30) == 0) + return; + + tmp1 = MemAlloc(sizeof(struct struct_3), 8); + ov31_0238A2A0.st3 = tmp1; + ov31_0238A2A0.st3->f = 0; + ov31_0238A2A0.st3->a = arg_1; + ov31_0238A2A0.st3->b = 0; + ov31_0238A2A0.st3->c = 0; + + u32 floor_type = GetFloorType(); + u32 r4 = 0; + if (floor_type == 2) { + r4 = 2; + } else if (floor_type == 1) { + r4 = 1; + } else if (ov29_02338708(&(arg_1->pos))) { + r4 = 3; + } + + ov31_0238A2A0.st3->d = r4; +} + +void ov31_02382F68(struct Window* window) +{ + u8* str = StringFromId(ov31_02389E22[ov31_0238A2A0.st3->d * 2]); + + ov31_0238A2A0.str = str; + DrawTextInWindow(window, 16, 18, str); + UpdateWindow(window); +} diff --git a/tools/extract_function/extract_function.py b/tools/extract_function/extract_function.py index 46e72130..f6cb665d 100644 --- a/tools/extract_function/extract_function.py +++ b/tools/extract_function/extract_function.py @@ -16,6 +16,8 @@ _, function_location, function_header = sys.argv if function_location.endswith('.s'): function_location = function_location[:-2] +if function_location.startswith("./asm/"): + function_location = function_location[6:] if function_header.endswith(';'): function_header = function_header[:-1] diff --git a/tools/m2ctx/m2ctx.sh b/tools/m2ctx/m2ctx.sh index ad99eec5..9feeaa28 100755 --- a/tools/m2ctx/m2ctx.sh +++ b/tools/m2ctx/m2ctx.sh @@ -4,7 +4,7 @@ OUT_FILE=ctx.c GCC=gcc FLAGS="-E -P -dD -undef" -INCLUDES="-Iinclude -Iinclude/library -Ifiles -Ilib/include -include global.h" +INCLUDES="-Iinclude -Iinclude/library -Ifiles -Ilib/include" # -include global.h" DEFINES="-DGAME_REMASTER=0 -DNORTH_AMERICA -DPM_KEEP_ASSERTS -DSDK_ARM9 -DSDK_CODE_ARM -DSDK_FINALROM"