diff --git a/asm/include/main_02054C24.inc b/asm/include/main_02054C24.inc index 19f609b3..54b8ff44 100644 --- a/asm/include/main_02054C24.inc +++ b/asm/include/main_02054C24.inc @@ -202,6 +202,7 @@ .public CloseCollectionMenu .public ClosePortraitBox .public Copy16BitsFrom +.public CopyAndInterleaveWrapper .public CopyBitsFrom .public CopyBitsTo .public CopyMovesetFrom @@ -466,7 +467,6 @@ .public sub_0201B43C .public sub_0201B9F8 .public sub_0201BB3C -.public sub_0201BFF0 .public sub_0201CF5C .public sub_0201D12C .public sub_0201D7A8 diff --git a/asm/include/overlay_29_022DEADC.inc b/asm/include/overlay_29_022DEADC.inc index 9bf08555..8d3ccee3 100644 --- a/asm/include/overlay_29_022DEADC.inc +++ b/asm/include/overlay_29_022DEADC.inc @@ -50,6 +50,7 @@ .public LEADER_PTR .public LoadMappaFileAttributes .public LoadScriptVariableValue +.public LoadWeather3DFiles .public MemZero .public OpenFixedBin .public ov10_022BDAB0 @@ -154,7 +155,6 @@ .public ov29_0233785C .public ov29_0233845C .public ov29_0233873C -.public ov29_023388B0 .public ov29_023389C4 .public ov29_02338A4C .public ov29_02338D30 diff --git a/asm/include/overlay_29_022E0378.inc b/asm/include/overlay_29_022E0378.inc index 4a627ead..1ed24290 100644 --- a/asm/include/overlay_29_022E0378.inc +++ b/asm/include/overlay_29_022E0378.inc @@ -4,6 +4,7 @@ .public _020AFC70 .public AnimationDelayOrSomething .public CalcSpeedStageWrapper +.public CopyAndInterleaveWrapper .public DirectoryFileMngr_OpenDirectoryFile .public DisplayMessage2 .public DUNGEON_PTR @@ -84,7 +85,6 @@ .public sub_02009454 .public sub_020094C4 .public sub_0201B43C -.public sub_0201BFF0 .public sub_0201E380 .public sub_0201F598 .public sub_0204AE80 diff --git a/asm/include/overlay_29_022E9618.inc b/asm/include/overlay_29_022E9618.inc index a1688bb0..97407486 100644 --- a/asm/include/overlay_29_022E9618.inc +++ b/asm/include/overlay_29_022E9618.inc @@ -12,6 +12,7 @@ .public DUNGEON_PTR .public DungeonRandInt .public EntityIsValid__022E95F4 +.public FlashLeaderIcon .public GetLeader .public GetTile .public GetTreatmentBetweenMonsters @@ -30,8 +31,6 @@ .public ov29_022ED800 .public ov29_0230473C .public ov29_02335F40 -.public ov29_02338AC4 -.public ov29_02339A24 .public ov29_02339FF4 .public ov29_0233A248 .public ov29_0234B1A4 @@ -48,6 +47,7 @@ .public ov29_0237C694 .public ov29_0237C850 .public ov29_0237C888 +.public RenderWeather3D .public sub_0201BAC8 .public sub_0204AEA0 .public sub_0204AEC0 diff --git a/asm/include/overlay_29_02322DDC.inc b/asm/include/overlay_29_02322DDC.inc index 703cf89a..246c8c69 100644 --- a/asm/include/overlay_29_02322DDC.inc +++ b/asm/include/overlay_29_02322DDC.inc @@ -1,15 +1,16 @@ #pragma once +.public _s32_div_f .public AbilityIsActiveVeneer .public AdvanceFrame .public AnimationDelayOrSomething +.public DefenderAbilityIsActive__02322D64 .public DETECT_BAND_MOVE_ACCURACY_DROP .public DIRECTIONS_XY .public DUNGEON_PTR -.public DefenderAbilityIsActive__02322D64 .public DungeonRandInt .public DungeonRandRange -.public EXCL_ITEM_EFFECTS_EVASION_BOOST .public EntityIsValid__02321438 +.public EXCL_ITEM_EFFECTS_EVASION_BOOST .public ExclusiveItemEffectFlagTest .public ExecuteMoveEffect .public FormatMoveStringMore @@ -31,13 +32,6 @@ .public MALE_ACCURACY_STAGE_MULTIPLIERS .public MALE_EVASION_STAGE_MULTIPLIERS .public MoveIsNotPhysical -.public PlayMoveAnimation -.public PositionHasMonster -.public QUICK_DODGER_MOVE_ACCURACY_DROP -.public ShouldDisplayEntityWrapper -.public TWO_TURN_MOVES_AND_STATUSES -.public TwoTurnMoveForcedMiss -.public _s32_div_f .public ov10_022BDE50 .public ov10_022BE9E8 .public ov10_022BEB2C @@ -65,6 +59,12 @@ .public ov29_02352A6C .public ov29_02352A8C .public ov29_0235370C +.public PlayMoveAnimation +.public PositionHasMonster +.public QUICK_DODGER_MOVE_ACCURACY_DROP +.public ShouldDisplayEntityWrapper .public sub_020018D0 .public sub_02001980 .public sub_0201CF90 +.public TWO_TURN_MOVES_AND_STATUSES +.public TwoTurnMoveForcedMiss diff --git a/asm/include/overlay_29_02324698.inc b/asm/include/overlay_29_02324698.inc index 04de7879..06495818 100644 --- a/asm/include/overlay_29_02324698.inc +++ b/asm/include/overlay_29_02324698.inc @@ -4,8 +4,8 @@ .public AnimationDelayOrSomething .public AnimationHasMoreFrames .public ChangeMonsterAnimation -.public DUNGEON_PTR .public DefenderAbilityIsActive__02322D64 +.public DUNGEON_PTR .public DungeonRandInt .public DungeonRandOutcome__022EAB50 .public EntityIsValid__02321438 @@ -23,10 +23,6 @@ .public IsFloorOver .public LogMessageByIdWithPopupCheckUser .public NATURE_POWER_TABLE -.public SetAndLoadCurrentAttackAnimation -.public ShouldDisplayEntityAdvanced -.public ShouldMovePlayAlternativeAnimation -.public WanTableSpriteHasAnimationGroup .public ov10_022BF01C .public ov10_022BF0F4 .public ov10_022BF1FC @@ -54,5 +50,9 @@ .public ov29_02352AD8 .public ov29_02352B1C .public ov29_0237CA84 +.public SetAndLoadCurrentAttackAnimation +.public ShouldDisplayEntityAdvanced +.public ShouldMovePlayAlternativeAnimation .public sub_0201CF90 .public sub_0201D1D4 +.public WanTableSpriteHasAnimationGroup diff --git a/asm/include/overlay_29_0234EC38.inc b/asm/include/overlay_29_0234EC38.inc index 43c834e2..87069308 100644 --- a/asm/include/overlay_29_0234EC38.inc +++ b/asm/include/overlay_29_0234EC38.inc @@ -10,9 +10,9 @@ .public CreateAdvancedTextBoxWithArg .public CreateParentMenuFromStringIds .public CreateTextBox -.public DUNGEON_PTR .public DisplayMessage .public DrawTextInWindow +.public DUNGEON_PTR .public DungeonGoesUp .public DungeonRequestsDoneWrapper .public EntityIsValid__0234EC14 @@ -32,13 +32,6 @@ .public MemFree .public MemZero .public OpenMessageLog -.public PreprocessString -.public SetAdvancedTextBoxField0x1C2 -.public ShowKeyboard -.public StoryRestrictionsEnabled -.public StringFromId -.public StrncpySimple -.public StrncpySimpleNoPadSafe .public ov29_022E8708 .public ov29_022E8768 .public ov29_022E87DC @@ -89,6 +82,13 @@ .public ov31_02388714 .public ov31_02388E88 .public ov31_0238941C +.public PreprocessString +.public SetAdvancedTextBoxField0x1C2 +.public ShowKeyboard +.public StoryRestrictionsEnabled +.public StringFromId +.public StrncpySimple +.public StrncpySimpleNoPadSafe .public sub_0200B3D4 .public sub_020282F4 .public sub_0202AB80 diff --git a/asm/main_0200ED1C.s b/asm/main_0200ED1C.s index a27fe5bd..0c250689 100644 --- a/asm/main_0200ED1C.s +++ b/asm/main_0200ED1C.s @@ -17102,14 +17102,14 @@ sub_0201BFAC: ; 0x0201BFAC _0201BFEC: .word _020AFC4C arm_func_end sub_0201BFAC - arm_func_start sub_0201BFF0 -sub_0201BFF0: ; 0x0201BFF0 + arm_func_start CopyAndInterleaveWrapper +CopyAndInterleaveWrapper: ; 0x0201BFF0 ldr ip, _0201BFFC ; =CopyAndInterleave mov r2, r2, asr #1 bx ip .align 2, 0 _0201BFFC: .word CopyAndInterleave - arm_func_end sub_0201BFF0 + arm_func_end CopyAndInterleaveWrapper arm_func_start sub_0201C000 sub_0201C000: ; 0x0201C000 diff --git a/asm/main_02054C24.s b/asm/main_02054C24.s index aaf0ff6a..0b49fb6d 100644 --- a/asm/main_02054C24.s +++ b/asm/main_02054C24.s @@ -4808,7 +4808,7 @@ sub_0205882C: ; 0x0205882C add r1, r5, #4 mov r2, #0x40 mov r3, #9 - bl sub_0201BFF0 + bl CopyAndInterleaveWrapper add r0, r4, #1 mov r0, r0, lsl #0x10 mov r0, r0, asr #0x10 @@ -4817,7 +4817,7 @@ sub_0205882C: ; 0x0205882C add r1, r5, #0x24 mov r2, #0x80 mov r3, #9 - bl sub_0201BFF0 + bl CopyAndInterleaveWrapper add r0, r4, #2 mov r0, r0, lsl #0x10 mov r0, r0, asr #0x10 @@ -4826,7 +4826,7 @@ sub_0205882C: ; 0x0205882C add r1, r5, #0x64 mov r2, #0x100 mov r3, #9 - bl sub_0201BFF0 + bl CopyAndInterleaveWrapper add r0, sp, #0x14 bl UnloadFile mov lr, #0 diff --git a/asm/overlay_29_022DEADC.s b/asm/overlay_29_022DEADC.s index fd6599e5..5bca15d9 100644 --- a/asm/overlay_29_022DEADC.s +++ b/asm/overlay_29_022DEADC.s @@ -431,7 +431,7 @@ _022DF0AC: bl ov29_022DE904 bl ov29_022F6E40 bl ov29_022ED030 - bl ov29_023388B0 + bl LoadWeather3DFiles bl ov29_02338F10 bl sub_02017B00 mov r1, r5 diff --git a/asm/overlay_29_022E0378.s b/asm/overlay_29_022E0378.s index 8edabbcb..41e724d9 100644 --- a/asm/overlay_29_022E0378.s +++ b/asm/overlay_29_022E0378.s @@ -1142,7 +1142,7 @@ _022E1038: ldr r1, [sp, #0x10] mov r3, r4 mov r2, r8, lsl #1 - bl sub_0201BFF0 + bl CopyAndInterleaveWrapper mov r0, r8, asr #1 add r0, r8, r0, lsr #30 add r7, r7, #1 @@ -1383,7 +1383,7 @@ _022E134C: ldmia r4, {r1, r2} mov r2, r2, lsl #8 mov r3, #0xd - bl sub_0201BFF0 + bl CopyAndInterleaveWrapper add r0, sp, #8 bl UnloadFile bl ov29_022E11F8 diff --git a/asm/overlay_29_022E9618.s b/asm/overlay_29_022E9618.s index 9215ec33..51b9a02f 100644 --- a/asm/overlay_29_022E9618.s +++ b/asm/overlay_29_022E9618.s @@ -862,14 +862,14 @@ _022EA0F8: cmpne r0, #0xc bne _022EA140 mov r0, #0 - bl ov29_02339A24 + bl FlashLeaderIcon b _022EA154 _022EA140: bl sub_0204AEA0 cmp r0, #3 bne _022EA154 mov r0, #1 - bl ov29_02339A24 + bl FlashLeaderIcon _022EA154: bl ov29_022EA64C bl ov29_022EA80C @@ -942,7 +942,7 @@ _022EA214: add r2, r2, #0x1a000 bl ov29_022ED800 _022EA260: - bl ov29_02338AC4 + bl RenderWeather3D bl ov29_022E8C10 ldr r0, _022EA290 ; =DUNGEON_PTR ldr r0, [r0] diff --git a/asm/overlay_29_0233861C.s b/asm/overlay_29_0233861C.s index bc8beda3..9c1d5ebe 100644 --- a/asm/overlay_29_0233861C.s +++ b/asm/overlay_29_0233861C.s @@ -286,8 +286,8 @@ SetHiddenFloorField: ; 0x02338898 _023388AC: .word DUNGEON_PTR arm_func_end SetHiddenFloorField - arm_func_start ov29_023388B0 -ov29_023388B0: ; 0x023388B0 + arm_func_start LoadWeather3DFiles +LoadWeather3DFiles: ; 0x023388B0 stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} sub sp, sp, #8 ldr r0, _02338974 ; =ov29_02352F1C @@ -344,7 +344,7 @@ _02338978: .word ov29_02352F40 _0233897C: .word ov29_0237CACC _02338980: .word ov29_0237CD40 _02338984: .word ov29_02352F7C - arm_func_end ov29_023388B0 + arm_func_end LoadWeather3DFiles arm_func_start ov29_02338988 ov29_02338988: ; 0x02338988 @@ -445,8 +445,8 @@ _02338ABC: .word ov29_0235372C _02338AC0: .word ov29_0237CACC arm_func_end ov29_02338A4C - arm_func_start ov29_02338AC4 -ov29_02338AC4: ; 0x02338AC4 + arm_func_start RenderWeather3D +RenderWeather3D: ; 0x02338AC4 stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} mov r5, #0 _02338ACC: @@ -615,7 +615,7 @@ _02338D18: .align 2, 0 _02338D28: .word ov29_0237CACC _02338D2C: .word 0x00000FFF - arm_func_end ov29_02338AC4 + arm_func_end RenderWeather3D arm_func_start ov29_02338D30 ov29_02338D30: ; 0x02338D30 @@ -1623,8 +1623,8 @@ _02339A1C: .word DUNGEON_PTR _02339A20: .word ov29_0237CFB8 arm_func_end ov29_0233992C - arm_func_start ov29_02339A24 -ov29_02339A24: ; 0x02339A24 + arm_func_start FlashLeaderIcon +FlashLeaderIcon: ; 0x02339A24 stmdb sp!, {r4, r5, r6, lr} sub sp, sp, #8 ldr r1, _02339CB8 ; =DUNGEON_PTR @@ -1804,7 +1804,7 @@ _02339CC4: .word _020AFC4C _02339CC8: .word 0xFFFF000F _02339CCC: .word 0x0000013F _02339CD0: .word 0x000001DD - arm_func_end ov29_02339A24 + arm_func_end FlashLeaderIcon arm_func_start ov29_02339CD4 ov29_02339CD4: ; 0x02339CD4 diff --git a/include/dungeon_move.h b/include/dungeon_move.h index 03307eb9..7bab3fa4 100644 --- a/include/dungeon_move.h +++ b/include/dungeon_move.h @@ -3,6 +3,10 @@ #include "dungeon_mode.h" +// Returns a boolean indicating whether or not the given entity is charging any two-turn move. +// pokemon: Entity pointer +// check_charge: Unused boolean which was supposed to make function return true if the entity is under the effect of Charge (the Electric-type move). +// However, the conditional which uses this boolean will never be activated, as the loop will always terminate before getting to it. bool8 IsChargingAnyTwoTurnMove(struct entity *pokemon, bool8 check_charge); #endif //PMDSKY_DUNGEON_MOVE_H diff --git a/src/dungeon_move.c b/src/dungeon_move.c index 2b96fe66..bd5f46c5 100644 --- a/src/dungeon_move.c +++ b/src/dungeon_move.c @@ -2,7 +2,7 @@ #include "dungeon_util.h" #include "overlay_29_02321438.h" -const u8 MULTI_TURN_BIDE_CLASS_STATUSES[11] = +const u8 TWO_TURN_STATUSES[11] = { BIDE_STATUS_SOLARBEAM, BIDE_STATUS_SKY_ATTACK, @@ -25,14 +25,14 @@ bool8 IsChargingAnyTwoTurnMove(struct entity *pokemon, bool8 check_charge) struct monster *pokemon_info = GetEntInfo(pokemon); for (s32 i = 0; i < 100; i++) { - if (MULTI_TURN_BIDE_CLASS_STATUSES[i] == STATUS_NONE) + if (TWO_TURN_STATUSES[i] == STATUS_NONE) return FALSE; - if (pokemon_info->bide_class_status.bide == MULTI_TURN_BIDE_CLASS_STATUSES[i]) + if (pokemon_info->bide_class_status.bide == TWO_TURN_STATUSES[i]) return TRUE; } - // BUG: This condition is never reached because the for loop terminates by returning FALSE at the end of the MULTI_TURN_BIDE_CLASS_STATUSES array. + // BUG: This condition is never reached because the for loop terminates by returning FALSE at the end of the TWO_TURN_STATUSES array. if (check_charge && pokemon_info->bide_class_status.bide == BIDE_STATUS_CHARGING) return TRUE; return FALSE; diff --git a/tools/extract_function/split_data.py b/tools/extract_function/split_data.py index 036f679d..f407e74f 100644 --- a/tools/extract_function/split_data.py +++ b/tools/extract_function/split_data.py @@ -5,7 +5,7 @@ import sys from write_inc_file import write_inc_file # Use this script to split a data file at a certain symbol. -# Example usage: python split_data.py overlay_29_0234EC38 MULTI_TURN_BIDE_CLASS_STATUSES +# Example usage: python split_data.py overlay_29_0234EC38 TWO_TURN_STATUSES if len(sys.argv) != 3: print('Usage: python extract_function.py ') diff --git a/tools/sync_pmdsky_debug/sync_to_pmdsky_debug.py b/tools/sync_pmdsky_debug/sync_to_pmdsky_debug.py index 1b8f7fec..afe270e7 100644 --- a/tools/sync_pmdsky_debug/sync_to_pmdsky_debug.py +++ b/tools/sync_pmdsky_debug/sync_to_pmdsky_debug.py @@ -272,12 +272,13 @@ def sync_xmap_symbol(address: int, symbol: SymbolDetails, language: str, section symbol_header = line break # Match the typedefs used in pmdsky-debug. - symbol_header = symbol_header.replace('u32', 'uint32_t') - symbol_header = symbol_header.replace('u16', 'uint16_t') - symbol_header = symbol_header.replace('u8', 'uint8_t') - symbol_header = symbol_header.replace('s32', 'int') - symbol_header = symbol_header.replace('s16', 'int16_t') - symbol_header = symbol_header.replace('s8', 'int8_t') + if symbol_header is not None: + symbol_header = symbol_header.replace('u32', 'uint32_t') + symbol_header = symbol_header.replace('u16', 'uint16_t') + symbol_header = symbol_header.replace('u8', 'uint8_t') + symbol_header = symbol_header.replace('s32', 'int') + symbol_header = symbol_header.replace('s16', 'int16_t') + symbol_header = symbol_header.replace('s8', 'int8_t') else: symbol_header = f'void {base_symbol_name}(void);\n' diff --git a/tools/sync_pmdsky_debug/xmap_reader.py b/tools/sync_pmdsky_debug/xmap_reader.py index 5df09440..4ccc2ab5 100644 --- a/tools/sync_pmdsky_debug/xmap_reader.py +++ b/tools/sync_pmdsky_debug/xmap_reader.py @@ -72,7 +72,7 @@ def read_xmap_symbols_for_language(language: str) -> Dict[str, Dict[int, SymbolD if current_section is not None and current_section not in xmap_symbols: xmap_symbols[current_section] = {} - elif current_section is not None and line.startswith(' ') and ('.text' in line or '.data' in line or '.bss' in line or '.itcm' in line) and len(line) > 28 and line[28] not in NON_FUNCTION_SYMBOLS: + elif current_section is not None and line.startswith(' ') and ('.text' in line or '.rodata' in line or '.data' in line or '.bss' in line or '.itcm' in line) and len(line) > 28 and line[28] not in NON_FUNCTION_SYMBOLS: symbol_split = line[28:-1].split('\t') symbol_name = symbol_split[0] symbol_address = int(line[2:10], 16) @@ -80,7 +80,7 @@ def read_xmap_symbols_for_language(language: str) -> Dict[str, Dict[int, SymbolD if not symbol_name.startswith('$'): xmap_symbols[current_section][symbol_address] = SymbolDetails(symbol_name, symbol_split[1][1:-1], True) else: - xmap_symbols[current_section][symbol_address] = SymbolDetails(symbol_name, symbol_split[1][1:-1], False) + xmap_symbols[current_section][symbol_address] = SymbolDetails(symbol_name, symbol_split[1][1:-1], '.rodata' in line) NON_FUNCTION_SYMBOLS = set(['$', '.']) read_xmap_file(xmap_lines)