Merge pull request #200 from AnonymousRandomPerson/main
Some checks failed
build / build (push) Has been cancelled

Decomped more AI funcs
This commit is contained in:
AnonymousRandomPerson 2025-10-28 17:51:13 -04:00 committed by GitHub
commit 35187d2cda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
40 changed files with 928 additions and 981 deletions

View File

@ -1,8 +1,7 @@
#pragma once
.public abs
.public CanSeeInvisibleMonsters
.public DrawMinimapTile
.public DUNGEON_PTR
.public DrawMinimapTile
.public EntityIsValid__022E1A1C
.public EntityIsValid__022E32E8
.public GetForcedLossReason
@ -13,6 +12,14 @@
.public IsPositionActuallyInSight
.public IsPositionInSight
.public ItemIsActive__022E330C
.public PrepareItemForPrinting2
.public SetPreprocessorArgsStringToName
.public StringFromId
.public SubstitutePlaceholderTrapTags
.public TeamMemberHasEnabledIqSkill
.public UpdateMinimap
.public UpdateTrapsVisibility
.public abs
.public ov29_022E34C8
.public ov29_022E3534
.public ov29_022E3A58
@ -22,13 +29,6 @@
.public ov29_0233711C
.public ov29_023372A4
.public ov29_0237C84C
.public PrepareItemForPrinting2
.public SetPreprocessorArgsStringToName
.public strcpy
.public StringFromId
.public sub_02009194
.public sub_020091B0
.public SubstitutePlaceholderTrapTags
.public TeamMemberHasEnabledIqSkill
.public UpdateMinimap
.public UpdateTrapsVisibility

View File

@ -0,0 +1,4 @@
#pragma once
.public DUNGEON_PTR
.public GetTile
.public GetVisibilityRange

View File

@ -1,11 +1,8 @@
#pragma once
.public _020AFC4C
.public abs
.public DUNGEON_PTR
.public EntityIsValid__022E95F4
.public GetTile
.public GetVisibilityRange
.public LEADER_PTR
.public _020AFC4C
.public ov29_0237C888
.public ov29_0237C88A
.public ov29_0237C88E

View File

@ -29,7 +29,7 @@
.public GetTileSafe
.public IQ_SKILLS
.public IsLevelResetDungeon
.public IsLoneOutlaw
.public IsBehaviorLoneOutlaw
.public IsMonsterIdInNormalRange
.public IsOutlawOrChallengeRequestFloor
.public IsRecruitingAllowed

View File

@ -48,7 +48,7 @@
.public IsDestinationFloorWithHiddenOutlaw
.public IsDestinationFloorWithMonster
.public IsInvalidSpawnTile
.public IsLoneOutlaw
.public IsBehaviorLoneOutlaw
.public IsOutlawMonsterHouseFloor
.public IsSecretBazaarNpcBehavior
.public IsSpecialStoryAllyOrClient

View File

@ -1,12 +1,2 @@
#pragma once
.public DUNGEON_PTR
.public EXCL_ITEM_EFFECTS_WEATHER_MOVE_SPEED_BOOST
.public ExclusiveItemEffectIsActive__022FFF28
.public GetApparentWeather
.public GetMobilityTypeCheckSlipAndFloating
.public GetSpeedStatus
.public GetTile
.public IqSkillIsEnabled
.public IsCurrentTilesetBackground
.public ItemIsActive__022FF898
.public MonsterIsType

View File

@ -0,0 +1,13 @@
#pragma once
.public DUNGEON_PTR
.public EXCL_ITEM_EFFECTS_WEATHER_MOVE_SPEED_BOOST
.public ExclusiveItemEffectIsActive__022FFF28
.public GetApparentWeather
.public GetMobilityTypeAfterIqSkills
.public GetMobilityTypeCheckSlipAndFloating
.public GetSpeedStatus
.public GetTile
.public IqSkillIsEnabled
.public IsCurrentTilesetBackground
.public ItemIsActive__022FF898
.public MonsterIsType

View File

@ -8,6 +8,6 @@
.public GetPerformanceFlagWithChecks
.public GetSpeciesIqSkill
.public IqSkillFlagTest
.public IsLoneOutlawVeneer
.public IsMonsterLoneOutlaw
.public MIN_IQ_EXCLUSIVE_MOVE_USER
.public MIN_IQ_ITEM_MASTER

View File

@ -31,7 +31,7 @@
.public IsBlinded
.public IsCurrentMissionType
.public IsExperienceLocked
.public IsLoneOutlawVeneer
.public IsMonsterLoneOutlaw
.public IsMonsterIdInNormalRangeVeneer
.public IsSecretBazaarNpcBehavior
.public IsSpecialStoryAlly

View File

@ -55,7 +55,7 @@
.public IsChargingTwoTurnMove
.public IsCurrentFixedRoomBossFight
.public IsFullFloorFixedRoom
.public IsLoneOutlawVeneer
.public IsMonsterLoneOutlaw
.public IsSecretBazaarNpc
.public LAST_RESORT_DAMAGE_MULT_TABLE
.public LogMessageByIdWithPopupCheckUser

View File

@ -32,7 +32,7 @@
.public IsExperienceLocked
.public IsGoldenChamber
.public IsHiddenStairsFloor
.public IsLoneOutlaw
.public IsBehaviorLoneOutlaw
.public IsOutlawMonsterHouseFloor
.public IsSecretBazaar
.public LoadFixedRoomData

View File

@ -6443,6 +6443,7 @@ _0205E5BC:
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
arm_func_end sub_0205E50C
; https://decomp.me/scratch/8eqok
arm_func_start GenerateDailyMissions
GenerateDailyMissions: ; 0x0205E5D0
stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr}

View File

