From b84cfded7845e75d76e06e53dad1cb197d680257 Mon Sep 17 00:00:00 2001 From: AnonymousRandomPerson Date: Fri, 24 Oct 2025 00:04:32 -0400 Subject: [PATCH] Decomped DoesTacticFollowLeader --- asm/include/main_02054E4C.inc | 83 +++++---- asm/include/main_02058C4C.inc | 8 + asm/include/main_rodata_020A190C.inc | 1 + asm/main_02054E4C.s | 243 --------------------------- asm/main_02058C4C.s | 238 ++++++++++++++++++++++++++ asm/main_rodata_020908D4.s | 63 ------- asm/main_rodata_020A190C.s | 63 +++++++ include/enums.h | 3 + include/main_02058C3C.h | 10 ++ include/tactics_data.h | 9 + main.lsf | 4 + src/main_020517D4.c | 12 +- src/main_02058C3C.c | 7 + src/tactics_data.c | 17 ++ 14 files changed, 408 insertions(+), 353 deletions(-) create mode 100644 asm/include/main_02058C4C.inc create mode 100644 asm/include/main_rodata_020A190C.inc create mode 100644 asm/main_02058C4C.s create mode 100644 asm/main_rodata_020A190C.s create mode 100644 include/main_02058C3C.h create mode 100644 include/tactics_data.h create mode 100644 src/main_02058C3C.c create mode 100644 src/tactics_data.c diff --git a/asm/include/main_02054E4C.inc b/asm/include/main_02054E4C.inc index 1a1d24f2..c0034ef8 100644 --- a/asm/include/main_02054E4C.inc +++ b/asm/include/main_02054E4C.inc @@ -1,5 +1,42 @@ #pragma once -.public _020A190C +.public AddMoneyCarried +.public CleanStickyItemsInBag +.public CopyAndInterleaveWrapper +.public CopyTacticString +.public Debug_Print0 +.public DirectoryFileMngr_OpenDirectoryFile +.public EnableAllLearnableIqSkills +.public GetBaseDefensiveStat +.public GetBaseFormCastformCherrimDeoxys +.public GetBaseHp +.public GetBaseOffensiveStat +.public GetBodySize +.public GetGameMode +.public GetItemAtIdx +.public GetItemMoveId16 +.public GetMaxMembersAllowed +.public GetMaxPp +.public GetMonsterGender +.public GetNameRaw +.public GetShadowSize +.public GroundToDungeonMoveset +.public HandleSir0Translation +.public IsLevelResetDungeon +.public IsSkyExclusiveDungeon +.public ItemZInit +.public MemZero +.public RemoveHolderForItemInBag +.public RemovePokeItemsInBag +.public SetHolderForItemInBag +.public SetPokemonJoined +.public ShuffleHiddenPower +.public SprintfStatic__02054A60 +.public StrcmpMonsterName +.public StrncpyName +.public StrncpySimple +.public StrncpySimpleNoPadSafe +.public TEAM_MEMBER_TABLE_PTR +.public UnloadFile .public _020A333C .public _020A3340 .public _020A3350 @@ -17,47 +54,6 @@ .public _020B0A4C .public _022B5788 .public _022B578C -.public AddMoneyCarried -.public CleanStickyItemsInBag -.public CopyAndInterleaveWrapper -.public CopyTacticString -.public Debug_Print0 -.public DirectoryFileMngr_OpenDirectoryFile -.public GetBaseDefensiveStat -.public GetBaseFormCastformCherrimDeoxys -.public GetBaseHp -.public GetBaseOffensiveStat -.public GetBodySize -.public GetGameMode -.public GetIqGroup -.public GetItemAtIdx -.public GetItemMoveId16 -.public GetMaxMembersAllowed -.public GetMaxPp -.public GetMonsterGender -.public GetNameRaw -.public GetPerformanceFlagWithChecks -.public GetShadowSize -.public GroundToDungeonMoveset -.public HandleSir0Translation -.public IQ_GROUP_SKILLS -.public IQ_SKILL_RESTRICTIONS -.public IQ_SKILLS -.public IqSkillFlagTest -.public IsLevelResetDungeon -.public IsSkyExclusiveDungeon -.public ItemZInit -.public MemZero -.public RemoveHolderForItemInBag -.public RemovePokeItemsInBag -.public SetHolderForItemInBag -.public SetPokemonJoined -.public ShuffleHiddenPower -.public SprintfStatic__02054A60 -.public StrcmpMonsterName -.public StrncpyName -.public StrncpySimple -.public StrncpySimpleNoPadSafe .public sub_0200D8AC .public sub_0200FA0C .public sub_0201B43C @@ -72,6 +68,3 @@ .public sub_020534BC .public sub_02053D1C .public sub_02053F10 -.public TACTICS_UNLOCK_LEVEL_TABLE -.public TEAM_MEMBER_TABLE_PTR -.public UnloadFile diff --git a/asm/include/main_02058C4C.inc b/asm/include/main_02058C4C.inc new file mode 100644 index 00000000..fbb341b7 --- /dev/null +++ b/asm/include/main_02058C4C.inc @@ -0,0 +1,8 @@ +#pragma once +.public GetIqGroup +.public GetPerformanceFlagWithChecks +.public IQ_GROUP_SKILLS +.public IQ_SKILLS +.public IQ_SKILL_RESTRICTIONS +.public IqSkillFlagTest +.public TACTICS_UNLOCK_LEVEL_TABLE diff --git a/asm/include/main_rodata_020A190C.inc b/asm/include/main_rodata_020A190C.inc new file mode 100644 index 00000000..6f70f09b --- /dev/null +++ b/asm/include/main_rodata_020A190C.inc @@ -0,0 +1 @@ +#pragma once diff --git a/asm/main_02054E4C.s b/asm/main_02054E4C.s index d80379d7..fbe56c19 100644 --- a/asm/main_02054E4C.s +++ b/asm/main_02054E4C.s @@ -4921,246 +4921,3 @@ sub_02058C30: ; 0x02058C30 .align 2, 0 _02058C38: .word CopyTacticString arm_func_end sub_02058C30 - - arm_func_start DoesTacticFollowLeader -DoesTacticFollowLeader: ; 0x02058C3C - ldr r1, _02058C48 ; =_020A190C - ldrb r0, [r1, r0] - bx lr - .align 2, 0 -_02058C48: .word _020A190C - arm_func_end DoesTacticFollowLeader - - arm_func_start GetUnlockedTactics -GetUnlockedTactics: ; 0x02058C4C - stmdb sp!, {r3, lr} - mov lr, #0 - ldr r3, _02058C98 ; =TACTICS_UNLOCK_LEVEL_TABLE - mov ip, lr -_02058C5C: - mov r2, ip, lsl #1 - ldrsh r2, [r3, r2] - cmp r2, r1 - strleb ip, [r0, lr] - add ip, ip, #1 - addle lr, lr, #1 - cmp ip, #0xc - blt _02058C5C - mov r1, #0xb - b _02058C8C -_02058C84: - strb r1, [r0, lr] - add lr, lr, #1 -_02058C8C: - cmp lr, #0xc - blt _02058C84 - ldmia sp!, {r3, pc} - .align 2, 0 -_02058C98: .word TACTICS_UNLOCK_LEVEL_TABLE - arm_func_end GetUnlockedTactics - - arm_func_start GetUnlockedTacticFlags -GetUnlockedTacticFlags: ; 0x02058C9C - stmdb sp!, {r4, lr} - mov r4, #0 - ldr lr, _02058CD4 ; =TACTICS_UNLOCK_LEVEL_TABLE - mov r2, r4 - mov r3, #1 -_02058CB0: - mov ip, r4, lsl #1 - ldrsh ip, [lr, ip] - cmp ip, r1 - strleb r3, [r0, r4] - strgtb r2, [r0, r4] - add r4, r4, #1 - cmp r4, #0xc - blt _02058CB0 - ldmia sp!, {r4, pc} - .align 2, 0 -_02058CD4: .word TACTICS_UNLOCK_LEVEL_TABLE - arm_func_end GetUnlockedTacticFlags - - arm_func_start CanLearnIqSkill -CanLearnIqSkill: ; 0x02058CD8 - cmp r1, #0 - moveq r0, #0 - bxeq lr - ldr r2, _02058D00 ; =IQ_SKILLS - ldr r1, [r2, r1, lsl #2] - cmp r1, r0 - movle r0, #1 - movgt r0, #0 - and r0, r0, #0xff - bx lr - .align 2, 0 -_02058D00: .word IQ_SKILLS - arm_func_end CanLearnIqSkill - - arm_func_start GetLearnableIqSkills -GetLearnableIqSkills: ; 0x02058D04 - stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} - mov r6, #0 - mov sl, r0 - mov sb, r1 - mov r8, r2 - mov r5, r6 - ldr r4, _02058DA0 ; =IQ_GROUP_SKILLS - mov fp, #0x19 - b _02058D74 -_02058D28: - mov r0, sb - bl GetIqGroup - mla r1, r0, fp, r4 - and r0, r5, #0xff - ldrb r7, [r0, r1] - cmp r7, #0xff - beq _02058D7C - cmp r7, #0x18 - bne _02058D58 - mov r0, #3 - bl GetPerformanceFlagWithChecks - b _02058D64 -_02058D58: - mov r0, r8 - mov r1, r7 - bl CanLearnIqSkill -_02058D64: - cmp r0, #0 - strneb r7, [sl, r6] - addne r6, r6, #1 - add r5, r5, #1 -_02058D74: - cmp r5, #0x19 - blt _02058D28 -_02058D7C: - mov r1, r6 - mov r0, #0 - b _02058D90 -_02058D88: - strb r0, [sl, r1] - add r1, r1, #1 -_02058D90: - cmp r1, #0x45 - blt _02058D88 - mov r0, r6 - ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} - .align 2, 0 -_02058DA0: .word IQ_GROUP_SKILLS - arm_func_end GetLearnableIqSkills - - arm_func_start DisableIqSkill -DisableIqSkill: ; 0x02058DA4 - stmdb sp!, {r3, r4, r5, lr} - mov r4, r0 - mov r5, r1 - bl IqSkillFlagTest - cmp r0, #0 - beq _02058DE4 - mov r0, r5, asr #4 - add r0, r5, r0, lsr #27 - mov r2, r0, asr #5 - sub r0, r5, r2, lsl #5 - mov r1, #1 - mvn r0, r1, lsl r0 - ldr r1, [r4, r2, lsl #2] - and r0, r1, r0 - str r0, [r4, r2, lsl #2] - ldmia sp!, {r3, r4, r5, pc} -_02058DE4: - mov r0, r4 - mov r1, r5 - bl EnableIqSkill - ldmia sp!, {r3, r4, r5, pc} - arm_func_end DisableIqSkill - - arm_func_start EnableIqSkill -EnableIqSkill: ; 0x02058DF4 - stmdb sp!, {r4, r5, r6, lr} - ldr r2, _02058E64 ; =IQ_SKILL_RESTRICTIONS - mov r3, r1, lsl #1 - ldrsh ip, [r2, r3] - mov r3, #0 - mov r4, #1 -_02058E0C: - mov r5, r3, lsl #1 - ldrsh r5, [r2, r5] - cmp ip, r5 - bne _02058E3C - mov lr, r3, asr #4 - add lr, r3, lr, lsr #27 - mov r6, lr, asr #5 - sub lr, r3, r6, lsl #5 - mvn lr, r4, lsl lr - ldr r5, [r0, r6, lsl #2] - and r5, r5, lr - str r5, [r0, r6, lsl #2] -_02058E3C: - add r3, r3, #1 - cmp r3, #0x45 - blt _02058E0C - mov ip, r1, lsr #5 - ldr r3, [r0, ip, lsl #2] - sub r1, r1, ip, lsl #5 - mov r2, #1 - orr r1, r3, r2, lsl r1 - str r1, [r0, ip, lsl #2] - ldmia sp!, {r4, r5, r6, pc} - .align 2, 0 -_02058E64: .word IQ_SKILL_RESTRICTIONS - arm_func_end EnableIqSkill - - arm_func_start GetSpeciesIqSkill -GetSpeciesIqSkill: ; 0x02058E68 - stmdb sp!, {r4, lr} - mov r4, r1 - bl GetIqGroup - ldr r2, _02058E88 ; =IQ_GROUP_SKILLS - mov r1, #0x19 - mla r1, r0, r1, r2 - ldrb r0, [r4, r1] - ldmia sp!, {r4, pc} - .align 2, 0 -_02058E88: .word IQ_GROUP_SKILLS - arm_func_end GetSpeciesIqSkill - - arm_func_start DisableAllIqSkills -DisableAllIqSkills: ; 0x02058E8C - mov r3, #0 - mov r2, r3 -_02058E94: - add r1, r3, #1 - mov r1, r1, lsl #0x10 - str r2, [r0, r3, lsl #2] - mov r3, r1, asr #0x10 - cmp r3, #3 - blt _02058E94 - bx lr - arm_func_end DisableAllIqSkills - - arm_func_start EnableAllLearnableIqSkills -EnableAllLearnableIqSkills: ; 0x02058EB0 - stmdb sp!, {r4, r5, r6, lr} - sub sp, sp, #0x48 - mov r6, r0 - add r0, sp, #0 - bl GetLearnableIqSkills - mov r0, r6 - bl DisableAllIqSkills - mov r5, #0 - add r4, sp, #0 - b _02058EF4 -_02058ED8: - ldrb r0, [r4, r5] - cmp r0, #0 - beq _02058EFC - ldrb r1, [r4, r5] - mov r0, r6 - bl EnableIqSkill - add r5, r5, #1 -_02058EF4: - cmp r5, #0x45 - blt _02058ED8 -_02058EFC: - add sp, sp, #0x48 - ldmia sp!, {r4, r5, r6, pc} - arm_func_end EnableAllLearnableIqSkills diff --git a/asm/main_02058C4C.s b/asm/main_02058C4C.s new file mode 100644 index 00000000..14f912ce --- /dev/null +++ b/asm/main_02058C4C.s @@ -0,0 +1,238 @@ + .include "asm/macros.inc" + .include "main_02058C4C.inc" + + .text + + arm_func_start GetUnlockedTactics +GetUnlockedTactics: ; 0x02058C4C + stmdb sp!, {r3, lr} + mov lr, #0 + ldr r3, _02058C98 ; =TACTICS_UNLOCK_LEVEL_TABLE + mov ip, lr +_02058C5C: + mov r2, ip, lsl #1 + ldrsh r2, [r3, r2] + cmp r2, r1 + strleb ip, [r0, lr] + add ip, ip, #1 + addle lr, lr, #1 + cmp ip, #0xc + blt _02058C5C + mov r1, #0xb + b _02058C8C +_02058C84: + strb r1, [r0, lr] + add lr, lr, #1 +_02058C8C: + cmp lr, #0xc + blt _02058C84 + ldmia sp!, {r3, pc} + .align 2, 0 +_02058C98: .word TACTICS_UNLOCK_LEVEL_TABLE + arm_func_end GetUnlockedTactics + + arm_func_start GetUnlockedTacticFlags +GetUnlockedTacticFlags: ; 0x02058C9C + stmdb sp!, {r4, lr} + mov r4, #0 + ldr lr, _02058CD4 ; =TACTICS_UNLOCK_LEVEL_TABLE + mov r2, r4 + mov r3, #1 +_02058CB0: + mov ip, r4, lsl #1 + ldrsh ip, [lr, ip] + cmp ip, r1 + strleb r3, [r0, r4] + strgtb r2, [r0, r4] + add r4, r4, #1 + cmp r4, #0xc + blt _02058CB0 + ldmia sp!, {r4, pc} + .align 2, 0 +_02058CD4: .word TACTICS_UNLOCK_LEVEL_TABLE + arm_func_end GetUnlockedTacticFlags + + arm_func_start CanLearnIqSkill +CanLearnIqSkill: ; 0x02058CD8 + cmp r1, #0 + moveq r0, #0 + bxeq lr + ldr r2, _02058D00 ; =IQ_SKILLS + ldr r1, [r2, r1, lsl #2] + cmp r1, r0 + movle r0, #1 + movgt r0, #0 + and r0, r0, #0xff + bx lr + .align 2, 0 +_02058D00: .word IQ_SKILLS + arm_func_end CanLearnIqSkill + + arm_func_start GetLearnableIqSkills +GetLearnableIqSkills: ; 0x02058D04 + stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr} + mov r6, #0 + mov sl, r0 + mov sb, r1 + mov r8, r2 + mov r5, r6 + ldr r4, _02058DA0 ; =IQ_GROUP_SKILLS + mov fp, #0x19 + b _02058D74 +_02058D28: + mov r0, sb + bl GetIqGroup + mla r1, r0, fp, r4 + and r0, r5, #0xff + ldrb r7, [r0, r1] + cmp r7, #0xff + beq _02058D7C + cmp r7, #0x18 + bne _02058D58 + mov r0, #3 + bl GetPerformanceFlagWithChecks + b _02058D64 +_02058D58: + mov r0, r8 + mov r1, r7 + bl CanLearnIqSkill +_02058D64: + cmp r0, #0 + strneb r7, [sl, r6] + addne r6, r6, #1 + add r5, r5, #1 +_02058D74: + cmp r5, #0x19 + blt _02058D28 +_02058D7C: + mov r1, r6 + mov r0, #0 + b _02058D90 +_02058D88: + strb r0, [sl, r1] + add r1, r1, #1 +_02058D90: + cmp r1, #0x45 + blt _02058D88 + mov r0, r6 + ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc} + .align 2, 0 +_02058DA0: .word IQ_GROUP_SKILLS + arm_func_end GetLearnableIqSkills + + arm_func_start DisableIqSkill +DisableIqSkill: ; 0x02058DA4 + stmdb sp!, {r3, r4, r5, lr} + mov r4, r0 + mov r5, r1 + bl IqSkillFlagTest + cmp r0, #0 + beq _02058DE4 + mov r0, r5, asr #4 + add r0, r5, r0, lsr #27 + mov r2, r0, asr #5 + sub r0, r5, r2, lsl #5 + mov r1, #1 + mvn r0, r1, lsl r0 + ldr r1, [r4, r2, lsl #2] + and r0, r1, r0 + str r0, [r4, r2, lsl #2] + ldmia sp!, {r3, r4, r5, pc} +_02058DE4: + mov r0, r4 + mov r1, r5 + bl EnableIqSkill + ldmia sp!, {r3, r4, r5, pc} + arm_func_end DisableIqSkill + + arm_func_start EnableIqSkill +EnableIqSkill: ; 0x02058DF4 + stmdb sp!, {r4, r5, r6, lr} + ldr r2, _02058E64 ; =IQ_SKILL_RESTRICTIONS + mov r3, r1, lsl #1 + ldrsh ip, [r2, r3] + mov r3, #0 + mov r4, #1 +_02058E0C: + mov r5, r3, lsl #1 + ldrsh r5, [r2, r5] + cmp ip, r5 + bne _02058E3C + mov lr, r3, asr #4 + add lr, r3, lr, lsr #27 + mov r6, lr, asr #5 + sub lr, r3, r6, lsl #5 + mvn lr, r4, lsl lr + ldr r5, [r0, r6, lsl #2] + and r5, r5, lr + str r5, [r0, r6, lsl #2] +_02058E3C: + add r3, r3, #1 + cmp r3, #0x45 + blt _02058E0C + mov ip, r1, lsr #5 + ldr r3, [r0, ip, lsl #2] + sub r1, r1, ip, lsl #5 + mov r2, #1 + orr r1, r3, r2, lsl r1 + str r1, [r0, ip, lsl #2] + ldmia sp!, {r4, r5, r6, pc} + .align 2, 0 +_02058E64: .word IQ_SKILL_RESTRICTIONS + arm_func_end EnableIqSkill + + arm_func_start GetSpeciesIqSkill +GetSpeciesIqSkill: ; 0x02058E68 + stmdb sp!, {r4, lr} + mov r4, r1 + bl GetIqGroup + ldr r2, _02058E88 ; =IQ_GROUP_SKILLS + mov r1, #0x19 + mla r1, r0, r1, r2 + ldrb r0, [r4, r1] + ldmia sp!, {r4, pc} + .align 2, 0 +_02058E88: .word IQ_GROUP_SKILLS + arm_func_end GetSpeciesIqSkill + + arm_func_start DisableAllIqSkills +DisableAllIqSkills: ; 0x02058E8C + mov r3, #0 + mov r2, r3 +_02058E94: + add r1, r3, #1 + mov r1, r1, lsl #0x10 + str r2, [r0, r3, lsl #2] + mov r3, r1, asr #0x10 + cmp r3, #3 + blt _02058E94 + bx lr + arm_func_end DisableAllIqSkills + + arm_func_start EnableAllLearnableIqSkills +EnableAllLearnableIqSkills: ; 0x02058EB0 + stmdb sp!, {r4, r5, r6, lr} + sub sp, sp, #0x48 + mov r6, r0 + add r0, sp, #0 + bl GetLearnableIqSkills + mov r0, r6 + bl DisableAllIqSkills + mov r5, #0 + add r4, sp, #0 + b _02058EF4 +_02058ED8: + ldrb r0, [r4, r5] + cmp r0, #0 + beq _02058EFC + ldrb r1, [r4, r5] + mov r0, r6 + bl EnableIqSkill + add r5, r5, #1 +_02058EF4: + cmp r5, #0x45 + blt _02058ED8 +_02058EFC: + add sp, sp, #0x48 + ldmia sp!, {r4, r5, r6, pc} + arm_func_end EnableAllLearnableIqSkills diff --git a/asm/main_rodata_020908D4.s b/asm/main_rodata_020908D4.s index 3c13073e..0fb316bc 100644 --- a/asm/main_rodata_020908D4.s +++ b/asm/main_rodata_020908D4.s @@ -10719,66 +10719,3 @@ _020A18FC: .global _020A1904 _020A1904: .byte 0x96, 0x97, 0x98, 0x99, 0x9A, 0x00, 0x00, 0x00 - .global _020A190C -_020A190C: - .byte 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01 - .byte 0x01, 0x00, 0x01, 0x00 - .global FORBIDDEN_FORGOT_MOVE_LIST -FORBIDDEN_FORGOT_MOVE_LIST: - .byte 0x18, 0x03, 0xD6, 0x00, 0xFB, 0x00, 0x19, 0x01, 0xD6, 0x00, 0x08, 0x00 - .byte 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00 - .global _020A192C -_020A192C: - .byte 0x00, 0x0E, 0x03, 0x04, 0x0C, 0x09, 0x02, 0x0E - .byte 0x11, 0x0A, 0x0D, 0x10, 0x08, 0x07, 0x01, 0x11, 0x10, 0x05, 0x00, 0x00 - .global TACTICS_UNLOCK_LEVEL_TABLE -TACTICS_UNLOCK_LEVEL_TABLE: - .byte 0x01, 0x00, 0x14, 0x00 - .byte 0xFF, 0xFF, 0xFF, 0xFF, 0xE7, 0x03, 0xE7, 0x03, 0x23, 0x00, 0x1E, 0x00, 0xE7, 0x03, 0x0A, 0x00 - .byte 0x0F, 0x00, 0xE7, 0x03 - .global _020A1958 -_020A1958: - .byte 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E - .byte 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E - .byte 0x8F, 0x90, 0x00, 0x00 - .global CLIENT_LEVEL_TABLE -CLIENT_LEVEL_TABLE: - .byte 0x00, 0x00, 0x07, 0x00, 0x08, 0x00, 0x09, 0x00, 0x0A, 0x00, 0x0B, 0x00 - .byte 0x0B, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0D, 0x00, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x00 - .byte 0x0F, 0x00, 0x0F, 0x00 - .global OUTLAW_LEVEL_TABLE -OUTLAW_LEVEL_TABLE: - .byte 0x00, 0x00, 0x11, 0x00, 0x14, 0x00, 0x19, 0x00, 0x20, 0x00, 0x25, 0x00 - .byte 0x2A, 0x00, 0x2F, 0x00, 0x34, 0x00, 0x39, 0x00, 0x3C, 0x00, 0x41, 0x00, 0x46, 0x00, 0x4B, 0x00 - .byte 0x50, 0x00, 0x5A, 0x00 - .global OUTLAW_MINION_LEVEL_TABLE -OUTLAW_MINION_LEVEL_TABLE: - .byte 0x00, 0x00, 0x11, 0x00, 0x14, 0x00, 0x19, 0x00, 0x20, 0x00, 0x25, 0x00 - .byte 0x2A, 0x00, 0x2F, 0x00, 0x34, 0x00, 0x39, 0x00, 0x3C, 0x00, 0x41, 0x00, 0x46, 0x00, 0x4B, 0x00 - .byte 0x50, 0x00, 0x5A, 0x00 - .global HIDDEN_POWER_BASE_POWER_TABLE -HIDDEN_POWER_BASE_POWER_TABLE: - .byte 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00 - .byte 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00 - .byte 0x0D, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00 - .global VERSION_EXCLUSIVE_MONSTERS -VERSION_EXCLUSIVE_MONSTERS: - .byte 0xC8, 0x01, 0x01, 0x00 - .byte 0x20, 0x04, 0x01, 0x00, 0xC6, 0x01, 0x01, 0x00, 0x1E, 0x04, 0x01, 0x00, 0x0C, 0x00, 0x01, 0x00 - .byte 0x64, 0x02, 0x01, 0x00, 0xD5, 0x01, 0x00, 0x01, 0x2D, 0x04, 0x00, 0x01, 0xBF, 0x01, 0x00, 0x01 - .byte 0x17, 0x04, 0x00, 0x01, 0xC0, 0x01, 0x00, 0x01, 0x18, 0x04, 0x00, 0x01, 0xC1, 0x01, 0x00, 0x01 - .byte 0x19, 0x04, 0x00, 0x01, 0x0F, 0x00, 0x00, 0x01, 0x67, 0x02, 0x00, 0x01, 0xE9, 0x01, 0x01, 0x00 - .byte 0x41, 0x04, 0x01, 0x00, 0xEA, 0x01, 0x01, 0x00, 0x42, 0x04, 0x01, 0x00, 0x16, 0x01, 0x01, 0x00 - .byte 0x09, 0x02, 0x00, 0x01, 0x96, 0x00, 0x00, 0x01 - .global IQ_SKILL_RESTRICTIONS -IQ_SKILL_RESTRICTIONS: - .byte 0x0F, 0x27, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00 - .byte 0x04, 0x00, 0x04, 0x00, 0x06, 0x00, 0x07, 0x00, 0x08, 0x00, 0x09, 0x00, 0x09, 0x00, 0x09, 0x00 - .byte 0x0A, 0x00, 0x0A, 0x00, 0x0B, 0x00, 0x0B, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x10, 0x00 - .byte 0x14, 0x00, 0x09, 0x00, 0x11, 0x00, 0x06, 0x00, 0x18, 0x00, 0x19, 0x00, 0x1A, 0x00, 0x1B, 0x00 - .byte 0x1C, 0x00, 0x1D, 0x00, 0x1E, 0x00, 0x1F, 0x00, 0x20, 0x00, 0x21, 0x00, 0x22, 0x00, 0x23, 0x00 - .byte 0x24, 0x00, 0x25, 0x00, 0x26, 0x00, 0x27, 0x00, 0x28, 0x00, 0x29, 0x00, 0x2A, 0x00, 0x2B, 0x00 - .byte 0x2C, 0x00, 0x2D, 0x00, 0x2E, 0x00, 0x2F, 0x00, 0x30, 0x00, 0x31, 0x00, 0x32, 0x00, 0x33, 0x00 - .byte 0x34, 0x00, 0x35, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00, 0x39, 0x00, 0x3A, 0x00, 0x3B, 0x00 - .byte 0x3C, 0x00, 0x3D, 0x00, 0x3E, 0x00, 0x3F, 0x00, 0x40, 0x00, 0x41, 0x00, 0x42, 0x00, 0x43, 0x00 - .byte 0x44, 0x00, 0x00, 0x00 diff --git a/asm/main_rodata_020A190C.s b/asm/main_rodata_020A190C.s new file mode 100644 index 00000000..b59639cd --- /dev/null +++ b/asm/main_rodata_020A190C.s @@ -0,0 +1,63 @@ + .include "asm/macros.inc" + .include "main_rodata_020A190C.inc" + + .rodata + .global FORBIDDEN_FORGOT_MOVE_LIST +FORBIDDEN_FORGOT_MOVE_LIST: + .byte 0x18, 0x03, 0xD6, 0x00, 0xFB, 0x00, 0x19, 0x01, 0xD6, 0x00, 0x08, 0x00 + .byte 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00 + .global _020A192C +_020A192C: + .byte 0x00, 0x0E, 0x03, 0x04, 0x0C, 0x09, 0x02, 0x0E + .byte 0x11, 0x0A, 0x0D, 0x10, 0x08, 0x07, 0x01, 0x11, 0x10, 0x05, 0x00, 0x00 + .global TACTICS_UNLOCK_LEVEL_TABLE +TACTICS_UNLOCK_LEVEL_TABLE: + .byte 0x01, 0x00, 0x14, 0x00 + .byte 0xFF, 0xFF, 0xFF, 0xFF, 0xE7, 0x03, 0xE7, 0x03, 0x23, 0x00, 0x1E, 0x00, 0xE7, 0x03, 0x0A, 0x00 + .byte 0x0F, 0x00, 0xE7, 0x03 + .global _020A1958 +_020A1958: + .byte 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E + .byte 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E + .byte 0x8F, 0x90, 0x00, 0x00 + .global CLIENT_LEVEL_TABLE +CLIENT_LEVEL_TABLE: + .byte 0x00, 0x00, 0x07, 0x00, 0x08, 0x00, 0x09, 0x00, 0x0A, 0x00, 0x0B, 0x00 + .byte 0x0B, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0D, 0x00, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x00 + .byte 0x0F, 0x00, 0x0F, 0x00 + .global OUTLAW_LEVEL_TABLE +OUTLAW_LEVEL_TABLE: + .byte 0x00, 0x00, 0x11, 0x00, 0x14, 0x00, 0x19, 0x00, 0x20, 0x00, 0x25, 0x00 + .byte 0x2A, 0x00, 0x2F, 0x00, 0x34, 0x00, 0x39, 0x00, 0x3C, 0x00, 0x41, 0x00, 0x46, 0x00, 0x4B, 0x00 + .byte 0x50, 0x00, 0x5A, 0x00 + .global OUTLAW_MINION_LEVEL_TABLE +OUTLAW_MINION_LEVEL_TABLE: + .byte 0x00, 0x00, 0x11, 0x00, 0x14, 0x00, 0x19, 0x00, 0x20, 0x00, 0x25, 0x00 + .byte 0x2A, 0x00, 0x2F, 0x00, 0x34, 0x00, 0x39, 0x00, 0x3C, 0x00, 0x41, 0x00, 0x46, 0x00, 0x4B, 0x00 + .byte 0x50, 0x00, 0x5A, 0x00 + .global HIDDEN_POWER_BASE_POWER_TABLE +HIDDEN_POWER_BASE_POWER_TABLE: + .byte 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00 + .byte 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00 + .byte 0x0D, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00 + .global VERSION_EXCLUSIVE_MONSTERS +VERSION_EXCLUSIVE_MONSTERS: + .byte 0xC8, 0x01, 0x01, 0x00 + .byte 0x20, 0x04, 0x01, 0x00, 0xC6, 0x01, 0x01, 0x00, 0x1E, 0x04, 0x01, 0x00, 0x0C, 0x00, 0x01, 0x00 + .byte 0x64, 0x02, 0x01, 0x00, 0xD5, 0x01, 0x00, 0x01, 0x2D, 0x04, 0x00, 0x01, 0xBF, 0x01, 0x00, 0x01 + .byte 0x17, 0x04, 0x00, 0x01, 0xC0, 0x01, 0x00, 0x01, 0x18, 0x04, 0x00, 0x01, 0xC1, 0x01, 0x00, 0x01 + .byte 0x19, 0x04, 0x00, 0x01, 0x0F, 0x00, 0x00, 0x01, 0x67, 0x02, 0x00, 0x01, 0xE9, 0x01, 0x01, 0x00 + .byte 0x41, 0x04, 0x01, 0x00, 0xEA, 0x01, 0x01, 0x00, 0x42, 0x04, 0x01, 0x00, 0x16, 0x01, 0x01, 0x00 + .byte 0x09, 0x02, 0x00, 0x01, 0x96, 0x00, 0x00, 0x01 + .global IQ_SKILL_RESTRICTIONS +IQ_SKILL_RESTRICTIONS: + .byte 0x0F, 0x27, 0x04, 0x00, 0x01, 0x00, 0x02, 0x00 + .byte 0x04, 0x00, 0x04, 0x00, 0x06, 0x00, 0x07, 0x00, 0x08, 0x00, 0x09, 0x00, 0x09, 0x00, 0x09, 0x00 + .byte 0x0A, 0x00, 0x0A, 0x00, 0x0B, 0x00, 0x0B, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x10, 0x00 + .byte 0x14, 0x00, 0x09, 0x00, 0x11, 0x00, 0x06, 0x00, 0x18, 0x00, 0x19, 0x00, 0x1A, 0x00, 0x1B, 0x00 + .byte 0x1C, 0x00, 0x1D, 0x00, 0x1E, 0x00, 0x1F, 0x00, 0x20, 0x00, 0x21, 0x00, 0x22, 0x00, 0x23, 0x00 + .byte 0x24, 0x00, 0x25, 0x00, 0x26, 0x00, 0x27, 0x00, 0x28, 0x00, 0x29, 0x00, 0x2A, 0x00, 0x2B, 0x00 + .byte 0x2C, 0x00, 0x2D, 0x00, 0x2E, 0x00, 0x2F, 0x00, 0x30, 0x00, 0x31, 0x00, 0x32, 0x00, 0x33, 0x00 + .byte 0x34, 0x00, 0x35, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00, 0x39, 0x00, 0x3A, 0x00, 0x3B, 0x00 + .byte 0x3C, 0x00, 0x3D, 0x00, 0x3E, 0x00, 0x3F, 0x00, 0x40, 0x00, 0x41, 0x00, 0x42, 0x00, 0x43, 0x00 + .byte 0x44, 0x00, 0x00, 0x00 diff --git a/include/enums.h b/include/enums.h index 924ea993..7b420f75 100644 --- a/include/enums.h +++ b/include/enums.h @@ -1,6 +1,8 @@ #ifndef PMDSKY_ENUMS_H #define PMDSKY_ENUMS_H +#define NUM_TACTICS TACTIC_NONE + 1 + // Tactic ID. These are usually encoded as bitvectors. enum tactic_id { TACTIC_LETS_GO_TOGETHER = 0, @@ -3424,6 +3426,7 @@ enum special_episode_type { EPISODE_TODAYS_OH_MY_GOSH = 2, EPISODE_HERE_COMES_TEAM_CHARM = 3, EPISODE_IN_THE_FUTURE_OF_DARKNESS = 4, + NUM_SPECIAL_EPISODES = 5 }; #endif //PMDSKY_ENUMS_H diff --git a/include/main_02058C3C.h b/include/main_02058C3C.h new file mode 100644 index 00000000..ab1685d5 --- /dev/null +++ b/include/main_02058C3C.h @@ -0,0 +1,10 @@ +#ifndef PMDSKY_MAIN_02058C3C_H +#define PMDSKY_MAIN_02058C3C_H + +#include "enums.h" +#include "util.h" + +// Returns whether or not the tactic involves following the team leader. +bool8 DoesTacticFollowLeader(enum tactic_id tactic_id); + +#endif //PMDSKY_MAIN_02058C3C_H diff --git a/include/tactics_data.h b/include/tactics_data.h new file mode 100644 index 00000000..78aaa65e --- /dev/null +++ b/include/tactics_data.h @@ -0,0 +1,9 @@ +#ifndef PMDSKY_TACTICS_DATA_H +#define PMDSKY_TACTICS_DATA_H + +#include "enums.h" +#include "util.h" + +extern const bool8 TACTICS_FOLLOW_LEADER[NUM_TACTICS]; + +#endif //PMDSKY_TACTICS_DATA_H diff --git a/main.lsf b/main.lsf index 69e08ea9..df127565 100644 --- a/main.lsf +++ b/main.lsf @@ -100,6 +100,8 @@ Static main Object asm/main_02051504.o Object src/main_02051760.o Object asm/main_02051788.o + Object src/tactics_data.o + Object asm/main_rodata_020A190C.o Object src/secondary_terrain_types.o Object asm/main_rodata_020A1BB0.o Object src/main_020517D4.o @@ -116,6 +118,8 @@ Static main Object asm/main_02054C24.o Object src/main_02054DC4.o Object asm/main_02054E4C.o + Object src/main_02058C3C.o + Object asm/main_02058C4C.o Object src/pokemon.o Object asm/main_02058F24.o Object src/main_0206C98C.o diff --git a/src/main_020517D4.c b/src/main_020517D4.c index ee24048a..15a8c621 100644 --- a/src/main_020517D4.c +++ b/src/main_020517D4.c @@ -1,8 +1,16 @@ #include "main_020517D4.h" +#include "enums.h" // 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 }; +const u32 BAG_CAPACITY_TABLE[8] = { 16, 24, 32, 40, 40, 40, 48, 48 }; +const u32 BAG_CAPACITY_TABLE_SPECIAL_EPISODES[NUM_SPECIAL_EPISODES] = +{ + [EPISODE_BIDOOFS_WISH] = 24, + [EPISODE_IGGLYBUFF_THE_PRODIGY] = 48, + [EPISODE_TODAYS_OH_MY_GOSH] = 48, + [EPISODE_HERE_COMES_TEAM_CHARM] = 48, + [EPISODE_IN_THE_FUTURE_OF_DARKNESS] = 48 +}; u32 GetBagCapacity(s32 scenario_balance) { diff --git a/src/main_02058C3C.c b/src/main_02058C3C.c new file mode 100644 index 00000000..ecd2d0c1 --- /dev/null +++ b/src/main_02058C3C.c @@ -0,0 +1,7 @@ +#include "main_02058C3C.h" +#include "tactics_data.h" + +bool8 DoesTacticFollowLeader(enum tactic_id tactic_id) +{ + return TACTICS_FOLLOW_LEADER[tactic_id]; +} diff --git a/src/tactics_data.c b/src/tactics_data.c new file mode 100644 index 00000000..c305efed --- /dev/null +++ b/src/tactics_data.c @@ -0,0 +1,17 @@ +#include "tactics_data.h" + +const bool8 TACTICS_FOLLOW_LEADER[NUM_TACTICS] = +{ + [TACTIC_LETS_GO_TOGETHER] = TRUE, + [TACTIC_YOU_GO_THE_OTHER_WAY] = FALSE, + [TACTIC_GO_AFTER_FOES] = FALSE, + [TACTIC_AVOID_THE_FIRST_HIT] = FALSE, + [TACTIC_ALL_FOR_ONE] = TRUE, + [TACTIC_GROUP_SAFETY] = TRUE, + [TACTIC_AVOID_TROUBLE] = TRUE, + [TACTIC_BE_PATIENT] = TRUE, + [TACTIC_KEEP_YOUR_DISTANCE] = TRUE, + [TACTIC_WAIT_THERE] = FALSE, + [TACTIC_GET_AWAY_FROM_HERE] = TRUE, + [TACTIC_NONE] = FALSE +};