From 31b0c3f685df1dcea576ad33a59c9a8bb590d2eb Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 13 Jul 2021 13:33:29 +0100 Subject: [PATCH] Merge 4DF30 into battle/battle (#309) * merge 4DF30 into battle/battle * nomatching load_battle * oops --- src/4DF30.c | 60 ---------------- src/battle/battle.c | 69 +++++++++++++++++++ .../{4DF30 => battle/battle}/load_battle.s | 0 .../battle}/load_battle_section.s | 0 .../battle}/load_demo_battle.s | 0 .../battle}/reset_battle_status.s | 0 .../battle}/setup_demo_player.s | 0 ver/us/splat.yaml | 4 +- 8 files changed, 70 insertions(+), 63 deletions(-) delete mode 100644 src/4DF30.c rename ver/us/asm/nonmatchings/{4DF30 => battle/battle}/load_battle.s (100%) rename ver/us/asm/nonmatchings/{4DF30 => battle/battle}/load_battle_section.s (100%) rename ver/us/asm/nonmatchings/{4DF30 => battle/battle}/load_demo_battle.s (100%) rename ver/us/asm/nonmatchings/{4DF30 => battle/battle}/reset_battle_status.s (100%) rename ver/us/asm/nonmatchings/{4DF30 => battle/battle}/setup_demo_player.s (100%) diff --git a/src/4DF30.c b/src/4DF30.c deleted file mode 100644 index d4b409aa24..0000000000 --- a/src/4DF30.c +++ /dev/null @@ -1,60 +0,0 @@ -#include "common.h" -#include "battle/battle.h" - -extern s32 D_800DC060; -extern Stage* D_800DC064; - -INCLUDE_ASM(s32, "4DF30", reset_battle_status); - -void ALT_reset_battle_status(void) { - reset_battle_status(); -} - -void func_80072BCC(s32 arg0) { - gBattleStatus.unk_488 = arg0; -} - -//weird stuff with loading gBattleStatus -#ifdef NON_MATCHING -void load_battle_section(void) { - BattleArea* battleArea; - s32 temp_a0; - - battleArea = &gBattleAreas[gBattleStatus.currentBattleSection]; - dma_copy(battleArea->dmaStart, battleArea->dmaEnd, battleArea->dmaDest); - - gBattleStatus.unk_48C = &(*battleArea->battles)[gBattleStatus.unk_47B]; - - if (gBattleStatus.unk_47C >= 0) { - D_800DC064 = NULL; - } else { - D_800DC064 = &(*battleArea->stages)[gBattleStatus.unk_47C]; - } - - btl_set_state(1); - gBattleStatus.unk_460 = 0; -} -#else -INCLUDE_ASM(s32, "4DF30", load_battle_section); -#endif - -INCLUDE_ASM(s32, "4DF30", load_battle); - -void set_battle_stage(s32 arg0) { - gBattleStatus.unk_47C = arg0; -} - -void set_battle_formation(s32 arg0) { - gBattleStatus.unk_484 = arg0; -} - -void func_80072CEC(f32 arg0, f32 arg1, f32 arg2) { -} - -void func_80072CF4(void) { - func_80072CEC(1.0f, 1.1f, 1.2f); -} - -INCLUDE_ASM(s32, "4DF30", setup_demo_player); - -INCLUDE_ASM(s32, "4DF30", load_demo_battle); diff --git a/src/battle/battle.c b/src/battle/battle.c index faad54fcf5..fc2b1dea48 100644 --- a/src/battle/battle.c +++ b/src/battle/battle.c @@ -2,6 +2,9 @@ #include "ld_addrs.h" #include "battle.h" +extern s32 D_800DC060; +extern Stage* D_800DC064; + extern BattleList b_area_kmr_part_1_formationTable; extern StageList b_area_kmr_part_1_stageTable; @@ -274,3 +277,69 @@ BattleArea gBattleAreas[0x30] = { }, {}, }; + +INCLUDE_ASM(s32, "battle/battle", reset_battle_status); + +void ALT_reset_battle_status(void) { + reset_battle_status(); +} + +void func_80072BCC(s32 arg0) { + gBattleStatus.unk_488 = arg0; +} + +//weird stuff with loading gBattleStatus +#ifdef NON_MATCHING +void load_battle_section(void) { + BattleArea* battleArea; + s32 temp_a0; + + battleArea = &gBattleAreas[gBattleStatus.currentBattleSection]; + dma_copy(battleArea->dmaStart, battleArea->dmaEnd, battleArea->dmaDest); + + gBattleStatus.unk_48C = &(*battleArea->battles)[gBattleStatus.unk_47B]; + + if (gBattleStatus.unk_47C >= 0) { + D_800DC064 = NULL; + } else { + D_800DC064 = &(*battleArea->stages)[gBattleStatus.unk_47C]; + } + + btl_set_state(1); + gBattleStatus.unk_460 = 0; +} +#else +INCLUDE_ASM(s32, "battle/battle", load_battle_section); +#endif + +// gBattleStatus is possibly shorter than we think +#ifdef NON_MATCHING +void load_battle(s32 arg0) { + gBattleStatus.unk_478 = arg0; + set_game_mode(8); + gBattleState = 0; + gBattleStatus.unk_460 = 0; + gBattleStatus.battleState = 0; +} +#else +INCLUDE_ASM(s32, "battle/battle", load_battle); +#endif + +void set_battle_stage(s32 arg0) { + gBattleStatus.unk_47C = arg0; +} + +void set_battle_formation(s32 arg0) { + gBattleStatus.unk_484 = arg0; +} + +void func_80072CEC(f32 arg0, f32 arg1, f32 arg2) { +} + +void func_80072CF4(void) { + func_80072CEC(1.0f, 1.1f, 1.2f); +} + +INCLUDE_ASM(s32, "battle/battle", setup_demo_player); + +INCLUDE_ASM(s32, "battle/battle", load_demo_battle); diff --git a/ver/us/asm/nonmatchings/4DF30/load_battle.s b/ver/us/asm/nonmatchings/battle/battle/load_battle.s similarity index 100% rename from ver/us/asm/nonmatchings/4DF30/load_battle.s rename to ver/us/asm/nonmatchings/battle/battle/load_battle.s diff --git a/ver/us/asm/nonmatchings/4DF30/load_battle_section.s b/ver/us/asm/nonmatchings/battle/battle/load_battle_section.s similarity index 100% rename from ver/us/asm/nonmatchings/4DF30/load_battle_section.s rename to ver/us/asm/nonmatchings/battle/battle/load_battle_section.s diff --git a/ver/us/asm/nonmatchings/4DF30/load_demo_battle.s b/ver/us/asm/nonmatchings/battle/battle/load_demo_battle.s similarity index 100% rename from ver/us/asm/nonmatchings/4DF30/load_demo_battle.s rename to ver/us/asm/nonmatchings/battle/battle/load_demo_battle.s diff --git a/ver/us/asm/nonmatchings/4DF30/reset_battle_status.s b/ver/us/asm/nonmatchings/battle/battle/reset_battle_status.s similarity index 100% rename from ver/us/asm/nonmatchings/4DF30/reset_battle_status.s rename to ver/us/asm/nonmatchings/battle/battle/reset_battle_status.s diff --git a/ver/us/asm/nonmatchings/4DF30/setup_demo_player.s b/ver/us/asm/nonmatchings/battle/battle/setup_demo_player.s similarity index 100% rename from ver/us/asm/nonmatchings/4DF30/setup_demo_player.s rename to ver/us/asm/nonmatchings/battle/battle/setup_demo_player.s diff --git a/ver/us/splat.yaml b/ver/us/splat.yaml index 41abdea92d..bcc13be2d3 100644 --- a/ver/us/splat.yaml +++ b/ver/us/splat.yaml @@ -245,8 +245,7 @@ segments: - [0x4a1f0, c, os/4a1f0_len_170] # yay0 decompression - some or all is hand-written - [0x4a360, c, os/4a360_len_930] # osFlash* - IDO O2 -g - [0x4ac90, c, 4ac90_len_3910] - - [0x4DF30, c, battle/battle] # DUMMY ROM location - not sure where it should go - - [0x4DF30, c, 4DF30] + - [0x4DF30, c, battle/battle] - [0x4E5A0, data, 1000_len_60] - [0x4F410, .data, 1370_len_7d0] - [0x4F420, .data, main_loop] @@ -330,7 +329,6 @@ segments: - [0x75340, .rodata, os/491c0_len_f80] - [0x75540, .rodata, os/49C70] - [0x75640, .rodata, battle/battle] - - [0x75978, .rodata, 4DF30] # bss starts at 0x8009A5B0 # 0x800 of bss until... # - [0x75240, .bss, main_loop]