@ -1,63 +1,8 @@
.include "asm/macros.inc"
.include "overlay_29_022E2810.inc"
.include "overlay_29_022E28D4.inc"
.text
arm_func_start CanTargetEntity
CanTargetEntity: ; 0x022E2810
stmdb sp!, {r3, r4, r5, lr}
mov r5, r0
mov r4, r1
bl EntityIsValid__022E1A1C
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, pc}
mov r0, r4
bl EntityIsValid__022E1A1C
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, pc}
ldrb r0, [r4, #0x20]
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, pc}
ldr r0, [r4]
cmp r0, #1
bne _022E28B8
ldr r0, [r5]
cmp r0, #1
bne _022E28A4
mov r0, r5
bl CanSeeInvisibleMonsters
cmp r0, #0
ldreq r0, [r4, #0xb4]
ldreqb r0, [r0, #0xef]
cmpeq r0, #1
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, pc}
mov r0, r5
mov r1, #1
bl IsBlinded
cmp r0, #0
beq _022E28B8
mov r0, #0
ldmia sp!, {r3, r4, r5, pc}
_022E28A4:
ldr r0, [r4, #0xb4]
ldrb r0, [r0, #0xef]
cmp r0, #1
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, pc}
_022E28B8:
mov r0, r5
bl HasDropeyeStatus
mov r2, r0
add r0, r5, #4
add r1, r4, #4
bl IsPositionInSight
ldmia sp!, {r3, r4, r5, pc}
arm_func_end CanTargetEntity
arm_func_start ov29_022E28D4
ov29_022E28D4: ; 0x022E28D4
stmdb sp!, {r3, r4, r5, lr}

View File

@ -1,333 +0,0 @@
.include "asm/macros.inc"
.include "overlay_29_022E91A4.inc"
.text
arm_func_start IsPositionInSight
IsPositionInSight: ; 0x022E91A4
stmdb sp!, {r3, r4, r5, r6, r7, lr}
mov r5, r0
mov r4, r1
ldrsh r0, [r5]
ldrsh r1, [r5, #2]
mov r7, r2
bl GetTile
ldrb r6, [r0, #7]
cmp r6, #0xff
beq _022E9230
cmp r7, #0
bne _022E9230
ldr r0, _022E9294 ; =DUNGEON_PTR
mov r1, #0x1c
ldr r0, [r0]
ldrsh r2, [r4]
#ifdef JAPAN
add r0, r0, #0x244
#else
add r0, r0, #0x2e8
#endif
add r0, r0, #0xec00
mla r3, r6, r1, r0
ldrsh r0, [r3, #2]
sub r0, r0, #1
cmp r0, r2
ldrlesh r0, [r3, #4]
ldrlesh r1, [r4, #2]
suble r0, r0, #1
cmple r0, r1
bgt _022E9230
ldrsh r0, [r3, #6]
add r0, r0, #1
cmp r0, r2
ldrgtsh r0, [r3, #8]
addgt r0, r0, #1
cmpgt r0, r1
movgt r0, #1
ldmgtia sp!, {r3, r4, r5, r6, r7, pc}
_022E9230:
ldrsh r1, [r5, #2]
ldrsh r0, [r4, #2]
sub r0, r1, r0
bl abs
ldrsh r2, [r5]
ldrsh r1, [r4]
mov r6, r0
sub r0, r2, r1
bl abs
cmp r0, r6
movle r0, r6
cmp r0, #2
movgt r0, #0
ldmgtia sp!, {r3, r4, r5, r6, r7, pc}
bne _022E928C
mov r0, r5
mov r1, r4
bl IsPositionWithinTwoTiles
cmp r0, #0
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022E928C:
mov r0, #1
ldmia sp!, {r3, r4, r5, r6, r7, pc}
.align 2, 0
_022E9294: .word DUNGEON_PTR
arm_func_end IsPositionInSight
arm_func_start ov29_022E9298
ov29_022E9298: ; 0x022E9298
stmdb sp!, {r3, r4, r5, r6, r7, lr}
mov r5, r0
mov r4, r1
ldrsh r0, [r5]
ldrsh r1, [r5, #2]
mov r7, r2
bl GetTile
mov r6, r0
bl GetVisibilityRange
cmp r7, #0
ldrb r2, [r6, #7]
bne _022E92D0
cmp r2, #0xff
bne _022E930C
_022E92D0:
ldrsh r1, [r5]
sub r1, r1, r0
str r1, [r4]
ldrsh r1, [r5]
add r1, r1, r0
add r1, r1, #1
str r1, [r4, #8]
ldrsh r1, [r5, #2]
sub r1, r1, r0
str r1, [r4, #4]
ldrsh r1, [r5, #2]
add r0, r1, r0
add r0, r0, #1
str r0, [r4, #0xc]
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022E930C:
ldr r0, _022E9358 ; =DUNGEON_PTR
mov r1, #0x1c
ldr r0, [r0]
#ifdef JAPAN
add r0, r0, #0x244
#else
add r0, r0, #0x2e8
#endif
add r0, r0, #0xec00
mla r1, r2, r1, r0
ldrsh r0, [r1, #2]
sub r0, r0, #1
str r0, [r4]
ldrsh r0, [r1, #6]
add r0, r0, #2
str r0, [r4, #8]
ldrsh r0, [r1, #4]
sub r0, r0, #1
str r0, [r4, #4]
ldrsh r0, [r1, #8]
add r0, r0, #2
str r0, [r4, #0xc]
ldmia sp!, {r3, r4, r5, r6, r7, pc}
.align 2, 0
_022E9358: .word DUNGEON_PTR
arm_func_end ov29_022E9298
arm_func_start IsPositionWithinTwoTiles
IsPositionWithinTwoTiles: ; 0x022E935C
stmdb sp!, {r4, r5, r6, r7, r8, lr}
mov r8, r0
mov r7, r1
ldrsh r4, [r8]
ldrsh r0, [r7]
sub r0, r4, r0
bl abs
mov r6, r0
cmp r6, #1
bgt _022E93A0
ldrsh r1, [r8, #2]
ldrsh r0, [r7, #2]
sub r0, r1, r0
bl abs
cmp r0, #1
movle r0, #1
ldmleia sp!, {r4, r5, r6, r7, r8, pc}
_022E93A0:
ldrsh r5, [r8, #2]
ldrsh r0, [r7, #2]
sub r0, r5, r0
bl abs
cmp r6, r0
movle r6, r0
cmp r6, #2
bne _022E9480
mov r6, #0
b _022E9410
_022E93C8:
ldrsh r0, [r7]
cmp r4, r0
addlt r4, r4, #1
cmp r4, r0
ldrsh r0, [r7, #2]
subgt r4, r4, #1
cmp r5, r0
addlt r5, r5, #1
cmp r5, r0
subgt r5, r5, #1
mov r0, r4
mov r1, r5
bl GetTile
ldrh r0, [r0]
tst r0, #3
moveq r0, #0
ldmeqia sp!, {r4, r5, r6, r7, r8, pc}
add r6, r6, #1
_022E9410:
cmp r6, #2
blt _022E93C8
ldrsh r4, [r7]
ldrsh r5, [r7, #2]
mov r6, #0
b _022E9470
_022E9428:
ldrsh r0, [r8]
cmp r4, r0
addlt r4, r4, #1
cmp r4, r0
ldrsh r0, [r8, #2]
subgt r4, r4, #1
cmp r5, r0
addlt r5, r5, #1
cmp r5, r0
subgt r5, r5, #1
mov r0, r4
mov r1, r5
bl GetTile
ldrh r0, [r0]
tst r0, #3
moveq r0, #0
ldmeqia sp!, {r4, r5, r6, r7, r8, pc}
add r6, r6, #1
_022E9470:
cmp r6, #2
blt _022E9428
mov r0, #1
ldmia sp!, {r4, r5, r6, r7, r8, pc}
_022E9480:
mov r0, #0
ldmia sp!, {r4, r5, r6, r7, r8, pc}
arm_func_end IsPositionWithinTwoTiles
arm_func_start ov29_022E9488
ov29_022E9488: ; 0x022E9488
stmdb sp!, {r3, r4, r5, lr}
ldr ip, _022E955C ; =DUNGEON_PTR
ldr r3, _022E9560 ; =0x0001A224
ldr r4, [ip]
add ip, r3, #2
ldrsh r3, [r4, r3]
ldrsh r4, [r4, ip]
mvn lr, #0xf
sub r3, r0, r3
sub r0, r1, r4
cmp r3, lr
cmpge r0, lr
blt _022E9554
rsb r1, lr, #0xff
cmp r3, r1
cmplt r0, #0xd0
bge _022E9554
mov r1, #0xc
mul ip, r2, r1
ldr r4, _022E9564 ; =ov29_0237C88A
ldr r5, _022E9568 ; =ov29_0237C890
ldrh r2, [r4, ip]
sub r1, r1, #0x20c
ldrsh r5, [r5, ip]
and r1, r2, r1
strh r1, [r4, ip]
add r1, r3, r5
ldrh r2, [r4, ip]
and r1, r1, lr, lsr #23
ldr r3, _022E956C ; =ov29_0237C88E
orr r1, r2, r1
strh r1, [r4, ip]
ldr r1, _022E9570 ; =ov29_0237C892
ldrh r4, [r3, ip]
ldrsh lr, [r1, ip]
ldr r1, _022E9574 ; =0xFFFF000F
ldr r2, _022E9578 ; =_020AFC4C
and r1, r4, r1
strh r1, [r3, ip]
add r0, r0, lr
ldr r1, _022E957C ; =ov29_0237C888
mov lr, r0, lsl #0x14
ldrh r4, [r3, ip]
ldr r0, [r2]
add r1, r1, ip
orr r4, r4, lr, lsr #16
mov r2, #0
strh r4, [r3, ip]
bl sub_0201B9F8
mov r0, #1
ldmia sp!, {r3, r4, r5, pc}
_022E9554:
mov r0, #0
ldmia sp!, {r3, r4, r5, pc}
.align 2, 0
_022E955C: .word DUNGEON_PTR
#ifdef JAPAN
_022E9560: .word 0x0001A180
#else
_022E9560: .word 0x0001A224
#endif
_022E9564: .word ov29_0237C88A
_022E9568: .word ov29_0237C890
_022E956C: .word ov29_0237C88E
_022E9570: .word ov29_0237C892
_022E9574: .word 0xFFFF000F
_022E9578: .word _020AFC4C
_022E957C: .word ov29_0237C888
arm_func_end ov29_022E9488
arm_func_start GetLeader
GetLeader: ; 0x022E9580
stmdb sp!, {r4, r5, r6, lr}
ldr r0, _022E95EC ; =LEADER_PTR
ldr r0, [r0]
cmp r0, #0
ldmneia sp!, {r4, r5, r6, pc}
mov r5, #0
ldr r4, _022E95F0 ; =DUNGEON_PTR
b _022E95DC
_022E95A0:
ldr r0, [r4]
add r0, r0, r5, lsl #2
add r0, r0, #0x12000
#ifdef JAPAN
ldr r6, [r0, #0xa84]
#else
ldr r6, [r0, #0xb28]
#endif
mov r0, r6
bl EntityIsValid__022E95F4
cmp r0, #0
ldrne r0, [r6, #0xb4]
ldrneb r0, [r0, #7]
cmpne r0, #0
ldrne r1, _022E95EC ; =LEADER_PTR
movne r0, r6
strne r6, [r1]
ldmneia sp!, {r4, r5, r6, pc}
add r5, r5, #1
_022E95DC:
cmp r5, #4
blt _022E95A0
mov r0, #0
ldmia sp!, {r4, r5, r6, pc}
.align 2, 0
_022E95EC: .word LEADER_PTR
_022E95F0: .word DUNGEON_PTR
arm_func_end GetLeader

64
asm/overlay_29_022E9298.s Normal file
View File

@ -0,0 +1,64 @@
.include "asm/macros.inc"
.include "overlay_29_022E9298.inc"
.text
arm_func_start ov29_022E9298
ov29_022E9298: ; 0x022E9298
stmdb sp!, {r3, r4, r5, r6, r7, lr}
mov r5, r0
mov r4, r1
ldrsh r0, [r5]
ldrsh r1, [r5, #2]
mov r7, r2
bl GetTile
mov r6, r0
bl GetVisibilityRange
cmp r7, #0
ldrb r2, [r6, #7]
bne _022E92D0
cmp r2, #0xff
bne _022E930C
_022E92D0:
ldrsh r1, [r5]
sub r1, r1, r0
str r1, [r4]
ldrsh r1, [r5]
add r1, r1, r0
add r1, r1, #1
str r1, [r4, #8]
ldrsh r1, [r5, #2]
sub r1, r1, r0
str r1, [r4, #4]
ldrsh r1, [r5, #2]
add r0, r1, r0
add r0, r0, #1
str r0, [r4, #0xc]
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022E930C:
ldr r0, _022E9358 ; =DUNGEON_PTR
mov r1, #0x1c
ldr r0, [r0]
#ifdef JAPAN
add r0, r0, #0x244
#else
add r0, r0, #0x2e8
#endif
add r0, r0, #0xec00
mla r1, r2, r1, r0
ldrsh r0, [r1, #2]
sub r0, r0, #1
str r0, [r4]
ldrsh r0, [r1, #6]
add r0, r0, #2
str r0, [r4, #8]
ldrsh r0, [r1, #4]
sub r0, r0, #1
str r0, [r4, #4]
ldrsh r0, [r1, #8]
add r0, r0, #2
str r0, [r4, #0xc]
ldmia sp!, {r3, r4, r5, r6, r7, pc}
.align 2, 0
_022E9358: .word DUNGEON_PTR
arm_func_end ov29_022E9298

116
asm/overlay_29_022E9488.s Normal file
View File

@ -0,0 +1,116 @@
.include "asm/macros.inc"
.include "overlay_29_022E9488.inc"
.text
arm_func_start ov29_022E9488
ov29_022E9488: ; 0x022E9488
stmdb sp!, {r3, r4, r5, lr}
ldr ip, _022E955C ; =DUNGEON_PTR
ldr r3, _022E9560 ; =0x0001A224
ldr r4, [ip]
add ip, r3, #2
ldrsh r3, [r4, r3]
ldrsh r4, [r4, ip]
mvn lr, #0xf
sub r3, r0, r3
sub r0, r1, r4
cmp r3, lr
cmpge r0, lr
blt _022E9554
rsb r1, lr, #0xff
cmp r3, r1
cmplt r0, #0xd0
bge _022E9554
mov r1, #0xc
mul ip, r2, r1
ldr r4, _022E9564 ; =ov29_0237C88A
ldr r5, _022E9568 ; =ov29_0237C890
ldrh r2, [r4, ip]
sub r1, r1, #0x20c
ldrsh r5, [r5, ip]
and r1, r2, r1
strh r1, [r4, ip]
add r1, r3, r5
ldrh r2, [r4, ip]
and r1, r1, lr, lsr #23
ldr r3, _022E956C ; =ov29_0237C88E
orr r1, r2, r1
strh r1, [r4, ip]
ldr r1, _022E9570 ; =ov29_0237C892
ldrh r4, [r3, ip]
ldrsh lr, [r1, ip]
ldr r1, _022E9574 ; =0xFFFF000F
ldr r2, _022E9578 ; =_020AFC4C
and r1, r4, r1
strh r1, [r3, ip]
add r0, r0, lr
ldr r1, _022E957C ; =ov29_0237C888
mov lr, r0, lsl #0x14
ldrh r4, [r3, ip]
ldr r0, [r2]
add r1, r1, ip
orr r4, r4, lr, lsr #16
mov r2, #0
strh r4, [r3, ip]
bl sub_0201B9F8
mov r0, #1
ldmia sp!, {r3, r4, r5, pc}
_022E9554:
mov r0, #0
ldmia sp!, {r3, r4, r5, pc}
.align 2, 0
_022E955C: .word DUNGEON_PTR
#ifdef JAPAN
_022E9560: .word 0x0001A180
#else
_022E9560: .word 0x0001A224
#endif
_022E9564: .word ov29_0237C88A
_022E9568: .word ov29_0237C890
_022E956C: .word ov29_0237C88E
_022E9570: .word ov29_0237C892
_022E9574: .word 0xFFFF000F
_022E9578: .word _020AFC4C
_022E957C: .word ov29_0237C888
arm_func_end ov29_022E9488
arm_func_start GetLeader
GetLeader: ; 0x022E9580
stmdb sp!, {r4, r5, r6, lr}
ldr r0, _022E95EC ; =LEADER_PTR
ldr r0, [r0]
cmp r0, #0
ldmneia sp!, {r4, r5, r6, pc}
mov r5, #0
ldr r4, _022E95F0 ; =DUNGEON_PTR
b _022E95DC
_022E95A0:
ldr r0, [r4]
add r0, r0, r5, lsl #2
add r0, r0, #0x12000
#ifdef JAPAN
ldr r6, [r0, #0xa84]
#else
ldr r6, [r0, #0xb28]
#endif
mov r0, r6
bl EntityIsValid__022E95F4
cmp r0, #0
ldrne r0, [r6, #0xb4]
ldrneb r0, [r0, #7]
cmpne r0, #0
ldrne r1, _022E95EC ; =LEADER_PTR
movne r0, r6
strne r6, [r1]
ldmneia sp!, {r4, r5, r6, pc}
add r5, r5, #1
_022E95DC:
cmp r5, #4
blt _022E95A0
mov r0, #0
ldmia sp!, {r4, r5, r6, pc}
.align 2, 0
_022E95EC: .word LEADER_PTR
_022E95F0: .word DUNGEON_PTR
arm_func_end GetLeader

View File

@ -1115,7 +1115,7 @@ _022F83B4:
cmpne sb, r0
beq _022F83F4
ldrb r0, [r7, #0xbc]
bl IsLoneOutlaw
bl IsBehaviorLoneOutlaw
cmp r0, #0
beq _022F83F4
mov r0, #1

View File

@ -553,7 +553,7 @@ SpawnMonster: ; 0x022FD084
strh r1, [r5, #0xe]
bl ov29_023021F0
ldrb r0, [r7, #2]
bl IsLoneOutlaw
bl IsBehaviorLoneOutlaw
cmp r0, #0
beq _022FD154
mov r0, #9
@ -616,7 +616,7 @@ _022FD1E8:
strb r0, [r5, #8]
_022FD1F0:
ldrb r0, [r7, #2]
bl IsLoneOutlaw
bl IsBehaviorLoneOutlaw
cmp r0, #0
beq _022FD224
ldr r0, _022FD30C ; =ov10_022C45A4

View File

@ -25,540 +25,3 @@ _022FF8EC:
ldmia sp!, {r3, r4, r5, pc}
arm_func_end GetMobilityTypeAfterIqSkills
#endif
arm_func_start CanMoveThroughWalls
CanMoveThroughWalls: ; 0x022FF908
stmdb sp!, {r3, r4, r5, lr}
mov r5, r0
ldr r4, [r5, #0xb4]
ldrb r1, [r4, #0xef]
cmp r1, #3
moveq r0, #1
ldmeqia sp!, {r3, r4, r5, pc}
mov r1, #0x10
bl ItemIsActive__022FF898
cmp r0, #0
movne r0, #1
ldmneia sp!, {r3, r4, r5, pc}
ldrsh r1, [r4, #2]
mov r0, r5
bl GetMobilityTypeCheckSlipAndFloating
cmp r0, #3
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
ldmia sp!, {r3, r4, r5, pc}
arm_func_end CanMoveThroughWalls
arm_func_start ov29_022FF958
ov29_022FF958: ; 0x022FF958
stmdb sp!, {r3, r4, r5, r6, r7, lr}
mov r7, r1
mov r6, r0
ldrsh r0, [r7]
ldrsh r1, [r7, #2]
ldr r5, [r6, #0xb4]
bl GetTile
ldrsh r1, [r7]
mov r4, r0
cmp r1, #0
movlt r0, #1
ldmltia sp!, {r3, r4, r5, r6, r7, pc}
ldrsh r0, [r7, #2]
cmp r0, #0
movlt r0, #1
ldmltia sp!, {r3, r4, r5, r6, r7, pc}
cmp r1, #0x38
movge r0, #1
ldmgeia sp!, {r3, r4, r5, r6, r7, pc}
cmp r0, #0x20
movge r0, #1
ldmgeia sp!, {r3, r4, r5, r6, r7, pc}
ldrh r0, [r4]
tst r0, #0x10
movne r0, #1
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
ldr r0, [r4, #0xc]
cmp r0, #0
ldrne r0, [r0]
cmpne r0, #1
movne r0, #1
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
bl IsCurrentTilesetBackground
cmp r0, #0
bne _022FFA0C
ldrb r0, [r5, #0xef]
cmp r0, #3
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
mov r0, r6
mov r1, #0x10
bl ItemIsActive__022FF898
cmp r0, #0
movne r0, #0
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
_022FFA0C:
ldrsh r1, [r5, #2]
mov r0, r6
bl GetMobilityTypeCheckSlipAndFloating
ldrh r2, [r4]
#ifdef JAPAN
mov r4, r0
mov r0, r6
mov r1, #0xc
and r5, r2, #3
bl IqSkillIsEnabled
cmp r0, #0
mov r0, r6
mov r1, #0xd
movne r4, #2
bl IqSkillIsEnabled
cmp r0, #0
movne r4, #3
cmp r4, #3
addls pc, pc, r4, lsl #2
#else
mov r1, r0
mov r0, r6
and r4, r2, #3
bl GetMobilityTypeAfterIqSkills
cmp r0, #3
addls pc, pc, r0, lsl #2
#endif
b _022FFA84
_022FFA38: ; jump table
b _022FFA48 ; case 0
b _022FFA58 ; case 1
b _022FFA74 ; case 2
b _022FFA84 ; case 3
_022FFA48:
#ifdef JAPAN
cmp r5, #1
#else
cmp r4, #1
#endif
bne _022FFA8C
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFA58:
#ifdef JAPAN
cmp r5, #2
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
cmp r5, #1
#else
cmp r4, #2
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
cmp r4, #1
#endif
bne _022FFA8C
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFA74:
#ifdef JAPAN
cmp r5, #0
#else
cmp r4, #0
#endif
beq _022FFA8C
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFA84:
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFA8C:
mov r0, #1
ldmia sp!, {r3, r4, r5, r6, r7, pc}
arm_func_end ov29_022FF958
arm_func_start ov29_022FFA94
ov29_022FFA94: ; 0x022FFA94
stmdb sp!, {r3, r4, r5, r6, r7, lr}
mov r7, r1
mov r6, r0
ldrsh r0, [r7]
ldrsh r1, [r7, #2]
ldr r5, [r6, #0xb4]
bl GetTile
ldrsh r1, [r7]
mov r4, r0
cmp r1, #0
movlt r0, #1
ldmltia sp!, {r3, r4, r5, r6, r7, pc}
ldrsh r0, [r7, #2]
cmp r0, #0
movlt r0, #1
ldmltia sp!, {r3, r4, r5, r6, r7, pc}
cmp r1, #0x38
movge r0, #1
ldmgeia sp!, {r3, r4, r5, r6, r7, pc}
cmp r0, #0x20
movge r0, #1
ldmgeia sp!, {r3, r4, r5, r6, r7, pc}
ldrh r0, [r4]
tst r0, #0x10
movne r0, #1
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
ldr r0, [r4, #0xc]
cmp r0, #0
ldrne r0, [r0]
cmpne r0, #1
movne r0, #1
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
ldrsh r1, [r5, #2]
mov r0, r6
bl GetMobilityTypeCheckSlipAndFloating
ldrh r1, [r4]
cmp r0, #3
and r1, r1, #3
addls pc, pc, r0, lsl #2
b _022FFB80
_022FFB34: ; jump table
b _022FFB44 ; case 0
b _022FFB54 ; case 1
b _022FFB70 ; case 2
b _022FFB70 ; case 3
_022FFB44:
cmp r1, #1
bne _022FFB88
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFB54:
cmp r1, #2
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
cmp r1, #1
bne _022FFB88
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFB70:
cmp r1, #0
beq _022FFB88
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFB80:
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFB88:
mov r0, #1
ldmia sp!, {r3, r4, r5, r6, r7, pc}
arm_func_end ov29_022FFA94
arm_func_start ov29_022FFB90
ov29_022FFB90: ; 0x022FFB90
stmdb sp!, {r3, r4, r5, r6, r7, lr}
mov r7, r1
mov r6, r0
ldrsh r0, [r7]
ldrsh r1, [r7, #2]
ldr r5, [r6, #0xb4]
bl GetTile
ldrsh r1, [r7]
mov r4, r0
cmp r1, #0
movlt r0, #1
ldmltia sp!, {r3, r4, r5, r6, r7, pc}
ldrsh r0, [r7, #2]
cmp r0, #0
movlt r0, #1
ldmltia sp!, {r3, r4, r5, r6, r7, pc}
cmp r1, #0x38
movge r0, #1
ldmgeia sp!, {r3, r4, r5, r6, r7, pc}
cmp r0, #0x20
movge r0, #1
ldmgeia sp!, {r3, r4, r5, r6, r7, pc}
ldrh r0, [r4]
tst r0, #0x10
movne r0, #1
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
ldr r0, [r4, #0xc]
cmp r0, #0
ldrne r0, [r0]
cmpne r0, #1
movne r0, #1
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
bl IsCurrentTilesetBackground
cmp r0, #0
bne _022FFC44
ldrb r0, [r5, #0xef]
cmp r0, #3
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
mov r0, r6
mov r1, #0x10
bl ItemIsActive__022FF898
cmp r0, #0
movne r0, #0
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
_022FFC44:
ldrsh r1, [r5, #2]
mov r0, r6
bl GetMobilityTypeCheckSlipAndFloating
ldrh r2, [r4]
#ifdef JAPAN
mov r4, r0
mov r0, r6
mov r1, #0xc
and r5, r2, #3
bl IqSkillIsEnabled
cmp r0, #0
mov r0, r6
mov r1, #0xd
movne r4, #2
bl IqSkillIsEnabled
cmp r0, #0
movne r4, #3
cmp r4, #3
addls pc, pc, r4, lsl #2
#else
mov r1, r0
mov r0, r6
and r4, r2, #3
bl GetMobilityTypeAfterIqSkills
cmp r0, #3
addls pc, pc, r0, lsl #2
#endif
b _022FFC94
_022FFC70: ; jump table
b _022FFC80 ; case 0
b _022FFC80 ; case 1
b _022FFC80 ; case 2
b _022FFC94 ; case 3
_022FFC80:
#ifdef JAPAN
cmp r5, #0
#else
cmp r4, #0
#endif
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFC94:
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
arm_func_end ov29_022FFB90
arm_func_start CannotStandOnTile
CannotStandOnTile: ; 0x022FFC9C
stmdb sp!, {r3, r4, r5, r6, r7, lr}
mov r7, r1
mov r6, r0
ldrsh r0, [r7]
ldrsh r1, [r7, #2]
ldr r5, [r6, #0xb4]
bl GetTile
ldrsh r1, [r7]
mov r4, r0
cmp r1, #0
movlt r0, #1
ldmltia sp!, {r3, r4, r5, r6, r7, pc}
ldrsh r0, [r7, #2]
cmp r0, #0
movlt r0, #1
ldmltia sp!, {r3, r4, r5, r6, r7, pc}
cmp r1, #0x38
movge r0, #1
ldmgeia sp!, {r3, r4, r5, r6, r7, pc}
cmp r0, #0x20
movge r0, #1
ldmgeia sp!, {r3, r4, r5, r6, r7, pc}
ldrh r0, [r4]
tst r0, #0x10
movne r0, #1
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
ldr r1, [r4, #0xc]
cmp r1, #0
beq _022FFD38
ldr r0, [r1]
cmp r0, #1
bne _022FFD30
ldr r0, [r1, #0xb4]
cmp r0, r5
beq _022FFD38
mov r0, #1
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFD30:
mov r0, #1
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFD38:
bl IsCurrentTilesetBackground
cmp r0, #0
bne _022FFD6C
ldrb r0, [r5, #0xef]
cmp r0, #3
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
mov r0, r6
mov r1, #0x10
bl ItemIsActive__022FF898
cmp r0, #0
movne r0, #0
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
_022FFD6C:
ldrsh r1, [r5, #2]
mov r0, r6
bl GetMobilityTypeCheckSlipAndFloating
ldrh r2, [r4]
#ifdef JAPAN
mov r4, r0
mov r0, r6
mov r1, #0xc
and r5, r2, #3
bl IqSkillIsEnabled
cmp r0, #0
mov r0, r6
mov r1, #0xd
movne r4, #2
bl IqSkillIsEnabled
cmp r0, #0
movne r4, #3
cmp r4, #3
addls pc, pc, r4, lsl #2
#else
mov r1, r0
mov r0, r6
and r4, r2, #3
bl GetMobilityTypeAfterIqSkills
cmp r0, #3
addls pc, pc, r0, lsl #2
#endif
b _022FFDE4
_022FFD98: ; jump table
b _022FFDA8 ; case 0
b _022FFDB8 ; case 1
b _022FFDD4 ; case 2
b _022FFDE4 ; case 3
_022FFDA8:
#ifdef JAPAN
cmp r5, #1
#else
cmp r4, #1
#endif
bne _022FFDEC
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFDB8:
#ifdef JAPAN
cmp r5, #2
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
cmp r5, #1
#else
cmp r4, #2
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
cmp r4, #1
#endif
bne _022FFDEC
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFDD4:
#ifdef JAPAN
cmp r5, #0
#else
cmp r4, #0
#endif
beq _022FFDEC
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFDE4:
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFDEC:
mov r0, #1
ldmia sp!, {r3, r4, r5, r6, r7, pc}
arm_func_end CannotStandOnTile
arm_func_start CalcSpeedStage
CalcSpeedStage: ; 0x022FFDF4
#ifdef JAPAN
#define CALC_SPEED_STAGE_OFFSET -4
#else
#define CALC_SPEED_STAGE_OFFSET 0
#endif
stmdb sp!, {r4, r5, r6, r7, r8, lr}
mov r8, r0
mov r7, r1
ldr r6, [r8, #0xb4]
bl GetApparentWeather
mov r4, #0
mov r5, r0
mov r1, r4
_022FFE14:
add r2, r6, r1
ldrb r0, [r2, #0x119 + CALC_SPEED_STAGE_OFFSET]
add r1, r1, #1
cmp r0, #0
ldrb r0, [r2, #0x114 + CALC_SPEED_STAGE_OFFSET]
subne r4, r4, r7
cmp r0, #0
addne r4, r4, r7
cmp r1, #5
blt _022FFE14
ldrb r0, [r6, #0xbf]
cmp r0, #4
ldrsh r0, [r6, #2]
subeq r4, r4, #1
bl GetSpeedStatus
add r4, r4, r0
mov r0, r8
mov r1, #6
bl MonsterIsType
cmp r0, #0
beq _022FFE78
mov r0, r8
bl GetApparentWeather
cmp r0, #7
addeq r4, r4, #1
_022FFE78:
mov r0, r8
mov r1, #0x3a
bl IqSkillIsEnabled
cmp r0, #0
ldr r1, _022FFF18 ; =EXCL_ITEM_EFFECTS_WEATHER_MOVE_SPEED_BOOST
addne r4, r4, #1
ldrb r0, [r1, r5]
cmp r0, #0
beq _022FFEB0
ldrb r1, [r1, r5]
mov r0, r8
bl ExclusiveItemEffectIsActive__022FFF28
cmp r0, #0
addne r4, r4, #1
_022FFEB0:
ldrsh r1, [r6, #4]
ldr r0, _022FFF1C ; =0x000001A5
cmp r1, r0
addne r0, r0, #0x72
cmpne r1, r0
ldrsh r1, [r6, #2]
ldr r0, _022FFF20 ; =0x0000017F
addeq r4, r4, #1
cmp r1, r0
addne r0, r0, #0x258
cmpne r1, r0
bne _022FFEFC
ldrb r0, [r6, #6]
cmp r0, #0
ldrne r0, _022FFF24 ; =DUNGEON_PTR
ldrne r0, [r0]
ldrneb r0, [r0, #0x790]
cmpne r0, #0
addne r4, r4, #1
_022FFEFC:
cmp r4, #0
movlt r4, #0
cmp r4, #5
movge r4, #4
mov r0, r4
str r4, [r6, #0x110 + CALC_SPEED_STAGE_OFFSET]
ldmia sp!, {r4, r5, r6, r7, r8, pc}
.align 2, 0
_022FFF18: .word EXCL_ITEM_EFFECTS_WEATHER_MOVE_SPEED_BOOST
_022FFF1C: .word 0x000001A5
_022FFF20: .word 0x0000017F
_022FFF24: .word DUNGEON_PTR
arm_func_end CalcSpeedStage

517
asm/overlay_29_022FF958.s Normal file
View File

@ -0,0 +1,517 @@
.include "asm/macros.inc"
.include "overlay_29_022FF958.inc"
.text
arm_func_start ov29_022FF958
ov29_022FF958: ; 0x022FF958
stmdb sp!, {r3, r4, r5, r6, r7, lr}
mov r7, r1
mov r6, r0
ldrsh r0, [r7]
ldrsh r1, [r7, #2]
ldr r5, [r6, #0xb4]
bl GetTile
ldrsh r1, [r7]
mov r4, r0
cmp r1, #0
movlt r0, #1
ldmltia sp!, {r3, r4, r5, r6, r7, pc}
ldrsh r0, [r7, #2]
cmp r0, #0
movlt r0, #1
ldmltia sp!, {r3, r4, r5, r6, r7, pc}
cmp r1, #0x38
movge r0, #1
ldmgeia sp!, {r3, r4, r5, r6, r7, pc}
cmp r0, #0x20
movge r0, #1
ldmgeia sp!, {r3, r4, r5, r6, r7, pc}
ldrh r0, [r4]
tst r0, #0x10
movne r0, #1
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
ldr r0, [r4, #0xc]
cmp r0, #0
ldrne r0, [r0]
cmpne r0, #1
movne r0, #1
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
bl IsCurrentTilesetBackground
cmp r0, #0
bne _022FFA0C
ldrb r0, [r5, #0xef]
cmp r0, #3
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
mov r0, r6
mov r1, #0x10
bl ItemIsActive__022FF898
cmp r0, #0
movne r0, #0
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
_022FFA0C:
ldrsh r1, [r5, #2]
mov r0, r6
bl GetMobilityTypeCheckSlipAndFloating
ldrh r2, [r4]
#ifdef JAPAN
mov r4, r0
mov r0, r6
mov r1, #0xc
and r5, r2, #3
bl IqSkillIsEnabled
cmp r0, #0
mov r0, r6
mov r1, #0xd
movne r4, #2
bl IqSkillIsEnabled
cmp r0, #0
movne r4, #3
cmp r4, #3
addls pc, pc, r4, lsl #2
#else
mov r1, r0
mov r0, r6
and r4, r2, #3
bl GetMobilityTypeAfterIqSkills
cmp r0, #3
addls pc, pc, r0, lsl #2
#endif
b _022FFA84
_022FFA38: ; jump table
b _022FFA48 ; case 0
b _022FFA58 ; case 1
b _022FFA74 ; case 2
b _022FFA84 ; case 3
_022FFA48:
#ifdef JAPAN
cmp r5, #1
#else
cmp r4, #1
#endif
bne _022FFA8C
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFA58:
#ifdef JAPAN
cmp r5, #2
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
cmp r5, #1
#else
cmp r4, #2
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
cmp r4, #1
#endif
bne _022FFA8C
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFA74:
#ifdef JAPAN
cmp r5, #0
#else
cmp r4, #0
#endif
beq _022FFA8C
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFA84:
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFA8C:
mov r0, #1
ldmia sp!, {r3, r4, r5, r6, r7, pc}
arm_func_end ov29_022FF958
arm_func_start ov29_022FFA94
ov29_022FFA94: ; 0x022FFA94
stmdb sp!, {r3, r4, r5, r6, r7, lr}
mov r7, r1
mov r6, r0
ldrsh r0, [r7]
ldrsh r1, [r7, #2]
ldr r5, [r6, #0xb4]
bl GetTile
ldrsh r1, [r7]
mov r4, r0
cmp r1, #0
movlt r0, #1
ldmltia sp!, {r3, r4, r5, r6, r7, pc}
ldrsh r0, [r7, #2]
cmp r0, #0
movlt r0, #1
ldmltia sp!, {r3, r4, r5, r6, r7, pc}
cmp r1, #0x38
movge r0, #1
ldmgeia sp!, {r3, r4, r5, r6, r7, pc}
cmp r0, #0x20
movge r0, #1
ldmgeia sp!, {r3, r4, r5, r6, r7, pc}
ldrh r0, [r4]
tst r0, #0x10
movne r0, #1
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
ldr r0, [r4, #0xc]
cmp r0, #0
ldrne r0, [r0]
cmpne r0, #1
movne r0, #1
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
ldrsh r1, [r5, #2]
mov r0, r6
bl GetMobilityTypeCheckSlipAndFloating
ldrh r1, [r4]
cmp r0, #3
and r1, r1, #3
addls pc, pc, r0, lsl #2
b _022FFB80
_022FFB34: ; jump table
b _022FFB44 ; case 0
b _022FFB54 ; case 1
b _022FFB70 ; case 2
b _022FFB70 ; case 3
_022FFB44:
cmp r1, #1
bne _022FFB88
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFB54:
cmp r1, #2
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
cmp r1, #1
bne _022FFB88
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFB70:
cmp r1, #0
beq _022FFB88
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFB80:
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFB88:
mov r0, #1
ldmia sp!, {r3, r4, r5, r6, r7, pc}
arm_func_end ov29_022FFA94
arm_func_start ov29_022FFB90
ov29_022FFB90: ; 0x022FFB90
stmdb sp!, {r3, r4, r5, r6, r7, lr}
mov r7, r1
mov r6, r0
ldrsh r0, [r7]
ldrsh r1, [r7, #2]
ldr r5, [r6, #0xb4]
bl GetTile
ldrsh r1, [r7]
mov r4, r0
cmp r1, #0
movlt r0, #1
ldmltia sp!, {r3, r4, r5, r6, r7, pc}
ldrsh r0, [r7, #2]
cmp r0, #0
movlt r0, #1
ldmltia sp!, {r3, r4, r5, r6, r7, pc}
cmp r1, #0x38
movge r0, #1
ldmgeia sp!, {r3, r4, r5, r6, r7, pc}
cmp r0, #0x20
movge r0, #1
ldmgeia sp!, {r3, r4, r5, r6, r7, pc}
ldrh r0, [r4]
tst r0, #0x10
movne r0, #1
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
ldr r0, [r4, #0xc]
cmp r0, #0
ldrne r0, [r0]
cmpne r0, #1
movne r0, #1
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
bl IsCurrentTilesetBackground
cmp r0, #0
bne _022FFC44
ldrb r0, [r5, #0xef]
cmp r0, #3
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
mov r0, r6
mov r1, #0x10
bl ItemIsActive__022FF898
cmp r0, #0
movne r0, #0
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
_022FFC44:
ldrsh r1, [r5, #2]
mov r0, r6
bl GetMobilityTypeCheckSlipAndFloating
ldrh r2, [r4]
#ifdef JAPAN
mov r4, r0
mov r0, r6
mov r1, #0xc
and r5, r2, #3
bl IqSkillIsEnabled
cmp r0, #0
mov r0, r6
mov r1, #0xd
movne r4, #2
bl IqSkillIsEnabled
cmp r0, #0
movne r4, #3
cmp r4, #3
addls pc, pc, r4, lsl #2
#else
mov r1, r0
mov r0, r6
and r4, r2, #3
bl GetMobilityTypeAfterIqSkills
cmp r0, #3
addls pc, pc, r0, lsl #2
#endif
b _022FFC94
_022FFC70: ; jump table
b _022FFC80 ; case 0
b _022FFC80 ; case 1
b _022FFC80 ; case 2
b _022FFC94 ; case 3
_022FFC80:
#ifdef JAPAN
cmp r5, #0
#else
cmp r4, #0
#endif
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFC94:
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
arm_func_end ov29_022FFB90
arm_func_start CannotStandOnTile
CannotStandOnTile: ; 0x022FFC9C
stmdb sp!, {r3, r4, r5, r6, r7, lr}
mov r7, r1
mov r6, r0
ldrsh r0, [r7]
ldrsh r1, [r7, #2]
ldr r5, [r6, #0xb4]
bl GetTile
ldrsh r1, [r7]
mov r4, r0
cmp r1, #0
movlt r0, #1
ldmltia sp!, {r3, r4, r5, r6, r7, pc}
ldrsh r0, [r7, #2]
cmp r0, #0
movlt r0, #1
ldmltia sp!, {r3, r4, r5, r6, r7, pc}
cmp r1, #0x38
movge r0, #1
ldmgeia sp!, {r3, r4, r5, r6, r7, pc}
cmp r0, #0x20
movge r0, #1
ldmgeia sp!, {r3, r4, r5, r6, r7, pc}
ldrh r0, [r4]
tst r0, #0x10
movne r0, #1
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
ldr r1, [r4, #0xc]
cmp r1, #0
beq _022FFD38
ldr r0, [r1]
cmp r0, #1
bne _022FFD30
ldr r0, [r1, #0xb4]
cmp r0, r5
beq _022FFD38
mov r0, #1
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFD30:
mov r0, #1
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFD38:
bl IsCurrentTilesetBackground
cmp r0, #0
bne _022FFD6C
ldrb r0, [r5, #0xef]
cmp r0, #3
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
mov r0, r6
mov r1, #0x10
bl ItemIsActive__022FF898
cmp r0, #0
movne r0, #0
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
_022FFD6C:
ldrsh r1, [r5, #2]
mov r0, r6
bl GetMobilityTypeCheckSlipAndFloating
ldrh r2, [r4]
#ifdef JAPAN
mov r4, r0
mov r0, r6
mov r1, #0xc
and r5, r2, #3
bl IqSkillIsEnabled
cmp r0, #0
mov r0, r6
mov r1, #0xd
movne r4, #2
bl IqSkillIsEnabled
cmp r0, #0
movne r4, #3
cmp r4, #3
addls pc, pc, r4, lsl #2
#else
mov r1, r0
mov r0, r6
and r4, r2, #3
bl GetMobilityTypeAfterIqSkills
cmp r0, #3
addls pc, pc, r0, lsl #2
#endif
b _022FFDE4
_022FFD98: ; jump table
b _022FFDA8 ; case 0
b _022FFDB8 ; case 1
b _022FFDD4 ; case 2
b _022FFDE4 ; case 3
_022FFDA8:
#ifdef JAPAN
cmp r5, #1
#else
cmp r4, #1
#endif
bne _022FFDEC
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFDB8:
#ifdef JAPAN
cmp r5, #2
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
cmp r5, #1
#else
cmp r4, #2
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
cmp r4, #1
#endif
bne _022FFDEC
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFDD4:
#ifdef JAPAN
cmp r5, #0
#else
cmp r4, #0
#endif
beq _022FFDEC
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFDE4:
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
_022FFDEC:
mov r0, #1
ldmia sp!, {r3, r4, r5, r6, r7, pc}
arm_func_end CannotStandOnTile
arm_func_start CalcSpeedStage
CalcSpeedStage: ; 0x022FFDF4
#ifdef JAPAN
#define CALC_SPEED_STAGE_OFFSET -4
#else
#define CALC_SPEED_STAGE_OFFSET 0
#endif
stmdb sp!, {r4, r5, r6, r7, r8, lr}
mov r8, r0
mov r7, r1
ldr r6, [r8, #0xb4]
bl GetApparentWeather
mov r4, #0
mov r5, r0
mov r1, r4
_022FFE14:
add r2, r6, r1
ldrb r0, [r2, #0x119 + CALC_SPEED_STAGE_OFFSET]
add r1, r1, #1
cmp r0, #0
ldrb r0, [r2, #0x114 + CALC_SPEED_STAGE_OFFSET]
subne r4, r4, r7
cmp r0, #0
addne r4, r4, r7
cmp r1, #5
blt _022FFE14
ldrb r0, [r6, #0xbf]
cmp r0, #4
ldrsh r0, [r6, #2]
subeq r4, r4, #1
bl GetSpeedStatus
add r4, r4, r0
mov r0, r8
mov r1, #6
bl MonsterIsType
cmp r0, #0
beq _022FFE78
mov r0, r8
bl GetApparentWeather
cmp r0, #7
addeq r4, r4, #1
_022FFE78:
mov r0, r8
mov r1, #0x3a
bl IqSkillIsEnabled
cmp r0, #0
ldr r1, _022FFF18 ; =EXCL_ITEM_EFFECTS_WEATHER_MOVE_SPEED_BOOST
addne r4, r4, #1
ldrb r0, [r1, r5]
cmp r0, #0
beq _022FFEB0
ldrb r1, [r1, r5]
mov r0, r8
bl ExclusiveItemEffectIsActive__022FFF28
cmp r0, #0
addne r4, r4, #1
_022FFEB0:
ldrsh r1, [r6, #4]
ldr r0, _022FFF1C ; =0x000001A5
cmp r1, r0
addne r0, r0, #0x72
cmpne r1, r0
ldrsh r1, [r6, #2]
ldr r0, _022FFF20 ; =0x0000017F
addeq r4, r4, #1
cmp r1, r0
addne r0, r0, #0x258
cmpne r1, r0
bne _022FFEFC
ldrb r0, [r6, #6]
cmp r0, #0
ldrne r0, _022FFF24 ; =DUNGEON_PTR
ldrne r0, [r0]
ldrneb r0, [r0, #0x790]
cmpne r0, #0
addne r4, r4, #1
_022FFEFC:
cmp r4, #0
movlt r4, #0
cmp r4, #5
movge r4, #4
mov r0, r4
str r4, [r6, #0x110 + CALC_SPEED_STAGE_OFFSET]
ldmia sp!, {r4, r5, r6, r7, r8, pc}
.align 2, 0
_022FFF18: .word EXCL_ITEM_EFFECTS_WEATHER_MOVE_SPEED_BOOST
_022FFF1C: .word 0x000001A5
_022FFF20: .word 0x0000017F
_022FFF24: .word DUNGEON_PTR
arm_func_end CalcSpeedStage

View File

@ -54,7 +54,7 @@ _02302034:
bl DisableIqSkill
_02302068:
mov r0, r4
bl IsLoneOutlawVeneer
bl IsMonsterLoneOutlaw
cmp r0, #0
bne _0230208C
ldr r0, _023021EC ; =MIN_IQ_ITEM_MASTER

View File

@ -2679,7 +2679,7 @@ _0230B04C:
cmp r0, #0
beq _0230B0B4
mov r0, r7
bl IsLoneOutlawVeneer
bl IsMonsterLoneOutlaw
cmp r0, #0
beq _0230B0B4
ldrb r0, [r7, #0x62]
@ -3283,7 +3283,7 @@ _0230A5E0:
cmp r0, #0
beq _0230A648
mov r0, r4
bl IsLoneOutlawVeneer
bl IsMonsterLoneOutlaw
cmp r0, #0
beq _0230A648
ldrb r0, [r4, #0x62]

View File

@ -326,7 +326,7 @@ _0232C8E4:
cmp r0, #0
beq _0232C96C
mov r0, r7
bl IsLoneOutlawVeneer
bl IsMonsterLoneOutlaw
cmp r0, #0
bne _0232C96C
ldrb r0, [r7, #6]

View File

@ -1185,7 +1185,7 @@ _023393DC:
cmp r0, #2
moveq r0, r5
beq _02339410
bl IsLoneOutlaw
bl IsBehaviorLoneOutlaw
_02339410:
cmp r0, #0
movne r5, #0xc

View File

@ -4,7 +4,7 @@
#include "dungeon_mode.h"
#include "util.h"
bool8 IsLoneOutlaw(enum monster_behavior behavior);
bool8 IsBehaviorLoneOutlaw(enum monster_behavior behavior);
// Checks if a behavior ID corresponds to one of the Secret Bazaar NPCs.
bool8 IsSecretBazaarNpcBehavior(enum monster_behavior behavior);

View File

@ -4,7 +4,7 @@
#include "dungeon_mode.h"
#include "util.h"
bool8 IsLoneOutlawVeneer(struct monster* monster_info);
bool8 IsMonsterLoneOutlaw(struct monster* monster_info);
bool8 IsSecretBazaarNpc(struct entity *entity);
#endif //PMDSKY_DUNGEON_LOGIC_7_H

View File

@ -0,0 +1,9 @@
#ifndef PMDSKY_DUNGEON_LOGIC_8_H
#define PMDSKY_DUNGEON_LOGIC_8_H
#include "dungeon_mode.h"
// Checks if a given monster can move through walls, including both the innate ability of Ghost types and outside modifiers like Mobile Scarf/Orb.
bool8 CanMoveThroughWalls(struct entity *monster);
#endif //PMDSKY_DUNGEON_LOGIC_8_H

View File

@ -11,5 +11,8 @@
// user_has_dropeye: True to assume the entity standing on the origin position has the dropeye status
// return: True if the target position is in sight from the origin position
bool8 IsPositionActuallyInSight(struct position *origin, struct position *target, bool8 user_has_dropeye);
// Checks if a given target position is in sight from a given origin position.
// There's multiple factors that affect this check, but generally, it's true if both positions are in the same room (by checking if the target position is within the boundaries of the room where the origin position is) or within 2 tiles of each other.
bool8 IsPositionInSight(struct position *origin, struct position *target, bool8 user_has_dropeye);
#endif //PMDSKY_DUNGEON_RANGE_H

View File

@ -0,0 +1,9 @@
#ifndef PMDSKY_DUNGEON_RANGE_2_H
#define PMDSKY_DUNGEON_RANGE_2_H
#include "dungeon_mode.h"
// Checks if a given target position is within two tiles of a given origin position.
bool8 IsPositionWithinTwoTiles(struct position *origin, struct position *target);
#endif //PMDSKY_DUNGEON_RANGE_2_H

View File

@ -7,5 +7,9 @@
// Calls IsPositionActuallyInSight. Also checks if the user is blinded, if the target is invisible, etc.
// This function is almost the same as CanTargetEntity, the only difference is that the latter calls IsPositionInSight instead.
bool8 CanSeeTarget(struct entity *user, struct entity *target);
// Checks if a monster can target another entity when controlled by the AI.
// More specifically, it checks if the target is invisible, if the user can see invisible monsters, if the user is blinded and if the target position is in sight from the position of the user (this last check is done by calling IsPositionInSight with the user's and the target's position).
// This function is almost the same as CanSeeTarget, the only difference is that the latter calls IsPositionActuallyInSight instead.
bool8 CanTargetEntity(struct entity *user, struct entity *target);
#endif //PMDSKY_DUNGEON_VISIBILITY_H

View File

@ -379,7 +379,7 @@ Overlay OVY_29
Object src/dg_object.o
Object asm/overlay_29_022E1AD4.o
Object src/dungeon_visibility.o
Object asm/overlay_29_022E2810.o
Object asm/overlay_29_022E28D4.o
Object src/dg_camera.o
Object asm/overlay_29_022E335C.o
Object src/dg_effect.o
@ -387,7 +387,9 @@ Overlay OVY_29
Object src/position_util.o
Object asm/overlay_29_rodata_02351628.o
Object src/dungeon_range.o
Object asm/overlay_29_022E91A4.o
Object asm/overlay_29_022E9298.o
Object src/dungeon_range_2.o
Object asm/overlay_29_022E9488.o
Object src/dg_uty.o
Object asm/overlay_29_022E9618.o
Object src/overlay_29_022EA9EC.o
@ -458,6 +460,8 @@ Overlay OVY_29
Object asm/overlay_29_022FF6C4.o
Object src/overlay_29_022FF898.o
Object asm/overlay_29_022FF8C8.o
Object src/dungeon_logic_8.o
Object asm/overlay_29_022FF958.o
Object src/overlay_29_022FFF28.o
Object asm/overlay_29_022FFF4C.o
Object src/overlay_29_023000E4.o

View File

@ -1,7 +1,6 @@
#include "dungeon_ai_leader.h"
#include "dungeon_util_static.h"
extern bool8 DoesTacticFollowLeader(enum tactic_id tactic_id);
#include "main_02058C3C.h"
bool8 EntityIsValid__0230827C(struct entity *entity)
{

View File

@ -8,8 +8,10 @@
#include "dungeon_capabilities_1.h"
#include "dungeon_capabilities_4.h"
#include "dungeon_logic_7.h"
#include "dungeon_logic_8.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes_1.h"
#include "dungeon_range_2.h"
#include "dungeon_util.h"
#include "dungeon_util_1.h"
#include "dungeon_util_static.h"
@ -46,11 +48,8 @@ struct can_move_in_direction_info
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 IsPositionWithinTwoTiles(struct position *origin, struct position *target);
extern s32 ov29_022FBE04(struct monster*);
extern bool8 CanMoveThroughWalls(struct entity *monster);
extern bool8 ShouldAvoidFirstHit(struct entity *monster, bool8 force_avoid);
extern bool8 CanSeeTeammate(struct entity *monster);
extern struct entity* GetLeaderIfVisible(struct entity *monster);

View File

@ -3,7 +3,7 @@
#include "dungeon_mode.h"
#include "util.h"
bool8 IsLoneOutlaw(enum monster_behavior behavior)
bool8 IsBehaviorLoneOutlaw(enum monster_behavior behavior)
{
bool8 result;

View File

@ -4,9 +4,9 @@
#include "dungeon_util_static.h"
#include "util.h"
bool8 IsLoneOutlawVeneer(struct monster* monster_info)
bool8 IsMonsterLoneOutlaw(struct monster* monster_info)
{
return IsLoneOutlaw(monster_info->monster_behavior);
return IsBehaviorLoneOutlaw(monster_info->monster_behavior);
}
bool8 IsSecretBazaarNpc(struct entity *entity)

19
src/dungeon_logic_8.c Normal file
View File

@ -0,0 +1,19 @@
#include "dungeon_logic_8.h"
#include "dungeon_mobility.h"
#include "dungeon_util_static.h"
#include "overlay_29_022FF898.h"
bool8 CanMoveThroughWalls(struct entity *monster)
{
struct monster *pokemon_info = GetEntInfo(monster);
if (pokemon_info->invisible_class_status.status == STATUS_INVISIBLE_MOBILE)
return TRUE;
if (ItemIsActive__022FF898(monster, ITEM_MOBILE_SCARF))
return TRUE;
if (GetMobilityTypeCheckSlipAndFloating(monster, pokemon_info->id) == MOBILITY_INTANGIBLE)
return TRUE;
return FALSE;
}

View File

@ -2,15 +2,14 @@
#include "dg_camera.h"
#include "dungeon.h"
#include "dungeon_map_access.h"
#include "dungeon_range_2.h"
#include "main_0208655C.h"
bool8 IsPositionActuallyInSight(struct position *origin, struct position *target, bool8 user_has_dropeye)
{
u8 origin_room;
s16 visibility = GetVisibilityRange();
const struct tile *tile_1;
tile_1 = GetTile(origin->x, origin->y);
const struct tile *tile_1 = GetTile(origin->x, origin->y);
origin_room = tile_1->room;
if (user_has_dropeye || origin_room == CORRIDOR_ROOM)
{
@ -20,10 +19,39 @@ bool8 IsPositionActuallyInSight(struct position *origin, struct position *target
else
{
struct room_data *origin_room_data = &DUNGEON_PTR[0]->room_data[origin_room];
if (origin_room_data->bottom_right_corner.x - 1 <= target->x && origin_room_data->bottom_right_corner.y - 1 <= target->y &&
origin_room_data->top_left_corner.x + 1 > target->x && origin_room_data->top_left_corner.y + 1 > target->y)
if (origin_room_data->bottom_right_corner.x - 1 <= target->x &&
origin_room_data->bottom_right_corner.y - 1 <= target->y &&
origin_room_data->top_left_corner.x + 1 > target->x &&
origin_room_data->top_left_corner.y + 1 > target->y)
return TRUE;
}
return FALSE;
}
bool8 IsPositionInSight(struct position *origin, struct position *target, bool8 user_has_dropeye)
{
const struct tile *tile = GetTile(origin->x, origin->y);
u8 origin_room = tile->room;
if (origin_room != CORRIDOR_ROOM && !user_has_dropeye)
{
struct room_data *origin_room_data = &DUNGEON_PTR[0]->room_data[origin_room];
if (origin_room_data->bottom_right_corner.x - 1 <= target->x &&
origin_room_data->bottom_right_corner.y - 1 <= target->y &&
origin_room_data->top_left_corner.x + 1 > target->x &&
origin_room_data->top_left_corner.y + 1 > target->y)
return TRUE;
}
s32 y_diff = abs(origin->y - target->y);
s32 diff = abs(origin->x - target->x);
if (diff <= y_diff)
diff = y_diff;
if (diff > 2)
return FALSE;
else if (diff == 2)
return !!IsPositionWithinTwoTiles(origin, target);
else
return TRUE;
}

69
src/dungeon_range_2.c Normal file
View File

@ -0,0 +1,69 @@
#include "dungeon_range_2.h"
#include "dungeon.h"
#include "dungeon_map_access.h"
#include "main_0208655C.h"
bool8 IsPositionWithinTwoTiles(struct position *origin, struct position *target)
{
s32 i;
s32 origin_x = origin->x;
s32 origin_y;
s32 diff = abs(origin_x - target->x);
if (diff <= 1)
{
s32 y_diff = abs(origin->y - target->y);
if (y_diff <= 1)
return TRUE;
}
origin_y = origin->y;
s32 y_diff = abs(origin_y - target->y);
if (diff <= y_diff)
diff = y_diff;
if (diff == 2)
{
for (i = 0; i < 2; i++)
{
if (origin_x < target->x)
origin_x++;
if (origin_x > target->x)
origin_x--;
if (origin_y < target->y)
origin_y++;
if (origin_y > target->y)
origin_y--;
const struct tile *tile = GetTile(origin_x, origin_y);
if (!(tile->terrain_flags & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)))
return FALSE;
}
s32 target_x = target->x;
s32 target_y = target->y;
for (i = 0; i < 2; i++)
{
if (target_x < origin->x)
target_x++;
if (target_x > origin->x)
target_x--;
if (target_y < origin->y)
target_y++;
if (target_y > origin->y)
target_y--;
const struct tile *tile = GetTile(target_x, target_y);
if (!(tile->terrain_flags & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)))
return FALSE;
}
return TRUE;
}
return FALSE;
}

View File

@ -121,7 +121,7 @@ bool8 RecruitCheck(struct entity* leader, struct entity* target)
return FALSE;
}
if (IsLoneOutlawVeneer(target_monster_info))
if (IsMonsterLoneOutlaw(target_monster_info))
return FALSE;
if (!SpecificRecruitCheck(target_monster_info->id))

View File

@ -32,3 +32,30 @@ bool8 CanSeeTarget(struct entity *user, struct entity *target)
return IsPositionActuallyInSight(&user->pos, &target->pos, HasDropeyeStatus(user));
}
bool8 CanTargetEntity(struct entity *user, struct entity *target)
{
if (!EntityIsValid__022E1A1C(user))
return FALSE;
if (!EntityIsValid__022E1A1C(target))
return FALSE;
if (!target->is_visible)
return FALSE;
if (target->type == ENTITY_MONSTER)
{
if (user->type == ENTITY_MONSTER)
{
if (!CanSeeInvisibleMonsters(user) && GetEntInfo(target)->invisible_class_status.status == STATUS_INVISIBLE_INVISIBLE)
return FALSE;
if (IsBlinded(user, TRUE))
return FALSE;
}
else if (GetEntInfo(target)->invisible_class_status.status == STATUS_INVISIBLE_INVISIBLE)
return FALSE;
}
return IsPositionInSight(&user->pos, &target->pos, HasDropeyeStatus(user));
}