From a05015dfe2fa148751f7624a1e4f23105e8b1695 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Wed, 28 Jan 2026 21:04:37 -0500 Subject: [PATCH 1/3] Synced from pmdsky-debug --- asm/include/main_rodata_020A2808.inc | 10 +++--- asm/main_rodata_020908D4.s | 32 +++++++++---------- asm/main_rodata_020A2808.s | 10 +++--- src/item_util_1.c | 14 ++++---- .../sync_pmdsky_debug/pmdsky_debug_reader.py | 16 +++++++--- tools/sync_pmdsky_debug/symbol_details.py | 12 +++++++ 6 files changed, 57 insertions(+), 37 deletions(-) diff --git a/asm/include/main_rodata_020A2808.inc b/asm/include/main_rodata_020A2808.inc index c6766542..40311a05 100644 --- a/asm/include/main_rodata_020A2808.inc +++ b/asm/include/main_rodata_020A2808.inc @@ -1679,11 +1679,11 @@ .public SoundLfoWave_InvalidFunc .public SoundLfoWave_ReverseSawFunc .public SoundLfoWave_SawFunc -.public ST_I2N_E_BIN -.public ST_I2N_F_BIN -.public ST_I2N_G_BIN -.public ST_I2N_I_BIN -.public ST_I2N_S_BIN +.public ST_I2N_E_BIN_FILE_NAME +.public ST_I2N_F_BIN_FILE_NAME +.public ST_I2N_G_BIN_FILE_NAME +.public ST_I2N_I_BIN_FILE_NAME +.public ST_I2N_S_BIN_FILE_NAME .public STRING_BALANCE_M_LEVEL_BIN .public STRING_DUNGEON_DUNGEON_BIN .public STRING_EFFECT_EFFECT_BIN diff --git a/asm/main_rodata_020908D4.s b/asm/main_rodata_020908D4.s index d010fa1d..398aa599 100644 --- a/asm/main_rodata_020908D4.s +++ b/asm/main_rodata_020908D4.s @@ -2886,24 +2886,24 @@ _02097FE4: .byte 0x25, 0x73, 0x5B, 0x43, 0x53, 0x3A, 0x31, 0x3A, 0x52, 0x5D, 0x25, 0x73, 0x5B, 0x43, 0x52, 0x3A .byte 0x31, 0x5D, 0x00, 0x00 #ifdef EUROPE - .global ST_I2N_I_BIN -ST_I2N_I_BIN: + .global ST_I2N_I_BIN_FILE_NAME +ST_I2N_I_BIN_FILE_NAME: .string "st_i2n_i.bin" .align 4 - .global ST_I2N_E_BIN -ST_I2N_E_BIN: + .global ST_I2N_E_BIN_FILE_NAME +ST_I2N_E_BIN_FILE_NAME: .string "st_i2n_e.bin" .align 4 - .global ST_I2N_S_BIN -ST_I2N_S_BIN: + .global ST_I2N_S_BIN_FILE_NAME +ST_I2N_S_BIN_FILE_NAME: .string "st_i2n_s.bin" .align 4 - .global ST_I2N_G_BIN -ST_I2N_G_BIN: + .global ST_I2N_G_BIN_FILE_NAME +ST_I2N_G_BIN_FILE_NAME: .string "st_i2n_g.bin" .align 4 - .global ST_I2N_F_BIN -ST_I2N_F_BIN: + .global ST_I2N_F_BIN_FILE_NAME +ST_I2N_F_BIN_FILE_NAME: .string "st_i2n_f.bin" .align 4 #endif @@ -2914,16 +2914,16 @@ BABY_EXCLUSIVE_ITEM_PAIRS: .byte 0xCF, 0x01, 0x0B, 0x01, 0xD0, 0x01, 0x46, 0x01, 0xD1, 0x01, 0x88, 0x01, 0xD2, 0x01, 0xE0, 0x01 .byte 0xD3, 0x01, 0xE1, 0x01, 0xD4, 0x01, 0xE2, 0x01, 0xD5, 0x01, 0xE9, 0x01, 0xD6, 0x01, 0xF4, 0x01 .byte 0xD7, 0x01, 0x13, 0x02 - .global ITEM_P_BIN -ITEM_P_BIN: + .global ITEM_P_BIN_FILE_PATH +ITEM_P_BIN_FILE_PATH: .string "rom0:/BALANCE/item_p.bin" .align 4 - .global ITEM_S_P_BIN -ITEM_S_P_BIN: + .global ITEM_S_P_BIN_FILE_PATH +ITEM_S_P_BIN_FILE_PATH: .string "rom0:/BALANCE/item_s_p.bin" .align 4 - .global ITEM_ST_I2N_BIN -ITEM_ST_I2N_BIN: + .global ITEM_ST_I2N_BIN_FORMAT +ITEM_ST_I2N_BIN_FORMAT: #ifdef EUROPE .string "rom0:/BALANCE/%s" #else diff --git a/asm/main_rodata_020A2808.s b/asm/main_rodata_020A2808.s index d7def128..2627993d 100644 --- a/asm/main_rodata_020A2808.s +++ b/asm/main_rodata_020A2808.s @@ -11671,11 +11671,11 @@ ITEM_DATA_TABLE_PTRS: #ifdef EUROPE .global ITEM_LANG_FILE_ARRAY ITEM_LANG_FILE_ARRAY: - .word ST_I2N_E_BIN - .word ST_I2N_F_BIN - .word ST_I2N_G_BIN - .word ST_I2N_I_BIN - .word ST_I2N_S_BIN + .word ST_I2N_E_BIN_FILE_NAME + .word ST_I2N_F_BIN_FILE_NAME + .word ST_I2N_G_BIN_FILE_NAME + .word ST_I2N_I_BIN_FILE_NAME + .word ST_I2N_S_BIN_FILE_NAME #endif .global _020AF6D0 _020AF6D0: diff --git a/src/item_util_1.c b/src/item_util_1.c index 9abc59c1..28a0e080 100644 --- a/src/item_util_1.c +++ b/src/item_util_1.c @@ -17,9 +17,9 @@ extern const char ITEM_NAME_FORMAT_YELLOW; extern const char ITEM_NAME_FORMAT_INDIGO; extern const char ITEM_NAME_FORMAT_PLAIN; extern const char ITEM_NAME_FORMAT_CREAM; -extern const char ITEM_P_BIN; -extern const char ITEM_S_P_BIN; -extern const char ITEM_ST_I2N_BIN; +extern const char ITEM_P_BIN_FILE_PATH; +extern const char ITEM_S_P_BIN_FILE_PATH; +extern const char ITEM_ST_I2N_BIN_FORMAT; extern char* ITEM_LANG_FILE_ARRAY[]; extern void LoadFileFromRom(struct iovec* iov, const char* filepath, u32 flags); @@ -36,18 +36,18 @@ static void SprintfStatic__0200E990(char*, const char*, ...); void LoadItemPspi2n(void) { struct iovec iov; - LoadFileFromRom(&iov, &ITEM_P_BIN, 1); + LoadFileFromRom(&iov, &ITEM_P_BIN_FILE_PATH, 1); HandleSir0Translation(&ITEM_DATA_TABLE_PTRS.data, iov.iov_base); - LoadFileFromRom(&iov, &ITEM_S_P_BIN, 1); + LoadFileFromRom(&iov, &ITEM_S_P_BIN_FILE_PATH, 1); HandleSir0Translation(&ITEM_DATA_TABLE_PTRS.exclusive_data, iov.iov_base); if (PointsToZero(&ITEM_DATA_TABLE_PTRS.langFile) != 0) { ZInit8(&ITEM_DATA_TABLE_PTRS.langFile); #ifdef EUROPE char buf[256]; - SprintfStatic__0200E990(buf, &ITEM_ST_I2N_BIN, ITEM_LANG_FILE_ARRAY[GetLanguage()]); + SprintfStatic__0200E990(buf, &ITEM_ST_I2N_BIN_FORMAT, ITEM_LANG_FILE_ARRAY[GetLanguage()]); LoadFileFromRom(&ITEM_DATA_TABLE_PTRS.langFile, buf, 1); #else - LoadFileFromRom(&ITEM_DATA_TABLE_PTRS.langFile, &ITEM_ST_I2N_BIN, 1); + LoadFileFromRom(&ITEM_DATA_TABLE_PTRS.langFile, &ITEM_ST_I2N_BIN_FORMAT, 1); #endif } } diff --git a/tools/sync_pmdsky_debug/pmdsky_debug_reader.py b/tools/sync_pmdsky_debug/pmdsky_debug_reader.py index 1193827d..5415b7cf 100644 --- a/tools/sync_pmdsky_debug/pmdsky_debug_reader.py +++ b/tools/sync_pmdsky_debug/pmdsky_debug_reader.py @@ -3,7 +3,7 @@ import yaml from typing import Dict, List from containing_folder import CONTAINING_FOLDER -from symbol_details import SymbolDetails +from symbol_details import ALWAYS_APPEND_ADDRESS_SYMBOLS, IGNORE_DUPLICATE_SYMBOLS, SymbolDetails SYMBOLS_FOLDER = 'symbols' pmdsky_debug_path = None @@ -22,6 +22,9 @@ PMDSKY_DEBUG_SYMBOL_BLACKLIST = set([ 'MEMORY_ALLOCATION_TABLE' ]) +def format_symbol_with_address(symbol_name, address): + return f'{symbol_name}__{address:08X}' + """ Returns the file path where pmdsky-debug is located locally, defined within pmdsky_debug_location.txt. """ @@ -90,17 +93,22 @@ def read_pmdsky_debug_symbols() -> Dict[str, Dict[str, Dict[int, SymbolDetails]] aliases = [] def add_symbol_address(address: int, symbol_details: SymbolDetails): - if address in symbols: + if address in symbols and symbol_details.name not in IGNORE_DUPLICATE_SYMBOLS: print(f'Warning: Duplicate symbols found for address {hex(address)}: {symbols[address].name}, {symbol_details.name}') symbols[address] = symbol_details + # If the symbol has multiple addresses in pmdsky-debug, append the address to the symbol name to ensure + # that each instance of the symbol has a unique name within the decomp. if isinstance(addresses, list): if len(addresses) > 1: for address in addresses: - aliases = [f'{alias}__{address:08X}' for alias in aliases] - add_symbol_address(address, SymbolDetails(f'{symbol_name}__{address:08X}', full_file_path, is_data, aliases)) + aliases = [format_symbol_with_address(alias, address) for alias in aliases] + add_symbol_address(address, SymbolDetails(format_symbol_with_address(symbol_name, address), full_file_path, is_data, aliases)) else: add_symbol_address(addresses[0], SymbolDetails(symbol_name, full_file_path, is_data, aliases)) + elif symbol_name in ALWAYS_APPEND_ADDRESS_SYMBOLS: + aliases = [format_symbol_with_address(alias, address) for alias in aliases] + add_symbol_address(addresses, SymbolDetails(format_symbol_with_address(symbol_name, address), full_file_path, is_data, aliases)) else: add_symbol_address(addresses, SymbolDetails(symbol_name, full_file_path, is_data, aliases)) diff --git a/tools/sync_pmdsky_debug/symbol_details.py b/tools/sync_pmdsky_debug/symbol_details.py index 8553b92a..8decfafb 100644 --- a/tools/sync_pmdsky_debug/symbol_details.py +++ b/tools/sync_pmdsky_debug/symbol_details.py @@ -116,6 +116,18 @@ XMAP_TO_PMDSKY_DEBUG_SYMBOL_MAPPING = { 'sPositionZero': 'POSITION_ZERO', } +# These symbols intentionally have the same address as another symbol in pmdsky-debug. Don't display warnings for them. +IGNORE_DUPLICATE_SYMBOLS = set([ + 'GUEST_MONSTER_DATA', + 'GUEST_MONSTER_BANETTE', +]) + +# Symbols to always append the address onto. +# Used for symbols that are part of multiple overlays, making it harder to detect whether there are multiple symbols with the same name. +ALWAYS_APPEND_ADDRESS_SYMBOLS = set([ + 'SprintfStatic', +]) + PMDSKY_DEBUG_TO_XMAP_SYMBOL_MAPPING = {pmdsky_debug_name: xmap_name for xmap_name, pmdsky_debug_name in XMAP_TO_PMDSKY_DEBUG_SYMBOL_MAPPING.items()} @dataclass From b7e554692c1953f2cea5a804bb172c344b002332 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Sat, 31 Jan 2026 22:26:26 -0500 Subject: [PATCH 2/3] Decomped fleeing outlaw teleport logic --- asm/include/overlay_29_022F59C4.inc | 2 +- asm/include/overlay_29_022FB678.inc | 10 +- asm/include/overlay_29_022FBA70.inc | 2 + asm/include/overlay_29_022FBB1C.inc | 4 +- asm/include/overlay_29_022FBC4C.inc | 5 + asm/include/overlay_29_0231A8A0.inc | 2 +- ...9_0231AF24.inc => overlay_29_0231AFB4.inc} | 8 +- asm/include/overlay_29_0231CBEC.inc | 2 +- asm/include/overlay_29_02346834.inc | 2 +- asm/include/overlay_29_023498A0.inc | 71 +- asm/include/overlay_29_0234AEE8.inc | 50 + asm/overlay_29_022F59C4.s | 2 +- asm/overlay_29_022FB678.s | 90 -- asm/overlay_29_022FBA70.s | 42 + asm/overlay_29_022FBB1C.s | 183 --- asm/overlay_29_022FBC4C.s | 151 +++ asm/overlay_29_0231A8A0.s | 2 +- ...ay_29_0231AF24.s => overlay_29_0231AFB4.s} | 49 +- asm/overlay_29_0231CBEC.s | 2 +- asm/overlay_29_0232145C.s | 44 +- asm/overlay_29_02346834.s | 2 +- asm/overlay_29_023498A0.s | 1141 +---------------- asm/overlay_29_0234AEE8.s | 1114 ++++++++++++++++ include/overlay_29_022FBA54.h | 9 + include/overlay_29_022FBBEC.h | 8 + include/overlay_29_0234AEA4.h | 6 + include/special_move_types.h | 1 + main.lsf | 8 +- src/overlay_29_022FBA54.c | 23 + src/overlay_29_022FBBEC.c | 15 + src/overlay_29_0234AEA4.c | 12 + src/special_move_types.c | 23 + 32 files changed, 1530 insertions(+), 1555 deletions(-) create mode 100644 asm/include/overlay_29_022FBA70.inc create mode 100644 asm/include/overlay_29_022FBC4C.inc rename asm/include/{overlay_29_0231AF24.inc => overlay_29_0231AFB4.inc} (77%) create mode 100644 asm/include/overlay_29_0234AEE8.inc create mode 100644 asm/overlay_29_022FBA70.s create mode 100644 asm/overlay_29_022FBC4C.s rename asm/{overlay_29_0231AF24.s => overlay_29_0231AFB4.s} (76%) create mode 100644 asm/overlay_29_0234AEE8.s create mode 100644 include/overlay_29_022FBA54.h create mode 100644 include/overlay_29_022FBBEC.h create mode 100644 include/overlay_29_0234AEA4.h create mode 100644 src/overlay_29_022FBA54.c create mode 100644 src/overlay_29_022FBBEC.c create mode 100644 src/overlay_29_0234AEA4.c diff --git a/asm/include/overlay_29_022F59C4.inc b/asm/include/overlay_29_022F59C4.inc index 50732564..8a644447 100644 --- a/asm/include/overlay_29_022F59C4.inc +++ b/asm/include/overlay_29_022F59C4.inc @@ -41,7 +41,7 @@ .public ov29_023009CC .public ov29_02304AFC .public ov29_0231AE3C -.public ov29_0232145C +.public UseMove .public ov29_02322374 .public ov29_0233A248 .public ov29_02344544 diff --git a/asm/include/overlay_29_022FB678.inc b/asm/include/overlay_29_022FB678.inc index c1d564b1..4079ad09 100644 --- a/asm/include/overlay_29_022FB678.inc +++ b/asm/include/overlay_29_022FB678.inc @@ -1,9 +1,8 @@ #pragma once -.public _020A1870 .public Conversion2IsActive .public DIRECTIONS_XY -.public DisplayAnimatedNumbers .public DUNGEON_PTR +.public DisplayAnimatedNumbers .public EntityIsValid__022F7364 .public GetMaxPp .public GetMoveBasePp @@ -11,9 +10,10 @@ .public IqSkillIsEnabled .public IsMonster__022F9720 .public IsSecretBazaarNpcBehavior -.public ov29_022E576C -.public ov29_02307CE0 -.public ov29_02348100 .public TeamMemberHasEnabledIqSkill .public UpdateMapSurveyorFlag .public UpdateMinimap +.public _020A1870 +.public ov29_022E576C +.public ov29_02307CE0 +.public ov29_02348100 diff --git a/asm/include/overlay_29_022FBA70.inc b/asm/include/overlay_29_022FBA70.inc new file mode 100644 index 00000000..6d023311 --- /dev/null +++ b/asm/include/overlay_29_022FBA70.inc @@ -0,0 +1,2 @@ +#pragma once +.public IsMonster__022F9720 diff --git a/asm/include/overlay_29_022FBB1C.inc b/asm/include/overlay_29_022FBB1C.inc index b1dfd0e4..def7fd20 100644 --- a/asm/include/overlay_29_022FBB1C.inc +++ b/asm/include/overlay_29_022FBB1C.inc @@ -1,11 +1,9 @@ #pragma once .public DUNGEON_PTR .public EntityIsValid__022F7364 -.public GetBodySize .public GetIdleAnimationId .public GetTileSafe .public InitAnimationControlWithSet__0201C0CC -.public IsMonster__022F9720 +.public SetSpriteIdForAnimationControl .public ov29_022DDA54 .public ov29_02304830 -.public SetSpriteIdForAnimationControl diff --git a/asm/include/overlay_29_022FBC4C.inc b/asm/include/overlay_29_022FBC4C.inc new file mode 100644 index 00000000..c6491025 --- /dev/null +++ b/asm/include/overlay_29_022FBC4C.inc @@ -0,0 +1,5 @@ +#pragma once +.public DUNGEON_PTR +.public EntityIsValid__022F7364 +.public GetBodySize +.public IsMonster__022F9720 diff --git a/asm/include/overlay_29_0231A8A0.inc b/asm/include/overlay_29_0231A8A0.inc index 3802029f..7b8abb1f 100644 --- a/asm/include/overlay_29_0231A8A0.inc +++ b/asm/include/overlay_29_0231A8A0.inc @@ -7,7 +7,7 @@ .public IsMonster__0231A9D4 .public LogMessageByIdWithPopupCheckUser .public ov29_022FA574 -.public ov29_0232145C +.public UseMove .public ShouldUsePp .public TryActivateTruant .public UpdateMovePp diff --git a/asm/include/overlay_29_0231AF24.inc b/asm/include/overlay_29_0231AFB4.inc similarity index 77% rename from asm/include/overlay_29_0231AF24.inc rename to asm/include/overlay_29_0231AFB4.inc index e2eea2d4..f692c18c 100644 --- a/asm/include/overlay_29_0231AF24.inc +++ b/asm/include/overlay_29_0231AFB4.inc @@ -3,13 +3,9 @@ .public DUNGEON_PTR .public EntityIsValid__0231B194 .public GetTreasureBoxChances -.public IsMonster__0231A9D4 .public LogMessageByIdWithPopupCheckParticipants .public LogMessageByIdWithPopupCheckUserTarget -.public ov29_022E4110 -.public ov29_022FB9E0 -.public ov29_0232145C -.public ov29_0232E80C .public PrepareItemForPrinting__02345728 -.public SetActionUseMoveAi .public SubstitutePlaceholderStringTags +.public ov29_022E4110 +.public ov29_0232E80C diff --git a/asm/include/overlay_29_0231CBEC.inc b/asm/include/overlay_29_0231CBEC.inc index 30577492..6770d518 100644 --- a/asm/include/overlay_29_0231CBEC.inc +++ b/asm/include/overlay_29_0231CBEC.inc @@ -77,7 +77,7 @@ .public ov29_022F8830 .public ov29_022F9C34 .public ov29_022FA02C -.public ov29_022FBA54 +.public DoesMonsterHaveMove .public ov29_023009A0 .public ov29_023021F0 .public ov29_02339FF4 diff --git a/asm/include/overlay_29_02346834.inc b/asm/include/overlay_29_02346834.inc index e3c07edc..36be5d33 100644 --- a/asm/include/overlay_29_02346834.inc +++ b/asm/include/overlay_29_02346834.inc @@ -48,7 +48,7 @@ .public ov29_022EBB98 .public ov29_022FAFD4 .public ov29_022FB920 -.public ov29_022FBA54 +.public DoesMonsterHaveMove .public ov29_023009A0 .public ov29_023457C8 .public ov29_0234B4CC diff --git a/asm/include/overlay_29_023498A0.inc b/asm/include/overlay_29_023498A0.inc index 7f79ff9a..ca165cc6 100644 --- a/asm/include/overlay_29_023498A0.inc +++ b/asm/include/overlay_29_023498A0.inc @@ -1,16 +1,11 @@ #pragma once -.public AddMessageToAlertBox .public AdvanceFrame -.public AllowPortraitDefault -.public AnimationDelayOrSomething .public BAG_ITEMS_PTR_MIRROR .public CanSeeTarget .public ChangeDungeonMusic -.public CloseAlertBox -.public CreateAlertBox +.public DUNGEON_PTR .public DisplayMessage .public DisplayMessage2 -.public DUNGEON_PTR .public DungeonRandInt .public EndNegativeStatusConditionWrapper .public EntityIsValid__0234987C @@ -21,20 +16,17 @@ .public GetItemToDeliver .public GetItemToRetrieve .public GetLeader +.public GetMessageLogPreprocessorArgs .public GetMissionDestination .public GetMissionTargetEnemy .public GetMonsterGenderVeneer .public GetMonsterPreEvolution -.public GetName .public GetRandomSpawnMonsterID .public GetSecondFormIfValid -.public GetSize0x80Buffer .public GetSpecialTargetItem .public GetTargetMonsterNotFoundFlag .public HandleFaint -.public InitPortraitParams -.public InitPreprocessorArgs -.public IsAlertBoxActive +.public InitPortraitDungeon .public IsCastform .public IsCherrim .public IsCurrentMissionType @@ -45,67 +37,40 @@ .public IsExperienceLocked .public IsJirachiChallengeFloor .public ItemZInit -.public MemAlloc -.public MemFree -.public MemZero -.public MESSAGE_LOG_INFO +.public LogMessageById .public MusicTableIdxToMusicId -.public ov10_022BFD20 -.public ov29_022E0B60 -.public ov29_022E2CA0 +.public PositionIsOnStairs +.public PrepareItemForPrinting__02345728 +.public RemoveEmptyItemsInBagWrapper +.public RemoveGroundItem +.public SetDungeonEscapeFields +.public SetMessageLogPreprocessorArgsStringToName +.public SetPortraitLayout +.public SetPreprocessorArgsIdVal +.public SubstitutePlaceholderStringTags +.public YesNoMenu .public ov29_022E550C -.public ov29_022E68F0 .public ov29_022E8244 -.public ov29_022E9FC0 .public ov29_022EA428 .public ov29_022EAC8C .public ov29_022EACE4 .public ov29_022EAEFC .public ov29_022EAF34 -.public ov29_022F2FE4 .public ov29_022FA3D4 -.public ov29_022FBA54 -.public ov29_022FBBEC +.public FindMonsterWithBehavior .public ov29_023009CC .public ov29_02300B04 -.public ov29_0231AF24 -.public ov29_0233A248 .public ov29_02344B9C .public ov29_02348888 .public ov29_02348A18 .public ov29_023491B8 .public ov29_023496B0 +.public TeleportFleeingOutlaw +.public ov29_0234AEE8 +.public ov29_0234AF34 .public ov29_0234D630 .public ov29_0234D70C .public ov29_0234D838 .public ov29_0234D8A0 -.public ov29_02353214 .public ov29_023537C8 -.public ov29_0237C694 -.public PositionIsOnStairs -.public PrepareItemForPrinting__02345728 -.public PreprocessString -.public RemoveEmptyItemsInBagWrapper -.public RemoveGroundItem -.public SetDungeonEscapeFields -.public SetPortraitLayout -.public ShouldDisplayEntityWrapper -.public ShouldMonsterHeadToStairs -.public StringFromId -.public strlen -.public strncmp -.public strncpy -.public sub_02001808 .public sub_02017C10 -.public sub_0202836C -.public sub_02030214 -.public sub_02047FFC -.public sub_0204804C -.public sub_020480CC -.public sub_02048134 -.public sub_02048150 -.public sub_02048240 -.public sub_0204833C -.public sub_02048360 -.public SubstitutePlaceholderStringTags -.public YesNoMenu diff --git a/asm/include/overlay_29_0234AEE8.inc b/asm/include/overlay_29_0234AEE8.inc new file mode 100644 index 00000000..60f11632 --- /dev/null +++ b/asm/include/overlay_29_0234AEE8.inc @@ -0,0 +1,50 @@ +#pragma once +.public AddMessageToAlertBox +.public AdvanceFrame +.public AllowPortraitDefault +.public AnimationDelayOrSomething +.public ChangeDungeonMusic +.public CloseAlertBox +.public CreateAlertBox +.public DUNGEON_PTR +.public GetName +.public GetSize0x80Buffer +.public HandleFaint +.public InitPortraitParams +.public InitPreprocessorArgs +.public IsAlertBoxActive +.public MESSAGE_LOG_INFO +.public MemAlloc +.public MemFree +.public MemZero +.public MusicTableIdxToMusicId +.public PreprocessString +.public ShouldDisplayEntityWrapper +.public StringFromId +.public ov10_022BFD20 +.public ov29_022E0B60 +.public ov29_022E2CA0 +.public ov29_022E68F0 +.public ov29_022E9FC0 +.public ov29_022EA428 +.public ov29_022EAEFC +.public ov29_022EAF34 +.public ov29_022F2FE4 +.public ov29_0233A248 +.public ov29_02348A18 +.public ov29_02353214 +.public ov29_0237C694 +.public strlen +.public strncmp +.public strncpy +.public sub_02001808 +.public sub_0202836C +.public sub_02030214 +.public sub_02047FFC +.public sub_0204804C +.public sub_020480CC +.public sub_02048134 +.public sub_02048150 +.public sub_02048240 +.public sub_0204833C +.public sub_02048360 diff --git a/asm/overlay_29_022F59C4.s b/asm/overlay_29_022F59C4.s index e2874ccc..7f29bb65 100644 --- a/asm/overlay_29_022F59C4.s +++ b/asm/overlay_29_022F59C4.s @@ -529,7 +529,7 @@ _022F5F9C: ldrb r1, [r8, #0x54] mov r2, r4 mov r3, r5 - bl ov29_0232145C + bl UseMove bl IsFloorOver cmp r0, #0 ldreqb r0, [r8, #0x23e + OV29_022F5F18_OFFSET] diff --git a/asm/overlay_29_022FB678.s b/asm/overlay_29_022FB678.s index a4269d19..be8960ce 100644 --- a/asm/overlay_29_022FB678.s +++ b/asm/overlay_29_022FB678.s @@ -311,93 +311,3 @@ ov29_022FB9BC: ; 0x022FB9BC and r0, r0, #0xff ldmia sp!, {r3, pc} arm_func_end ov29_022FB9BC - - arm_func_start ov29_022FB9E0 -ov29_022FB9E0: ; 0x022FB9E0 - stmdb sp!, {r3, r4, r5, lr} - mov r5, r0 - mov r4, r1 - bl IsMonster__022F9720 - cmp r0, #0 - beq _022FBA4C - ldr r1, [r5, #0xb4] - mov r0, #0 -#ifdef JAPAN - add ip, r1, #0x120 -#else - add ip, r1, #0x124 -#endif - mov r2, r0 - mov r3, #1 - b _022FBA44 -_022FBA10: - ldrb r1, [ip, r0, lsl #3] - add lr, ip, r0, lsl #3 - tst r1, #1 - movne r1, r3 - moveq r1, r2 - tst r1, #0xff - beq _022FBA38 - ldrh r1, [lr, #4] - cmp r1, r4 - ldmeqia sp!, {r3, r4, r5, pc} -_022FBA38: - add r0, r0, #1 - mov r0, r0, lsl #0x10 - mov r0, r0, asr #0x10 -_022FBA44: - cmp r0, #4 - blt _022FBA10 -_022FBA4C: - mvn r0, #0 - ldmia sp!, {r3, r4, r5, pc} - arm_func_end ov29_022FB9E0 - - arm_func_start ov29_022FBA54 -ov29_022FBA54: ; 0x022FBA54 - stmdb sp!, {r3, lr} - bl ov29_022FB9E0 - cmp r0, #0 - movge r0, #1 - movlt r0, #0 - and r0, r0, #0xff - ldmia sp!, {r3, pc} - arm_func_end ov29_022FBA54 - - arm_func_start IsSpecialStoryAllyOrClient -IsSpecialStoryAllyOrClient: ; 0x022FBA70 - stmdb sp!, {r4, lr} - mov r4, r0 - bl IsMonster__022F9720 - cmp r0, #0 - beq _022FBAAC - ldr r0, [r4, #0xb4] - ldrb r0, [r0, #0x48] - cmp r0, #0xfa - moveq r0, #1 - ldmeqia sp!, {r4, pc} - cmp r0, #0xd9 - blo _022FBAAC - cmp r0, #0xe4 - movlo r0, #1 - ldmloia sp!, {r4, pc} -_022FBAAC: - mov r0, #0 - ldmia sp!, {r4, pc} - arm_func_end IsSpecialStoryAllyOrClient - - arm_func_start ResetTriggerFlags -ResetTriggerFlags: ; 0x022FBAB4 - ldr r2, [r0, #0xb4] - cmp r2, #0 - addne r0, r2, #0x100 - movne r1, #0 -#ifdef JAPAN - strneh r1, [r0, #0x8e] - strne r1, [r2, #0x188] -#else - strneh r1, [r0, #0x92] - strne r1, [r2, #0x18c] -#endif - bx lr - arm_func_end ResetTriggerFlags diff --git a/asm/overlay_29_022FBA70.s b/asm/overlay_29_022FBA70.s new file mode 100644 index 00000000..549fb7eb --- /dev/null +++ b/asm/overlay_29_022FBA70.s @@ -0,0 +1,42 @@ + .include "asm/macros.inc" + .include "overlay_29_022FBA70.inc" + + .text + + arm_func_start IsSpecialStoryAllyOrClient +IsSpecialStoryAllyOrClient: ; 0x022FBA70 + stmdb sp!, {r4, lr} + mov r4, r0 + bl IsMonster__022F9720 + cmp r0, #0 + beq _022FBAAC + ldr r0, [r4, #0xb4] + ldrb r0, [r0, #0x48] + cmp r0, #0xfa + moveq r0, #1 + ldmeqia sp!, {r4, pc} + cmp r0, #0xd9 + blo _022FBAAC + cmp r0, #0xe4 + movlo r0, #1 + ldmloia sp!, {r4, pc} +_022FBAAC: + mov r0, #0 + ldmia sp!, {r4, pc} + arm_func_end IsSpecialStoryAllyOrClient + + arm_func_start ResetTriggerFlags +ResetTriggerFlags: ; 0x022FBAB4 + ldr r2, [r0, #0xb4] + cmp r2, #0 + addne r0, r2, #0x100 + movne r1, #0 +#ifdef JAPAN + strneh r1, [r0, #0x8e] + strne r1, [r2, #0x188] +#else + strneh r1, [r0, #0x92] + strne r1, [r2, #0x18c] +#endif + bx lr + arm_func_end ResetTriggerFlags diff --git a/asm/overlay_29_022FBB1C.s b/asm/overlay_29_022FBB1C.s index f12e7af9..97693b46 100644 --- a/asm/overlay_29_022FBB1C.s +++ b/asm/overlay_29_022FBB1C.s @@ -81,186 +81,3 @@ _022FBBE4: .word DUNGEON_PTR _022FBBE8: .word 0x00019914 #endif arm_func_end ov29_022FBB1C - - arm_func_start ov29_022FBBEC -ov29_022FBBEC: ; 0x022FBBEC - stmdb sp!, {r3, r4, r5, r6, r7, lr} - mov r5, r0 - mov r4, #0 - ldr r6, _022FBC48 ; =DUNGEON_PTR - b _022FBC38 -_022FBC00: - ldr r0, [r6] - add r0, r0, r4, lsl #2 - add r0, r0, #0x12000 -#ifdef JAPAN - ldr r7, [r0, #0xad4] -#else - ldr r7, [r0, #0xb78] -#endif - mov r0, r7 - bl EntityIsValid__022F7364 - cmp r0, #0 - beq _022FBC34 - ldr r0, [r7, #0xb4] - ldrb r0, [r0, #0xbc] - cmp r5, r0 - moveq r0, r7 - ldmeqia sp!, {r3, r4, r5, r6, r7, pc} -_022FBC34: - add r4, r4, #1 -_022FBC38: - cmp r4, #0x14 - blt _022FBC00 - mov r0, #0 - ldmia sp!, {r3, r4, r5, r6, r7, pc} - .align 2, 0 -_022FBC48: .word DUNGEON_PTR - arm_func_end ov29_022FBBEC - - arm_func_start ov29_022FBC4C -ov29_022FBC4C: ; 0x022FBC4C - stmdb sp!, {r3, r4, r5, lr} - mov r5, #0 - ldr r4, _022FBC90 ; =DUNGEON_PTR - b _022FBC80 -_022FBC5C: - ldr r0, [r4] - add r0, r0, r5, lsl #2 - add r0, r0, #0x12000 -#ifdef JAPAN - ldr r0, [r0, #0xa84] -#else - ldr r0, [r0, #0xb28] -#endif - bl EntityIsValid__022F7364 - cmp r0, #0 - moveq r0, #1 - ldmeqia sp!, {r3, r4, r5, pc} - add r5, r5, #1 -_022FBC80: - cmp r5, #4 - blt _022FBC5C - mov r0, #0 - ldmia sp!, {r3, r4, r5, pc} - .align 2, 0 -_022FBC90: .word DUNGEON_PTR - arm_func_end ov29_022FBC4C - - arm_func_start ov29_022FBC94 -ov29_022FBC94: ; 0x022FBC94 - stmdb sp!, {r4, r5, r6, lr} - bl GetBodySize - ldr r6, _022FBD04 ; =DUNGEON_PTR - mov r4, r0 - mov r5, #0 -_022FBCA8: - ldr r0, [r6] - add r0, r0, r5, lsl #2 - add r0, r0, #0x12000 -#ifdef JAPAN - ldr r0, [r0, #0xa84] -#else - ldr r0, [r0, #0xb28] -#endif - bl EntityIsValid__022F7364 - cmp r0, #0 - beq _022FBCE4 - ldr r0, [r6] - 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] - ldrsh r0, [r0, #2] - bl GetBodySize - add r4, r4, r0 -_022FBCE4: - add r5, r5, #1 - cmp r5, #4 - blt _022FBCA8 - cmp r4, #6 - movle r0, #1 - movgt r0, #0 - and r0, r0, #0xff - ldmia sp!, {r4, r5, r6, pc} - .align 2, 0 -_022FBD04: .word DUNGEON_PTR - arm_func_end ov29_022FBC94 - -#ifndef JAPAN - arm_func_start ov29_022FBD08 -ov29_022FBD08: ; 0x022FBD08 - ldr r0, _022FBD20 ; =DUNGEON_PTR - mov r1, #0 - ldr r0, [r0] - add r0, r0, #0x3000 - str r1, [r0, #0xe1c] - bx lr - .align 2, 0 -_022FBD20: .word DUNGEON_PTR - arm_func_end ov29_022FBD08 - - arm_func_start ov29_022FBD24 -ov29_022FBD24: ; 0x022FBD24 - stmdb sp!, {r4, lr} - mov r4, r0 - bl IsMonster__022F9720 - cmp r0, #0 - moveq r0, #0 - ldmeqia sp!, {r4, pc} - ldr r0, _022FBD7C ; =DUNGEON_PTR - ldr r0, [r0] - add r0, r0, #0x1cc - add r3, r0, #0x3c00 - ldr r2, [r3, #0x50] - cmp r2, #0x14 - moveq r0, #0 - ldmeqia sp!, {r4, pc} - ldr r1, [r4, #0xb4] - mov r0, #1 - ldr r1, [r1, #0xb0] - str r1, [r3, r2, lsl #2] - ldr r1, [r3, #0x50] - add r1, r1, #1 - str r1, [r3, #0x50] - ldmia sp!, {r4, pc} - .align 2, 0 -_022FBD7C: .word DUNGEON_PTR - arm_func_end ov29_022FBD24 - - arm_func_start ov29_022FBD80 -ov29_022FBD80: ; 0x022FBD80 - stmdb sp!, {r4, lr} - mov r4, r0 - bl IsMonster__022F9720 - cmp r0, #0 - beq _022FBDD4 - ldr r0, _022FBDDC ; =DUNGEON_PTR - ldr r1, [r4, #0xb4] - ldr r0, [r0] - ldr r2, [r1, #0xb0] - add r0, r0, #0x1cc - add r1, r0, #0x3c00 - ldr ip, [r1, #0x50] - mov r3, #0 - b _022FBDCC -_022FBDB8: - ldr r0, [r1, r3, lsl #2] - cmp r2, r0 - moveq r0, #1 - ldmeqia sp!, {r4, pc} - add r3, r3, #1 -_022FBDCC: - cmp r3, ip - blt _022FBDB8 -_022FBDD4: - mov r0, #0 - ldmia sp!, {r4, pc} - .align 2, 0 -_022FBDDC: .word DUNGEON_PTR - arm_func_end ov29_022FBD80 -#endif diff --git a/asm/overlay_29_022FBC4C.s b/asm/overlay_29_022FBC4C.s new file mode 100644 index 00000000..4bd76200 --- /dev/null +++ b/asm/overlay_29_022FBC4C.s @@ -0,0 +1,151 @@ + .include "asm/macros.inc" + .include "overlay_29_022FBC4C.inc" + + .text + + arm_func_start ov29_022FBC4C +ov29_022FBC4C: ; 0x022FBC4C + stmdb sp!, {r3, r4, r5, lr} + mov r5, #0 + ldr r4, _022FBC90 ; =DUNGEON_PTR + b _022FBC80 +_022FBC5C: + ldr r0, [r4] + add r0, r0, r5, lsl #2 + add r0, r0, #0x12000 +#ifdef JAPAN + ldr r0, [r0, #0xa84] +#else + ldr r0, [r0, #0xb28] +#endif + bl EntityIsValid__022F7364 + cmp r0, #0 + moveq r0, #1 + ldmeqia sp!, {r3, r4, r5, pc} + add r5, r5, #1 +_022FBC80: + cmp r5, #4 + blt _022FBC5C + mov r0, #0 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_022FBC90: .word DUNGEON_PTR + arm_func_end ov29_022FBC4C + + arm_func_start ov29_022FBC94 +ov29_022FBC94: ; 0x022FBC94 + stmdb sp!, {r4, r5, r6, lr} + bl GetBodySize + ldr r6, _022FBD04 ; =DUNGEON_PTR + mov r4, r0 + mov r5, #0 +_022FBCA8: + ldr r0, [r6] + add r0, r0, r5, lsl #2 + add r0, r0, #0x12000 +#ifdef JAPAN + ldr r0, [r0, #0xa84] +#else + ldr r0, [r0, #0xb28] +#endif + bl EntityIsValid__022F7364 + cmp r0, #0 + beq _022FBCE4 + ldr r0, [r6] + 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] + ldrsh r0, [r0, #2] + bl GetBodySize + add r4, r4, r0 +_022FBCE4: + add r5, r5, #1 + cmp r5, #4 + blt _022FBCA8 + cmp r4, #6 + movle r0, #1 + movgt r0, #0 + and r0, r0, #0xff + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_022FBD04: .word DUNGEON_PTR + arm_func_end ov29_022FBC94 + +#ifndef JAPAN + arm_func_start ov29_022FBD08 +ov29_022FBD08: ; 0x022FBD08 + ldr r0, _022FBD20 ; =DUNGEON_PTR + mov r1, #0 + ldr r0, [r0] + add r0, r0, #0x3000 + str r1, [r0, #0xe1c] + bx lr + .align 2, 0 +_022FBD20: .word DUNGEON_PTR + arm_func_end ov29_022FBD08 + + arm_func_start ov29_022FBD24 +ov29_022FBD24: ; 0x022FBD24 + stmdb sp!, {r4, lr} + mov r4, r0 + bl IsMonster__022F9720 + cmp r0, #0 + moveq r0, #0 + ldmeqia sp!, {r4, pc} + ldr r0, _022FBD7C ; =DUNGEON_PTR + ldr r0, [r0] + add r0, r0, #0x1cc + add r3, r0, #0x3c00 + ldr r2, [r3, #0x50] + cmp r2, #0x14 + moveq r0, #0 + ldmeqia sp!, {r4, pc} + ldr r1, [r4, #0xb4] + mov r0, #1 + ldr r1, [r1, #0xb0] + str r1, [r3, r2, lsl #2] + ldr r1, [r3, #0x50] + add r1, r1, #1 + str r1, [r3, #0x50] + ldmia sp!, {r4, pc} + .align 2, 0 +_022FBD7C: .word DUNGEON_PTR + arm_func_end ov29_022FBD24 + + arm_func_start ov29_022FBD80 +ov29_022FBD80: ; 0x022FBD80 + stmdb sp!, {r4, lr} + mov r4, r0 + bl IsMonster__022F9720 + cmp r0, #0 + beq _022FBDD4 + ldr r0, _022FBDDC ; =DUNGEON_PTR + ldr r1, [r4, #0xb4] + ldr r0, [r0] + ldr r2, [r1, #0xb0] + add r0, r0, #0x1cc + add r1, r0, #0x3c00 + ldr ip, [r1, #0x50] + mov r3, #0 + b _022FBDCC +_022FBDB8: + ldr r0, [r1, r3, lsl #2] + cmp r2, r0 + moveq r0, #1 + ldmeqia sp!, {r4, pc} + add r3, r3, #1 +_022FBDCC: + cmp r3, ip + blt _022FBDB8 +_022FBDD4: + mov r0, #0 + ldmia sp!, {r4, pc} + .align 2, 0 +_022FBDDC: .word DUNGEON_PTR + arm_func_end ov29_022FBD80 +#endif diff --git a/asm/overlay_29_0231A8A0.s b/asm/overlay_29_0231A8A0.s index 56fae257..32be0b00 100644 --- a/asm/overlay_29_0231A8A0.s +++ b/asm/overlay_29_0231A8A0.s @@ -56,7 +56,7 @@ _0231A924: ldrb r1, [r8, #0x4e] mov r2, r4 mov r3, r5 - bl ov29_0232145C + bl UseMove mov r0, sb bl EntityIsValid__02319F8C cmp r0, #0 diff --git a/asm/overlay_29_0231AF24.s b/asm/overlay_29_0231AFB4.s similarity index 76% rename from asm/overlay_29_0231AF24.s rename to asm/overlay_29_0231AFB4.s index c67426c8..15f0e00e 100644 --- a/asm/overlay_29_0231AF24.s +++ b/asm/overlay_29_0231AFB4.s @@ -1,55 +1,8 @@ .include "asm/macros.inc" - .include "overlay_29_0231AF24.inc" + .include "overlay_29_0231AFB4.inc" .text - arm_func_start ov29_0231AF24 -ov29_0231AF24: ; 0x0231AF24 -#ifdef JAPAN -#define OV29_0231AF24_OFFSET -4 -#else -#define OV29_0231AF24_OFFSET 0 -#endif - stmdb sp!, {r3, r4, r5, r6, lr} - sub sp, sp, #4 - mov r6, r0 - mov r5, r1 - mov r4, r2 - bl IsMonster__0231A9D4 - cmp r0, #0 - beq _0231AFAC - mov r0, r6 - mov r1, r5 - bl ov29_022FB9E0 - mov r1, r0 - cmp r4, #0 - beq _0231AF98 - cmp r1, #0 - bge _0231AF98 - ldr r4, [r6, #0xb4] - mov r1, #0 - mov r2, r1 - add r0, r4, #0x4a - bl SetActionUseMoveAi - mov r2, #1 - strb r2, [r4, #0x124 + OV29_0231AF24_OFFSET] - add r0, r4, #0x100 - mov r1, #0 - strh r1, [r0, #0x26 + OV29_0231AF24_OFFSET] - strh r5, [r0, #0x28 + OV29_0231AF24_OFFSET] - strb r2, [r4, #0x12a + OV29_0231AF24_OFFSET] - strb r1, [r4, #0x12b + OV29_0231AF24_OFFSET] -_0231AF98: - mov r3, #0 - mov r0, r6 - mov r2, #1 - str r3, [sp] - bl ov29_0232145C -_0231AFAC: - add sp, sp, #4 - ldmia sp!, {r3, r4, r5, r6, pc} - arm_func_end ov29_0231AF24 - arm_func_start ov29_0231AFB4 ov29_0231AFB4: ; 0x0231AFB4 stmdb sp!, {r4, lr} diff --git a/asm/overlay_29_0231CBEC.s b/asm/overlay_29_0231CBEC.s index db105c60..6196941b 100644 --- a/asm/overlay_29_0231CBEC.s +++ b/asm/overlay_29_0231CBEC.s @@ -1235,7 +1235,7 @@ _0231DAF8: mov r6, r0 mov r0, r7 mov r1, r5 - bl ov29_022FBA54 + bl DoesMonsterHaveMove cmp r0, #0 mov r0, r7 movne r6, #0 diff --git a/asm/overlay_29_0232145C.s b/asm/overlay_29_0232145C.s index f30ffef7..5eb237b9 100644 --- a/asm/overlay_29_0232145C.s +++ b/asm/overlay_29_0232145C.s @@ -3,12 +3,12 @@ .text - arm_func_start ov29_0232145C -ov29_0232145C: ; 0x0232145C + arm_func_start UseMove +UseMove: ; 0x0232145C #ifdef JAPAN -#define OV29_0232145C_OFFSET -4 +#define USE_MOVE_OFFSET -4 #else -#define OV29_0232145C_OFFSET 0 +#define USE_MOVE_OFFSET 0 #endif stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} sub sp, sp, #0x34 @@ -24,7 +24,7 @@ ov29_0232145C: ; 0x0232145C bge _02321A40 bl ResetTriggerFlags mov r0, #0 - strb r0, [r5, #0x163 + OV29_0232145C_OFFSET] + strb r0, [r5, #0x163 + USE_MOVE_OFFSET] ldrb r1, [r5, #0xd0] cmp r1, #1 bne _023214C4 @@ -69,7 +69,7 @@ _0232152C: add r1, r5, r0, lsl #1 add r1, r1, #0x100 add r0, r0, #1 - strh r2, [r1, #0x94 + OV29_0232145C_OFFSET] + strh r2, [r1, #0x94 + USE_MOVE_OFFSET] cmp r0, #4 blt _0232152C mov r1, r2 @@ -80,7 +80,7 @@ _0232154C: add r2, r2, #1 bge _02321578 add r0, r5, r4, lsl #3 - ldrb r0, [r0, #0x124 + OV29_0232145C_OFFSET] + ldrb r0, [r0, #0x124 + USE_MOVE_OFFSET] tst r0, #2 beq _02321578 add r1, r1, #1 @@ -92,7 +92,7 @@ _02321578: movge r6, #1 movlt r6, #0 _02321584: - add r1, r5, #0x124 + OV29_0232145C_OFFSET + add r1, r5, #0x124 + USE_MOVE_OFFSET mov r0, sl add r4, r1, sb, lsl #3 bl EntityIsValid__02321438 @@ -183,7 +183,7 @@ _023216AC: mov r0, #0 str r0, [sp, #0x10] ldr r0, [r1, #0x18] - strb fp, [r5, #0x163 + OV29_0232145C_OFFSET] + strb fp, [r5, #0x163 + USE_MOVE_OFFSET] ldrh r1, [r4, #4] str r0, [sp, #0xc] cmp r1, #0xe5 @@ -306,7 +306,7 @@ _02321848: cmp sb, #4 bge _02321888 add r0, r5, sb, lsl #3 - ldrb r0, [r0, #0x124 + OV29_0232145C_OFFSET] + ldrb r0, [r0, #0x124 + USE_MOVE_OFFSET] tst r0, #2 bne _02321584 _02321888: @@ -318,10 +318,10 @@ _02321888: _0232189C: add r0, r5, sb, lsl #1 add r0, r0, #0x100 - ldrh r1, [r0, #0x94 + OV29_0232145C_OFFSET] + ldrh r1, [r0, #0x94 + USE_MOVE_OFFSET] cmp r1, #0 beq _02321994 - ldrh r1, [r0, #0x94 + OV29_0232145C_OFFSET] + ldrh r1, [r0, #0x94 + USE_MOVE_OFFSET] add r4, sp, #0x24 mov r0, r4 bl InitMoveCheckId @@ -445,13 +445,13 @@ _02321A40: ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc} .align 2, 0 #ifdef JAPAN -#define OV29_0232145C_DATA_OFFSET -0x2BE +#define UseMove_DATA_OFFSET -0x2BE #else -#define OV29_0232145C_DATA_OFFSET 0 +#define UseMove_DATA_OFFSET 0 #endif -_02321A48: .word 0x00000E7C + OV29_0232145C_DATA_OFFSET -_02321A4C: .word 0x00000E7D + OV29_0232145C_DATA_OFFSET -_02321A50: .word 0x00000E78 + OV29_0232145C_DATA_OFFSET +_02321A48: .word 0x00000E7C + UseMove_DATA_OFFSET +_02321A4C: .word 0x00000E7D + UseMove_DATA_OFFSET +_02321A50: .word 0x00000E78 + UseMove_DATA_OFFSET _02321A54: .word ov29_0237CA68 #ifdef JAPAN _02321A5C: .word 0x00000BC1 @@ -460,13 +460,13 @@ _02322F08: .word 0x00000BC2 _02321A58: .word 0x00000E7E _02321A5C: .word 0x00000E7F #endif -_02321A60: .word 0x00000E81 + OV29_0232145C_DATA_OFFSET -_02321A64: .word 0x00000E79 + OV29_0232145C_DATA_OFFSET +_02321A60: .word 0x00000E81 + UseMove_DATA_OFFSET +_02321A64: .word 0x00000E79 + UseMove_DATA_OFFSET _02321A68: .word 0x000001D1 -_02321A6C: .word 0x00000E76 + OV29_0232145C_DATA_OFFSET -_02321A70: .word 0x00000E77 + OV29_0232145C_DATA_OFFSET +_02321A6C: .word 0x00000E76 + UseMove_DATA_OFFSET +_02321A70: .word 0x00000E77 + UseMove_DATA_OFFSET _02321A74: .word ov10_022C4714 - arm_func_end ov29_0232145C + arm_func_end UseMove arm_func_start TryActivateNondamagingDefenderAbility TryActivateNondamagingDefenderAbility: ; 0x02321A78 diff --git a/asm/overlay_29_02346834.s b/asm/overlay_29_02346834.s index a69c3979..a0fba8d0 100644 --- a/asm/overlay_29_02346834.s +++ b/asm/overlay_29_02346834.s @@ -121,7 +121,7 @@ _0234694C: movne sb, r6 mov r0, sl mov r1, r8 - bl ov29_022FBA54 + bl DoesMonsterHaveMove cmp r0, #0 movne sb, r5 mov r0, sl diff --git a/asm/overlay_29_023498A0.s b/asm/overlay_29_023498A0.s index 737bd9e6..9e6418c2 100644 --- a/asm/overlay_29_023498A0.s +++ b/asm/overlay_29_023498A0.s @@ -483,7 +483,7 @@ _02349E6C: b _0234A1D4 _02349F1C: mov r0, #4 - bl ov29_022FBBEC + bl FindMonsterWithBehavior add r0, r0, #4 bl ov29_022FA3D4 mov r0, #1 @@ -1688,13 +1688,13 @@ _0234ADF0: cmp r0, #2 bne _0234AE0C mov r0, #3 - bl ov29_022FBBEC + bl FindMonsterWithBehavior add r0, r0, #4 bl ov29_022FA3D4 b _0234AE1C _0234AE0C: mov r0, #1 - bl ov29_022FBBEC + bl FindMonsterWithBehavior add r0, r0, #4 bl ov29_022FA3D4 _0234AE1C: @@ -1734,7 +1734,7 @@ ov29_0234AE40: ; 0x0234AE40 add r0, sp, #0 mov r2, #1 bl DisplayMessage - ldr r1, _0234AE9C ; =ov29_0234AEA4 + ldr r1, _0234AE9C ; =TeleportFleeingOutlaw ldr r0, _0234AEA0 ; =ov29_023537C8 str r1, [r0] add sp, sp, #0x10 @@ -1745,1137 +1745,6 @@ _0234AE98: .word 0x00000B47 #else _0234AE98: .word 0x00000E06 #endif -_0234AE9C: .word ov29_0234AEA4 +_0234AE9C: .word TeleportFleeingOutlaw _0234AEA0: .word ov29_023537C8 arm_func_end ov29_0234AE40 - - arm_func_start ov29_0234AEA4 -ov29_0234AEA4: ; 0x0234AEA4 - stmdb sp!, {r4, lr} - mov r0, #3 - bl ov29_022FBBEC - mov r4, r0 - bl ShouldMonsterHeadToStairs - cmp r0, #0 - ldmneia sp!, {r4, pc} - mov r0, r4 - mov r1, #0xbb - bl ov29_022FBA54 - cmp r0, #0 - ldmeqia sp!, {r4, pc} - mov r0, r4 - mov r1, #0xbb - mov r2, #0 - bl ov29_0231AF24 - ldmia sp!, {r4, pc} - arm_func_end ov29_0234AEA4 - - arm_func_start ov29_0234AEE8 -ov29_0234AEE8: ; 0x0234AEE8 - stmdb sp!, {r3, lr} - ldr r0, _0234AF30 ; =DUNGEON_PTR - ldr r0, [r0] - ldrb r0, [r0, #0x790] - cmp r0, #0 - bne _0234AF24 - bl ov29_022EAEFC - cmp r0, #0 - beq _0234AF24 - ldr r0, _0234AF30 ; =DUNGEON_PTR - ldr r0, [r0] - add r0, r0, #0x4000 -#ifdef JAPAN - ldrsh r0, [r0, #0x32] -#else - ldrsh r0, [r0, #0xd6] -#endif - bl MusicTableIdxToMusicId - bl ChangeDungeonMusic -_0234AF24: - mov r0, #0 - bl ov29_022EAF34 - ldmia sp!, {r3, pc} - .align 2, 0 -_0234AF30: .word DUNGEON_PTR - arm_func_end ov29_0234AEE8 - - arm_func_start ov29_0234AF34 -ov29_0234AF34: ; 0x0234AF34 - stmdb sp!, {r4, r5, r6, lr} - mov r6, r0 - ldrb ip, [r2] - ldr r2, [r6, #0xb4] - mov r5, r1 - mov r4, r3 - strb ip, [r2, #0x48] - bl ov29_022E68F0 - cmp r5, #0 - beq _0234AF64 - mov r0, r5 - bl ov29_022E68F0 -_0234AF64: - ldr r1, _0234AFA0 ; =0x0000025B - mov r0, r6 - mov r2, #0 - bl HandleFaint - cmp r5, #0 - beq _0234AF8C - ldr r1, _0234AFA0 ; =0x0000025B - mov r0, r5 - mov r2, #0 - bl HandleFaint -_0234AF8C: - mov r0, #1 - bl AnimationDelayOrSomething - mov r0, r4 - bl ov29_02348A18 - ldmia sp!, {r4, r5, r6, pc} - .align 2, 0 -_0234AFA0: .word 0x0000025B - arm_func_end ov29_0234AF34 - - arm_func_start InitAlertBoxInfo -InitAlertBoxInfo: ; 0x0234AFA4 - stmdb sp!, {r3, lr} - mov r0, #0xcf0 - mov r1, #0 - bl MemAlloc - ldr r2, _0234AFCC ; =MESSAGE_LOG_INFO - mov r1, #0xcf0 - str r0, [r2, #4] - bl MemZero - bl ov29_0234B130 - ldmia sp!, {r3, pc} - .align 2, 0 -_0234AFCC: .word MESSAGE_LOG_INFO - arm_func_end InitAlertBoxInfo - - arm_func_start FreeAlertBoxInfo -FreeAlertBoxInfo: ; 0x0234AFD0 - stmdb sp!, {r3, lr} - ldr r0, _0234AFF8 ; =MESSAGE_LOG_INFO - ldr r0, [r0, #4] - cmp r0, #0 - ldmeqia sp!, {r3, pc} - bl MemFree - ldr r0, _0234AFF8 ; =MESSAGE_LOG_INFO - mov r1, #0 - str r1, [r0, #4] - ldmia sp!, {r3, pc} - .align 2, 0 -_0234AFF8: .word MESSAGE_LOG_INFO - arm_func_end FreeAlertBoxInfo - - arm_func_start ov29_0234AFFC -ov29_0234AFFC: ; 0x0234AFFC - ldr r1, _0234B00C ; =MESSAGE_LOG_INFO - ldr r1, [r1, #4] - strb r0, [r1, #0xced] - bx lr - .align 2, 0 -_0234B00C: .word MESSAGE_LOG_INFO - arm_func_end ov29_0234AFFC - - arm_func_start ov29_0234B010 -ov29_0234B010: ; 0x0234B010 - ldr r1, _0234B020 ; =MESSAGE_LOG_INFO - ldr r1, [r1, #4] - strb r0, [r1, #0xcee] - bx lr - .align 2, 0 -_0234B020: .word MESSAGE_LOG_INFO - arm_func_end ov29_0234B010 - - arm_func_start SetMessageLogGroupStartFlag -SetMessageLogGroupStartFlag: ; 0x0234B024 - ldr r1, _0234B030 ; =MESSAGE_LOG_INFO - strb r0, [r1] - bx lr - .align 2, 0 -_0234B030: .word MESSAGE_LOG_INFO - arm_func_end SetMessageLogGroupStartFlag - - arm_func_start GetMessageLogPreprocessorArgs -GetMessageLogPreprocessorArgs: ; 0x0234B034 - ldr r0, _0234B048 ; =MESSAGE_LOG_INFO - ldr r0, [r0, #4] - add r0, r0, #0x9c - add r0, r0, #0xc00 - bx lr - .align 2, 0 -_0234B048: .word MESSAGE_LOG_INFO - arm_func_end GetMessageLogPreprocessorArgs - - arm_func_start InitMessageLogPreprocessorArgs -InitMessageLogPreprocessorArgs: ; 0x0234B04C - ldr r0, _0234B064 ; =MESSAGE_LOG_INFO - ldr ip, _0234B068 ; =InitPreprocessorArgs - ldr r0, [r0, #4] - add r0, r0, #0x9c - add r0, r0, #0xc00 - bx ip - .align 2, 0 -_0234B064: .word MESSAGE_LOG_INFO -_0234B068: .word InitPreprocessorArgs - arm_func_end InitMessageLogPreprocessorArgs - - arm_func_start SetMessageLogPreprocessorArgsFlagVal -SetMessageLogPreprocessorArgsFlagVal: ; 0x0234B06C - ldr r2, _0234B080 ; =MESSAGE_LOG_INFO - ldr r2, [r2, #4] - add r0, r2, r0, lsl #2 - str r1, [r0, #0xc9c] - bx lr - .align 2, 0 -_0234B080: .word MESSAGE_LOG_INFO - arm_func_end SetMessageLogPreprocessorArgsFlagVal - - arm_func_start SetPreprocessorArgsIdVal -SetPreprocessorArgsIdVal: ; 0x0234B084 - ldr r2, _0234B098 ; =MESSAGE_LOG_INFO - ldr r2, [r2, #4] - add r0, r2, r0, lsl #2 - str r1, [r0, #0xcac] - bx lr - .align 2, 0 -_0234B098: .word MESSAGE_LOG_INFO - arm_func_end SetPreprocessorArgsIdVal - - arm_func_start SetMessageLogPreprocessorArgsNumberVal -SetMessageLogPreprocessorArgsNumberVal: ; 0x0234B09C - ldr r2, _0234B0B0 ; =MESSAGE_LOG_INFO - ldr r2, [r2, #4] - add r0, r2, r0, lsl #2 - str r1, [r0, #0xcc0] - bx lr - .align 2, 0 -_0234B0B0: .word MESSAGE_LOG_INFO - arm_func_end SetMessageLogPreprocessorArgsNumberVal - - arm_func_start SetMessageLogPreprocessorArgsString -SetMessageLogPreprocessorArgsString: ; 0x0234B0B4 - ldr r2, _0234B0C8 ; =MESSAGE_LOG_INFO - ldr r2, [r2, #4] - add r0, r2, r0, lsl #2 - str r1, [r0, #0xcd4] - bx lr - .align 2, 0 -_0234B0C8: .word MESSAGE_LOG_INFO - arm_func_end SetMessageLogPreprocessorArgsString - - arm_func_start SetMessageLogPreprocessorArgsStringToName -SetMessageLogPreprocessorArgsStringToName: ; 0x0234B0CC - stmdb sp!, {r3, r4, r5, lr} - mov r4, r1 - mov r5, r0 - bl GetSize0x80Buffer - mov r1, r4 - mov r2, #0x4e - mov r4, r0 - bl GetName - ldr r0, _0234B100 ; =MESSAGE_LOG_INFO - ldr r0, [r0, #4] - add r0, r0, r5, lsl #2 - str r4, [r0, #0xcd4] - ldmia sp!, {r3, r4, r5, pc} - .align 2, 0 -_0234B100: .word MESSAGE_LOG_INFO - arm_func_end SetMessageLogPreprocessorArgsStringToName - - arm_func_start SetMessageLogPreprocessorArgsSpeakerId -SetMessageLogPreprocessorArgsSpeakerId: ; 0x0234B104 - ldr r1, _0234B114 ; =MESSAGE_LOG_INFO - ldr r1, [r1, #4] - str r0, [r1, #0xce8] - bx lr - .align 2, 0 -_0234B114: .word MESSAGE_LOG_INFO - arm_func_end SetMessageLogPreprocessorArgsSpeakerId - - arm_func_start SetMessageLogPreprocessorArgsSpeakerId0x30000 -SetMessageLogPreprocessorArgsSpeakerId0x30000: ; 0x0234B118 - ldr r1, _0234B12C ; =MESSAGE_LOG_INFO - orr r2, r0, #0x30000 - ldr r0, [r1, #4] - str r2, [r0, #0xce8] - bx lr - .align 2, 0 -_0234B12C: .word MESSAGE_LOG_INFO - arm_func_end SetMessageLogPreprocessorArgsSpeakerId0x30000 - - arm_func_start ov29_0234B130 -ov29_0234B130: ; 0x0234B130 - stmdb sp!, {r3, lr} - mov r3, #0 - ldr r1, _0234B1A0 ; =MESSAGE_LOG_INFO - mov r0, r3 -_0234B140: - ldr r2, [r1, #4] - add r2, r2, r3 - add r3, r3, #1 - strb r0, [r2, #0xc80] - cmp r3, #0xa - blt _0234B140 - ldr r1, _0234B1A0 ; =MESSAGE_LOG_INFO - mvn ip, #1 - ldr r3, [r1, #4] - mov r2, #1 - strb ip, [r3, #0xcec] - ldr r3, [r1, #4] - strb r0, [r3, #0xcee] - ldr r3, [r1, #4] - strb r0, [r3, #0xced] - str r0, [r1, #8] - strb r2, [r1] - bl ov29_0234B1A4 - ldr r0, _0234B1A0 ; =MESSAGE_LOG_INFO - ldr r0, [r0, #4] - add r0, r0, #0x9c - add r0, r0, #0xc00 - bl InitPreprocessorArgs - ldmia sp!, {r3, pc} - .align 2, 0 -_0234B1A0: .word MESSAGE_LOG_INFO - arm_func_end ov29_0234B130 - - arm_func_start ov29_0234B1A4 -ov29_0234B1A4: ; 0x0234B1A4 - stmdb sp!, {r4, lr} - mov r4, r0 - bl ov29_022E9FC0 - cmp r0, #0 - ldmeqia sp!, {r4, pc} - mov ip, #0 - ldr r2, _0234B24C ; =MESSAGE_LOG_INFO - mov r0, ip -_0234B1C4: - ldr r3, [r2, #4] - add r1, ip, ip, lsl #2 - add ip, ip, #1 - strb r0, [r3, r1, lsl #6] - cmp ip, #0xa - blt _0234B1C4 - ldr r2, _0234B24C ; =MESSAGE_LOG_INFO - mov r3, #4 - ldr r1, [r2, #4] - strb r0, [r1, #0xc8b] - ldr r1, [r2, #4] - add r1, r1, #0xc00 - strh r0, [r1, #0x8c] - ldr r1, [r2, #4] - add r1, r1, #0xc00 - strh r0, [r1, #0x8e] - ldr r1, [r2, #4] - add r1, r1, #0xc00 - strh r0, [r1, #0x90] - ldr r1, [r2, #4] - add r1, r1, #0xc00 - strh r3, [r1, #0x92] - ldr r1, [r2, #4] - str r0, [r1, #0xc98] - bl ov29_0234B768 - cmp r0, #0 - cmpne r4, #0 - ldmeqia sp!, {r4, pc} - mov r0, #0 - mov r1, r0 - bl ov29_022EA428 - mov r0, #0xb - bl AdvanceFrame - ldmia sp!, {r4, pc} - .align 2, 0 -_0234B24C: .word MESSAGE_LOG_INFO - arm_func_end ov29_0234B1A4 - - arm_func_start LogMessageByIdWithPopupCheckParticipants -LogMessageByIdWithPopupCheckParticipants: ; 0x0234B250 - stmdb sp!, {r3, lr} - ldr ip, _0234B290 ; =MESSAGE_LOG_INFO - cmp r1, #0 - ldr ip, [ip, #4] - ldrsh lr, [sp, #8] - add r3, ip, r3, lsl #2 - cmpne r0, #0 - str lr, [r3, #0xcac] - beq _0234B27C - bl LogMessageByIdWithPopupCheckUserTarget - ldmia sp!, {r3, pc} -_0234B27C: - cmp r0, #0 - ldmeqia sp!, {r3, pc} - mov r1, r2 - bl LogMessageByIdWithPopupCheckUser - ldmia sp!, {r3, pc} - .align 2, 0 -_0234B290: .word MESSAGE_LOG_INFO - arm_func_end LogMessageByIdWithPopupCheckParticipants - - arm_func_start WaitUntilAlertBoxTextIsLoadedWrapper -WaitUntilAlertBoxTextIsLoadedWrapper: ; 0x0234B294 - ldr ip, _0234B2A0 ; =WaitUntilAlertBoxTextIsLoaded - mov r0, #0x50 - bx ip - .align 2, 0 -_0234B2A0: .word WaitUntilAlertBoxTextIsLoaded - arm_func_end WaitUntilAlertBoxTextIsLoadedWrapper - - arm_func_start LogMessageByIdWithPopupCheckUser -LogMessageByIdWithPopupCheckUser: ; 0x0234B2A4 - stmdb sp!, {r4, r5, r6, lr} - mov r4, #0 - mov r6, r0 - mov r5, r1 - bl ShouldDisplayEntityWrapper - cmp r0, #0 - movne r4, #1 - cmp r4, #0 - ldmeqia sp!, {r4, r5, r6, pc} - mov r0, r5 - bl StringFromId - mov r1, r0 - mov r0, r6 - mov r2, #1 - bl LogMessage - ldmia sp!, {r4, r5, r6, pc} - arm_func_end LogMessageByIdWithPopupCheckUser - - arm_func_start LogMessageWithPopupCheckUser -LogMessageWithPopupCheckUser: ; 0x0234B2E4 - stmdb sp!, {r4, r5, r6, lr} - mov r4, #0 - mov r6, r0 - mov r5, r1 - bl ShouldDisplayEntityWrapper - cmp r0, #0 - movne r4, #1 - cmp r4, #0 - ldmeqia sp!, {r4, r5, r6, pc} - mov r0, r6 - mov r1, r5 - mov r2, #1 - bl LogMessage - ldmia sp!, {r4, r5, r6, pc} - arm_func_end LogMessageWithPopupCheckUser - - arm_func_start LogMessageByIdQuiet -LogMessageByIdQuiet: ; 0x0234B31C - stmdb sp!, {r4, lr} - mov r4, r0 - mov r0, r1 - bl StringFromId - mov r1, r0 - mov r0, r4 - mov r2, #0 - bl LogMessage - ldmia sp!, {r4, pc} - arm_func_end LogMessageByIdQuiet - - arm_func_start LogMessageQuiet -LogMessageQuiet: ; 0x0234B340 - ldr ip, _0234B34C ; =LogMessage - mov r2, #0 - bx ip - .align 2, 0 -_0234B34C: .word LogMessage - arm_func_end LogMessageQuiet - - arm_func_start LogMessageByIdWithPopupCheckUserTarget -LogMessageByIdWithPopupCheckUserTarget: ; 0x0234B350 - stmdb sp!, {r3, r4, r5, r6, r7, lr} - mov r6, r1 - mov r4, #0 - mov r7, r0 - mov r5, r2 - bl ShouldDisplayEntityWrapper - cmp r0, #0 - movne r4, #1 - mov r0, r6 - bl ShouldDisplayEntityWrapper - cmp r0, #0 - movne r4, #1 - cmp r4, #0 - ldmeqia sp!, {r3, r4, r5, r6, r7, pc} - mov r0, r5 - bl StringFromId - mov r1, r0 - mov r0, r7 - mov r2, #1 - bl LogMessage - ldmia sp!, {r3, r4, r5, r6, r7, pc} - arm_func_end LogMessageByIdWithPopupCheckUserTarget - - arm_func_start LogMessageWithPopupCheckUserTarget -LogMessageWithPopupCheckUserTarget: ; 0x0234B3A4 - stmdb sp!, {r3, r4, r5, r6, r7, lr} - mov r6, r1 - mov r4, #0 - mov r7, r0 - mov r5, r2 - bl ShouldDisplayEntityWrapper - cmp r0, #0 - movne r4, #1 - mov r0, r6 - bl ShouldDisplayEntityWrapper - cmp r0, #0 - movne r4, #1 - cmp r4, #0 - ldmeqia sp!, {r3, r4, r5, r6, r7, pc} - mov r0, r7 - mov r1, r5 - mov r2, #1 - bl LogMessage - ldmia sp!, {r3, r4, r5, r6, r7, pc} - arm_func_end LogMessageWithPopupCheckUserTarget - - arm_func_start LogMessageByIdQuietCheckUserTarget -LogMessageByIdQuietCheckUserTarget: ; 0x0234B3F0 - stmdb sp!, {r3, r4, r5, r6, r7, lr} - mov r6, r1 - mov r4, #0 - mov r7, r0 - mov r5, r2 - bl ShouldDisplayEntityWrapper - cmp r0, #0 - movne r4, #1 - mov r0, r6 - bl ShouldDisplayEntityWrapper - cmp r0, #0 - movne r4, #1 - cmp r4, #0 - ldmeqia sp!, {r3, r4, r5, r6, r7, pc} - mov r0, r5 - bl StringFromId - mov r1, r0 - mov r0, r7 - mov r2, #0 - bl LogMessage - ldmia sp!, {r3, r4, r5, r6, r7, pc} - arm_func_end LogMessageByIdQuietCheckUserTarget - - arm_func_start LogMessageByIdWithPopupCheckUserUnknown -LogMessageByIdWithPopupCheckUserUnknown: ; 0x0234B444 - stmdb sp!, {r3, r4, r5, r6, r7, lr} - mov r6, r1 - mov r4, #0 - mov r7, r0 - mov r5, r2 - bl ShouldDisplayEntityWrapper - cmp r0, #0 - movne r4, #1 - mov r0, r6 - bl ov29_022E2CA0 - cmp r0, #0 - movne r4, #1 - cmp r4, #0 - ldmeqia sp!, {r3, r4, r5, r6, r7, pc} - mov r0, r5 - bl StringFromId - mov r1, r0 - mov r0, r7 - mov r2, #1 - bl LogMessage - ldmia sp!, {r3, r4, r5, r6, r7, pc} - arm_func_end LogMessageByIdWithPopupCheckUserUnknown - - arm_func_start LogMessageByIdWithPopup -LogMessageByIdWithPopup: ; 0x0234B498 - stmdb sp!, {r4, lr} - mov r4, r0 - mov r0, r1 - bl StringFromId - mov r1, r0 - mov r0, r4 - mov r2, #1 - bl LogMessage - ldmia sp!, {r4, pc} - arm_func_end LogMessageByIdWithPopup - - arm_func_start LogMessageWithPopup -LogMessageWithPopup: ; 0x0234B4BC - ldr ip, _0234B4C8 ; =LogMessage - mov r2, #1 - bx ip - .align 2, 0 -_0234B4C8: .word LogMessage - arm_func_end LogMessageWithPopup - - arm_func_start ov29_0234B4CC -ov29_0234B4CC: ; 0x0234B4CC - ldr r1, _0234B4DC ; =MESSAGE_LOG_INFO - ldr r1, [r1, #4] - strb r0, [r1, #0xc8a] - bx lr - .align 2, 0 -_0234B4DC: .word MESSAGE_LOG_INFO - arm_func_end ov29_0234B4CC - - arm_func_start ov29_0234B4E0 -ov29_0234B4E0: ; 0x0234B4E0 - ldr r0, _0234B4F0 ; =MESSAGE_LOG_INFO - ldr r0, [r0, #4] - ldrb r0, [r0, #0xc8b] - bx lr - .align 2, 0 -_0234B4F0: .word MESSAGE_LOG_INFO - arm_func_end ov29_0234B4E0 - - arm_func_start ov29_0234B4F4 -ov29_0234B4F4: ; 0x0234B4F4 - ldr r0, _0234B504 ; =MESSAGE_LOG_INFO - ldr r0, [r0, #4] - ldr r0, [r0, #0xc98] - bx lr - .align 2, 0 -_0234B504: .word MESSAGE_LOG_INFO - arm_func_end ov29_0234B4F4 - - arm_func_start LogMessage -LogMessage: ; 0x0234B508 -#ifdef EUROPE -#define LOG_MESSAGE_STACK_OFFSET 0xC0 -#else -#define LOG_MESSAGE_STACK_OFFSET 0 -#endif - stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} - sub sp, sp, #0x284 + LOG_MESSAGE_STACK_OFFSET - ldr r4, _0234B708 ; =MESSAGE_LOG_INFO - mov fp, r2 - ldr r3, [r4, #4] - ldrb r2, [r3, #0xced] - cmp r2, #0 - ldreqb r2, [r3, #0xcee] - cmpeq r2, #0 - bne _0234B700 - ldr r3, _0234B70C ; =DUNGEON_PTR - mov r7, #0 - ldr r2, [r3] - mvn r5, #0 - add r2, r2, #0x100 - strh r5, [r2, #0xd8] - ldr r2, [r3] - mov r3, #0x400 - add r2, r2, #0x100 - strh r5, [r2, #0xda] - ldr r2, [r4, #8] - mov r8, r7 - cmp r2, r0 - movne sl, #1 - ldreqb sl, [r4] - ldr r2, _0234B708 ; =MESSAGE_LOG_INFO - mov r6, #1 - str r0, [r2, #8] - strb r7, [r2] - ldr r2, [r2, #4] - add r0, sp, #0x144 - add r2, r2, #0x9c - add r4, r2, #0xc00 - mov r2, r1 - mov r1, #0x140 + LOG_MESSAGE_STACK_OFFSET - str r4, [sp] - bl PreprocessString - ldr r4, _0234B708 ; =MESSAGE_LOG_INFO - add r5, sp, #0x144 -_0234B5A4: - ldr r0, [r4, #4] - add r1, r0, #0xc00 - ldrsh sb, [r1, #0x8c] - add r1, r0, #0xc00 - ldrsh r2, [r1, #0x8e] - add r3, sb, #1 - cmp r3, #0xa - moveq r3, #0 - cmp r3, r2 - bne _0234B5D8 - mov r0, #0 - bl AdvanceFrame - b _0234B5A4 -_0234B5D8: - ldrb r2, [r5, r8] - cmp r2, #0 - beq _0234B6D4 - add r0, r0, sb - strb sl, [r0, #0xc80] - ldr r1, [r4, #4] - add r0, sp, #4 - add r1, r1, #0x9c - add r1, r1, #0xc00 - str r1, [sp] - mov r1, #0x140 - add r2, r5, r8 - mov r3, #0x440 - bl PreprocessString - add r8, r8, r0 - ldrb sb, [r5, r8] - mov r2, #0 - add r1, sp, #4 - strb r2, [r1, r0] - cmp sb, #0 - beq _0234B660 - ldr r1, _0234B710 ; =ov29_02353214 - add r0, r5, r8 - mov r2, #3 - bl strncmp - cmp r0, #0 - bne _0234B654 - ldr r0, _0234B710 ; =ov29_02353214 - bl strlen - add r8, r8, r0 - b _0234B660 -_0234B654: - cmp sb, #0xd - cmpne sb, #0xa - addeq r8, r8, #1 -_0234B660: - add r0, sp, #4 - mov r1, sl - mov r2, r6 - bl ov29_0234BB44 - mov sl, #0 - cmp fp, #0 - mov r6, sl - beq _0234B5A4 - ldr sb, [r4, #4] - mov r2, #0x140 - add r0, sb, #0xc00 - ldrsh r3, [r0, #0x8c] - mov r0, r2 - add r1, sp, #4 - smlabb r0, r3, r0, sb - mov r7, #1 - bl strncpy - ldr r0, [r4, #4] - add r0, r0, #0xc00 - ldrsh r1, [r0, #0x8c] - add r1, r1, #1 - strh r1, [r0, #0x8c] - ldr r0, [r4, #4] - add r1, r0, #0xc00 - ldrsh r0, [r1, #0x8c] - cmp r0, #0xa - moveq r0, sl - streqh r0, [r1, #0x8c] - b _0234B5A4 -_0234B6D4: - cmp r7, #0 - beq _0234B700 - ldr r0, _0234B708 ; =MESSAGE_LOG_INFO - mov r2, #0xf0 - strh r2, [r1, #0x90] - ldr r1, [r0, #4] - ldr r0, [r1, #0xc98] - cmp r0, #0 - moveq r0, #1 - streq r0, [r1, #0xc98] - bl ov29_022F2FE4 -_0234B700: - add sp, sp, #0x284 + LOG_MESSAGE_STACK_OFFSET - ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc} - .align 2, 0 -_0234B708: .word MESSAGE_LOG_INFO -_0234B70C: .word DUNGEON_PTR -_0234B710: .word ov29_02353214 - arm_func_end LogMessage - - arm_func_start LogMessageById -LogMessageById: ; 0x0234B714 - stmdb sp!, {r3, r4, r5, lr} - mov r5, r0 - mov r4, r2 - mov r0, r1 - bl StringFromId - mov r1, r0 - mov r0, r5 - mov r2, r4 - bl LogMessage - ldmia sp!, {r3, r4, r5, pc} - arm_func_end LogMessageById - - arm_func_start ov29_0234B73C -ov29_0234B73C: ; 0x0234B73C - ldr r0, _0234B764 ; =MESSAGE_LOG_INFO - mvn r1, #1 - ldr r0, [r0, #4] - add r0, r0, #0xc00 - ldrsb r0, [r0, #0xec] - cmp r0, r1 - movne r0, #1 - moveq r0, #0 - and r0, r0, #0xff - bx lr - .align 2, 0 -_0234B764: .word MESSAGE_LOG_INFO - arm_func_end ov29_0234B73C - - arm_func_start ov29_0234B768 -ov29_0234B768: ; 0x0234B768 - stmdb sp!, {r3, lr} - ldr r0, _0234B7E8 ; =MESSAGE_LOG_INFO - mvn r1, #1 - ldr r0, [r0, #4] - add r0, r0, #0xc00 - ldrsb r0, [r0, #0xec] - cmp r0, r1 - movne r1, #1 - moveq r1, #0 - tst r1, #0xff - moveq r0, #0 - ldmeqia sp!, {r3, pc} - bl sub_0202836C - ldr r0, _0234B7E8 ; =MESSAGE_LOG_INFO - ldr r0, [r0, #4] - add r0, r0, #0xc00 - ldrsb r0, [r0, #0xec] - bl sub_02030214 - ldr r0, _0234B7E8 ; =MESSAGE_LOG_INFO - ldr r0, [r0, #4] - add r0, r0, #0xc00 - ldrsb r0, [r0, #0xec] - bl CloseAlertBox - ldr r0, _0234B7E8 ; =MESSAGE_LOG_INFO - mvn r3, #1 - ldr r1, [r0, #4] - mov r2, #0 - strb r3, [r1, #0xcec] - ldr r1, [r0, #4] - mov r0, #1 - str r2, [r1, #0xc98] - ldmia sp!, {r3, pc} - .align 2, 0 -_0234B7E8: .word MESSAGE_LOG_INFO - arm_func_end ov29_0234B768 - - arm_func_start AlertBoxIsScrolling -AlertBoxIsScrolling: ; 0x0234B7EC - stmdb sp!, {r3, lr} - ldr r0, _0234B850 ; =MESSAGE_LOG_INFO - mvn r1, #1 - ldr r0, [r0, #4] - add r0, r0, #0xc00 - ldrsb r0, [r0, #0xec] - cmp r0, r1 - movne r1, #1 - moveq r1, #0 - tst r1, #0xff - moveq r0, #0 - ldmeqia sp!, {r3, pc} - ldr r1, _0234B850 ; =MESSAGE_LOG_INFO - ldr r1, [r1, #4] - add r1, r1, #0xc00 - ldrsh r2, [r1, #0x8c] - ldrsh r1, [r1, #0x8e] - cmp r2, r1 - bne _0234B848 - bl IsAlertBoxActive - cmp r0, #0 - moveq r0, #0 - ldmeqia sp!, {r3, pc} -_0234B848: - mov r0, #1 - ldmia sp!, {r3, pc} - .align 2, 0 -_0234B850: .word MESSAGE_LOG_INFO - arm_func_end AlertBoxIsScrolling - - arm_func_start ov29_0234B854 -ov29_0234B854: ; 0x0234B854 - stmdb sp!, {r3, r4, r5, lr} - ldr r0, _0234BA14 ; =MESSAGE_LOG_INFO - ldr r1, [r0, #4] - cmp r1, #0 - ldmeqia sp!, {r3, r4, r5, pc} - ldrb r0, [r1, #0xced] - cmp r0, #0 - movne r0, #0 - strne r0, [r1, #0xc98] - ldr r0, _0234BA14 ; =MESSAGE_LOG_INFO - ldr r4, [r0, #4] - ldr r0, [r4, #0xc98] - cmp r0, #0 - beq _0234B9C8 - cmp r0, #1 - beq _0234B8A0 - cmp r0, #2 - beq _0234B908 - b _0234B9C8 -_0234B8A0: - bl ov10_022BFD20 - cmp r0, #0 - bne _0234B9C8 -#ifndef JAPAN - bl sub_02001808 - cmp r0, #0x3000 - blt _0234B9C8 -#endif - ldr r0, _0234BA14 ; =MESSAGE_LOG_INFO - mvn r1, #1 - ldr r0, [r0, #4] - add r0, r0, #0xc00 - ldrsb r0, [r0, #0xec] - cmp r0, r1 - movne r0, #1 - moveq r0, #0 - tst r0, #0xff - bne _0234B900 - mov r0, #0 - bl CreateAlertBox - ldr r1, _0234BA14 ; =MESSAGE_LOG_INFO - mov r2, #0 - ldr r3, [r1, #4] - strb r0, [r3, #0xcec] - ldr r0, [r1, #4] - str r2, [r0, #0xce8] -_0234B900: - mov r0, #2 - str r0, [r4, #0xc98] -_0234B908: - ldr r0, _0234BA14 ; =MESSAGE_LOG_INFO - mvn r2, #1 - ldr r1, [r0, #4] - add r0, r1, #0xc00 - ldrsb r0, [r0, #0xec] - cmp r0, r2 - movne r2, #1 - moveq r2, #0 - tst r2, #0xff - moveq r0, #1 - beq _0234B9BC - ldr r3, _0234BA14 ; =MESSAGE_LOG_INFO - mov r2, #0x140 - ldr r5, [r3, #4] - add r3, r5, #0xc00 - ldrsh ip, [r3, #0x8e] - ldrsh r3, [r3, #0x8c] - smulbb lr, ip, r2 - cmp r3, ip - bne _0234B96C - bl AlertBoxIsScrolling - cmp r0, #0 - bne _0234B9B8 - mov r0, #1 - b _0234B9BC -_0234B96C: - add r2, r5, ip - ldrb ip, [r2, #0xc80] - add r1, r1, #0x9c - add r3, r1, #0xc00 - add r2, r5, lr - mov r1, #0x400 - str ip, [sp] - bl AddMessageToAlertBox - cmp r0, #0 - moveq r0, #0 - beq _0234B9BC - add r0, r5, #0xc00 - ldrsh r1, [r0, #0x8e] - add r1, r1, #1 - strh r1, [r0, #0x8e] - ldrsh r1, [r0, #0x8e] - cmp r1, #0xa - moveq r1, #0 - streqh r1, [r0, #0x8e] -_0234B9B8: - mov r0, #0 -_0234B9BC: - cmp r0, #0 - movne r0, #0 - strne r0, [r4, #0xc98] -_0234B9C8: - ldrb r0, [r4, #0xc8a] - cmp r0, #0 - ldmneia sp!, {r3, r4, r5, pc} - add r0, r4, #0xc00 - ldrsh r1, [r0, #0x90] - cmp r1, #0 - ldmeqia sp!, {r3, r4, r5, pc} - sub r1, r1, #1 - strh r1, [r0, #0x90] - ldrsh r0, [r0, #0x90] - cmp r0, #0 - ldmneia sp!, {r3, r4, r5, pc} - mov r0, #0 - str r0, [r4, #0xc98] - bl ov29_0234B768 - mov r0, #0 - mov r1, r0 - bl ov29_022EA428 - ldmia sp!, {r3, r4, r5, pc} - .align 2, 0 -_0234BA14: .word MESSAGE_LOG_INFO - arm_func_end ov29_0234B854 - - arm_func_start WaitUntilAlertBoxTextIsLoaded -WaitUntilAlertBoxTextIsLoaded: ; 0x0234BA18 - stmdb sp!, {r3, r4, r5, lr} - ldr r1, _0234BA50 ; =MESSAGE_LOG_INFO - mov r5, r0 - ldr r4, [r1, #4] -_0234BA28: - ldr r0, [r4, #0xc98] - cmp r0, #0 - bne _0234BA40 - bl AlertBoxIsScrolling - cmp r0, #0 - ldmeqia sp!, {r3, r4, r5, pc} -_0234BA40: - mov r0, r5 - bl AdvanceFrame - b _0234BA28 -_0234BA4C: - ldmia sp!, {r3, r4, r5, pc} - .align 2, 0 -_0234BA50: .word MESSAGE_LOG_INFO - arm_func_end WaitUntilAlertBoxTextIsLoaded - - arm_func_start ov29_0234BA54 -ov29_0234BA54: ; 0x0234BA54 - stmdb sp!, {r3, r4, r5, r6, r7, lr} - ldr r1, _0234BAB8 ; =MESSAGE_LOG_INFO - mov r5, r0 - ldr r6, [r1, #4] - bl WaitUntilAlertBoxTextIsLoaded - mov r4, #0 - add r6, r6, #0xc00 - ldr r7, _0234BABC ; =ov29_0237C694 - b _0234BAAC -_0234BA78: - ldrsh r0, [r6, #0x90] - cmp r0, #0xb4 - ldmltia sp!, {r3, r4, r5, r6, r7, pc} - ldrh r0, [r7] - and r0, r0, #3 - cmp r0, #3 - ldmeqia sp!, {r3, r4, r5, r6, r7, pc} - ldrh r0, [r7, #2] - tst r0, #0xf0 - ldmneia sp!, {r3, r4, r5, r6, r7, pc} - mov r0, r5 - bl AdvanceFrame - add r4, r4, #1 -_0234BAAC: - cmp r4, #0xf0 - blt _0234BA78 - ldmia sp!, {r3, r4, r5, r6, r7, pc} - .align 2, 0 -_0234BAB8: .word MESSAGE_LOG_INFO -_0234BABC: .word ov29_0237C694 - arm_func_end ov29_0234BA54 - - arm_func_start InitPortraitDungeon -InitPortraitDungeon: ; 0x0234BAC0 - stmdb sp!, {r4, r5, r6, lr} - mov r6, r0 - mov r5, r1 - mov r4, r2 - bl InitPortraitParams - strh r5, [r6] - strb r4, [r6, #2] - mov r2, #0 - strb r2, [r6, #3] - mov r0, #2 - str r0, [r6, #4] - mov r0, #9 - str r0, [r6, #8] - strb r2, [r6, #0xc] - strb r2, [r6, #0xd] - mov r0, r6 - mov r1, #1 - strb r2, [r6, #0xe] - bl AllowPortraitDefault - ldmia sp!, {r4, r5, r6, pc} - arm_func_end InitPortraitDungeon - - arm_func_start ov29_0234BB10 -ov29_0234BB10: ; 0x0234BB10 - ldr ip, _0234BB1C ; =sub_02047FFC - mov r0, #0 - bx ip - .align 2, 0 -_0234BB1C: .word sub_02047FFC - arm_func_end ov29_0234BB10 - - arm_func_start ov29_0234BB20 -ov29_0234BB20: ; 0x0234BB20 - ldr ip, _0234BB28 ; =sub_0204804C - bx ip - .align 2, 0 -_0234BB28: .word sub_0204804C - arm_func_end ov29_0234BB20 - - arm_func_start ov29_0234BB2C -ov29_0234BB2C: ; 0x0234BB2C - ldr ip, _0234BB34 ; =sub_020480CC - bx ip - .align 2, 0 -_0234BB34: .word sub_020480CC - arm_func_end ov29_0234BB2C - - arm_func_start ov29_0234BB38 -ov29_0234BB38: ; 0x0234BB38 - ldr ip, _0234BB40 ; =sub_02048134 - bx ip - .align 2, 0 -_0234BB40: .word sub_02048134 - arm_func_end ov29_0234BB38 - - arm_func_start ov29_0234BB44 -ov29_0234BB44: ; 0x0234BB44 - ldr ip, _0234BB4C ; =sub_02048150 - bx ip - .align 2, 0 -_0234BB4C: .word sub_02048150 - arm_func_end ov29_0234BB44 - - arm_func_start ov29_0234BB50 -ov29_0234BB50: ; 0x0234BB50 - ldr ip, _0234BB58 ; =sub_02048240 - bx ip - .align 2, 0 -_0234BB58: .word sub_02048240 - arm_func_end ov29_0234BB50 - - arm_func_start OpenMessageLog -OpenMessageLog: ; 0x0234BB5C - stmdb sp!, {r4, r5, r6, lr} - mov r4, r0 - mov r6, r1 - mov r0, #6 - mov r1, #0 - bl ov29_022EA428 - cmp r4, #0 - bne _0234BB84 - mov r0, #0 - bl ov29_0233A248 -_0234BB84: - mov r0, #0x62 - bl AdvanceFrame - mov r0, #0x62 - bl AdvanceFrame - bl sub_0204833C - mov r4, #0x62 -_0234BB9C: - mov r0, r4 - bl AdvanceFrame - bl sub_02048360 - movs r5, r0 - beq _0234BB9C - mov r0, #0x62 - bl AdvanceFrame - cmp r6, #0 - beq _0234BBCC - mov r0, #0 - mov r1, r0 - bl ov29_022EA428 -_0234BBCC: - cmp r5, #1 - moveq r0, #1 - movne r0, #0 - ldmia sp!, {r4, r5, r6, pc} - arm_func_end OpenMessageLog - - arm_func_start ov29_0234BBDC -ov29_0234BBDC: ; 0x0234BBDC - ldr ip, _0234BBE4 ; =ov29_022E0B60 - bx ip - .align 2, 0 -_0234BBE4: .word ov29_022E0B60 - arm_func_end ov29_0234BBDC diff --git a/asm/overlay_29_0234AEE8.s b/asm/overlay_29_0234AEE8.s new file mode 100644 index 00000000..75eea9ea --- /dev/null +++ b/asm/overlay_29_0234AEE8.s @@ -0,0 +1,1114 @@ + .include "asm/macros.inc" + .include "overlay_29_0234AEE8.inc" + + .text + + arm_func_start ov29_0234AEE8 +ov29_0234AEE8: ; 0x0234AEE8 + stmdb sp!, {r3, lr} + ldr r0, _0234AF30 ; =DUNGEON_PTR + ldr r0, [r0] + ldrb r0, [r0, #0x790] + cmp r0, #0 + bne _0234AF24 + bl ov29_022EAEFC + cmp r0, #0 + beq _0234AF24 + ldr r0, _0234AF30 ; =DUNGEON_PTR + ldr r0, [r0] + add r0, r0, #0x4000 +#ifdef JAPAN + ldrsh r0, [r0, #0x32] +#else + ldrsh r0, [r0, #0xd6] +#endif + bl MusicTableIdxToMusicId + bl ChangeDungeonMusic +_0234AF24: + mov r0, #0 + bl ov29_022EAF34 + ldmia sp!, {r3, pc} + .align 2, 0 +_0234AF30: .word DUNGEON_PTR + arm_func_end ov29_0234AEE8 + + arm_func_start ov29_0234AF34 +ov29_0234AF34: ; 0x0234AF34 + stmdb sp!, {r4, r5, r6, lr} + mov r6, r0 + ldrb ip, [r2] + ldr r2, [r6, #0xb4] + mov r5, r1 + mov r4, r3 + strb ip, [r2, #0x48] + bl ov29_022E68F0 + cmp r5, #0 + beq _0234AF64 + mov r0, r5 + bl ov29_022E68F0 +_0234AF64: + ldr r1, _0234AFA0 ; =0x0000025B + mov r0, r6 + mov r2, #0 + bl HandleFaint + cmp r5, #0 + beq _0234AF8C + ldr r1, _0234AFA0 ; =0x0000025B + mov r0, r5 + mov r2, #0 + bl HandleFaint +_0234AF8C: + mov r0, #1 + bl AnimationDelayOrSomething + mov r0, r4 + bl ov29_02348A18 + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_0234AFA0: .word 0x0000025B + arm_func_end ov29_0234AF34 + + arm_func_start InitAlertBoxInfo +InitAlertBoxInfo: ; 0x0234AFA4 + stmdb sp!, {r3, lr} + mov r0, #0xcf0 + mov r1, #0 + bl MemAlloc + ldr r2, _0234AFCC ; =MESSAGE_LOG_INFO + mov r1, #0xcf0 + str r0, [r2, #4] + bl MemZero + bl ov29_0234B130 + ldmia sp!, {r3, pc} + .align 2, 0 +_0234AFCC: .word MESSAGE_LOG_INFO + arm_func_end InitAlertBoxInfo + + arm_func_start FreeAlertBoxInfo +FreeAlertBoxInfo: ; 0x0234AFD0 + stmdb sp!, {r3, lr} + ldr r0, _0234AFF8 ; =MESSAGE_LOG_INFO + ldr r0, [r0, #4] + cmp r0, #0 + ldmeqia sp!, {r3, pc} + bl MemFree + ldr r0, _0234AFF8 ; =MESSAGE_LOG_INFO + mov r1, #0 + str r1, [r0, #4] + ldmia sp!, {r3, pc} + .align 2, 0 +_0234AFF8: .word MESSAGE_LOG_INFO + arm_func_end FreeAlertBoxInfo + + arm_func_start ov29_0234AFFC +ov29_0234AFFC: ; 0x0234AFFC + ldr r1, _0234B00C ; =MESSAGE_LOG_INFO + ldr r1, [r1, #4] + strb r0, [r1, #0xced] + bx lr + .align 2, 0 +_0234B00C: .word MESSAGE_LOG_INFO + arm_func_end ov29_0234AFFC + + arm_func_start ov29_0234B010 +ov29_0234B010: ; 0x0234B010 + ldr r1, _0234B020 ; =MESSAGE_LOG_INFO + ldr r1, [r1, #4] + strb r0, [r1, #0xcee] + bx lr + .align 2, 0 +_0234B020: .word MESSAGE_LOG_INFO + arm_func_end ov29_0234B010 + + arm_func_start SetMessageLogGroupStartFlag +SetMessageLogGroupStartFlag: ; 0x0234B024 + ldr r1, _0234B030 ; =MESSAGE_LOG_INFO + strb r0, [r1] + bx lr + .align 2, 0 +_0234B030: .word MESSAGE_LOG_INFO + arm_func_end SetMessageLogGroupStartFlag + + arm_func_start GetMessageLogPreprocessorArgs +GetMessageLogPreprocessorArgs: ; 0x0234B034 + ldr r0, _0234B048 ; =MESSAGE_LOG_INFO + ldr r0, [r0, #4] + add r0, r0, #0x9c + add r0, r0, #0xc00 + bx lr + .align 2, 0 +_0234B048: .word MESSAGE_LOG_INFO + arm_func_end GetMessageLogPreprocessorArgs + + arm_func_start InitMessageLogPreprocessorArgs +InitMessageLogPreprocessorArgs: ; 0x0234B04C + ldr r0, _0234B064 ; =MESSAGE_LOG_INFO + ldr ip, _0234B068 ; =InitPreprocessorArgs + ldr r0, [r0, #4] + add r0, r0, #0x9c + add r0, r0, #0xc00 + bx ip + .align 2, 0 +_0234B064: .word MESSAGE_LOG_INFO +_0234B068: .word InitPreprocessorArgs + arm_func_end InitMessageLogPreprocessorArgs + + arm_func_start SetMessageLogPreprocessorArgsFlagVal +SetMessageLogPreprocessorArgsFlagVal: ; 0x0234B06C + ldr r2, _0234B080 ; =MESSAGE_LOG_INFO + ldr r2, [r2, #4] + add r0, r2, r0, lsl #2 + str r1, [r0, #0xc9c] + bx lr + .align 2, 0 +_0234B080: .word MESSAGE_LOG_INFO + arm_func_end SetMessageLogPreprocessorArgsFlagVal + + arm_func_start SetPreprocessorArgsIdVal +SetPreprocessorArgsIdVal: ; 0x0234B084 + ldr r2, _0234B098 ; =MESSAGE_LOG_INFO + ldr r2, [r2, #4] + add r0, r2, r0, lsl #2 + str r1, [r0, #0xcac] + bx lr + .align 2, 0 +_0234B098: .word MESSAGE_LOG_INFO + arm_func_end SetPreprocessorArgsIdVal + + arm_func_start SetMessageLogPreprocessorArgsNumberVal +SetMessageLogPreprocessorArgsNumberVal: ; 0x0234B09C + ldr r2, _0234B0B0 ; =MESSAGE_LOG_INFO + ldr r2, [r2, #4] + add r0, r2, r0, lsl #2 + str r1, [r0, #0xcc0] + bx lr + .align 2, 0 +_0234B0B0: .word MESSAGE_LOG_INFO + arm_func_end SetMessageLogPreprocessorArgsNumberVal + + arm_func_start SetMessageLogPreprocessorArgsString +SetMessageLogPreprocessorArgsString: ; 0x0234B0B4 + ldr r2, _0234B0C8 ; =MESSAGE_LOG_INFO + ldr r2, [r2, #4] + add r0, r2, r0, lsl #2 + str r1, [r0, #0xcd4] + bx lr + .align 2, 0 +_0234B0C8: .word MESSAGE_LOG_INFO + arm_func_end SetMessageLogPreprocessorArgsString + + arm_func_start SetMessageLogPreprocessorArgsStringToName +SetMessageLogPreprocessorArgsStringToName: ; 0x0234B0CC + stmdb sp!, {r3, r4, r5, lr} + mov r4, r1 + mov r5, r0 + bl GetSize0x80Buffer + mov r1, r4 + mov r2, #0x4e + mov r4, r0 + bl GetName + ldr r0, _0234B100 ; =MESSAGE_LOG_INFO + ldr r0, [r0, #4] + add r0, r0, r5, lsl #2 + str r4, [r0, #0xcd4] + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_0234B100: .word MESSAGE_LOG_INFO + arm_func_end SetMessageLogPreprocessorArgsStringToName + + arm_func_start SetMessageLogPreprocessorArgsSpeakerId +SetMessageLogPreprocessorArgsSpeakerId: ; 0x0234B104 + ldr r1, _0234B114 ; =MESSAGE_LOG_INFO + ldr r1, [r1, #4] + str r0, [r1, #0xce8] + bx lr + .align 2, 0 +_0234B114: .word MESSAGE_LOG_INFO + arm_func_end SetMessageLogPreprocessorArgsSpeakerId + + arm_func_start SetMessageLogPreprocessorArgsSpeakerId0x30000 +SetMessageLogPreprocessorArgsSpeakerId0x30000: ; 0x0234B118 + ldr r1, _0234B12C ; =MESSAGE_LOG_INFO + orr r2, r0, #0x30000 + ldr r0, [r1, #4] + str r2, [r0, #0xce8] + bx lr + .align 2, 0 +_0234B12C: .word MESSAGE_LOG_INFO + arm_func_end SetMessageLogPreprocessorArgsSpeakerId0x30000 + + arm_func_start ov29_0234B130 +ov29_0234B130: ; 0x0234B130 + stmdb sp!, {r3, lr} + mov r3, #0 + ldr r1, _0234B1A0 ; =MESSAGE_LOG_INFO + mov r0, r3 +_0234B140: + ldr r2, [r1, #4] + add r2, r2, r3 + add r3, r3, #1 + strb r0, [r2, #0xc80] + cmp r3, #0xa + blt _0234B140 + ldr r1, _0234B1A0 ; =MESSAGE_LOG_INFO + mvn ip, #1 + ldr r3, [r1, #4] + mov r2, #1 + strb ip, [r3, #0xcec] + ldr r3, [r1, #4] + strb r0, [r3, #0xcee] + ldr r3, [r1, #4] + strb r0, [r3, #0xced] + str r0, [r1, #8] + strb r2, [r1] + bl ov29_0234B1A4 + ldr r0, _0234B1A0 ; =MESSAGE_LOG_INFO + ldr r0, [r0, #4] + add r0, r0, #0x9c + add r0, r0, #0xc00 + bl InitPreprocessorArgs + ldmia sp!, {r3, pc} + .align 2, 0 +_0234B1A0: .word MESSAGE_LOG_INFO + arm_func_end ov29_0234B130 + + arm_func_start ov29_0234B1A4 +ov29_0234B1A4: ; 0x0234B1A4 + stmdb sp!, {r4, lr} + mov r4, r0 + bl ov29_022E9FC0 + cmp r0, #0 + ldmeqia sp!, {r4, pc} + mov ip, #0 + ldr r2, _0234B24C ; =MESSAGE_LOG_INFO + mov r0, ip +_0234B1C4: + ldr r3, [r2, #4] + add r1, ip, ip, lsl #2 + add ip, ip, #1 + strb r0, [r3, r1, lsl #6] + cmp ip, #0xa + blt _0234B1C4 + ldr r2, _0234B24C ; =MESSAGE_LOG_INFO + mov r3, #4 + ldr r1, [r2, #4] + strb r0, [r1, #0xc8b] + ldr r1, [r2, #4] + add r1, r1, #0xc00 + strh r0, [r1, #0x8c] + ldr r1, [r2, #4] + add r1, r1, #0xc00 + strh r0, [r1, #0x8e] + ldr r1, [r2, #4] + add r1, r1, #0xc00 + strh r0, [r1, #0x90] + ldr r1, [r2, #4] + add r1, r1, #0xc00 + strh r3, [r1, #0x92] + ldr r1, [r2, #4] + str r0, [r1, #0xc98] + bl ov29_0234B768 + cmp r0, #0 + cmpne r4, #0 + ldmeqia sp!, {r4, pc} + mov r0, #0 + mov r1, r0 + bl ov29_022EA428 + mov r0, #0xb + bl AdvanceFrame + ldmia sp!, {r4, pc} + .align 2, 0 +_0234B24C: .word MESSAGE_LOG_INFO + arm_func_end ov29_0234B1A4 + + arm_func_start LogMessageByIdWithPopupCheckParticipants +LogMessageByIdWithPopupCheckParticipants: ; 0x0234B250 + stmdb sp!, {r3, lr} + ldr ip, _0234B290 ; =MESSAGE_LOG_INFO + cmp r1, #0 + ldr ip, [ip, #4] + ldrsh lr, [sp, #8] + add r3, ip, r3, lsl #2 + cmpne r0, #0 + str lr, [r3, #0xcac] + beq _0234B27C + bl LogMessageByIdWithPopupCheckUserTarget + ldmia sp!, {r3, pc} +_0234B27C: + cmp r0, #0 + ldmeqia sp!, {r3, pc} + mov r1, r2 + bl LogMessageByIdWithPopupCheckUser + ldmia sp!, {r3, pc} + .align 2, 0 +_0234B290: .word MESSAGE_LOG_INFO + arm_func_end LogMessageByIdWithPopupCheckParticipants + + arm_func_start WaitUntilAlertBoxTextIsLoadedWrapper +WaitUntilAlertBoxTextIsLoadedWrapper: ; 0x0234B294 + ldr ip, _0234B2A0 ; =WaitUntilAlertBoxTextIsLoaded + mov r0, #0x50 + bx ip + .align 2, 0 +_0234B2A0: .word WaitUntilAlertBoxTextIsLoaded + arm_func_end WaitUntilAlertBoxTextIsLoadedWrapper + + arm_func_start LogMessageByIdWithPopupCheckUser +LogMessageByIdWithPopupCheckUser: ; 0x0234B2A4 + stmdb sp!, {r4, r5, r6, lr} + mov r4, #0 + mov r6, r0 + mov r5, r1 + bl ShouldDisplayEntityWrapper + cmp r0, #0 + movne r4, #1 + cmp r4, #0 + ldmeqia sp!, {r4, r5, r6, pc} + mov r0, r5 + bl StringFromId + mov r1, r0 + mov r0, r6 + mov r2, #1 + bl LogMessage + ldmia sp!, {r4, r5, r6, pc} + arm_func_end LogMessageByIdWithPopupCheckUser + + arm_func_start LogMessageWithPopupCheckUser +LogMessageWithPopupCheckUser: ; 0x0234B2E4 + stmdb sp!, {r4, r5, r6, lr} + mov r4, #0 + mov r6, r0 + mov r5, r1 + bl ShouldDisplayEntityWrapper + cmp r0, #0 + movne r4, #1 + cmp r4, #0 + ldmeqia sp!, {r4, r5, r6, pc} + mov r0, r6 + mov r1, r5 + mov r2, #1 + bl LogMessage + ldmia sp!, {r4, r5, r6, pc} + arm_func_end LogMessageWithPopupCheckUser + + arm_func_start LogMessageByIdQuiet +LogMessageByIdQuiet: ; 0x0234B31C + stmdb sp!, {r4, lr} + mov r4, r0 + mov r0, r1 + bl StringFromId + mov r1, r0 + mov r0, r4 + mov r2, #0 + bl LogMessage + ldmia sp!, {r4, pc} + arm_func_end LogMessageByIdQuiet + + arm_func_start LogMessageQuiet +LogMessageQuiet: ; 0x0234B340 + ldr ip, _0234B34C ; =LogMessage + mov r2, #0 + bx ip + .align 2, 0 +_0234B34C: .word LogMessage + arm_func_end LogMessageQuiet + + arm_func_start LogMessageByIdWithPopupCheckUserTarget +LogMessageByIdWithPopupCheckUserTarget: ; 0x0234B350 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r6, r1 + mov r4, #0 + mov r7, r0 + mov r5, r2 + bl ShouldDisplayEntityWrapper + cmp r0, #0 + movne r4, #1 + mov r0, r6 + bl ShouldDisplayEntityWrapper + cmp r0, #0 + movne r4, #1 + cmp r4, #0 + ldmeqia sp!, {r3, r4, r5, r6, r7, pc} + mov r0, r5 + bl StringFromId + mov r1, r0 + mov r0, r7 + mov r2, #1 + bl LogMessage + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end LogMessageByIdWithPopupCheckUserTarget + + arm_func_start LogMessageWithPopupCheckUserTarget +LogMessageWithPopupCheckUserTarget: ; 0x0234B3A4 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r6, r1 + mov r4, #0 + mov r7, r0 + mov r5, r2 + bl ShouldDisplayEntityWrapper + cmp r0, #0 + movne r4, #1 + mov r0, r6 + bl ShouldDisplayEntityWrapper + cmp r0, #0 + movne r4, #1 + cmp r4, #0 + ldmeqia sp!, {r3, r4, r5, r6, r7, pc} + mov r0, r7 + mov r1, r5 + mov r2, #1 + bl LogMessage + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end LogMessageWithPopupCheckUserTarget + + arm_func_start LogMessageByIdQuietCheckUserTarget +LogMessageByIdQuietCheckUserTarget: ; 0x0234B3F0 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r6, r1 + mov r4, #0 + mov r7, r0 + mov r5, r2 + bl ShouldDisplayEntityWrapper + cmp r0, #0 + movne r4, #1 + mov r0, r6 + bl ShouldDisplayEntityWrapper + cmp r0, #0 + movne r4, #1 + cmp r4, #0 + ldmeqia sp!, {r3, r4, r5, r6, r7, pc} + mov r0, r5 + bl StringFromId + mov r1, r0 + mov r0, r7 + mov r2, #0 + bl LogMessage + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end LogMessageByIdQuietCheckUserTarget + + arm_func_start LogMessageByIdWithPopupCheckUserUnknown +LogMessageByIdWithPopupCheckUserUnknown: ; 0x0234B444 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + mov r6, r1 + mov r4, #0 + mov r7, r0 + mov r5, r2 + bl ShouldDisplayEntityWrapper + cmp r0, #0 + movne r4, #1 + mov r0, r6 + bl ov29_022E2CA0 + cmp r0, #0 + movne r4, #1 + cmp r4, #0 + ldmeqia sp!, {r3, r4, r5, r6, r7, pc} + mov r0, r5 + bl StringFromId + mov r1, r0 + mov r0, r7 + mov r2, #1 + bl LogMessage + ldmia sp!, {r3, r4, r5, r6, r7, pc} + arm_func_end LogMessageByIdWithPopupCheckUserUnknown + + arm_func_start LogMessageByIdWithPopup +LogMessageByIdWithPopup: ; 0x0234B498 + stmdb sp!, {r4, lr} + mov r4, r0 + mov r0, r1 + bl StringFromId + mov r1, r0 + mov r0, r4 + mov r2, #1 + bl LogMessage + ldmia sp!, {r4, pc} + arm_func_end LogMessageByIdWithPopup + + arm_func_start LogMessageWithPopup +LogMessageWithPopup: ; 0x0234B4BC + ldr ip, _0234B4C8 ; =LogMessage + mov r2, #1 + bx ip + .align 2, 0 +_0234B4C8: .word LogMessage + arm_func_end LogMessageWithPopup + + arm_func_start ov29_0234B4CC +ov29_0234B4CC: ; 0x0234B4CC + ldr r1, _0234B4DC ; =MESSAGE_LOG_INFO + ldr r1, [r1, #4] + strb r0, [r1, #0xc8a] + bx lr + .align 2, 0 +_0234B4DC: .word MESSAGE_LOG_INFO + arm_func_end ov29_0234B4CC + + arm_func_start ov29_0234B4E0 +ov29_0234B4E0: ; 0x0234B4E0 + ldr r0, _0234B4F0 ; =MESSAGE_LOG_INFO + ldr r0, [r0, #4] + ldrb r0, [r0, #0xc8b] + bx lr + .align 2, 0 +_0234B4F0: .word MESSAGE_LOG_INFO + arm_func_end ov29_0234B4E0 + + arm_func_start ov29_0234B4F4 +ov29_0234B4F4: ; 0x0234B4F4 + ldr r0, _0234B504 ; =MESSAGE_LOG_INFO + ldr r0, [r0, #4] + ldr r0, [r0, #0xc98] + bx lr + .align 2, 0 +_0234B504: .word MESSAGE_LOG_INFO + arm_func_end ov29_0234B4F4 + + arm_func_start LogMessage +LogMessage: ; 0x0234B508 +#ifdef EUROPE +#define LOG_MESSAGE_STACK_OFFSET 0xC0 +#else +#define LOG_MESSAGE_STACK_OFFSET 0 +#endif + stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr} + sub sp, sp, #0x284 + LOG_MESSAGE_STACK_OFFSET + ldr r4, _0234B708 ; =MESSAGE_LOG_INFO + mov fp, r2 + ldr r3, [r4, #4] + ldrb r2, [r3, #0xced] + cmp r2, #0 + ldreqb r2, [r3, #0xcee] + cmpeq r2, #0 + bne _0234B700 + ldr r3, _0234B70C ; =DUNGEON_PTR + mov r7, #0 + ldr r2, [r3] + mvn r5, #0 + add r2, r2, #0x100 + strh r5, [r2, #0xd8] + ldr r2, [r3] + mov r3, #0x400 + add r2, r2, #0x100 + strh r5, [r2, #0xda] + ldr r2, [r4, #8] + mov r8, r7 + cmp r2, r0 + movne sl, #1 + ldreqb sl, [r4] + ldr r2, _0234B708 ; =MESSAGE_LOG_INFO + mov r6, #1 + str r0, [r2, #8] + strb r7, [r2] + ldr r2, [r2, #4] + add r0, sp, #0x144 + add r2, r2, #0x9c + add r4, r2, #0xc00 + mov r2, r1 + mov r1, #0x140 + LOG_MESSAGE_STACK_OFFSET + str r4, [sp] + bl PreprocessString + ldr r4, _0234B708 ; =MESSAGE_LOG_INFO + add r5, sp, #0x144 +_0234B5A4: + ldr r0, [r4, #4] + add r1, r0, #0xc00 + ldrsh sb, [r1, #0x8c] + add r1, r0, #0xc00 + ldrsh r2, [r1, #0x8e] + add r3, sb, #1 + cmp r3, #0xa + moveq r3, #0 + cmp r3, r2 + bne _0234B5D8 + mov r0, #0 + bl AdvanceFrame + b _0234B5A4 +_0234B5D8: + ldrb r2, [r5, r8] + cmp r2, #0 + beq _0234B6D4 + add r0, r0, sb + strb sl, [r0, #0xc80] + ldr r1, [r4, #4] + add r0, sp, #4 + add r1, r1, #0x9c + add r1, r1, #0xc00 + str r1, [sp] + mov r1, #0x140 + add r2, r5, r8 + mov r3, #0x440 + bl PreprocessString + add r8, r8, r0 + ldrb sb, [r5, r8] + mov r2, #0 + add r1, sp, #4 + strb r2, [r1, r0] + cmp sb, #0 + beq _0234B660 + ldr r1, _0234B710 ; =ov29_02353214 + add r0, r5, r8 + mov r2, #3 + bl strncmp + cmp r0, #0 + bne _0234B654 + ldr r0, _0234B710 ; =ov29_02353214 + bl strlen + add r8, r8, r0 + b _0234B660 +_0234B654: + cmp sb, #0xd + cmpne sb, #0xa + addeq r8, r8, #1 +_0234B660: + add r0, sp, #4 + mov r1, sl + mov r2, r6 + bl ov29_0234BB44 + mov sl, #0 + cmp fp, #0 + mov r6, sl + beq _0234B5A4 + ldr sb, [r4, #4] + mov r2, #0x140 + add r0, sb, #0xc00 + ldrsh r3, [r0, #0x8c] + mov r0, r2 + add r1, sp, #4 + smlabb r0, r3, r0, sb + mov r7, #1 + bl strncpy + ldr r0, [r4, #4] + add r0, r0, #0xc00 + ldrsh r1, [r0, #0x8c] + add r1, r1, #1 + strh r1, [r0, #0x8c] + ldr r0, [r4, #4] + add r1, r0, #0xc00 + ldrsh r0, [r1, #0x8c] + cmp r0, #0xa + moveq r0, sl + streqh r0, [r1, #0x8c] + b _0234B5A4 +_0234B6D4: + cmp r7, #0 + beq _0234B700 + ldr r0, _0234B708 ; =MESSAGE_LOG_INFO + mov r2, #0xf0 + strh r2, [r1, #0x90] + ldr r1, [r0, #4] + ldr r0, [r1, #0xc98] + cmp r0, #0 + moveq r0, #1 + streq r0, [r1, #0xc98] + bl ov29_022F2FE4 +_0234B700: + add sp, sp, #0x284 + LOG_MESSAGE_STACK_OFFSET + ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_0234B708: .word MESSAGE_LOG_INFO +_0234B70C: .word DUNGEON_PTR +_0234B710: .word ov29_02353214 + arm_func_end LogMessage + + arm_func_start LogMessageById +LogMessageById: ; 0x0234B714 + stmdb sp!, {r3, r4, r5, lr} + mov r5, r0 + mov r4, r2 + mov r0, r1 + bl StringFromId + mov r1, r0 + mov r0, r5 + mov r2, r4 + bl LogMessage + ldmia sp!, {r3, r4, r5, pc} + arm_func_end LogMessageById + + arm_func_start ov29_0234B73C +ov29_0234B73C: ; 0x0234B73C + ldr r0, _0234B764 ; =MESSAGE_LOG_INFO + mvn r1, #1 + ldr r0, [r0, #4] + add r0, r0, #0xc00 + ldrsb r0, [r0, #0xec] + cmp r0, r1 + movne r0, #1 + moveq r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_0234B764: .word MESSAGE_LOG_INFO + arm_func_end ov29_0234B73C + + arm_func_start ov29_0234B768 +ov29_0234B768: ; 0x0234B768 + stmdb sp!, {r3, lr} + ldr r0, _0234B7E8 ; =MESSAGE_LOG_INFO + mvn r1, #1 + ldr r0, [r0, #4] + add r0, r0, #0xc00 + ldrsb r0, [r0, #0xec] + cmp r0, r1 + movne r1, #1 + moveq r1, #0 + tst r1, #0xff + moveq r0, #0 + ldmeqia sp!, {r3, pc} + bl sub_0202836C + ldr r0, _0234B7E8 ; =MESSAGE_LOG_INFO + ldr r0, [r0, #4] + add r0, r0, #0xc00 + ldrsb r0, [r0, #0xec] + bl sub_02030214 + ldr r0, _0234B7E8 ; =MESSAGE_LOG_INFO + ldr r0, [r0, #4] + add r0, r0, #0xc00 + ldrsb r0, [r0, #0xec] + bl CloseAlertBox + ldr r0, _0234B7E8 ; =MESSAGE_LOG_INFO + mvn r3, #1 + ldr r1, [r0, #4] + mov r2, #0 + strb r3, [r1, #0xcec] + ldr r1, [r0, #4] + mov r0, #1 + str r2, [r1, #0xc98] + ldmia sp!, {r3, pc} + .align 2, 0 +_0234B7E8: .word MESSAGE_LOG_INFO + arm_func_end ov29_0234B768 + + arm_func_start AlertBoxIsScrolling +AlertBoxIsScrolling: ; 0x0234B7EC + stmdb sp!, {r3, lr} + ldr r0, _0234B850 ; =MESSAGE_LOG_INFO + mvn r1, #1 + ldr r0, [r0, #4] + add r0, r0, #0xc00 + ldrsb r0, [r0, #0xec] + cmp r0, r1 + movne r1, #1 + moveq r1, #0 + tst r1, #0xff + moveq r0, #0 + ldmeqia sp!, {r3, pc} + ldr r1, _0234B850 ; =MESSAGE_LOG_INFO + ldr r1, [r1, #4] + add r1, r1, #0xc00 + ldrsh r2, [r1, #0x8c] + ldrsh r1, [r1, #0x8e] + cmp r2, r1 + bne _0234B848 + bl IsAlertBoxActive + cmp r0, #0 + moveq r0, #0 + ldmeqia sp!, {r3, pc} +_0234B848: + mov r0, #1 + ldmia sp!, {r3, pc} + .align 2, 0 +_0234B850: .word MESSAGE_LOG_INFO + arm_func_end AlertBoxIsScrolling + + arm_func_start ov29_0234B854 +ov29_0234B854: ; 0x0234B854 + stmdb sp!, {r3, r4, r5, lr} + ldr r0, _0234BA14 ; =MESSAGE_LOG_INFO + ldr r1, [r0, #4] + cmp r1, #0 + ldmeqia sp!, {r3, r4, r5, pc} + ldrb r0, [r1, #0xced] + cmp r0, #0 + movne r0, #0 + strne r0, [r1, #0xc98] + ldr r0, _0234BA14 ; =MESSAGE_LOG_INFO + ldr r4, [r0, #4] + ldr r0, [r4, #0xc98] + cmp r0, #0 + beq _0234B9C8 + cmp r0, #1 + beq _0234B8A0 + cmp r0, #2 + beq _0234B908 + b _0234B9C8 +_0234B8A0: + bl ov10_022BFD20 + cmp r0, #0 + bne _0234B9C8 +#ifndef JAPAN + bl sub_02001808 + cmp r0, #0x3000 + blt _0234B9C8 +#endif + ldr r0, _0234BA14 ; =MESSAGE_LOG_INFO + mvn r1, #1 + ldr r0, [r0, #4] + add r0, r0, #0xc00 + ldrsb r0, [r0, #0xec] + cmp r0, r1 + movne r0, #1 + moveq r0, #0 + tst r0, #0xff + bne _0234B900 + mov r0, #0 + bl CreateAlertBox + ldr r1, _0234BA14 ; =MESSAGE_LOG_INFO + mov r2, #0 + ldr r3, [r1, #4] + strb r0, [r3, #0xcec] + ldr r0, [r1, #4] + str r2, [r0, #0xce8] +_0234B900: + mov r0, #2 + str r0, [r4, #0xc98] +_0234B908: + ldr r0, _0234BA14 ; =MESSAGE_LOG_INFO + mvn r2, #1 + ldr r1, [r0, #4] + add r0, r1, #0xc00 + ldrsb r0, [r0, #0xec] + cmp r0, r2 + movne r2, #1 + moveq r2, #0 + tst r2, #0xff + moveq r0, #1 + beq _0234B9BC + ldr r3, _0234BA14 ; =MESSAGE_LOG_INFO + mov r2, #0x140 + ldr r5, [r3, #4] + add r3, r5, #0xc00 + ldrsh ip, [r3, #0x8e] + ldrsh r3, [r3, #0x8c] + smulbb lr, ip, r2 + cmp r3, ip + bne _0234B96C + bl AlertBoxIsScrolling + cmp r0, #0 + bne _0234B9B8 + mov r0, #1 + b _0234B9BC +_0234B96C: + add r2, r5, ip + ldrb ip, [r2, #0xc80] + add r1, r1, #0x9c + add r3, r1, #0xc00 + add r2, r5, lr + mov r1, #0x400 + str ip, [sp] + bl AddMessageToAlertBox + cmp r0, #0 + moveq r0, #0 + beq _0234B9BC + add r0, r5, #0xc00 + ldrsh r1, [r0, #0x8e] + add r1, r1, #1 + strh r1, [r0, #0x8e] + ldrsh r1, [r0, #0x8e] + cmp r1, #0xa + moveq r1, #0 + streqh r1, [r0, #0x8e] +_0234B9B8: + mov r0, #0 +_0234B9BC: + cmp r0, #0 + movne r0, #0 + strne r0, [r4, #0xc98] +_0234B9C8: + ldrb r0, [r4, #0xc8a] + cmp r0, #0 + ldmneia sp!, {r3, r4, r5, pc} + add r0, r4, #0xc00 + ldrsh r1, [r0, #0x90] + cmp r1, #0 + ldmeqia sp!, {r3, r4, r5, pc} + sub r1, r1, #1 + strh r1, [r0, #0x90] + ldrsh r0, [r0, #0x90] + cmp r0, #0 + ldmneia sp!, {r3, r4, r5, pc} + mov r0, #0 + str r0, [r4, #0xc98] + bl ov29_0234B768 + mov r0, #0 + mov r1, r0 + bl ov29_022EA428 + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_0234BA14: .word MESSAGE_LOG_INFO + arm_func_end ov29_0234B854 + + arm_func_start WaitUntilAlertBoxTextIsLoaded +WaitUntilAlertBoxTextIsLoaded: ; 0x0234BA18 + stmdb sp!, {r3, r4, r5, lr} + ldr r1, _0234BA50 ; =MESSAGE_LOG_INFO + mov r5, r0 + ldr r4, [r1, #4] +_0234BA28: + ldr r0, [r4, #0xc98] + cmp r0, #0 + bne _0234BA40 + bl AlertBoxIsScrolling + cmp r0, #0 + ldmeqia sp!, {r3, r4, r5, pc} +_0234BA40: + mov r0, r5 + bl AdvanceFrame + b _0234BA28 +_0234BA4C: + ldmia sp!, {r3, r4, r5, pc} + .align 2, 0 +_0234BA50: .word MESSAGE_LOG_INFO + arm_func_end WaitUntilAlertBoxTextIsLoaded + + arm_func_start ov29_0234BA54 +ov29_0234BA54: ; 0x0234BA54 + stmdb sp!, {r3, r4, r5, r6, r7, lr} + ldr r1, _0234BAB8 ; =MESSAGE_LOG_INFO + mov r5, r0 + ldr r6, [r1, #4] + bl WaitUntilAlertBoxTextIsLoaded + mov r4, #0 + add r6, r6, #0xc00 + ldr r7, _0234BABC ; =ov29_0237C694 + b _0234BAAC +_0234BA78: + ldrsh r0, [r6, #0x90] + cmp r0, #0xb4 + ldmltia sp!, {r3, r4, r5, r6, r7, pc} + ldrh r0, [r7] + and r0, r0, #3 + cmp r0, #3 + ldmeqia sp!, {r3, r4, r5, r6, r7, pc} + ldrh r0, [r7, #2] + tst r0, #0xf0 + ldmneia sp!, {r3, r4, r5, r6, r7, pc} + mov r0, r5 + bl AdvanceFrame + add r4, r4, #1 +_0234BAAC: + cmp r4, #0xf0 + blt _0234BA78 + ldmia sp!, {r3, r4, r5, r6, r7, pc} + .align 2, 0 +_0234BAB8: .word MESSAGE_LOG_INFO +_0234BABC: .word ov29_0237C694 + arm_func_end ov29_0234BA54 + + arm_func_start InitPortraitDungeon +InitPortraitDungeon: ; 0x0234BAC0 + stmdb sp!, {r4, r5, r6, lr} + mov r6, r0 + mov r5, r1 + mov r4, r2 + bl InitPortraitParams + strh r5, [r6] + strb r4, [r6, #2] + mov r2, #0 + strb r2, [r6, #3] + mov r0, #2 + str r0, [r6, #4] + mov r0, #9 + str r0, [r6, #8] + strb r2, [r6, #0xc] + strb r2, [r6, #0xd] + mov r0, r6 + mov r1, #1 + strb r2, [r6, #0xe] + bl AllowPortraitDefault + ldmia sp!, {r4, r5, r6, pc} + arm_func_end InitPortraitDungeon + + arm_func_start ov29_0234BB10 +ov29_0234BB10: ; 0x0234BB10 + ldr ip, _0234BB1C ; =sub_02047FFC + mov r0, #0 + bx ip + .align 2, 0 +_0234BB1C: .word sub_02047FFC + arm_func_end ov29_0234BB10 + + arm_func_start ov29_0234BB20 +ov29_0234BB20: ; 0x0234BB20 + ldr ip, _0234BB28 ; =sub_0204804C + bx ip + .align 2, 0 +_0234BB28: .word sub_0204804C + arm_func_end ov29_0234BB20 + + arm_func_start ov29_0234BB2C +ov29_0234BB2C: ; 0x0234BB2C + ldr ip, _0234BB34 ; =sub_020480CC + bx ip + .align 2, 0 +_0234BB34: .word sub_020480CC + arm_func_end ov29_0234BB2C + + arm_func_start ov29_0234BB38 +ov29_0234BB38: ; 0x0234BB38 + ldr ip, _0234BB40 ; =sub_02048134 + bx ip + .align 2, 0 +_0234BB40: .word sub_02048134 + arm_func_end ov29_0234BB38 + + arm_func_start ov29_0234BB44 +ov29_0234BB44: ; 0x0234BB44 + ldr ip, _0234BB4C ; =sub_02048150 + bx ip + .align 2, 0 +_0234BB4C: .word sub_02048150 + arm_func_end ov29_0234BB44 + + arm_func_start ov29_0234BB50 +ov29_0234BB50: ; 0x0234BB50 + ldr ip, _0234BB58 ; =sub_02048240 + bx ip + .align 2, 0 +_0234BB58: .word sub_02048240 + arm_func_end ov29_0234BB50 + + arm_func_start OpenMessageLog +OpenMessageLog: ; 0x0234BB5C + stmdb sp!, {r4, r5, r6, lr} + mov r4, r0 + mov r6, r1 + mov r0, #6 + mov r1, #0 + bl ov29_022EA428 + cmp r4, #0 + bne _0234BB84 + mov r0, #0 + bl ov29_0233A248 +_0234BB84: + mov r0, #0x62 + bl AdvanceFrame + mov r0, #0x62 + bl AdvanceFrame + bl sub_0204833C + mov r4, #0x62 +_0234BB9C: + mov r0, r4 + bl AdvanceFrame + bl sub_02048360 + movs r5, r0 + beq _0234BB9C + mov r0, #0x62 + bl AdvanceFrame + cmp r6, #0 + beq _0234BBCC + mov r0, #0 + mov r1, r0 + bl ov29_022EA428 +_0234BBCC: + cmp r5, #1 + moveq r0, #1 + movne r0, #0 + ldmia sp!, {r4, r5, r6, pc} + arm_func_end OpenMessageLog + + arm_func_start ov29_0234BBDC +ov29_0234BBDC: ; 0x0234BBDC + ldr ip, _0234BBE4 ; =ov29_022E0B60 + bx ip + .align 2, 0 +_0234BBE4: .word ov29_022E0B60 + arm_func_end ov29_0234BBDC diff --git a/include/overlay_29_022FBA54.h b/include/overlay_29_022FBA54.h new file mode 100644 index 00000000..d49d9f61 --- /dev/null +++ b/include/overlay_29_022FBA54.h @@ -0,0 +1,9 @@ +#ifndef PMDSKY_OVERLAY_29_022FBA54_H +#define PMDSKY_OVERLAY_29_022FBA54_H + +#include "dungeon_mode.h" + +s16 FindMoveOnMonster(struct entity* entity, enum move_id move_id); +bool8 DoesMonsterHaveMove(struct entity* entity, enum move_id move_id); + +#endif //PMDSKY_OVERLAY_29_022FBA54_H diff --git a/include/overlay_29_022FBBEC.h b/include/overlay_29_022FBBEC.h new file mode 100644 index 00000000..d8361e5d --- /dev/null +++ b/include/overlay_29_022FBBEC.h @@ -0,0 +1,8 @@ +#ifndef PMDSKY_OVERLAY_29_022FBBEC_H +#define PMDSKY_OVERLAY_29_022FBBEC_H + +#include "dungeon_mode.h" + +struct entity* FindMonsterWithBehavior(enum monster_behavior monster_behavior); + +#endif //PMDSKY_OVERLAY_29_022FBBEC_H diff --git a/include/overlay_29_0234AEA4.h b/include/overlay_29_0234AEA4.h new file mode 100644 index 00000000..7177d6fc --- /dev/null +++ b/include/overlay_29_0234AEA4.h @@ -0,0 +1,6 @@ +#ifndef PMDSKY_OVERLAY_29_0234AEA4_H +#define PMDSKY_OVERLAY_29_0234AEA4_H + +void TeleportFleeingOutlaw(); + +#endif //PMDSKY_OVERLAY_29_0234AEA4_H diff --git a/include/special_move_types.h b/include/special_move_types.h index 0e56cb1e..d98803ad 100644 --- a/include/special_move_types.h +++ b/include/special_move_types.h @@ -7,5 +7,6 @@ const struct natural_gift_item_info* GetEntityNaturalGiftInfo(struct entity* entity); // Gets the current Weather Ball type for the given entity, based on the apparent weather. enum type_id GetEntityWeatherBallType(struct entity* entity); +void UseMoveByMoveId(struct entity *entity, enum move_id move_id, bool8 add_move_if_not_exists); #endif //PMDSKY_SPECIAL_MOVE_TYPES_H diff --git a/main.lsf b/main.lsf index 235a35ea..9e8e19d1 100644 --- a/main.lsf +++ b/main.lsf @@ -454,8 +454,12 @@ Overlay OVY_29 Object src/overlay_29_022FB538.o Object src/dungeon_logic_4.o Object asm/overlay_29_022FB678.o + Object src/overlay_29_022FBA54.o + Object asm/overlay_29_022FBA70.o Object src/joined_at_checks.o Object asm/overlay_29_022FBB1C.o + Object src/overlay_29_022FBBEC.o + Object asm/overlay_29_022FBC4C.o Object src/dungeon_logic_7.o Object asm/overlay_29_022FBE58.o Object src/overlay_29_022FC99C.o @@ -573,7 +577,7 @@ Overlay OVY_29 Object src/overlay_29_0231ACAC.o Object asm/overlay_29_0231AD38.o Object src/special_move_types.o - Object asm/overlay_29_0231AF24.o + Object asm/overlay_29_0231AFB4.o Object src/overlay_29_0231B194.o Object asm/overlay_29_0231B1B8.o Object src/overlay_29_0231B318.o @@ -659,6 +663,8 @@ Overlay OVY_29 Object asm/overlay_29_02348D3C.o Object src/overlay_29_0234987C.o Object asm/overlay_29_023498A0.o + Object src/overlay_29_0234AEA4.o + Object asm/overlay_29_0234AEE8.o Object src/overlay_29_0234BBE8.o Object asm/overlay_29_0234BEE0.o Object src/overlay_29_0234CA68.o diff --git a/src/overlay_29_022FBA54.c b/src/overlay_29_022FBA54.c new file mode 100644 index 00000000..cdc1f438 --- /dev/null +++ b/src/overlay_29_022FBA54.c @@ -0,0 +1,23 @@ +#include "overlay_29_022FBA54.h" +#include "dungeon_util_static.h" +#include "overlay_29_022F9720.h" + +s16 FindMoveOnMonster(struct entity* entity, enum move_id move_id) +{ + if (IsMonster__022F9720(entity)) + { + struct monster *monster = GetEntInfo(entity); + for (s16 i = 0; i < MAX_MON_MOVES; i++) + { + struct move *move = &monster->moves.moves[i]; + if (MoveExists(move) && move->id == move_id) + return i; + } + } + return -1; +} + +bool8 DoesMonsterHaveMove(struct entity* entity, enum move_id move_id) +{ + return FindMoveOnMonster(entity, move_id) >= 0; +} diff --git a/src/overlay_29_022FBBEC.c b/src/overlay_29_022FBBEC.c new file mode 100644 index 00000000..c904f793 --- /dev/null +++ b/src/overlay_29_022FBBEC.c @@ -0,0 +1,15 @@ +#include "overlay_29_022FBBEC.h" +#include "dungeon.h" +#include "dungeon_util_static.h" +#include "overlay_29_022F7364.h" + +struct entity* FindMonsterWithBehavior(enum monster_behavior monster_behavior) +{ + for (s32 i = 0; i < DUNGEON_MAX_POKEMON; i++) + { + struct entity *entity = DUNGEON_PTR[0]->active_monster_ptrs[i]; + if (EntityIsValid__022F7364(entity) && monster_behavior == GetEntInfo(entity)->monster_behavior) + return entity; + } + return NULL; +} diff --git a/src/overlay_29_0234AEA4.c b/src/overlay_29_0234AEA4.c new file mode 100644 index 00000000..378f6704 --- /dev/null +++ b/src/overlay_29_0234AEA4.c @@ -0,0 +1,12 @@ +#include "overlay_29_0234AEA4.h" +#include "overlay_29_022FA430.h" +#include "overlay_29_022FBA54.h" +#include "overlay_29_022FBBEC.h" +#include "special_move_types.h" + +void TeleportFleeingOutlaw() +{ + struct entity *entity = FindMonsterWithBehavior(BEHAVIOR_FLEEING_OUTLAW); + if (!ShouldMonsterHeadToStairs(entity) && DoesMonsterHaveMove(entity, MOVE_TELEPORT)) + UseMoveByMoveId(entity, MOVE_TELEPORT, 0); +} diff --git a/src/special_move_types.c b/src/special_move_types.c index 751e794c..2d00ecac 100644 --- a/src/special_move_types.c +++ b/src/special_move_types.c @@ -1,10 +1,14 @@ #include "special_move_types.h" +#include "dungeon_action_helper.h" #include "dungeon_parameters_2.h" #include "dungeon_util_static.h" #include "natural_gift_data.h" #include "overlay_29_0231A9D4.h" +#include "overlay_29_022FBA54.h" #include "weather.h" +extern void UseMove(struct entity*, s16, s32, s32, s32); + const struct natural_gift_item_info* GetEntityNaturalGiftInfo(struct entity* entity) { if (IsMonster__0231A9D4(entity)) { @@ -38,3 +42,22 @@ enum type_id GetEntityWeatherBallType(struct entity* entity) { return WEATHER_BALL_TYPE_TABLE[GetApparentWeather(entity)]; } + +void UseMoveByMoveId(struct entity *entity, enum move_id move_id, bool8 add_move_if_not_exists) +{ + if (!IsMonster__0231A9D4(entity)) + return; + + s16 move_index = FindMoveOnMonster(entity, move_id); + if (add_move_if_not_exists && move_index < 0) { + struct monster *monster = GetEntInfo(entity); + SetActionUseMoveAi(&monster->action, 0, DIR_DOWN); + monster->moves.moves[0].flags0 = MOVE_FLAG_EXISTS; + monster->moves.moves[0].flags2 = 0; + monster->moves.moves[0].id = move_id; + monster->moves.moves[0].pp = 1; + monster->moves.moves[0].ginseng = 0; + move_index = 0; + } + UseMove(entity, move_index, 1, 0, 0); +} From 4aa593bf636d517f211dacea13a7b5739ea7fd47 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Sat, 31 Jan 2026 22:43:34 -0500 Subject: [PATCH 3/3] Renamed IsMonsterCornered --- include/dungeon_capabilities_4.h | 2 +- src/dungeon_ai_itcm.c | 4 ++-- src/dungeon_capabilities_4.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/dungeon_capabilities_4.h b/include/dungeon_capabilities_4.h index 013cd5bf..c9d1edbd 100644 --- a/include/dungeon_capabilities_4.h +++ b/include/dungeon_capabilities_4.h @@ -4,7 +4,7 @@ #include "dungeon_mode.h" // True if the given monster is cornered (it can't move in any direction) -bool8 IsMonsterCornered(struct entity *monster); +bool8 CanMonsterMoveOrSwapWithAllyInAnyDirection(struct entity *monster); // Checks if the given monster can move in the specified direction. Includes if an allied or neutral monster is standing on an adjacent tile, as the monsters can swap places. // Returns false if an enemy monster is standing on the target tile bool8 CanMonsterMoveOrSwapWithAllyInDirection(struct entity *monster, s32 direction); diff --git a/src/dungeon_ai_itcm.c b/src/dungeon_ai_itcm.c index 42b43559..98883382 100644 --- a/src/dungeon_ai_itcm.c +++ b/src/dungeon_ai_itcm.c @@ -38,7 +38,7 @@ void ChooseAiMove(struct entity *monster) if (!AreMovesEnabled(DUNGEON_PTR[0]->gen_info.fixed_room_id) || MonsterCannotAttack(monster, FALSE) || ShouldMonsterRunAwayAndShowEffect(monster, TRUE) || - GetEntInfo(monster)->monster_behavior == BEHAVIOR_FLEEING_OUTLAW && IsMonsterCornered(monster) || + GetEntInfo(monster)->monster_behavior == BEHAVIOR_FLEEING_OUTLAW && CanMonsterMoveOrSwapWithAllyInAnyDirection(monster) || IsTacticSet(monster, TACTIC_KEEP_YOUR_DISTANCE) || (pokemon_info->cringe_class_status.cringe == STATUS_CRINGE_CONFUSED && DungeonRandOutcome__022EAB20(AI_CONFUSED_NO_ATTACK_CHANCE))) return; @@ -327,7 +327,7 @@ asm void ChooseAiMove(struct entity *monster) cmp r0, #3 bne _01FFB6CC mov r0, r10 - bl IsMonsterCornered + bl CanMonsterMoveOrSwapWithAllyInAnyDirection cmp r0, #0 bne _01FFBD0C _01FFB6CC: diff --git a/src/dungeon_capabilities_4.c b/src/dungeon_capabilities_4.c index 8f61b2cd..1ad90b87 100644 --- a/src/dungeon_capabilities_4.c +++ b/src/dungeon_capabilities_4.c @@ -16,7 +16,7 @@ #include "secondary_terrain_types.h" #include "targeting.h" -bool8 IsMonsterCornered(struct entity *monster) +bool8 CanMonsterMoveOrSwapWithAllyInAnyDirection(struct entity *monster) { for (u8 i = 0; i < NUM_DIRECTIONS; i++) {