mirror of
https://github.com/pret/pmd-sky.git
synced 2026-08-27 05:07:12 -05:00
Merge pull request #156 from Chesyon/main
Some checks are pending
build / build (push) Waiting to run
Some checks are pending
build / build (push) Waiting to run
Another assortment of small functions
This commit is contained in:
@@ -2,17 +2,11 @@
|
||||
.public CopyBitsFrom
|
||||
.public CopyBitsTo
|
||||
.public DUNGEON_RESTRICTIONS
|
||||
.public DungeonFloorToGroupFloor
|
||||
.public GetItemIdFromList
|
||||
.public GetNbFloorsPlusOne
|
||||
.public MISSION_FLOORS_FORBIDDEN
|
||||
.public RandIntSafe
|
||||
.public _020A0C68
|
||||
.public _020A0C69
|
||||
.public _020A0C6A
|
||||
.public _020A0C6C
|
||||
.public _020A0C6E
|
||||
.public _020A1864
|
||||
.public _020AFF7C
|
||||
.public _020AFF80
|
||||
.public _020AFF88
|
||||
|
||||
10
asm/include/main_02051504.inc
Normal file
10
asm/include/main_02051504.inc
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
.public CopyBitsFrom
|
||||
.public CopyBitsTo
|
||||
.public DUNGEON_RESTRICTIONS
|
||||
.public DungeonFloorToGroupFloor
|
||||
.public GetItemIdFromList
|
||||
.public GetNbFloorsPlusOne
|
||||
.public MISSION_FLOORS_FORBIDDEN
|
||||
.public RandIntSafe
|
||||
.public _020A1864
|
||||
@@ -1,4 +1,56 @@
|
||||
#pragma once
|
||||
.public Debug_Print0
|
||||
.public DecompressAtNormalVeneer
|
||||
.public DexNumbersEqual
|
||||
.public DirectoryFileMngr_OpenDirectoryFile
|
||||
.public DungeonToGroundMoveset
|
||||
.public EnableAllLearnableIqSkills
|
||||
.public FORBIDDEN_FORGOT_MOVE_LIST
|
||||
.public FemaleToMaleForm
|
||||
.public GetBaseHp
|
||||
.public GetDexNumber
|
||||
.public GetInfoGroundMoveset
|
||||
.public GetInfoMoveGround
|
||||
.public GetKeyM2NSwitch
|
||||
.public GetKeyN2MSwitch
|
||||
.public GetLanguage
|
||||
.public GetMonsterGender
|
||||
.public GetMovesetEggPtr
|
||||
.public GetMovesetHmTmPtr
|
||||
.public GetMovesetIdx__02013CAC
|
||||
.public GetMovesetLevelUpPtr
|
||||
.public GetNameRaw
|
||||
.public GetNameString
|
||||
.public GetNbMoves
|
||||
.public GetSpriteSize
|
||||
.public GroundToDungeonMoveset
|
||||
.public HIDDEN_POWER_BASE_POWER_TABLE
|
||||
.public HandleSir0Translation
|
||||
.public IsShaymin
|
||||
.public IsValidTeamMember
|
||||
.public ItemZInit
|
||||
.public LEVEL_UP_DATA_DECOMPRESS_BUFFER
|
||||
.public LEVEL_UP_DATA_MONSTER_ID
|
||||
.public LoadFileFromRom
|
||||
.public LoadMonsterMd
|
||||
.public MONSTER_DATA_TABLE_PTR
|
||||
.public MemAlloc
|
||||
.public MemFree
|
||||
.public PointsToZero
|
||||
.public Rand16Bit
|
||||
.public RandIntSafe
|
||||
.public RemoveActiveMembersFromAllTeams
|
||||
.public RemoveActiveMembersFromRescueTeam
|
||||
.public RemoveActiveMembersFromSpecialEpisodeTeam
|
||||
.public SprintfStatic__02052418
|
||||
.public StrcpyName
|
||||
.public StrncmpSimple
|
||||
.public StrncpyName
|
||||
.public StrncpySimple
|
||||
.public TEAM_MEMBER_TABLE
|
||||
.public TEAM_MEMBER_TABLE_PTR
|
||||
.public UnloadFile
|
||||
.public ZInit8
|
||||
.public _020A1880
|
||||
.public _020A1884
|
||||
.public _020A189C
|
||||
@@ -17,53 +69,6 @@
|
||||
.public _020B12F4_EU
|
||||
.public _020B1308_EU
|
||||
.public _s32_div_f
|
||||
.public Debug_Print0
|
||||
.public DecompressAtNormalVeneer
|
||||
.public DexNumbersEqual
|
||||
.public DirectoryFileMngr_OpenDirectoryFile
|
||||
.public DungeonToGroundMoveset
|
||||
.public EnableAllLearnableIqSkills
|
||||
.public FemaleToMaleForm
|
||||
.public FORBIDDEN_FORGOT_MOVE_LIST
|
||||
.public GetBaseHp
|
||||
.public GetDexNumber
|
||||
.public GetInfoGroundMoveset
|
||||
.public GetInfoMoveGround
|
||||
.public GetKeyM2NSwitch
|
||||
.public GetKeyN2MSwitch
|
||||
.public GetLanguage
|
||||
.public GetMonsterGender
|
||||
.public GetMovesetEggPtr
|
||||
.public GetMovesetHmTmPtr
|
||||
.public GetMovesetIdx__02013CAC
|
||||
.public GetMovesetLevelUpPtr
|
||||
.public GetNameRaw
|
||||
.public GetNameString
|
||||
.public GetNbMoves
|
||||
.public GetSpriteSize
|
||||
.public GroundToDungeonMoveset
|
||||
.public HandleSir0Translation
|
||||
.public HIDDEN_POWER_BASE_POWER_TABLE
|
||||
.public IsValidTeamMember
|
||||
.public ItemZInit
|
||||
.public LEVEL_UP_DATA_DECOMPRESS_BUFFER
|
||||
.public LEVEL_UP_DATA_MONSTER_ID
|
||||
.public LoadFileFromRom
|
||||
.public LoadMonsterMd
|
||||
.public MemAlloc
|
||||
.public MemFree
|
||||
.public MONSTER_DATA_TABLE_PTR
|
||||
.public PointsToZero
|
||||
.public Rand16Bit
|
||||
.public RandIntSafe
|
||||
.public RemoveActiveMembersFromAllTeams
|
||||
.public RemoveActiveMembersFromRescueTeam
|
||||
.public RemoveActiveMembersFromSpecialEpisodeTeam
|
||||
.public SprintfStatic__02052418
|
||||
.public StrcpyName
|
||||
.public StrncmpSimple
|
||||
.public StrncpyName
|
||||
.public StrncpySimple
|
||||
.public sub_01FF8F28
|
||||
.public sub_02015090
|
||||
.public sub_02025304_JP
|
||||
@@ -77,8 +82,4 @@
|
||||
.public sub_020560B8
|
||||
.public sub_020564B0
|
||||
.public sub_02056504
|
||||
.public TEAM_MEMBER_TABLE
|
||||
.public TEAM_MEMBER_TABLE_PTR
|
||||
.public UnloadFile
|
||||
.public vsprintf
|
||||
.public ZInit8
|
||||
|
||||
1
asm/include/main_02054AD4.inc
Normal file
1
asm/include/main_02054AD4.inc
Normal file
@@ -0,0 +1 @@
|
||||
#pragma once
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
.public DUNGEON_PTR
|
||||
.public DirectoryFileMngr_GetDirectoryFileSize
|
||||
.public FloorNumberIsEven
|
||||
.public GendersEqualNotGenderless
|
||||
.public GetMonsterGender
|
||||
.public GetSpriteFileSize
|
||||
@@ -10,6 +9,5 @@
|
||||
.public LoadWanTableEntryFromPack
|
||||
.public LoadWanTableEntryFromPackUseProvidedMemory
|
||||
.public MemAlloc
|
||||
.public ReplaceWanFromBinFile
|
||||
.public WAN_TABLE
|
||||
.public ov29_0237C9B0
|
||||
@@ -370,240 +370,3 @@ _020514A8:
|
||||
and r0, r0, #0xff
|
||||
bx lr
|
||||
arm_func_end JoinedAtRangeCheck
|
||||
|
||||
arm_func_start IsDojoDungeon
|
||||
IsDojoDungeon: ; 0x020514B0
|
||||
cmp r0, #0xb4
|
||||
blo _020514C4
|
||||
cmp r0, #0xd3
|
||||
movls r0, #1
|
||||
bxls lr
|
||||
_020514C4:
|
||||
mov r0, #0
|
||||
bx lr
|
||||
arm_func_end IsDojoDungeon
|
||||
|
||||
arm_func_start IsFutureDungeon
|
||||
IsFutureDungeon: ; 0x020514CC
|
||||
cmp r0, #0x1b
|
||||
blo _020514E0
|
||||
cmp r0, #0x21
|
||||
movls r0, #1
|
||||
bxls lr
|
||||
_020514E0:
|
||||
mov r0, #0
|
||||
bx lr
|
||||
arm_func_end IsFutureDungeon
|
||||
|
||||
arm_func_start IsSpecialEpisodeDungeon
|
||||
IsSpecialEpisodeDungeon: ; 0x020514E8
|
||||
cmp r0, #0x7b
|
||||
blo _020514FC
|
||||
cmp r0, #0xa4
|
||||
movls r0, #1
|
||||
bxls lr
|
||||
_020514FC:
|
||||
mov r0, #0
|
||||
bx lr
|
||||
arm_func_end IsSpecialEpisodeDungeon
|
||||
|
||||
arm_func_start RetrieveFromItemList1
|
||||
RetrieveFromItemList1: ; 0x02051504
|
||||
stmdb sp!, {r3, r4, r5, r6, r7, lr}
|
||||
mov r7, r0
|
||||
ldr r0, _02051564 ; =0x0000270F
|
||||
mov r6, r1
|
||||
bl RandIntSafe
|
||||
mov r4, r0
|
||||
ldr r0, _02051564 ; =0x0000270F
|
||||
bl RandIntSafe
|
||||
mov r5, r0
|
||||
ldrb r0, [r7]
|
||||
cmp r0, #0xb4
|
||||
cmphs r0, #0xd3
|
||||
movhs r0, #0x55
|
||||
ldmhsia sp!, {r3, r4, r5, r6, r7, pc}
|
||||
bl GetNbFloorsPlusOne
|
||||
ldrb r1, [r7, #1]
|
||||
cmp r1, r0
|
||||
movhs r0, #0x55
|
||||
ldmhsia sp!, {r3, r4, r5, r6, r7, pc}
|
||||
mov r0, r6
|
||||
mov r1, r4
|
||||
mov r2, r5
|
||||
bl GetItemIdFromList
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, pc}
|
||||
.align 2, 0
|
||||
_02051564: .word 0x0000270F
|
||||
arm_func_end RetrieveFromItemList1
|
||||
|
||||
arm_func_start IsForbiddenFloor
|
||||
IsForbiddenFloor: ; 0x02051568
|
||||
stmdb sp!, {r3, lr}
|
||||
mov r1, r0
|
||||
add r0, sp, #0
|
||||
bl DungeonFloorToGroupFloor
|
||||
ldrb ip, [sp]
|
||||
ldrb lr, [sp, #1]
|
||||
ldr r1, _020515C0 ; =MISSION_FLOORS_FORBIDDEN
|
||||
mov r3, #0
|
||||
_02051588:
|
||||
ldrb r0, [r1, r3, lsl #1]
|
||||
mov r2, r3, lsl #1
|
||||
cmp r0, #0x64
|
||||
beq _020515B8
|
||||
cmp ip, r0
|
||||
addeq r0, r1, r2
|
||||
ldreqb r0, [r0, #1]
|
||||
cmpeq lr, r0
|
||||
moveq r0, #1
|
||||
ldmeqia sp!, {r3, pc}
|
||||
add r3, r3, #1
|
||||
b _02051588
|
||||
_020515B8:
|
||||
mov r0, #0
|
||||
ldmia sp!, {r3, pc}
|
||||
.align 2, 0
|
||||
_020515C0: .word MISSION_FLOORS_FORBIDDEN
|
||||
arm_func_end IsForbiddenFloor
|
||||
|
||||
arm_func_start sub_020515C4
|
||||
sub_020515C4: ; 0x020515C4
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r5, r0
|
||||
mov r4, r1
|
||||
mov r2, #8
|
||||
bl CopyBitsTo
|
||||
mov r0, r5
|
||||
add r1, r4, #1
|
||||
mov r2, #8
|
||||
bl CopyBitsTo
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end sub_020515C4
|
||||
|
||||
arm_func_start Copy16BitsFrom
|
||||
Copy16BitsFrom: ; 0x020515EC
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r4, r1
|
||||
mov r3, #0
|
||||
strb r3, [r4]
|
||||
mov r5, r0
|
||||
mov r2, #8
|
||||
strb r3, [r4, #1]
|
||||
bl CopyBitsFrom
|
||||
mov r0, r5
|
||||
add r1, r4, #1
|
||||
mov r2, #8
|
||||
bl CopyBitsFrom
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end Copy16BitsFrom
|
||||
|
||||
arm_func_start sub_02051620
|
||||
sub_02051620: ; 0x02051620
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r5, r0
|
||||
mov r4, r1
|
||||
mov r2, #7
|
||||
bl CopyBitsTo
|
||||
mov r0, r5
|
||||
add r1, r4, #1
|
||||
mov r2, #7
|
||||
bl CopyBitsTo
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end sub_02051620
|
||||
|
||||
arm_func_start sub_02051648
|
||||
sub_02051648: ; 0x02051648
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r4, r1
|
||||
mov r3, #0
|
||||
strb r3, [r4]
|
||||
mov r5, r0
|
||||
mov r2, #7
|
||||
strb r3, [r4, #1]
|
||||
bl CopyBitsFrom
|
||||
mov r0, r5
|
||||
add r1, r4, #1
|
||||
mov r2, #7
|
||||
bl CopyBitsFrom
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end sub_02051648
|
||||
|
||||
arm_func_start RetrieveFromItemList2
|
||||
RetrieveFromItemList2: ; 0x0205167C
|
||||
stmdb sp!, {r3, r4, r5, r6, r7, lr}
|
||||
mov r7, r0
|
||||
ldr r0, _020516D8 ; =0x0000270F
|
||||
mov r6, r1
|
||||
bl RandIntSafe
|
||||
mov r5, r0
|
||||
ldr r0, _020516D8 ; =0x0000270F
|
||||
bl RandIntSafe
|
||||
mov r4, r0
|
||||
ldrb r0, [r7]
|
||||
cmp r0, #0xb4
|
||||
movhs r0, #0x55
|
||||
ldmhsia sp!, {r3, r4, r5, r6, r7, pc}
|
||||
bl GetNbFloorsPlusOne
|
||||
ldrb r1, [r7, #1]
|
||||
cmp r1, r0
|
||||
movhs r0, #0x55
|
||||
ldmhsia sp!, {r3, r4, r5, r6, r7, pc}
|
||||
mov r0, r6
|
||||
mov r1, r5
|
||||
mov r2, r4
|
||||
bl GetItemIdFromList
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, pc}
|
||||
.align 2, 0
|
||||
_020516D8: .word 0x0000270F
|
||||
arm_func_end RetrieveFromItemList2
|
||||
|
||||
arm_func_start IsInvalidForMission
|
||||
IsInvalidForMission: ; 0x020516DC
|
||||
cmp r0, #0xb4
|
||||
movhs r0, #1
|
||||
bxhs lr
|
||||
mov r2, #0
|
||||
ldr r1, _02051718 ; =_020A1864
|
||||
b _02051704
|
||||
_020516F4:
|
||||
cmp r3, r0
|
||||
moveq r0, #1
|
||||
bxeq lr
|
||||
add r2, r2, #1
|
||||
_02051704:
|
||||
ldrb r3, [r1, r2]
|
||||
cmp r3, #0xb4
|
||||
bne _020516F4
|
||||
mov r0, #0
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02051718: .word _020A1864
|
||||
arm_func_end IsInvalidForMission
|
||||
|
||||
arm_func_start IsExpEnabledInDungeon
|
||||
IsExpEnabledInDungeon: ; 0x0205171C
|
||||
mov r1, #0xc
|
||||
mul r1, r0, r1
|
||||
ldr r0, _02051740 ; =DUNGEON_RESTRICTIONS
|
||||
ldr r0, [r0, r1]
|
||||
tst r0, #4
|
||||
movne r0, #1
|
||||
moveq r0, #0
|
||||
and r0, r0, #0xff
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02051740: .word DUNGEON_RESTRICTIONS
|
||||
arm_func_end IsExpEnabledInDungeon
|
||||
|
||||
arm_func_start IsSkyExclusiveDungeon
|
||||
IsSkyExclusiveDungeon: ; 0x02051744
|
||||
cmp r0, #0x67
|
||||
blo _02051758
|
||||
cmp r0, #0xb0
|
||||
movls r0, #1
|
||||
bxls lr
|
||||
_02051758:
|
||||
mov r0, #0
|
||||
bx lr
|
||||
arm_func_end IsSkyExclusiveDungeon
|
||||
|
||||
205
asm/main_02051504.s
Normal file
205
asm/main_02051504.s
Normal file
@@ -0,0 +1,205 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "main_02051504.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start RetrieveFromItemList1
|
||||
RetrieveFromItemList1: ; 0x02051504
|
||||
stmdb sp!, {r3, r4, r5, r6, r7, lr}
|
||||
mov r7, r0
|
||||
ldr r0, _02051564 ; =0x0000270F
|
||||
mov r6, r1
|
||||
bl RandIntSafe
|
||||
mov r4, r0
|
||||
ldr r0, _02051564 ; =0x0000270F
|
||||
bl RandIntSafe
|
||||
mov r5, r0
|
||||
ldrb r0, [r7]
|
||||
cmp r0, #0xb4
|
||||
cmphs r0, #0xd3
|
||||
movhs r0, #0x55
|
||||
ldmhsia sp!, {r3, r4, r5, r6, r7, pc}
|
||||
bl GetNbFloorsPlusOne
|
||||
ldrb r1, [r7, #1]
|
||||
cmp r1, r0
|
||||
movhs r0, #0x55
|
||||
ldmhsia sp!, {r3, r4, r5, r6, r7, pc}
|
||||
mov r0, r6
|
||||
mov r1, r4
|
||||
mov r2, r5
|
||||
bl GetItemIdFromList
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, pc}
|
||||
.align 2, 0
|
||||
_02051564: .word 0x0000270F
|
||||
arm_func_end RetrieveFromItemList1
|
||||
|
||||
arm_func_start IsForbiddenFloor
|
||||
IsForbiddenFloor: ; 0x02051568
|
||||
stmdb sp!, {r3, lr}
|
||||
mov r1, r0
|
||||
add r0, sp, #0
|
||||
bl DungeonFloorToGroupFloor
|
||||
ldrb ip, [sp]
|
||||
ldrb lr, [sp, #1]
|
||||
ldr r1, _020515C0 ; =MISSION_FLOORS_FORBIDDEN
|
||||
mov r3, #0
|
||||
_02051588:
|
||||
ldrb r0, [r1, r3, lsl #1]
|
||||
mov r2, r3, lsl #1
|
||||
cmp r0, #0x64
|
||||
beq _020515B8
|
||||
cmp ip, r0
|
||||
addeq r0, r1, r2
|
||||
ldreqb r0, [r0, #1]
|
||||
cmpeq lr, r0
|
||||
moveq r0, #1
|
||||
ldmeqia sp!, {r3, pc}
|
||||
add r3, r3, #1
|
||||
b _02051588
|
||||
_020515B8:
|
||||
mov r0, #0
|
||||
ldmia sp!, {r3, pc}
|
||||
.align 2, 0
|
||||
_020515C0: .word MISSION_FLOORS_FORBIDDEN
|
||||
arm_func_end IsForbiddenFloor
|
||||
|
||||
arm_func_start sub_020515C4
|
||||
sub_020515C4: ; 0x020515C4
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r5, r0
|
||||
mov r4, r1
|
||||
mov r2, #8
|
||||
bl CopyBitsTo
|
||||
mov r0, r5
|
||||
add r1, r4, #1
|
||||
mov r2, #8
|
||||
bl CopyBitsTo
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end sub_020515C4
|
||||
|
||||
arm_func_start Copy16BitsFrom
|
||||
Copy16BitsFrom: ; 0x020515EC
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r4, r1
|
||||
mov r3, #0
|
||||
strb r3, [r4]
|
||||
mov r5, r0
|
||||
mov r2, #8
|
||||
strb r3, [r4, #1]
|
||||
bl CopyBitsFrom
|
||||
mov r0, r5
|
||||
add r1, r4, #1
|
||||
mov r2, #8
|
||||
bl CopyBitsFrom
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end Copy16BitsFrom
|
||||
|
||||
arm_func_start sub_02051620
|
||||
sub_02051620: ; 0x02051620
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r5, r0
|
||||
mov r4, r1
|
||||
mov r2, #7
|
||||
bl CopyBitsTo
|
||||
mov r0, r5
|
||||
add r1, r4, #1
|
||||
mov r2, #7
|
||||
bl CopyBitsTo
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end sub_02051620
|
||||
|
||||
arm_func_start sub_02051648
|
||||
sub_02051648: ; 0x02051648
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r4, r1
|
||||
mov r3, #0
|
||||
strb r3, [r4]
|
||||
mov r5, r0
|
||||
mov r2, #7
|
||||
strb r3, [r4, #1]
|
||||
bl CopyBitsFrom
|
||||
mov r0, r5
|
||||
add r1, r4, #1
|
||||
mov r2, #7
|
||||
bl CopyBitsFrom
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end sub_02051648
|
||||
|
||||
arm_func_start RetrieveFromItemList2
|
||||
RetrieveFromItemList2: ; 0x0205167C
|
||||
stmdb sp!, {r3, r4, r5, r6, r7, lr}
|
||||
mov r7, r0
|
||||
ldr r0, _020516D8 ; =0x0000270F
|
||||
mov r6, r1
|
||||
bl RandIntSafe
|
||||
mov r5, r0
|
||||
ldr r0, _020516D8 ; =0x0000270F
|
||||
bl RandIntSafe
|
||||
mov r4, r0
|
||||
ldrb r0, [r7]
|
||||
cmp r0, #0xb4
|
||||
movhs r0, #0x55
|
||||
ldmhsia sp!, {r3, r4, r5, r6, r7, pc}
|
||||
bl GetNbFloorsPlusOne
|
||||
ldrb r1, [r7, #1]
|
||||
cmp r1, r0
|
||||
movhs r0, #0x55
|
||||
ldmhsia sp!, {r3, r4, r5, r6, r7, pc}
|
||||
mov r0, r6
|
||||
mov r1, r5
|
||||
mov r2, r4
|
||||
bl GetItemIdFromList
|
||||
ldmia sp!, {r3, r4, r5, r6, r7, pc}
|
||||
.align 2, 0
|
||||
_020516D8: .word 0x0000270F
|
||||
arm_func_end RetrieveFromItemList2
|
||||
|
||||
arm_func_start IsInvalidForMission
|
||||
IsInvalidForMission: ; 0x020516DC
|
||||
cmp r0, #0xb4
|
||||
movhs r0, #1
|
||||
bxhs lr
|
||||
mov r2, #0
|
||||
ldr r1, _02051718 ; =_020A1864
|
||||
b _02051704
|
||||
_020516F4:
|
||||
cmp r3, r0
|
||||
moveq r0, #1
|
||||
bxeq lr
|
||||
add r2, r2, #1
|
||||
_02051704:
|
||||
ldrb r3, [r1, r2]
|
||||
cmp r3, #0xb4
|
||||
bne _020516F4
|
||||
mov r0, #0
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02051718: .word _020A1864
|
||||
arm_func_end IsInvalidForMission
|
||||
|
||||
arm_func_start IsExpEnabledInDungeon
|
||||
IsExpEnabledInDungeon: ; 0x0205171C
|
||||
mov r1, #0xc
|
||||
mul r1, r0, r1
|
||||
ldr r0, _02051740 ; =DUNGEON_RESTRICTIONS
|
||||
ldr r0, [r0, r1]
|
||||
tst r0, #4
|
||||
movne r0, #1
|
||||
moveq r0, #0
|
||||
and r0, r0, #0xff
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02051740: .word DUNGEON_RESTRICTIONS
|
||||
arm_func_end IsExpEnabledInDungeon
|
||||
|
||||
arm_func_start IsSkyExclusiveDungeon
|
||||
IsSkyExclusiveDungeon: ; 0x02051744
|
||||
cmp r0, #0x67
|
||||
blo _02051758
|
||||
cmp r0, #0xb0
|
||||
movls r0, #1
|
||||
bxls lr
|
||||
_02051758:
|
||||
mov r0, #0
|
||||
bx lr
|
||||
arm_func_end IsSkyExclusiveDungeon
|
||||
@@ -2625,104 +2625,3 @@ SprintfStatic__02054A60: ; 0x02054A60
|
||||
add sp, sp, #0x10
|
||||
bx lr
|
||||
arm_func_end SprintfStatic__02054A60
|
||||
|
||||
arm_func_start IsUnown
|
||||
IsUnown: ; 0x02054A88
|
||||
cmp r0, #0xc9
|
||||
blt _02054A9C
|
||||
cmp r0, #0xe4
|
||||
movle r0, #1
|
||||
bxle lr
|
||||
_02054A9C:
|
||||
mov r0, #0
|
||||
bx lr
|
||||
arm_func_end IsUnown
|
||||
|
||||
arm_func_start IsShaymin
|
||||
IsShaymin: ; 0x02054AA4
|
||||
ldr r1, _02054AD0 ; =0xFFFFFDEA
|
||||
add r0, r0, r1
|
||||
mov r0, r0, lsl #0x10
|
||||
mov r0, r0, asr #0x10
|
||||
mov r0, r0, lsl #0x10
|
||||
mov r0, r0, lsr #0x10
|
||||
cmp r0, #1
|
||||
movls r0, #1
|
||||
movhi r0, #0
|
||||
and r0, r0, #0xff
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02054AD0: .word 0xFFFFFDEA
|
||||
arm_func_end IsShaymin
|
||||
|
||||
arm_func_start IsCastform
|
||||
IsCastform: ; 0x02054AD4
|
||||
ldr r2, _02054B24 ; =0x0000017B
|
||||
cmp r0, r2
|
||||
cmpne r0, #0x17c
|
||||
addne r1, r2, #2
|
||||
cmpne r0, r1
|
||||
addne r1, r2, #3
|
||||
cmpne r0, r1
|
||||
beq _02054B14
|
||||
ldr r1, _02054B28 ; =0xFFFFFC2D
|
||||
add r0, r0, r1
|
||||
mov r0, r0, lsl #0x10
|
||||
mov r0, r0, asr #0x10
|
||||
mov r0, r0, lsl #0x10
|
||||
mov r0, r0, lsr #0x10
|
||||
cmp r0, #3
|
||||
bhi _02054B1C
|
||||
_02054B14:
|
||||
mov r0, #1
|
||||
bx lr
|
||||
_02054B1C:
|
||||
mov r0, #0
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02054B24: .word 0x0000017B
|
||||
_02054B28: .word 0xFFFFFC2D
|
||||
arm_func_end IsCastform
|
||||
|
||||
arm_func_start IsCherrim
|
||||
IsCherrim: ; 0x02054B2C
|
||||
cmp r0, #0x1cc
|
||||
ldrne r1, _02054B6C ; =0x000001CD
|
||||
cmpne r0, r1
|
||||
beq _02054B5C
|
||||
ldr r1, _02054B70 ; =0xFFFFFBDC
|
||||
add r0, r0, r1
|
||||
mov r0, r0, lsl #0x10
|
||||
mov r0, r0, asr #0x10
|
||||
mov r0, r0, lsl #0x10
|
||||
mov r0, r0, lsr #0x10
|
||||
cmp r0, #1
|
||||
bhi _02054B64
|
||||
_02054B5C:
|
||||
mov r0, #1
|
||||
bx lr
|
||||
_02054B64:
|
||||
mov r0, #0
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02054B6C: .word 0x000001CD
|
||||
_02054B70: .word 0xFFFFFBDC
|
||||
arm_func_end IsCherrim
|
||||
|
||||
; https://decomp.me/scratch/IvDKt
|
||||
arm_func_start IsDeoxys
|
||||
IsDeoxys: ; 0x02054B74
|
||||
ldr r1, _02054BA0 ; =0xFFFFFE5E
|
||||
add r0, r0, r1
|
||||
mov r0, r0, lsl #0x10
|
||||
mov r0, r0, asr #0x10
|
||||
mov r0, r0, lsl #0x10
|
||||
mov r0, r0, lsr #0x10
|
||||
cmp r0, #3
|
||||
movls r0, #1
|
||||
movhi r0, #0
|
||||
and r0, r0, #0xff
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02054BA0: .word 0xFFFFFE5E
|
||||
arm_func_end IsDeoxys
|
||||
|
||||
59
asm/main_02054AD4.s
Normal file
59
asm/main_02054AD4.s
Normal file
@@ -0,0 +1,59 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "main_02054AD4.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start IsCastform
|
||||
IsCastform: ; 0x02054AD4
|
||||
ldr r2, _02054B24 ; =0x0000017B
|
||||
cmp r0, r2
|
||||
cmpne r0, #0x17c
|
||||
addne r1, r2, #2
|
||||
cmpne r0, r1
|
||||
addne r1, r2, #3
|
||||
cmpne r0, r1
|
||||
beq _02054B14
|
||||
ldr r1, _02054B28 ; =0xFFFFFC2D
|
||||
add r0, r0, r1
|
||||
mov r0, r0, lsl #0x10
|
||||
mov r0, r0, asr #0x10
|
||||
mov r0, r0, lsl #0x10
|
||||
mov r0, r0, lsr #0x10
|
||||
cmp r0, #3
|
||||
bhi _02054B1C
|
||||
_02054B14:
|
||||
mov r0, #1
|
||||
bx lr
|
||||
_02054B1C:
|
||||
mov r0, #0
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02054B24: .word 0x0000017B
|
||||
_02054B28: .word 0xFFFFFC2D
|
||||
arm_func_end IsCastform
|
||||
|
||||
arm_func_start IsCherrim
|
||||
IsCherrim: ; 0x02054B2C
|
||||
cmp r0, #0x1cc
|
||||
ldrne r1, _02054B6C ; =0x000001CD
|
||||
cmpne r0, r1
|
||||
beq _02054B5C
|
||||
ldr r1, _02054B70 ; =0xFFFFFBDC
|
||||
add r0, r0, r1
|
||||
mov r0, r0, lsl #0x10
|
||||
mov r0, r0, asr #0x10
|
||||
mov r0, r0, lsl #0x10
|
||||
mov r0, r0, lsr #0x10
|
||||
cmp r0, #1
|
||||
bhi _02054B64
|
||||
_02054B5C:
|
||||
mov r0, #1
|
||||
bx lr
|
||||
_02054B64:
|
||||
mov r0, #0
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02054B6C: .word 0x000001CD
|
||||
_02054B70: .word 0xFFFFFBDC
|
||||
arm_func_end IsCherrim
|
||||
|
||||
@@ -1,21 +1,8 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "overlay_29_022F73EC.inc"
|
||||
.include "overlay_29_022F740C.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start GetKecleonIdToSpawnByFloor
|
||||
GetKecleonIdToSpawnByFloor: ; 0x022F73EC
|
||||
stmdb sp!, {r3, lr}
|
||||
bl FloorNumberIsEven
|
||||
cmp r0, #0
|
||||
ldrne r0, _022F7404 ; =0x000003D7
|
||||
ldreq r0, _022F7408 ; =0x0000017F
|
||||
ldmia sp!, {r3, pc}
|
||||
.align 2, 0
|
||||
_022F7404: .word 0x000003D7
|
||||
_022F7408: .word 0x0000017F
|
||||
arm_func_end GetKecleonIdToSpawnByFloor
|
||||
|
||||
arm_func_start StoreSpriteFileIndexBothGenders
|
||||
StoreSpriteFileIndexBothGenders: ; 0x022F740C
|
||||
stmdb sp!, {r3, r4, r5, r6, r7, lr}
|
||||
@@ -163,46 +150,3 @@ _022F75C8: .word 0x00019914
|
||||
_022F75CC: .word ov29_0237C9B0
|
||||
_022F75D0: .word WAN_TABLE
|
||||
arm_func_end LoadMonsterSpriteInner
|
||||
|
||||
arm_func_start SwapMonsterWanFileIndex
|
||||
SwapMonsterWanFileIndex: ; 0x022F75D4
|
||||
stmdb sp!, {r3, r4, r5, r6, lr}
|
||||
sub sp, sp, #4
|
||||
ldr r2, _022F764C ; =DUNGEON_PTR
|
||||
mov r5, r1
|
||||
ldr r1, [r2]
|
||||
mov r6, r0
|
||||
#ifdef JAPAN
|
||||
add r1, r1, #0x870
|
||||
mov r0, r5
|
||||
add r4, r1, #0x19000
|
||||
#else
|
||||
add r1, r1, #0x114
|
||||
mov r0, r5
|
||||
add r4, r1, #0x19800
|
||||
#endif
|
||||
bl GetSpriteIndex__020526EC
|
||||
mov r1, #1
|
||||
str r1, [sp]
|
||||
mov r1, r6, lsl #1
|
||||
ldr r2, _022F7650 ; =WAN_TABLE
|
||||
mov r3, r0
|
||||
ldrsh r1, [r4, r1]
|
||||
ldr r0, [r2]
|
||||
mov r2, #0
|
||||
bl ReplaceWanFromBinFile
|
||||
mov r1, r0
|
||||
mov r0, r5
|
||||
bl StoreSpriteFileIndexBothGenders
|
||||
mov r3, r6, lsl #1
|
||||
ldrsh r2, [r4, r3]
|
||||
mov r1, r5, lsl #1
|
||||
mov r0, #0
|
||||
strh r2, [r4, r1]
|
||||
strh r0, [r4, r3]
|
||||
add sp, sp, #4
|
||||
ldmia sp!, {r3, r4, r5, r6, pc}
|
||||
.align 2, 0
|
||||
_022F764C: .word DUNGEON_PTR
|
||||
_022F7650: .word WAN_TABLE
|
||||
arm_func_end SwapMonsterWanFileIndex
|
||||
@@ -2913,4 +2913,19 @@ enum mobility_type {
|
||||
NUM_MOBILITY_TYPES
|
||||
};
|
||||
|
||||
enum wan_source_type {
|
||||
WAN_SOURCE_NULL = 0,
|
||||
WAN_SOURCE_FILE = 1, // Directly loaded from a .wan
|
||||
WAN_SOURCE_PACK = 2, // Loaded from a pack file
|
||||
};
|
||||
|
||||
enum pack_file_id {
|
||||
PACK_ARCHIVE_MONSTER = 0,
|
||||
PACK_ARCHIVE_M_ATTACK = 1,
|
||||
PACK_ARCHIVE_M_GROUND = 2,
|
||||
PACK_ARCHIVE_EFFECT = 3,
|
||||
PACK_ARCHIVE_DUNGEON = 4,
|
||||
PACK_ARCHIVE_M_LEVEL = 5,
|
||||
};
|
||||
|
||||
#endif //PMDSKY_ENUMS_H
|
||||
|
||||
9
include/main_020514CC.h
Normal file
9
include/main_020514CC.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef PMDSKY_MAIN_020514CC_H
|
||||
#define PMDSKY_MAIN_020514CC_H
|
||||
#include "util.h"
|
||||
|
||||
bool32 IsDojoDungeon(u8 dungeon_id);
|
||||
bool32 IsFutureDungeon(u8 dungeon_id);
|
||||
bool32 IsSpecialEpisodeDungeon(u8 dungeon_id);
|
||||
|
||||
#endif //PMDSKY_MAIN_020514CC_H
|
||||
9
include/main_02054AA4.h
Normal file
9
include/main_02054AA4.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef PMDSKY_MAIN_02054AA4_H
|
||||
#define PMDSKY_MAIN_02054AA4_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
bool8 IsUnown(s16 monster_id);
|
||||
bool8 IsShaymin(s16 monster_id);
|
||||
|
||||
#endif //PMDSKY_MAIN_02054AA4_H
|
||||
@@ -1,6 +1,9 @@
|
||||
#ifndef PMDSKY_MAIN_02054BE0_H
|
||||
#define PMDSKY_MAIN_02054BE0_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
bool8 IsDeoxys(s16 monster_id);
|
||||
s16 GetSecondFormIfValid(s16 id);
|
||||
// Returns the ID of the first form of the specified monster if the specified ID corresponds to a secondary form with female gender and the first form has male gender. If those conditions don't meet, returns the same ID unchanged.
|
||||
// return: ID of the male form of the monster if the requirements meet, same ID otherwise.
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
#include "util.h"
|
||||
|
||||
bool32 FloorNumberIsEven();
|
||||
s16 GetKecleonIdToSpawnByFloor();
|
||||
|
||||
#endif //PMDSKY_OVERLAY_29_022F73B4_H
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define PMDSKY_OVERLAY_29_022F7654_H
|
||||
#include "enums.h"
|
||||
|
||||
void SwapMonsterWanFileIndex(s16 src_id, s16 dst_id);
|
||||
void LoadMonsterSprite(s16 monster_id, u8 skip_deoxys_check);
|
||||
|
||||
#endif //PMDSKY_OVERLAY_29_022F7654_H
|
||||
|
||||
@@ -11,4 +11,38 @@ struct wan_animation_frame {
|
||||
struct vec2_16 shadow_offset;
|
||||
};
|
||||
|
||||
#endif //PMDSKY_WAN_H
|
||||
struct wan_table_entry {
|
||||
char path[32]; // 0x0: Needs to be null-terminated. Only used for direct file.
|
||||
bool8 file_externally_allocated; // 0x20: True if the iov_base shouldn’t be freed by this struct.
|
||||
u8 source_type; // 0x21: 1 = direct file, 2 = pack file
|
||||
s16 pack_id; // 0x22: for wan in pack file
|
||||
s16 file_index; // 0x24: for wan in pack file
|
||||
u8 field5_0x26;
|
||||
u8 field6_0x27;
|
||||
u32 iov_len;
|
||||
// 0x2C: When removing a reference, if it reaches 0, the entry is removed (unless
|
||||
// file_externally_allocated is true, as it is always removed even if there are remaining
|
||||
// references)
|
||||
s16 reference_counter;
|
||||
u8 field9_0x2e;
|
||||
u8 field10_0x2f;
|
||||
// 0x30: pointer to the beginning of the data section of iov_base.
|
||||
struct wan_header* sprite_start;
|
||||
void* iov_base; // 0x34: points to a sirO
|
||||
};
|
||||
|
||||
struct wan_table {
|
||||
struct wan_table_entry sprites[96]; // 0x0
|
||||
void* at_decompress_scratch_space; // 0x1500
|
||||
u8 field2_0x1504;
|
||||
u8 field3_0x1505;
|
||||
u8 field4_0x1506;
|
||||
u8 field5_0x1507;
|
||||
s16 total_nb_of_entries; // 0x1508: The total number of entries. Should be equal to 0x60.
|
||||
s16 next_alloc_start_pos; // 0x150A
|
||||
s16 field8_0x150c;
|
||||
u8 field9_0x150e;
|
||||
u8 field10_0x150f;
|
||||
};
|
||||
|
||||
#endif //PMDSKY_WAN_H
|
||||
|
||||
6
main.lsf
6
main.lsf
@@ -57,12 +57,16 @@ Static main
|
||||
Object asm/main_0204B018.o
|
||||
Object src/number_util.o
|
||||
Object asm/main_02051098.o
|
||||
Object src/main_020514CC.o
|
||||
Object asm/main_02051504.o
|
||||
Object src/main_02051760.o
|
||||
Object asm/main_02051788.o
|
||||
Object src/main_02052874.o
|
||||
Object asm/main_02052890.o
|
||||
Object src/main_02052950.o
|
||||
Object asm/main_0205297C.o
|
||||
Object src/main_02054AA4.o
|
||||
Object asm/main_02054AD4.o
|
||||
Object src/main_02054BE0.o
|
||||
Object asm/main_02054C24.o
|
||||
Object src/pokemon.o
|
||||
@@ -339,7 +343,7 @@ Overlay OVY_29
|
||||
Object asm/overlay_29_022F62CC.o
|
||||
Object src/overlay_29_022F7364.o
|
||||
Object src/overlay_29_022F73B4.o
|
||||
Object asm/overlay_29_022F73EC.o
|
||||
Object asm/overlay_29_022F740C.o
|
||||
Object src/overlay_29_022F7654.o
|
||||
Object asm/overlay_29_022F7768.o
|
||||
Object src/dungeon_misc.o
|
||||
|
||||
17
src/main_020514CC.c
Normal file
17
src/main_020514CC.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "main_020514CC.h"
|
||||
#include "util.h"
|
||||
#include "enums.h"
|
||||
|
||||
bool32 IsDojoDungeon(u8 dungeon_id)
|
||||
{
|
||||
return dungeon_id >= DUNGEON_NORMAL_FLY_MAZE && dungeon_id <= DUNGEON_DOJO_0xD3;
|
||||
}
|
||||
|
||||
bool32 IsFutureDungeon(u8 dungeon_id) {
|
||||
return dungeon_id >= DUNGEON_CHASM_CAVE && dungeon_id <= DUNGEON_DEEP_DUSK_FOREST;
|
||||
}
|
||||
|
||||
|
||||
bool32 IsSpecialEpisodeDungeon(u8 dungeon_id) {
|
||||
return dungeon_id >= DUNGEON_STAR_CAVE_SE1 && dungeon_id <= DUNGEON_SPRING_CAVE_PIT;
|
||||
}
|
||||
12
src/main_02054AA4.c
Normal file
12
src/main_02054AA4.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "main_02054AA4.h"
|
||||
#include "enums.h"
|
||||
#include "util.h"
|
||||
|
||||
bool8 IsUnown(s16 monster_id) {
|
||||
if(monster_id >= MONSTER_UNOWN_A && monster_id <= MONSTER_UNOWN_QUESTION) return TRUE;
|
||||
else return FALSE;
|
||||
}
|
||||
|
||||
bool8 IsShaymin(s16 monster_id) {
|
||||
return (u16)(s16)(monster_id - MONSTER_SHAYMIN_LAND) <= 1;
|
||||
}
|
||||
@@ -1,5 +1,11 @@
|
||||
#include "main_02054BE0.h"
|
||||
#include "enums.h"
|
||||
#include "util.h"
|
||||
|
||||
bool8 IsDeoxys(s16 monster_id)
|
||||
{
|
||||
return (u16)(s16)(monster_id - MONSTER_DEOXYS_NORMAL) <= 3;
|
||||
}
|
||||
|
||||
extern s16 GetMonsterGender(s16 monster_id);
|
||||
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
#include "overlay_29_022F73B4.h"
|
||||
#include "dungeon.h"
|
||||
#include "util.h"
|
||||
|
||||
extern struct dungeon *DUNGEON_PTR[];
|
||||
#include "enums.h"
|
||||
|
||||
bool32 FloorNumberIsEven() {
|
||||
struct dungeon *dungeon = DUNGEON_PTR[0];
|
||||
if (dungeon->id == DUNGEON_LABYRINTH_CAVE && dungeon->floor == 10) return 0;
|
||||
return (dungeon->floor & 1) == 0;
|
||||
}
|
||||
|
||||
s16 GetKecleonIdToSpawnByFloor()
|
||||
{
|
||||
if (!FloorNumberIsEven()) return MONSTER_KECLEON;
|
||||
else return MONSTER_KECLEON_SECONDARY;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
#include "overlay_29_022F7654.h"
|
||||
#include "dungeon.h"
|
||||
#include "enums.h"
|
||||
#include "wan.h"
|
||||
|
||||
extern struct wan_table *WAN_TABLE;
|
||||
extern s16 GetSpriteIndex__020526EC(s16 monster_id);
|
||||
extern s16 ReplaceWanFromBinFile(struct wan_table *wan_table, s16 wan_id, s16 pack_id, s16 file_index, bool8 compressed);
|
||||
extern void StoreSpriteFileIndexBothGenders(s16 monster_id, s16 file_id);
|
||||
|
||||
void SwapMonsterWanFileIndex(s16 src_id, s16 dst_id)
|
||||
{
|
||||
s16 *sprite_indexes = (s16 *)DUNGEON_PTR[0]->sprite_indexes;
|
||||
StoreSpriteFileIndexBothGenders(dst_id, ReplaceWanFromBinFile(WAN_TABLE, sprite_indexes[src_id], PACK_ARCHIVE_MONSTER, GetSpriteIndex__020526EC(dst_id), TRUE));
|
||||
sprite_indexes[dst_id] = sprite_indexes[src_id];
|
||||
sprite_indexes[src_id] = 0;
|
||||
}
|
||||
|
||||
extern struct dungeon *DUNGEON_PTR[];
|
||||
extern void LoadMonsterSpriteInner(s16 monster_id);
|
||||
void LoadMonsterSprite(s16 monster_id, u8 skip_deoxys_check)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user