From f02fe261c88940da7e710b6d2d41b9e8aed063e2 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Thu, 23 Oct 2025 23:28:19 -0400 Subject: [PATCH] Decomped GetBagCapacitySpecialEpisode --- asm/include/{main_020517E4.inc => main_020517F4.inc} | 1 - asm/{main_020517E4.s => main_020517F4.s} | 11 +---------- asm/main_rodata_020A1BB0.s | 4 ---- include/enums.h | 1 + include/main_020517D4.h | 1 + main.lsf | 2 +- src/dungeon_ai_movement.c | 2 +- src/main_0200EDC0.c | 4 ++-- src/main_0204CB94.c | 2 +- src/main_020517D4.c | 9 ++++++++- 10 files changed, 16 insertions(+), 21 deletions(-) rename asm/include/{main_020517E4.inc => main_020517F4.inc} (95%) rename asm/{main_020517E4.s => main_020517F4.s} (98%) diff --git a/asm/include/main_020517E4.inc b/asm/include/main_020517F4.inc similarity index 95% rename from asm/include/main_020517E4.inc rename to asm/include/main_020517F4.inc index 86071f67..c047e09b 100644 --- a/asm/include/main_020517E4.inc +++ b/asm/include/main_020517F4.inc @@ -2,7 +2,6 @@ .public ARM9_UNKNOWN_PTR__NA_20A2C84 .public ArrayCopy32 .public ArrayFill32 -.public BAG_CAPACITY_TABLE_SPECIAL_EPISODES .public DecompressAtNormalVeneer .public GetAtSize .public GetBaseForm diff --git a/asm/main_020517E4.s b/asm/main_020517F4.s similarity index 98% rename from asm/main_020517E4.s rename to asm/main_020517F4.s index 0d5d414b..7410a5b8 100644 --- a/asm/main_020517E4.s +++ b/asm/main_020517F4.s @@ -1,17 +1,8 @@ .include "asm/macros.inc" - .include "main_020517E4.inc" + .include "main_020517F4.inc" .text - arm_func_start GetBagCapacitySpecialEpisode -GetBagCapacitySpecialEpisode: ; 0x020517E4 - ldr r1, _020517F0 ; =BAG_CAPACITY_TABLE_SPECIAL_EPISODES - ldr r0, [r1, r0, lsl #2] - bx lr - .align 2, 0 -_020517F0: .word BAG_CAPACITY_TABLE_SPECIAL_EPISODES - arm_func_end GetBagCapacitySpecialEpisode - arm_func_start GetRankUpEntry GetRankUpEntry: ; 0x020517F4 ldr r1, _02051800 ; =RANK_UP_TABLE diff --git a/asm/main_rodata_020A1BB0.s b/asm/main_rodata_020A1BB0.s index 70482246..957570e7 100644 --- a/asm/main_rodata_020A1BB0.s +++ b/asm/main_rodata_020A1BB0.s @@ -219,7 +219,3 @@ GUMMI_BELLY_RESTORE_TABLE: .byte 0x0A, 0x00, 0x0F, 0x00, 0x1E, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x0F, 0x00 .byte 0x0A, 0x00, 0x0F, 0x00, 0x0A, 0x00, 0x14, 0x00, 0x05, 0x00, 0x14, 0x00, 0x0A, 0x00, 0x0A, 0x00 .byte 0x0A, 0x00, 0x0A, 0x00, 0x0A, 0x00, 0x0A, 0x00, 0x0A, 0x00, 0x1E, 0x00 - .global BAG_CAPACITY_TABLE_SPECIAL_EPISODES -BAG_CAPACITY_TABLE_SPECIAL_EPISODES: - .byte 0x18, 0x00, 0x00, 0x00 - .byte 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00 diff --git a/include/enums.h b/include/enums.h index 7e769554..924ea993 100644 --- a/include/enums.h +++ b/include/enums.h @@ -3418,6 +3418,7 @@ enum script_var_id { }; enum special_episode_type { + EPISODE_NONE = -1, EPISODE_BIDOOFS_WISH = 0, EPISODE_IGGLYBUFF_THE_PRODIGY = 1, EPISODE_TODAYS_OH_MY_GOSH = 2, diff --git a/include/main_020517D4.h b/include/main_020517D4.h index 7a7e9abf..95cb9969 100644 --- a/include/main_020517D4.h +++ b/include/main_020517D4.h @@ -3,5 +3,6 @@ // Returns the player's bag capacity for a given point in the game. u32 GetBagCapacity(s32 scenario_balance); +u32 GetBagCapacitySpecialEpisode(s32 se_type); #endif //PMDSKY_MAIN_020517D4_H diff --git a/main.lsf b/main.lsf index 1470c98f..df9438c4 100644 --- a/main.lsf +++ b/main.lsf @@ -103,7 +103,7 @@ Static main Object src/secondary_terrain_types.o Object asm/main_rodata_020A1BB0.o Object src/main_020517D4.o - Object asm/main_020517E4.o + Object asm/main_020517F4.o Object src/main_020526EC.o Object asm/get_category_string.o Object src/main_020527A8.o diff --git a/src/dungeon_ai_movement.c b/src/dungeon_ai_movement.c index fea533d0..b6e1861f 100644 --- a/src/dungeon_ai_movement.c +++ b/src/dungeon_ai_movement.c @@ -13,6 +13,7 @@ #include "dungeon_util_1.h" #include "dungeon_util_static.h" #include "dungeon_visibility.h" +#include "main_0200EDC0.h" #include "main_0208655C.h" #include "math.h" #include "number_util.h" @@ -47,7 +48,6 @@ const s32 FACING_DIRECTION_INCREMENTS[] = {0, 1, -1, 2, -2, 3, -3, 4}; extern bool8 CanTargetEntity(struct entity *user, struct entity *target); extern bool8 CanTargetPosition(struct entity *monster, struct position *position); -extern bool8 IsBagFull(); extern bool8 ShouldMonsterFollowLeader(struct entity *monster); extern bool8 IsPositionWithinTwoTiles(struct position *origin, struct position *target); extern s32 ov29_022FBE04(struct monster*); diff --git a/src/main_0200EDC0.c b/src/main_0200EDC0.c index 0beb34cc..a6de5d09 100644 --- a/src/main_0200EDC0.c +++ b/src/main_0200EDC0.c @@ -3,16 +3,16 @@ #include "main_0204C938.h" #include "main_0204CB94.h" #include "main_020517D4.h" +#include "scripting.h" extern struct bag_items *BAG_ITEMS_PTR_MIRROR; -extern s32 GetBagCapacitySpecialEpisode(s32 se_type); extern bool8 GetPerformanceFlagWithChecks(s32 flag_id); s32 GetCurrentBagCapacity() { s32 special_episode_type = GetExecuteSpecialEpisodeType(); - if (special_episode_type == -1) + if (special_episode_type == EPISODE_NONE) { if (GetPerformanceFlagWithChecks(2) == 0) return 1; diff --git a/src/main_0204CB94.c b/src/main_0204CB94.c index 888a7c4b..3680f099 100644 --- a/src/main_0204CB94.c +++ b/src/main_0204CB94.c @@ -4,7 +4,7 @@ u8 GetScenarioBalance() { s32 special_episode_type = LoadScriptVariableValue(0, VAR_EXECUTE_SPECIAL_EPISODE_TYPE); - if (special_episode_type == -1) + if (special_episode_type == EPISODE_NONE) { s32 scenario_balance = LoadScriptVariableValue(0, VAR_SCENARIO_BALANCE_DEBUG); if (scenario_balance < 0) diff --git a/src/main_020517D4.c b/src/main_020517D4.c index a09a8be6..ee24048a 100644 --- a/src/main_020517D4.c +++ b/src/main_020517D4.c @@ -1,8 +1,15 @@ #include "main_020517D4.h" -const u32 BAG_CAPACITY_TABLE[8] = { 16, 24, 32, 40, 40, 40, 48, 48 }; +// Array of 4-byte integers containing the bag capacity for each bag level. +const u32 BAG_CAPACITY_TABLE[] = { 16, 24, 32, 40, 40, 40, 48, 48 }; +const u32 BAG_CAPACITY_TABLE_SPECIAL_EPISODES[] = { 24, 48, 48, 48, 48 }; u32 GetBagCapacity(s32 scenario_balance) { return BAG_CAPACITY_TABLE[scenario_balance]; } + +u32 GetBagCapacitySpecialEpisode(s32 se_type) +{ + return BAG_CAPACITY_TABLE_SPECIAL_EPISODES[se_type]; +}