Decomped AiDecideUseItem

This commit is contained in:
AnonymousRandomPerson 2024-12-29 22:50:59 -06:00
parent 6cae6710f5
commit 0d4b5d3ff2
45 changed files with 2618 additions and 2658 deletions

View File

@ -1,25 +0,0 @@
#pragma once
.public abs
.public AI_THROWN_ITEM_ACTION_CHOICE_COUNT
.public BAG_ITEMS_PTR_MIRROR
.public CanSeeTarget
.public CheckVariousConditions
.public DUNGEON_PTR
.public DungeonRandInt
.public DungeonRandOutcome__022EAB20
.public EntityIsValid__0230F008
.public GetAiUseItemProbability
.public GetDirectionTowardsPosition
.public GetItemCategoryVeneer
.public GetItemInfo
.public GetPossibleAiArcItemTargets
.public GetTile
.public GetTreatmentBetweenMonsters
.public IqSkillIsEnabled
.public IsTargetInRange
.public MonsterCanThrowItems
.public ov29_0237C9D0
.public ov29_0237C9D8
.public ov29_0237C9F8
.public SetMonsterActionFields
.public TestItemAiFlag

View File

@ -0,0 +1,12 @@
#pragma once
.public AI_THROWN_ITEM_ACTION_CHOICE_COUNT
.public CanSeeTarget
.public DUNGEON_PTR
.public EntityIsValid__0230F008
.public GetAiUseItemProbability
.public GetTreatmentBetweenMonsters
.public IsTargetInRange
.public abs
.public ov29_0237C9D0
.public AI_THROWN_ITEM_PROBABILITIES
.public AI_THROWN_ITEM_DIRECTIONS

View File

@ -0,0 +1 @@
#pragma once

View File

@ -0,0 +1 @@
#pragma once

View File

@ -0,0 +1,22 @@
#pragma once
.public ov29_0230D704
.public ov29_0230D70C
.public ov29_0230D738
.public ov29_0230D76C
.public ov29_0234FD28
.public ov29_0234FD38
.public ov29_0234FD58
.public ov29_0234FD6C
.public ov29_0234FD80
.public ov29_0234FD88
.public ov29_0234FD90
.public ov29_0234FD98
.public ov29_0234FDA0
.public ov29_0234FDA8
.public ov29_0234FDB0
.public ov29_0234FDB8
.public ov29_0234FDC0
.public ov29_0234FDC8
.public ov29_023527E0
.public ov29_023527E4
.public ov29_023527E8

View File

@ -0,0 +1,6 @@
#pragma once
.public ov29_02353128
.public ov29_02353140
.public ov29_02353158
.public ov29_02353170
.public ov29_02353188

View File

@ -23,32 +23,6 @@
.public ov10_022C4AE8
.public ov10_022C4B00
.public ov10_022C4B98
.public ov29_0230D704
.public ov29_0230D70C
.public ov29_0230D738
.public ov29_0230D76C
.public ov29_0234F21C
.public ov29_0234F248
.public ov29_0234F9E8
.public ov29_0234FD28
.public ov29_0234FD38
.public ov29_0234FD58
.public ov29_0234FD6C
.public ov29_0234FD80
.public ov29_0234FD88
.public ov29_0234FD90
.public ov29_0234FD98
.public ov29_0234FDA0
.public ov29_0234FDA8
.public ov29_0234FDB0
.public ov29_0234FDB8
.public ov29_0234FDC0
.public ov29_0234FDC8
.public ov29_023527E0
.public ov29_023527E4
.public ov29_023527E8
.public ov29_02353128
.public ov29_02353140
.public ov29_02353158
.public ov29_02353170
.public ov29_02353188

View File

@ -1,507 +0,0 @@
.include "asm/macros.inc"
.include "overlay_29_0230E914.inc"
.text
arm_func_start AiDecideUseItem
AiDecideUseItem: ; 0x0230E914
stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr}
sub sp, sp, #0x50
mov sl, r0
ldr r7, [sl, #0xb4]
bl CheckVariousConditions
cmp r0, #0
movne r0, #0
#ifdef JAPAN
strneb r0, [r7, #0x108]
bne _0230ED98
ldrb r0, [r7, #0x108]
#else
strneb r0, [r7, #0x109]
bne _0230ED98
ldrb r0, [r7, #0x109]
#endif
cmp r0, #0
beq _0230EAF0
ldrb r0, [r7, #0x62]
tst r0, #1
movne r0, #1
moveq r0, #0
tst r0, #0xff
beq _0230ED98
ldrsh r0, [r7, #0x66]
bl GetItemCategoryVeneer
cmp r0, #0
bne _0230EA08
mov r0, sl
add r2, r7, #0x62
mov r1, #2
mov r3, #1
bl GetPossibleAiThrownItemDirections
mov r4, #0
ldr r6, _0230EDA0 ; =ov29_0237C9D8
ldr r5, _0230EDA4 ; =AI_THROWN_ITEM_ACTION_CHOICE_COUNT
b _0230E9DC
_0230E990:
ldr r0, [r6, r4, lsl #2]
bl DungeonRandOutcome__022EAB20
cmp r0, #0
beq _0230E9D8
add r0, r7, #0x4a
mov r1, #0x24
bl SetMonsterActionFields
mov r0, #0x81
strb r0, [r7, #0x4e]
ldrsh r1, [sl, #4]
ldr r0, _0230EDA8 ; =ov29_0237C9F8
strh r1, [r7, #0x50]
ldrsh r1, [sl, #6]
strh r1, [r7, #0x52]
ldr r0, [r0, r4, lsl #2]
and r0, r0, #7
strb r0, [r7, #0x4c]
b _0230E9E8
_0230E9D8:
add r4, r4, #1
_0230E9DC:
ldr r0, [r5]
cmp r4, r0
blt _0230E990
_0230E9E8:
ldr r0, _0230EDA4 ; =AI_THROWN_ITEM_ACTION_CHOICE_COUNT
ldr r0, [r0]
cmp r4, r0
bne _0230ED98
add r0, r7, #0x4a
mov r1, #0x39
bl SetMonsterActionFields
b _0230ED98
_0230EA08:
cmp r0, #1
bne _0230EAAC
add r2, sp, #0
mov r0, sl
add r1, r7, #0x62
mov r3, #1
bl GetPossibleAiArcItemTargets
ldr r0, _0230EDA4 ; =AI_THROWN_ITEM_ACTION_CHOICE_COUNT
ldr r1, [r0]
cmp r1, #0
beq _0230EA9C
ldr r0, [r0]
bl DungeonRandInt
mov r4, r0
add r0, r7, #0x4a
mov r1, #0x24
bl SetMonsterActionFields
mov r0, #0x81
strb r0, [r7, #0x4e]
ldrsh r2, [sl, #4]
add r1, sp, #0
add r0, sl, #4
strh r2, [r7, #0x50]
ldrsh r2, [sl, #6]
add r1, r1, r4, lsl #2
strh r2, [r7, #0x52]
bl GetDirectionTowardsPosition
and r0, r0, #7
strb r0, [r7, #0x4c]
add r1, sp, #0
mov r0, r4, lsl #2
ldrh r0, [r1, r0]
add r1, r1, r4, lsl #2
strh r0, [r7, #0x5a]
ldrh r0, [r1, #2]
strh r0, [r7, #0x5c]
b _0230ED98
_0230EA9C:
add r0, r7, #0x4a
mov r1, #0x39
bl SetMonsterActionFields
b _0230ED98
_0230EAAC:
add r0, r0, #0xfe
and r0, r0, #0xff
cmp r0, #1
add r0, r7, #0x4a
bhi _0230EAE4
mov r1, #0x23
bl SetMonsterActionFields
mov r0, #0x81
strb r0, [r7, #0x4e]
ldrsh r0, [sl, #4]
strh r0, [r7, #0x50]
ldrsh r0, [sl, #6]
strh r0, [r7, #0x52]
b _0230ED98
_0230EAE4:
mov r1, #0x39
bl SetMonsterActionFields
b _0230ED98
_0230EAF0:
mov r0, sl
mov r1, #0x16
bl IqSkillIsEnabled
cmp r0, #0
beq _0230ED98
mov r5, #1
b _0230ED90
_0230EB0C:
cmp r5, #1
addeq r8, r7, #0x62
moveq r6, #0x81
beq _0230EB84
cmp r5, #0
bne _0230EB58
ldrsh r0, [sl, #4]
ldrsh r1, [sl, #6]
bl GetTile
ldr r0, [r0, #0x10]
cmp r0, #0
beq _0230ED8C
ldr r1, [r0]
cmp r1, #3
bne _0230ED8C
bl GetItemInfo
mov r8, r0
mov r6, #0x80
b _0230EB84
_0230EB58:
ldrb r0, [r7, #7]
cmp r0, #0
beq _0230ED98
ldr r0, _0230EDAC ; =BAG_ITEMS_PTR_MIRROR
sub r1, r5, #1
ldr r0, [r0]
sub r2, r5, #2
ldr r3, [r0, #0x384]
mov r0, #6
mla r8, r2, r0, r3
and r6, r1, #0xff
_0230EB84:
ldrb r1, [r8]
tst r1, #1
movne r0, #1
moveq r0, #0
tst r0, #0xff
beq _0230ED8C
ldrb r0, [r8]
tst r0, #2
bne _0230ED8C
tst r1, #8
movne r0, #1
moveq r0, #0
tst r0, #0xff
bne _0230ED8C
ldrsh r0, [r8, #4]
mov r1, #0
bl TestItemAiFlag
cmp r0, #0
beq _0230EC4C
mov r0, sl
mov r1, r8
mov r2, #2
bl GetAiUseItemProbability
movs r4, r0
beq _0230EC4C
ldrsh r0, [r8, #4]
bl GetItemCategoryVeneer
mov sb, r0
cmp sb, #9
ldreqb r0, [r7, #6]
cmpeq r0, #0
beq _0230EC4C
mov r0, r4
bl DungeonRandOutcome__022EAB20
cmp r0, #0
beq _0230EC4C
cmp sb, #9
add r0, r7, #0x4a
bne _0230EC2C
mov r1, #0x31
bl SetMonsterActionFields
b _0230EC34
_0230EC2C:
mov r1, #0x23
bl SetMonsterActionFields
_0230EC34:
strb r6, [r7, #0x4e]
ldrsh r0, [sl, #4]
strh r0, [r7, #0x50]
ldrsh r0, [sl, #6]
strh r0, [r7, #0x52]
b _0230ED98
_0230EC4C:
mov r0, r7
bl MonsterCanThrowItems
cmp r0, #0
beq _0230ED8C
mov r4, #1
ldr fp, _0230EDA4 ; =AI_THROWN_ITEM_ACTION_CHOICE_COUNT
b _0230ED84
_0230EC68:
ldrsh r0, [r8, #4]
mov r1, r4
bl TestItemAiFlag
cmp r0, #0
beq _0230ED80
ldrsh r0, [r8, #4]
bl GetItemCategoryVeneer
cmp r0, #1
mov r0, sl
mov r3, #0
bne _0230ED14
mov r1, r8
add r2, sp, #0
bl GetPossibleAiArcItemTargets
ldr r0, [fp]
cmp r0, #0
beq _0230ED80
ldr r0, _0230EDA4 ; =AI_THROWN_ITEM_ACTION_CHOICE_COUNT
ldr r0, [r0]
bl DungeonRandInt
mov r4, r0
add r0, r7, #0x4a
mov r1, #0x24
bl SetMonsterActionFields
strb r6, [r7, #0x4e]
ldrsh r2, [sl, #4]
add r1, sp, #0
add r0, sl, #4
strh r2, [r7, #0x50]
ldrsh r2, [sl, #6]
add r1, r1, r4, lsl #2
strh r2, [r7, #0x52]
bl GetDirectionTowardsPosition
and r0, r0, #7
strb r0, [r7, #0x4c]
add r1, sp, #0
mov r0, r4, lsl #2
ldrh r0, [r1, r0]
add r1, r1, r4, lsl #2
strh r0, [r7, #0x5a]
ldrh r0, [r1, #2]
strh r0, [r7, #0x5c]
b _0230ED98
_0230ED14:
mov r1, r4
mov r2, r8
bl GetPossibleAiThrownItemDirections
mov sb, #0
b _0230ED74
_0230ED28:
ldr r0, _0230EDA0 ; =ov29_0237C9D8
ldr r0, [r0, sb, lsl #2]
bl DungeonRandOutcome__022EAB20
cmp r0, #0
beq _0230ED70
add r0, r7, #0x4a
mov r1, #0x24
bl SetMonsterActionFields
strb r6, [r7, #0x4e]
ldrsh r1, [sl, #4]
ldr r0, _0230EDA8 ; =ov29_0237C9F8
strh r1, [r7, #0x50]
ldrsh r1, [sl, #6]
strh r1, [r7, #0x52]
ldr r0, [r0, sb, lsl #2]
and r0, r0, #7
strb r0, [r7, #0x4c]
b _0230ED98
_0230ED70:
add sb, sb, #1
_0230ED74:
ldr r0, [fp]
cmp sb, r0
blt _0230ED28
_0230ED80:
add r4, r4, #1
_0230ED84:
cmp r4, #3
blt _0230EC68
_0230ED8C:
add r5, r5, #1
_0230ED90:
cmp r5, #0x34
blt _0230EB0C
_0230ED98:
add sp, sp, #0x50
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
.align 2, 0
_0230EDA0: .word ov29_0237C9D8
_0230EDA4: .word AI_THROWN_ITEM_ACTION_CHOICE_COUNT
_0230EDA8: .word ov29_0237C9F8
_0230EDAC: .word BAG_ITEMS_PTR_MIRROR
arm_func_end AiDecideUseItem
arm_func_start GetPossibleAiThrownItemDirections
GetPossibleAiThrownItemDirections: ; 0x0230EDB0
stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr}
sub sp, sp, #0x14
ldr r4, _0230EFF4 ; =AI_THROWN_ITEM_ACTION_CHOICE_COUNT
mov r5, #0
mov sl, r0
str r3, [sp, #8]
ldr r0, _0230EFF8 ; =ov29_0237C9D0
str r1, [sp]
str r2, [sp, #4]
str r5, [r4]
mov fp, r5
_0230EDDC:
strb fp, [r0, r5]
add r5, r5, #1
cmp r5, #8
blt _0230EDDC
mvn r0, #0
str r0, [sp, #0x10]
_0230EDF4:
ldr r0, _0230EFFC ; =DUNGEON_PTR
ldr r0, [r0]
add r0, r0, fp, lsl #2
add r0, r0, #0x12000
#ifdef JAPAN
ldr r4, [r0, #0xad4]
#else
ldr r4, [r0, #0xb78]
#endif
mov r0, r4
bl EntityIsValid__0230F008
cmp r0, #0
cmpne sl, r4
beq _0230EFE0
ldr r0, [sp]
mov r2, #0
cmp r0, #1
mov r0, sl
mov r1, r4
bne _0230EE50
mov r3, r2
bl GetTreatmentBetweenMonsters
cmp r0, #0
bne _0230EFE0
mov r0, #3
str r0, [sp, #0xc]
b _0230EE68
_0230EE50:
mov r3, #1
bl GetTreatmentBetweenMonsters
cmp r0, #1
bne _0230EFE0
mov r0, #1
str r0, [sp, #0xc]
_0230EE68:
mov r0, sl
mov r1, r4
bl CanSeeTarget
cmp r0, #0
beq _0230EFE0
ldrsh r6, [r4, #4]
ldrsh r7, [sl, #4]
sub r0, r7, r6
bl abs
mov r5, r0
ldrsh r8, [r4, #6]
ldrsh sb, [sl, #6]
sub r0, sb, r8
bl abs
ldr r1, [sl, #0xb4]
ldrb r1, [r1, #0xee]
cmp r1, #0
bne _0230EEC4
cmp r5, r0
movgt r1, r5
movle r1, r0
cmp r1, #0xa
bgt _0230EFE0
_0230EEC4:
cmp r5, r0
ldr r5, [sp, #0x10]
bne _0230EF08
cmp r7, r6
cmplt sb, r8
movlt r5, #1
blt _0230EF54
cmp r7, r6
bge _0230EEF4
cmp sb, r8
movgt r5, #3
bgt _0230EF54
_0230EEF4:
cmp r7, r6
cmpgt sb, r8
movgt r5, #5
movle r5, #7
b _0230EF54
_0230EF08:
cmp r7, r6
bne _0230EF1C
cmp sb, r8
movlt r5, #0
blt _0230EF54
_0230EF1C:
cmp r7, r6
bge _0230EF30
cmp sb, r8
moveq r5, #2
beq _0230EF54
_0230EF30:
cmp r7, r6
bne _0230EF44
cmp sb, r8
movgt r5, #4
bgt _0230EF54
_0230EF44:
cmp r7, r6
ble _0230EF54
cmp sb, r8
moveq r5, #6
_0230EF54:
cmp r5, #0
blt _0230EFE0
ldr r0, _0230EFF8 ; =ov29_0237C9D0
ldrb r0, [r0, r5]
cmp r0, #0
bne _0230EFE0
mov r0, sl
mov r1, r4
mov r2, r5
mov r3, #0xa
bl IsTargetInRange
cmp r0, #0
beq _0230EFE0
ldr r0, _0230EFF8 ; =ov29_0237C9D0
mov r1, #1
strb r1, [r0, r5]
ldr r0, [sp, #8]
cmp r0, #0
ldr r0, _0230EFF4 ; =AI_THROWN_ITEM_ACTION_CHOICE_COUNT
ldr r1, [r0]
ldr r0, _0230F000 ; =ov29_0237C9F8
str r5, [r0, r1, lsl #2]
movne r0, #0x64
bne _0230EFC4
ldr r2, [sp, #0xc]
ldr r1, [sp, #4]
mov r0, r4
bl GetAiUseItemProbability
_0230EFC4:
ldr r1, _0230EFF4 ; =AI_THROWN_ITEM_ACTION_CHOICE_COUNT
ldr r2, [r1]
ldr r1, _0230F004 ; =ov29_0237C9D8
str r0, [r1, r2, lsl #2]
ldr r0, _0230EFF4 ; =AI_THROWN_ITEM_ACTION_CHOICE_COUNT
add r1, r2, #1
str r1, [r0]
_0230EFE0:
add fp, fp, #1
cmp fp, #0x14
blt _0230EDF4
add sp, sp, #0x14
ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc}
.align 2, 0
_0230EFF4: .word AI_THROWN_ITEM_ACTION_CHOICE_COUNT
_0230EFF8: .word ov29_0237C9D0
_0230EFFC: .word DUNGEON_PTR
_0230F000: .word ov29_0237C9F8
_0230F004: .word ov29_0237C9D8
arm_func_end GetPossibleAiThrownItemDirections

176
asm/overlay_29_0230EDB0.s Normal file
View File

@ -0,0 +1,176 @@
.include "asm/macros.inc"
.include "overlay_29_0230EDB0.inc"
.text
arm_func_start GetPossibleAiThrownItemDirections
GetPossibleAiThrownItemDirections: ; 0x0230EDB0
stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, fp, lr}
sub sp, sp, #0x14
ldr r4, _0230EFF4 ; =AI_THROWN_ITEM_ACTION_CHOICE_COUNT
mov r5, #0
mov sl, r0
str r3, [sp, #8]
ldr r0, _0230EFF8 ; =ov29_0237C9D0
str r1, [sp]
str r2, [sp, #4]
str r5, [r4]
mov fp, r5
_0230EDDC:
strb fp, [r0, r5]
add r5, r5, #1
cmp r5, #8
blt _0230EDDC
mvn r0, #0
str r0, [sp, #0x10]
_0230EDF4:
ldr r0, _0230EFFC ; =DUNGEON_PTR
ldr r0, [r0]
add r0, r0, fp, lsl #2
add r0, r0, #0x12000
#ifdef JAPAN
ldr r4, [r0, #0xad4]
#else
ldr r4, [r0, #0xb78]
#endif
mov r0, r4
bl EntityIsValid__0230F008
cmp r0, #0
cmpne sl, r4
beq _0230EFE0
ldr r0, [sp]
mov r2, #0
cmp r0, #1
mov r0, sl
mov r1, r4
bne _0230EE50
mov r3, r2
bl GetTreatmentBetweenMonsters
cmp r0, #0
bne _0230EFE0
mov r0, #3
str r0, [sp, #0xc]
b _0230EE68
_0230EE50:
mov r3, #1
bl GetTreatmentBetweenMonsters
cmp r0, #1
bne _0230EFE0
mov r0, #1
str r0, [sp, #0xc]
_0230EE68:
mov r0, sl
mov r1, r4
bl CanSeeTarget
cmp r0, #0
beq _0230EFE0
ldrsh r6, [r4, #4]
ldrsh r7, [sl, #4]
sub r0, r7, r6
bl abs
mov r5, r0
ldrsh r8, [r4, #6]
ldrsh sb, [sl, #6]
sub r0, sb, r8
bl abs
ldr r1, [sl, #0xb4]
ldrb r1, [r1, #0xee]
cmp r1, #0
bne _0230EEC4
cmp r5, r0
movgt r1, r5
movle r1, r0
cmp r1, #0xa
bgt _0230EFE0
_0230EEC4:
cmp r5, r0
ldr r5, [sp, #0x10]
bne _0230EF08
cmp r7, r6
cmplt sb, r8
movlt r5, #1
blt _0230EF54
cmp r7, r6
bge _0230EEF4
cmp sb, r8
movgt r5, #3
bgt _0230EF54
_0230EEF4:
cmp r7, r6
cmpgt sb, r8
movgt r5, #5
movle r5, #7
b _0230EF54
_0230EF08:
cmp r7, r6
bne _0230EF1C
cmp sb, r8
movlt r5, #0
blt _0230EF54
_0230EF1C:
cmp r7, r6
bge _0230EF30
cmp sb, r8
moveq r5, #2
beq _0230EF54
_0230EF30:
cmp r7, r6
bne _0230EF44
cmp sb, r8
movgt r5, #4
bgt _0230EF54
_0230EF44:
cmp r7, r6
ble _0230EF54
cmp sb, r8
moveq r5, #6
_0230EF54:
cmp r5, #0
blt _0230EFE0
ldr r0, _0230EFF8 ; =ov29_0237C9D0
ldrb r0, [r0, r5]
cmp r0, #0
bne _0230EFE0
mov r0, sl
mov r1, r4
mov r2, r5
mov r3, #0xa
bl IsTargetInRange
cmp r0, #0
beq _0230EFE0
ldr r0, _0230EFF8 ; =ov29_0237C9D0
mov r1, #1
strb r1, [r0, r5]
ldr r0, [sp, #8]
cmp r0, #0
ldr r0, _0230EFF4 ; =AI_THROWN_ITEM_ACTION_CHOICE_COUNT
ldr r1, [r0]
ldr r0, _0230F000 ; =AI_THROWN_ITEM_DIRECTIONS
str r5, [r0, r1, lsl #2]
movne r0, #0x64
bne _0230EFC4
ldr r2, [sp, #0xc]
ldr r1, [sp, #4]
mov r0, r4
bl GetAiUseItemProbability
_0230EFC4:
ldr r1, _0230EFF4 ; =AI_THROWN_ITEM_ACTION_CHOICE_COUNT
ldr r2, [r1]
ldr r1, _0230F004 ; =AI_THROWN_ITEM_PROBABILITIES
str r0, [r1, r2, lsl #2]
ldr r0, _0230EFF4 ; =AI_THROWN_ITEM_ACTION_CHOICE_COUNT
add r1, r2, #1
str r1, [r0]
_0230EFE0:
add fp, fp, #1
cmp fp, #0x14
blt _0230EDF4
add sp, sp, #0x14
ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, fp, pc}
.align 2, 0
_0230EFF4: .word AI_THROWN_ITEM_ACTION_CHOICE_COUNT
_0230EFF8: .word ov29_0237C9D0
_0230EFFC: .word DUNGEON_PTR
_0230F000: .word AI_THROWN_ITEM_DIRECTIONS
_0230F004: .word AI_THROWN_ITEM_PROBABILITIES
arm_func_end GetPossibleAiThrownItemDirections

View File

@ -0,0 +1,162 @@
.include "asm/macros.inc"
.include "overlay_29_bss_02353860.inc"
.bss
#ifndef EUROPE
.global ov29_02353860
ov29_02353860:
.space 0x20
#endif
.global ov29_02353880
ov29_02353880:
.space 0x34
.global ov29_023538B4
ov29_023538B4:
.space 0x1963C
.global ov29_0236CEF0
ov29_0236CEF0:
.space 0x6FC
.global ov29_0236D5EC
ov29_0236D5EC:
.space 0x6000
.global ov29_023735EC
ov29_023735EC:
.space 0x4
.global ov29_023735F0
ov29_023735F0:
.space 0x4
.global ov29_023735F4
ov29_023735F4:
.space 0x4
.global ov29_023735F8
ov29_023735F8:
.space 0x4
.global ov29_023735FC
ov29_023735FC:
.space 0x10
.global ov29_0237360C
ov29_0237360C:
.space 0x80
.global ov29_0237368C
ov29_0237368C:
.space 0x4
.global ov29_02373690
ov29_02373690:
.space 0x9000
.global ov29_0237C690
ov29_0237C690:
.space 0x4
.global ov29_0237C694
ov29_0237C694:
.space 0x2
.global ov29_0237C696
ov29_0237C696:
.space 0x2
.global ov29_0237C698
ov29_0237C698:
.space 0xC
.global ov29_0237C6A4
ov29_0237C6A4:
.space 0x14
.global ov29_0237C6B8
ov29_0237C6B8:
.space 0x1C
.global ov29_0237C6D4
ov29_0237C6D4:
.space 0x40
.global ov29_0237C714
ov29_0237C714:
.space 0x40
.global ov29_0237C754
ov29_0237C754:
.space 0x48
.global ov29_0237C79C
ov29_0237C79C:
.space 0xB0
.global ov29_0237C84C
ov29_0237C84C:
.space 0x4
.global ov29_0237C850
ov29_0237C850:
.space 0x14
.global ov29_0237C864
ov29_0237C864:
.space 0x24
.global ov29_0237C888
ov29_0237C888:
.space 0x2
.global ov29_0237C88A
ov29_0237C88A:
.space 0x4
.global ov29_0237C88E
ov29_0237C88E:
.space 0x2
.global ov29_0237C890
ov29_0237C890:
.space 0x2
.global ov29_0237C892
ov29_0237C892:
.space 0x86
.global ov29_0237C918
ov29_0237C918:
.space 0x4
.global ov29_0237C91C
ov29_0237C91C:
.space 0x2
.global ov29_0237C91E
ov29_0237C91E:
.space 0x2
.global ov29_0237C920
ov29_0237C920:
.space 0x2
.global ov29_0237C922
ov29_0237C922:
.space 0x4A
.global ov29_0237C96C
ov29_0237C96C:
.space 0x8
.global ov29_0237C974
ov29_0237C974:
.space 0x28
.global ov29_0237C99C
ov29_0237C99C:
.space 0x4
.global ov29_0237C9A0
ov29_0237C9A0:
.space 0x4
.global ov29_0237C9A4
ov29_0237C9A4:
.space 0x8
.global ov29_0237C9AC
ov29_0237C9AC:
.space 0x4
.global ov29_0237C9B0
ov29_0237C9B0:
.space 0x8
.global ov29_0237C9B8
ov29_0237C9B8:
.space 0x8
.global ov29_0237C9C0
ov29_0237C9C0:
.space 0x1
.global ov29_0237C9C1
ov29_0237C9C1:
.space 0x3
.global ov29_0237C9C4
ov29_0237C9C4:
.space 0x1
.global ov29_0237C9C5
ov29_0237C9C5:
.space 0x3
.global ov29_0237C9C8
ov29_0237C9C8:
.space 0x1
.global ov29_0237C9C9
ov29_0237C9C9:
.space 0x3
.global ov29_0237C9CC
ov29_0237C9CC:
.space 0x4
.global ov29_0237C9D0
ov29_0237C9D0:
.space 0x8

View File

@ -0,0 +1,106 @@
.include "asm/macros.inc"
.include "overlay_29_bss_0237CA18.inc"
.bss
.global ov29_0237CA18
ov29_0237CA18:
.space 0x8
.global ov29_0237CA20
ov29_0237CA20:
.space 0x8
.global ov29_0237CA28
ov29_0237CA28:
.space 0x20
.global ov29_0237CA48
ov29_0237CA48:
.space 0x20
.global ov29_0237CA68
ov29_0237CA68:
.space 0x1
.global ov29_0237CA69
ov29_0237CA69:
.space 0x1
.global ov29_0237CA6A
ov29_0237CA6A:
.space 0x1
.global ov29_0237CA6B
ov29_0237CA6B:
.space 0x1
.global ov29_0237CA6C
ov29_0237CA6C:
.space 0x1
.global ov29_0237CA6D
ov29_0237CA6D:
.space 0x3
.global ov29_0237CA70
ov29_0237CA70:
.space 0x4
.global ov29_0237CA74
ov29_0237CA74:
.space 0x4
.global ov29_0237CA78
ov29_0237CA78:
.space 0x4
.global ov29_0237CA7C
ov29_0237CA7C:
.space 0x4
.global ov29_0237CA80
ov29_0237CA80:
.space 0x4
.global ov29_0237CA84
ov29_0237CA84:
.space 0x4
.global ov29_0237CA88
ov29_0237CA88:
.space 0x4
.global ov29_0237CA8C
ov29_0237CA8C:
.space 0x4
.global ov29_0237CA90
ov29_0237CA90:
.space 0x6
.global ov29_0237CA96
ov29_0237CA96:
.space 0xA
.global ov29_0237CAA0
ov29_0237CAA0:
.space 0xC
.global ov29_0237CAAC
ov29_0237CAAC:
.space 0xC
.global ov29_0237CAB8
ov29_0237CAB8:
.space 0x14
.global ov29_0237CACC
ov29_0237CACC:
.space 0x274
.global ov29_0237CD40
ov29_0237CD40:
.space 0x278
.global ov29_0237CFB8
ov29_0237CFB8:
.space 0x3
.global ov29_0237CFBB
ov29_0237CFBB:
.space 0x1
.global ov29_0237CFBC
ov29_0237CFBC:
.space 0x4
.global ov29_0237CFC0
ov29_0237CFC0:
.space 0x3C
.global ov29_0237CFFC
ov29_0237CFFC:
.space 0x4
.global ov29_0237D000
ov29_0237D000:
.space 0x5800
.global ov29_02382800
ov29_02382800:
.space 0x4
.global ov29_02382804
ov29_02382804:
.space 0x8
.global ov29_0238280C
ov29_0238280C:
.space 0x14

View File

@ -0,0 +1,171 @@
.include "asm/macros.inc"
.include "overlay_29_data_023534E0.inc"
.data
.global ov29_023534E0
ov29_023534E0:
.word ov29_0234FD6C
.word ov29_0234FD28
.global ov29_023534E8
ov29_023534E8:
.word ov29_0234FD58
.word ov29_0234FD38
.global ov29_023534F0
ov29_023534F0:
.word ov29_0234FDB8
.word ov29_0234FDC8
.word ov29_0234FDC0
.word ov29_0234FD88
.word ov29_0234FDB0
.word ov29_0234FD98
.word ov29_0234FDA0
.word ov29_0234FDA8
.word ov29_0234FD90
.word ov29_0234FD80
.global ov29_02353518
ov29_02353518:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_0235351C
ov29_0235351C:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_02353524
ov29_02353524:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_0235352C
ov29_0235352C:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353530
ov29_02353530:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353534
ov29_02353534:
.byte 0x00, 0x00, 0x00, 0x00
.global DUNGEON_PTR
DUNGEON_PTR:
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353540
ov29_02353540:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353544
ov29_02353544:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_0235354C
ov29_0235354C:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global TOP_SCREEN_STATUS_PTR
TOP_SCREEN_STATUS_PTR:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353558
ov29_02353558:
.byte 0x00, 0x00, 0x00, 0x00
.global LEADER_PTR
LEADER_PTR:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353560
ov29_02353560:
.byte 0x00, 0x00
.global ov29_02353562
ov29_02353562:
.byte 0x00
.global ov29_02353563
ov29_02353563:
.byte 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global DUNGEON_PRNG_STATE
DUNGEON_PRNG_STATE:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global DUNGEON_PRNG_STATE_SECONDARY_VALUES
DUNGEON_PRNG_STATE_SECONDARY_VALUES:
.byte 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.global ov29_02353598
ov29_02353598:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_0235359C
ov29_0235359C:
.byte 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00
.global ov29_023535A4
ov29_023535A4:
.byte 0xFE, 0x00, 0x00, 0x00
.global ov29_023535A8
ov29_023535A8:
.byte 0x00, 0x00, 0x00, 0x00
.global LOADED_ATTACK_SPRITE_FILE_INDEX
LOADED_ATTACK_SPRITE_FILE_INDEX:
.byte 0xFF, 0xFF, 0xFF, 0xFF
.global EXCL_ITEM_EFFECTS_WEATHER_ATK_SPEED_BOOST
EXCL_ITEM_EFFECTS_WEATHER_ATK_SPEED_BOOST:
.byte 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x00
.global EXCL_ITEM_EFFECTS_WEATHER_MOVE_SPEED_BOOST
EXCL_ITEM_EFFECTS_WEATHER_MOVE_SPEED_BOOST:
.byte 0x2F, 0x30, 0x31, 0x32
.byte 0x33, 0x34, 0x35, 0x00
.global EXCL_ITEM_EFFECTS_WEATHER_NO_STATUS
EXCL_ITEM_EFFECTS_WEATHER_NO_STATUS:
.byte 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x00
.global ov29_023535C8
ov29_023535C8:
.word ov29_023527E0
.word ov29_023527E8
.word ov29_023527E4
.global ov29_023535D4
ov29_023535D4:
.byte 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_023535DC
ov29_023535DC:
.byte 0x0C, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00
.word ov29_0230D738
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x0D, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00
.word ov29_0230D738
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00
.word ov29_0230D738
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x0F, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00
.word ov29_0230D738
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x12, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00
.word ov29_0230D76C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x11, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x15, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x16, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x17, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x18, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.word ov29_0230D704
.byte 0x00, 0x00, 0x00, 0x00

View File

@ -0,0 +1,126 @@
.include "asm/macros.inc"
.include "overlay_29_data_02353700.inc"
.data
; Should be in dungeon_ai_items.c, but not sure how to mark it as .data rather than .rodata or .bss.
.global AI_THROWN_ITEM_ACTION_CHOICE_COUNT
AI_THROWN_ITEM_ACTION_CHOICE_COUNT:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353700
ov29_02353700:
.byte 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00
.global ov29_0235370C
ov29_0235370C:
.byte 0x00, 0x00, 0x00, 0x00
.global EXCL_ITEM_EFFECTS_EVASION_BOOST
EXCL_ITEM_EFFECTS_EVASION_BOOST:
.byte 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x00
.global ov29_02353718
ov29_02353718:
.byte 0x00, 0x00, 0x00, 0x00
#if defined(EUROPE)
.byte 0xEF, 0x03, 0xF0, 0x03
.byte 0xF1, 0x03, 0xF2, 0x03
.byte 0xF3, 0x03
.global ov29_02353720
ov29_02353720:
.byte 0xF5, 0x03
.byte 0xF7, 0x03, 0xF9, 0x03
.byte 0xFB, 0x03, 0xFD, 0x03
.global ov29_0235371C
ov29_0235371C:
.byte 0xF4, 0x03, 0xF6, 0x03
.byte 0xF8, 0x03, 0xFA, 0x03
.byte 0xFC, 0x03, 0x00, 0x00
#elif !defined(JAPAN)
.global ov29_0235371C
ov29_0235371C:
.byte 0xF4, 0x03, 0xF4, 0x03
.global ov29_02353720
ov29_02353720:
.byte 0xF5, 0x03, 0xF5, 0x03
#endif
.global DEFAULT_TILE
DEFAULT_TILE:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_0235372C
ov29_0235372C:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353730
ov29_02353730:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_0235376C
ov29_0235376C:
.byte 0x00, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_0235377C
ov29_0235377C:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_02353784
ov29_02353784:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global HIDDEN_STAIRS_SPAWN_BLOCKED
HIDDEN_STAIRS_SPAWN_BLOCKED:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global FIXED_ROOM_DATA_PTR
FIXED_ROOM_DATA_PTR:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353798
ov29_02353798:
.byte 0x00, 0x00, 0x00, 0x00
.word ov29_02353188
.word ov29_02353170
.word ov29_02353128
.word ov29_02353158
.word ov29_02353140
.global ov29_023537B0
ov29_023537B0:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_023537B4
ov29_023537B4:
.byte 0x15, 0x00, 0x16, 0x00, 0x15, 0x00, 0x16, 0x00
.global ov29_023537BC
ov29_023537BC:
.byte 0x02, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02
.global ov29_023537C4
ov29_023537C4:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_023537C8
ov29_023537C8:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_023537CC
ov29_023537CC:
.byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_023537D8
ov29_023537D8:
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global DUNGEON_FADES_PTR
DUNGEON_FADES_PTR:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_023537E4
ov29_023537E4:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_023537E8
ov29_023537E8:
.byte 0xFA, 0x00, 0xB8, 0x04
.byte 0xD9, 0x00, 0xB5, 0x04, 0xDB, 0x00, 0xB6, 0x04, 0xDC, 0x00, 0xB4, 0x04, 0xDD, 0x00, 0xB7, 0x04
.byte 0xDE, 0x00, 0xBE, 0x04, 0xDF, 0x00, 0xC0, 0x04, 0xE0, 0x00, 0xC1, 0x04, 0xE1, 0x00, 0xD2, 0x04
.byte 0xE2, 0x00, 0xBD, 0x04, 0xEC, 0x00, 0xBF, 0x04, 0xEE, 0x00, 0xC5, 0x04, 0xEF, 0x00, 0xC2, 0x04
.byte 0xF0, 0x00, 0xC3, 0x04, 0xE3, 0x00, 0xC4, 0x04, 0xF1, 0x00, 0x00, 0x00, 0xF2, 0x00, 0x00, 0x00
.byte 0xF3, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00
.global ov29_02353834
ov29_02353834:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353838
ov29_02353838:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_0235383C
ov29_0235383C:
.byte 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00
.global ov29_02353848
ov29_02353848:
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00

View File

@ -1,5 +1,5 @@
.include "asm/macros.inc"
.include "overlay_29_02352A54.inc"
.include "overlay_29_rodata_0234FD04.inc"
.rodata
.global ov29_0234FD04

View File

@ -1,5 +1,5 @@
.include "asm/macros.inc"
.include "overlay_29_0238280C.inc"
.include "overlay_29_rodata_02352A6C.inc"
.rodata
.global ov29_02352A6C
@ -818,561 +818,3 @@ ov29_02353474:
ov29_023534B4:
.byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x11, 0x1C, 0x05
.byte 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.data
.global ov29_023534E0
ov29_023534E0:
.word ov29_0234FD6C
.word ov29_0234FD28
.global ov29_023534E8
ov29_023534E8:
.word ov29_0234FD58
.word ov29_0234FD38
.global ov29_023534F0
ov29_023534F0:
.word ov29_0234FDB8
.word ov29_0234FDC8
.word ov29_0234FDC0
.word ov29_0234FD88
.word ov29_0234FDB0
.word ov29_0234FD98
.word ov29_0234FDA0
.word ov29_0234FDA8
.word ov29_0234FD90
.word ov29_0234FD80
.global ov29_02353518
ov29_02353518:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_0235351C
ov29_0235351C:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_02353524
ov29_02353524:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_0235352C
ov29_0235352C:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353530
ov29_02353530:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353534
ov29_02353534:
.byte 0x00, 0x00, 0x00, 0x00
.global DUNGEON_PTR
DUNGEON_PTR:
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353540
ov29_02353540:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353544
ov29_02353544:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_0235354C
ov29_0235354C:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global TOP_SCREEN_STATUS_PTR
TOP_SCREEN_STATUS_PTR:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353558
ov29_02353558:
.byte 0x00, 0x00, 0x00, 0x00
.global LEADER_PTR
LEADER_PTR:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353560
ov29_02353560:
.byte 0x00, 0x00
.global ov29_02353562
ov29_02353562:
.byte 0x00
.global ov29_02353563
ov29_02353563:
.byte 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global DUNGEON_PRNG_STATE
DUNGEON_PRNG_STATE:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global DUNGEON_PRNG_STATE_SECONDARY_VALUES
DUNGEON_PRNG_STATE_SECONDARY_VALUES:
.byte 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.global ov29_02353598
ov29_02353598:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_0235359C
ov29_0235359C:
.byte 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00
.global ov29_023535A4
ov29_023535A4:
.byte 0xFE, 0x00, 0x00, 0x00
.global ov29_023535A8
ov29_023535A8:
.byte 0x00, 0x00, 0x00, 0x00
.global LOADED_ATTACK_SPRITE_FILE_INDEX
LOADED_ATTACK_SPRITE_FILE_INDEX:
.byte 0xFF, 0xFF, 0xFF, 0xFF
.global EXCL_ITEM_EFFECTS_WEATHER_ATK_SPEED_BOOST
EXCL_ITEM_EFFECTS_WEATHER_ATK_SPEED_BOOST:
.byte 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x00
.global EXCL_ITEM_EFFECTS_WEATHER_MOVE_SPEED_BOOST
EXCL_ITEM_EFFECTS_WEATHER_MOVE_SPEED_BOOST:
.byte 0x2F, 0x30, 0x31, 0x32
.byte 0x33, 0x34, 0x35, 0x00
.global EXCL_ITEM_EFFECTS_WEATHER_NO_STATUS
EXCL_ITEM_EFFECTS_WEATHER_NO_STATUS:
.byte 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x00
.global ov29_023535C8
ov29_023535C8:
.word ov29_023527E0
.word ov29_023527E8
.word ov29_023527E4
.global ov29_023535D4
ov29_023535D4:
.byte 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_023535DC
ov29_023535DC:
.byte 0x0C, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00
.word ov29_0230D738
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x0D, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00
.word ov29_0230D738
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00
.word ov29_0230D738
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x0F, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00
.word ov29_0230D738
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x12, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00
.word ov29_0230D76C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x11, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x15, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x16, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x17, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x18, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00
.word ov29_0230D70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.word ov29_0230D704
.byte 0x00, 0x00, 0x00, 0x00
.global AI_THROWN_ITEM_ACTION_CHOICE_COUNT
AI_THROWN_ITEM_ACTION_CHOICE_COUNT:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353700
ov29_02353700:
.byte 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00
.global ov29_0235370C
ov29_0235370C:
.byte 0x00, 0x00, 0x00, 0x00
.global EXCL_ITEM_EFFECTS_EVASION_BOOST
EXCL_ITEM_EFFECTS_EVASION_BOOST:
.byte 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x00
.global ov29_02353718
ov29_02353718:
.byte 0x00, 0x00, 0x00, 0x00
#if defined(EUROPE)
.byte 0xEF, 0x03, 0xF0, 0x03
.byte 0xF1, 0x03, 0xF2, 0x03
.byte 0xF3, 0x03
.global ov29_02353720
ov29_02353720:
.byte 0xF5, 0x03
.byte 0xF7, 0x03, 0xF9, 0x03
.byte 0xFB, 0x03, 0xFD, 0x03
.global ov29_0235371C
ov29_0235371C:
.byte 0xF4, 0x03, 0xF6, 0x03
.byte 0xF8, 0x03, 0xFA, 0x03
.byte 0xFC, 0x03, 0x00, 0x00
#elif !defined(JAPAN)
.global ov29_0235371C
ov29_0235371C:
.byte 0xF4, 0x03, 0xF4, 0x03
.global ov29_02353720
ov29_02353720:
.byte 0xF5, 0x03, 0xF5, 0x03
#endif
.global DEFAULT_TILE
DEFAULT_TILE:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_0235372C
ov29_0235372C:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353730
ov29_02353730:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_0235376C
ov29_0235376C:
.byte 0x00, 0x00, 0x64, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_0235377C
ov29_0235377C:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_02353784
ov29_02353784:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global HIDDEN_STAIRS_SPAWN_BLOCKED
HIDDEN_STAIRS_SPAWN_BLOCKED:
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global FIXED_ROOM_DATA_PTR
FIXED_ROOM_DATA_PTR:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353798
ov29_02353798:
.byte 0x00, 0x00, 0x00, 0x00
.word ov29_02353188
.word ov29_02353170
.word ov29_02353128
.word ov29_02353158
.word ov29_02353140
.global ov29_023537B0
ov29_023537B0:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_023537B4
ov29_023537B4:
.byte 0x15, 0x00, 0x16, 0x00, 0x15, 0x00, 0x16, 0x00
.global ov29_023537BC
ov29_023537BC:
.byte 0x02, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02
.global ov29_023537C4
ov29_023537C4:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_023537C8
ov29_023537C8:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_023537CC
ov29_023537CC:
.byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global ov29_023537D8
ov29_023537D8:
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global DUNGEON_FADES_PTR
DUNGEON_FADES_PTR:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_023537E4
ov29_023537E4:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_023537E8
ov29_023537E8:
.byte 0xFA, 0x00, 0xB8, 0x04
.byte 0xD9, 0x00, 0xB5, 0x04, 0xDB, 0x00, 0xB6, 0x04, 0xDC, 0x00, 0xB4, 0x04, 0xDD, 0x00, 0xB7, 0x04
.byte 0xDE, 0x00, 0xBE, 0x04, 0xDF, 0x00, 0xC0, 0x04, 0xE0, 0x00, 0xC1, 0x04, 0xE1, 0x00, 0xD2, 0x04
.byte 0xE2, 0x00, 0xBD, 0x04, 0xEC, 0x00, 0xBF, 0x04, 0xEE, 0x00, 0xC5, 0x04, 0xEF, 0x00, 0xC2, 0x04
.byte 0xF0, 0x00, 0xC3, 0x04, 0xE3, 0x00, 0xC4, 0x04, 0xF1, 0x00, 0x00, 0x00, 0xF2, 0x00, 0x00, 0x00
.byte 0xF3, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00
.global ov29_02353834
ov29_02353834:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_02353838
ov29_02353838:
.byte 0x00, 0x00, 0x00, 0x00
.global ov29_0235383C
ov29_0235383C:
.byte 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00
.global ov29_02353848
ov29_02353848:
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.bss
#ifndef EUROPE
.global ov29_02353860
ov29_02353860:
.space 0x20
#endif
.global ov29_02353880
ov29_02353880:
.space 0x34
.global ov29_023538B4
ov29_023538B4:
.space 0x1963C
.global ov29_0236CEF0
ov29_0236CEF0:
.space 0x6FC
.global ov29_0236D5EC
ov29_0236D5EC:
.space 0x6000
.global ov29_023735EC
ov29_023735EC:
.space 0x4
.global ov29_023735F0
ov29_023735F0:
.space 0x4
.global ov29_023735F4
ov29_023735F4:
.space 0x4
.global ov29_023735F8
ov29_023735F8:
.space 0x4
.global ov29_023735FC
ov29_023735FC:
.space 0x10
.global ov29_0237360C
ov29_0237360C:
.space 0x80
.global ov29_0237368C
ov29_0237368C:
.space 0x4
.global ov29_02373690
ov29_02373690:
.space 0x9000
.global ov29_0237C690
ov29_0237C690:
.space 0x4
.global ov29_0237C694
ov29_0237C694:
.space 0x2
.global ov29_0237C696
ov29_0237C696:
.space 0x2
.global ov29_0237C698
ov29_0237C698:
.space 0xC
.global ov29_0237C6A4
ov29_0237C6A4:
.space 0x14
.global ov29_0237C6B8
ov29_0237C6B8:
.space 0x1C
.global ov29_0237C6D4
ov29_0237C6D4:
.space 0x40
.global ov29_0237C714
ov29_0237C714:
.space 0x40
.global ov29_0237C754
ov29_0237C754:
.space 0x48
.global ov29_0237C79C
ov29_0237C79C:
.space 0xB0
.global ov29_0237C84C
ov29_0237C84C:
.space 0x4
.global ov29_0237C850
ov29_0237C850:
.space 0x14
.global ov29_0237C864
ov29_0237C864:
.space 0x24
.global ov29_0237C888
ov29_0237C888:
.space 0x2
.global ov29_0237C88A
ov29_0237C88A:
.space 0x4
.global ov29_0237C88E
ov29_0237C88E:
.space 0x2
.global ov29_0237C890
ov29_0237C890:
.space 0x2
.global ov29_0237C892
ov29_0237C892:
.space 0x86
.global ov29_0237C918
ov29_0237C918:
.space 0x4
.global ov29_0237C91C
ov29_0237C91C:
.space 0x2
.global ov29_0237C91E
ov29_0237C91E:
.space 0x2
.global ov29_0237C920
ov29_0237C920:
.space 0x2
.global ov29_0237C922
ov29_0237C922:
.space 0x4A
.global ov29_0237C96C
ov29_0237C96C:
.space 0x8
.global ov29_0237C974
ov29_0237C974:
.space 0x28
.global ov29_0237C99C
ov29_0237C99C:
.space 0x4
.global ov29_0237C9A0
ov29_0237C9A0:
.space 0x4
.global ov29_0237C9A4
ov29_0237C9A4:
.space 0x8
.global ov29_0237C9AC
ov29_0237C9AC:
.space 0x4
.global ov29_0237C9B0
ov29_0237C9B0:
.space 0x8
.global ov29_0237C9B8
ov29_0237C9B8:
.space 0x8
.global ov29_0237C9C0
ov29_0237C9C0:
.space 0x1
.global ov29_0237C9C1
ov29_0237C9C1:
.space 0x3
.global ov29_0237C9C4
ov29_0237C9C4:
.space 0x1
.global ov29_0237C9C5
ov29_0237C9C5:
.space 0x3
.global ov29_0237C9C8
ov29_0237C9C8:
.space 0x1
.global ov29_0237C9C9
ov29_0237C9C9:
.space 0x3
.global ov29_0237C9CC
ov29_0237C9CC:
.space 0x4
.global ov29_0237C9D0
ov29_0237C9D0:
.space 0x8
.global ov29_0237C9D8
ov29_0237C9D8:
.space 0x20
.global ov29_0237C9F8
ov29_0237C9F8:
.space 0x20
.global ov29_0237CA18
ov29_0237CA18:
.space 0x8
.global ov29_0237CA20
ov29_0237CA20:
.space 0x8
.global ov29_0237CA28
ov29_0237CA28:
.space 0x20
.global ov29_0237CA48
ov29_0237CA48:
.space 0x20
.global ov29_0237CA68
ov29_0237CA68:
.space 0x1
.global ov29_0237CA69
ov29_0237CA69:
.space 0x1
.global ov29_0237CA6A
ov29_0237CA6A:
.space 0x1
.global ov29_0237CA6B
ov29_0237CA6B:
.space 0x1
.global ov29_0237CA6C
ov29_0237CA6C:
.space 0x1
.global ov29_0237CA6D
ov29_0237CA6D:
.space 0x3
.global ov29_0237CA70
ov29_0237CA70:
.space 0x4
.global ov29_0237CA74
ov29_0237CA74:
.space 0x4
.global ov29_0237CA78
ov29_0237CA78:
.space 0x4
.global ov29_0237CA7C
ov29_0237CA7C:
.space 0x4
.global ov29_0237CA80
ov29_0237CA80:
.space 0x4
.global ov29_0237CA84
ov29_0237CA84:
.space 0x4
.global ov29_0237CA88
ov29_0237CA88:
.space 0x4
.global ov29_0237CA8C
ov29_0237CA8C:
.space 0x4
.global ov29_0237CA90
ov29_0237CA90:
.space 0x6
.global ov29_0237CA96
ov29_0237CA96:
.space 0xA
.global ov29_0237CAA0
ov29_0237CAA0:
.space 0xC
.global ov29_0237CAAC
ov29_0237CAAC:
.space 0xC
.global ov29_0237CAB8
ov29_0237CAB8:
.space 0x14
.global ov29_0237CACC
ov29_0237CACC:
.space 0x274
.global ov29_0237CD40
ov29_0237CD40:
.space 0x278
.global ov29_0237CFB8
ov29_0237CFB8:
.space 0x3
.global ov29_0237CFBB
ov29_0237CFBB:
.space 0x1
.global ov29_0237CFBC
ov29_0237CFBC:
.space 0x4
.global ov29_0237CFC0
ov29_0237CFC0:
.space 0x3C
.global ov29_0237CFFC
ov29_0237CFFC:
.space 0x4
.global ov29_0237D000
ov29_0237D000:
.space 0x5800
.global ov29_02382800
ov29_02382800:
.space 0x4
.global ov29_02382804
ov29_02382804:
.space 0x8
.global ov29_0238280C
ov29_0238280C:
.space 0x14

View File

@ -1,16 +1,18 @@
#ifndef PMDSKY_DG_RANDOM_H
#define PMDSKY_DG_RANDOM_H
#include "util.h"
s32 DungeonRandInt(s32 end);
s32 DungeonRandRange(s32 from, s32 to);
// Returns the result of a possibly biased coin flip (a Bernoulli random variable) with some success probability p, using the dungeon PRNG.
// percentChance: success percentage (100*p)
// return: true with probability p, false with probability (1-p)
u8 DungeonRandOutcome__022EAB20(s32 percentChance);
bool8 DungeonRandOutcome__022EAB20(s32 percentChance);
// Returns the result of a possibly biased coin flip (a Bernoulli random variable) with some success probability p, using the dungeon PRNG.
// percentChance: success percentage (100*p)
// return: true with probability p, false with probability (1-p)
u8 DungeonRandOutcome__022EAB50(s32 percentChance);
bool8 DungeonRandOutcome__022EAB50(s32 percentChance);
#endif //PMDSKY_DG_RANDOM_H

21
include/direction.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef PMDSKY_DIRECTION_H
#define PMDSKY_DIRECTION_H
// Direction on the dungeon grid
enum direction_id {
DIR_NONE = -1,
DIR_DOWN = 0,
DIR_DOWN_RIGHT = 1,
DIR_RIGHT = 2,
DIR_UP_RIGHT = 3,
DIR_UP = 4,
DIR_UP_LEFT = 5,
DIR_LEFT = 6,
DIR_DOWN_LEFT = 7,
DIR_CURRENT = 8, // Current direction of an entity. Used as a special value in some functions
};
#define DIRECTION_MASK 7
#define NUM_DIRECTIONS 8
#endif //PMDSKY_DIRECTION_H

View File

@ -1,8 +1,9 @@
#ifndef HEADERS_TYPES_DUNGEON_MODE_DUNGEON_H_
#define HEADERS_TYPES_DUNGEON_MODE_DUNGEON_H_
#include "enums.h"
#include "dungeon_mode.h"
#include "enums.h"
#include "item.h"
#define MAX_TEAM_MEMBERS 4
#define DUNGEON_MAX_POKEMON 20

View File

@ -0,0 +1,11 @@
#ifndef PMDSKY_DUNGEON_AI_ITEMS_H
#define PMDSKY_DUNGEON_AI_ITEMS_H
#include "dungeon_mode.h"
// Checks if an entity pointer points to a valid entity (not entity type 0, which represents no entity).
bool8 EntityIsValid__0230E8F0(struct entity *entity);
// Decides whether or not an AI should use its held item and updates its action_data fields accordingly.
void AiDecideUseItem(struct entity *pokemon);
#endif //PMDSKY_DUNGEON_AI_ITEMS_H

View File

@ -1,10 +1,12 @@
#ifndef PMDSKY_DUNGEON_MODE_H
#define PMDSKY_DUNGEON_MODE_H
#include "util.h"
#include "enums.h"
#include "graphics.h"
#include "direction.h"
#include "dungeon_mode_common.h"
#include "enums.h"
#include "item.h"
#include "graphics.h"
#include "util.h"
// Used in various contexts, like with entity positions in the dungeon
struct position {
@ -19,31 +21,6 @@ struct pixel_position {
u32 y;
};
// Item info
struct item {
// 0x0: flags: 1-byte bitfield
//u8 flags;
bool8 f_exists : 1; // Validity flag
bool8 f_in_shop : 1; // In a Kecleon Shop
bool8 f_unpaid : 1; // Picked up from a Kecleon Shop but not paid for yet
bool8 f_sticky : 1; // Sticky
bool8 f_set : 1; // Usable by L+R
bool8 flag_unk5 : 1;
// For stolen items to recover from outlaws (has red X)? Could be for other items for other
// types of missions? (Uncertain)
bool8 f_unk_mission_item1 : 1;
// For stolen items to recover from outlaws (has red X)? Could be for other items for other
// types of missions? (Uncertain) Definitely used temporarily when sorting the items in
// storage.
bool8 f_unk_mission_item2 : 1;
// 0x1: For bag items. 0 for none, 1 if held by the leader, 2 for the second party member, etc.
u8 held_by;
// 0x2: Only for stackable items. Will be 0 if unapplicable. For Poké, this is an "amount code"
// rather than the literal amount (see MONEY_QUANTITY_TABLE)
u16 quantity;
enum item_id id; // 0x4
};
// Monster stat modifier info
struct monster_stat_modifiers {
// Stages go from 0-20 inclusive, with normal being 10
@ -125,8 +102,8 @@ struct action_data {
enum direction_id direction; // 0x2: Direction in which the action will be performed
u8 field_0x3;
struct action_parameter action_parameters[2]; // 0x4: Parameters for the action
s16 field_0x10;
s16 field_0x12;
// 0x10: Position of the target that the Pokémon wants throw an item at.
struct position item_target_position;
};
struct sleep_class_status {

View File

@ -5,31 +5,31 @@
// Monster move info
struct move {
// 0x0: flags0: 1-byte bitfield
u8 flags0;
/* bool8 f_exists : 1; // This move will show up in the move list */
/* bool8 f_subsequent_in_link_chain : 1; // This move is in a link chain, but not the first move */
/* bool8 f_enabled_for_ai : 1; // AI can use this move */
/* bool8 f_set : 1; // Usable by L+A */
/* bool8 f_last_used : 1; // This move was the last one used (for things like Torment?) */
/* bool8 f_disabled : 1; // For Torment (and maybe others) */
/* u8 flags0_unk6 : 2; */
// 0x0: flags: 1-byte bitfield
u8 flags;
// bool8 f_exists : 1; // This move will show up in the move list
// bool8 f_subsequent_in_link_chain : 1; // This move is in a link chain, but not the first move
// bool8 f_enabled_for_ai : 1; // AI can use this move
// bool8 f_set : 1; // Usable by L+A
// bool8 f_last_used : 1; // This move was the last one used (for things like Torment?)
// bool8 f_disabled : 1; // For Torment (and maybe others)
// u8 flags_unk6 : 2;
u8 field_0x1;
// 0x2: flags2: 2-byte bitfield
u16 flags2;
/* bool8 f_sealed : 1; // Sealed by a Seal Trap. Also prevents AI from using this move */
/* u16 flags2_unk1 : 2; */
/* bool8 f_consume_pp : 1; // This move will consume PP this turn */
/* bool8 f_consume_2_pp : 1; // Consume 2 PP this turn. No effect unless f_consume_pp is set */
/* u16 flags2_unk5 : 1; */
/* // Consume 4 PP this turn. No effect unless f_consume_pp is set, overrides f_consume_2_pp */
/* bool8 f_consume_4_pp : 1; */
/* u16 flags2_unk7 : 1; */
/* u16 flags2_unk8 : 1; */
/* bool8 f_exclusive_item_pp_boost : 1; // A PP-boosting exclusive item is in effect */
/* u16 flags3_unk10 : 6; */
// bool8 f_sealed : 1; // Sealed by a Seal Trap. Also prevents AI from using this move
// u16 flags2_unk1 : 2;
// bool8 f_consume_pp : 1; // This move will consume PP this turn
// bool8 f_consume_2_pp : 1; // Consume 2 PP this turn. No effect unless f_consume_pp is set
// u16 flags2_unk5 : 1;
// // Consume 4 PP this turn. No effect unless f_consume_pp is set, overrides f_consume_2_pp
// bool8 f_consume_4_pp : 1;
// u16 flags2_unk7 : 1;
// u16 flags2_unk8 : 1;
// bool8 f_exclusive_item_pp_boost : 1; // A PP-boosting exclusive item is in effect
// u16 flags3_unk10 : 6;
enum move_id id : 16; // 0x4
u8 pp; // 0x6: Current PP

View File

@ -1,11 +1,8 @@
#ifndef PMDSKY_DUNGEON_UTIL_H
#define PMDSKY_DUNGEON_UTIL_H
#include "dungeon.h"
#include "dungeon_mode.h"
static inline struct monster *GetEntInfo(struct entity *ent)
{
return ent->info;
}
bool8 ShouldRunMonsterAi(struct entity *pokemon);
#endif // PMDSKY_DUNGEON_UTIL_H
#endif //PMDSKY_DUNGEON_UTIL_H

View File

@ -1,8 +0,0 @@
#ifndef PMDSKY_DUNGEON_UTIL_1_H
#define PMDSKY_DUNGEON_UTIL_1_H
#include "dungeon_mode.h"
bool8 ShouldRunMonsterAi(struct entity *pokemon);
#endif //PMDSKY_DUNGEON_UTIL_1_H

View File

@ -0,0 +1,22 @@
#ifndef PMDSKY_DUNGEON_UTIL_STATIC_H
#define PMDSKY_DUNGEON_UTIL_STATIC_H
#include "dungeon.h"
static inline struct monster *GetEntInfo(struct entity *ent)
{
return ent->info;
}
static inline bool8 ItemSticky(u8 flags)
{
// Double bang is needed to match for some reason.
return !!(flags & ITEM_FLAG_STICKY);
}
static inline bool8 ItemExists(u8 flags)
{
return !!(flags & ITEM_FLAG_EXISTS);
}
#endif // PMDSKY_DUNGEON_UTIL_STATIC_H

File diff suppressed because it is too large Load Diff

1486
include/item.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +0,0 @@
#ifndef PMDSKY_OVERLAY_29_0230E8F0_H
#define PMDSKY_OVERLAY_29_0230E8F0_H
#include "dungeon_mode.h"
// Checks if an entity pointer points to a valid entity (not entity type 0, which represents no entity).
bool8 EntityIsValid__0230E8F0(struct entity *entity);
#endif //PMDSKY_OVERLAY_29_0230E8F0_H

View File

@ -3,6 +3,7 @@
#include "dungeon_mode.h"
#include "dungeon_mode_common.h"
#include "item.h"
// Checks if an entity pointer points to a valid entity (not entity type 0, which represents no entity).
bool8 EntityIsValidMoveEffects__0232E250(struct entity *entity);

View File

@ -1,5 +1,5 @@
#ifndef PMDSKY_OVERLAY_3102382820_H
#define PMDSKY_OVERLAY_3102382820_H
#ifndef PMDSKY_OVERLAY_31_02382820_H
#define PMDSKY_OVERLAY_31_02382820_H
#include "main_020348E4.h"
#include "util.h"
@ -94,4 +94,4 @@ void StairsSubheadingCallback(struct Window* window);
#endif //PMDSKY_OVERLAY_3102382820_H
#endif //PMDSKY_OVERLAY_31_02382820_H

View File

@ -220,6 +220,9 @@ Overlay OVY_28
Overlay OVY_29
{
After OVY_10
Object asm/overlay_29_rodata_0234FD04.o
Object asm/overlay_29_data_023534E0.o
Object asm/overlay_29_bss_02353860.o
Object src/poly_text.o
Object asm/overlay_29_022DC314.o
Object src/overlay_29_022DEAB0.o
@ -246,7 +249,7 @@ Overlay OVY_29
Object asm/overlay_29_022EE36C.o
Object src/overlay_29_022EF7A0.o
Object asm/overlay_29_022EF7C4.o
Object src/dungeon_util_1.o
Object src/dungeon_util.o
Object asm/overlay_29_022EFA6C.o
Object src/overlay_29_022F0590.o
Object asm/overlay_29_022F05B4.o
@ -300,8 +303,10 @@ Overlay OVY_29
Object asm/overlay_29_02308FE0.o
Object src/overlay_29_0230A994.o
Object asm/overlay_29_0230A9B8.o
Object src/overlay_29_0230E8F0.o
Object asm/overlay_29_0230E914.o
Object src/dungeon_ai_items.o
Object asm/overlay_29_data_02353700.o
Object asm/overlay_29_bss_0237CA18.o
Object asm/overlay_29_0230EDB0.o
Object src/overlay_29_0230F008.o
Object asm/overlay_29_0230F02C.o
Object src/overlay_29_0230F980.o
@ -344,8 +349,8 @@ Overlay OVY_29
Object asm/overlay_29_0232145C.o
Object src/overlay_29_02322DB8.o
Object asm/overlay_29_02322DDC.o
Object asm/overlay_29_02352A54.o
Object src/dungeon_move.o
Object asm/overlay_29_rodata_02352A6C.o
Object asm/overlay_29_02324698.o
Object src/overlay_29_02325620.o
Object asm/overlay_29_02325644.o
@ -385,7 +390,6 @@ Overlay OVY_29
Object asm/overlay_29_0234DDF4.o
Object src/overlay_29_0234EC14.o
Object asm/overlay_29_0234EC38.o
Object asm/overlay_29_0238280C.o
}
Overlay OVY_30
{

View File

@ -26,7 +26,7 @@ s32 DungeonRandRange(s32 from, s32 to)
}
}
u8 DungeonRandOutcome__022EAB20(s32 percentChance)
bool8 DungeonRandOutcome__022EAB20(s32 percentChance)
{
if ((((DungeonRand16Bit() & 0xFFFF) * 100) >> 16) < percentChance)
{
@ -35,7 +35,7 @@ u8 DungeonRandOutcome__022EAB20(s32 percentChance)
return FALSE;
}
u8 DungeonRandOutcome__022EAB50(s32 percentChance)
bool8 DungeonRandOutcome__022EAB50(s32 percentChance)
{
if ((((DungeonRand16Bit() & 0xFFFF) * 100) >> 16) < percentChance)
{

View File

@ -1,8 +1,9 @@
#include "dungeon_ai.h"
#include "dg_random.h"
#include "direction.h"
#include "dungeon_capabilities_1.h"
#include "dungeon_util_static.h"
#include "dungeon_util.h"
#include "dungeon_util_1.h"
#ifdef JAPAN
#define CANNOT_USE_ITEM_MESSAGE 0xB2D

213
src/dungeon_ai_items.c Normal file
View File

@ -0,0 +1,213 @@
#include "dungeon_ai_items.h"
#include "dg_random.h"
#include "direction.h"
#include "dungeon_capabilities_1.h"
#include "dungeon_util_static.h"
#include "item.h"
#define NUM_POTENTIAL_ROCK_TARGETS 20
u32 AI_THROWN_ITEM_PROBABILITIES[NUM_DIRECTIONS] = {0};
u32 AI_THROWN_ITEM_DIRECTIONS[NUM_DIRECTIONS] = {0};
extern volatile s32 AI_THROWN_ITEM_ACTION_CHOICE_COUNT;
extern struct bag_items *BAG_ITEMS_PTR_MIRROR;
extern void GetPossibleAiThrownItemDirections(struct entity *pokemon, s32 thrown_ai_flag, struct item *item, bool8 ignore_roll_chance);
extern void SetMonsterActionFields(struct action_data *action_pointer, u16 action);
extern bool8 IqSkillIsEnabled(struct entity *pokemon, u8 iq_skill);
extern const struct tile *GetTile(s32 x, s32 y);
extern bool8 TestItemAiFlag(s16 id, s32 aiFlag);
extern enum item_category GetItemCategoryVeneer(s16 index);
extern void GetPossibleAiArcItemTargets(struct entity *pokemon, struct item *item, struct position potential_targets[], bool8 ignore_roll_chance);
extern s32 GetDirectionTowardsPosition(struct position *origin_pos, struct position *target_pos);
extern struct item *GetItemInfo(struct entity *entity);
extern u32 GetAiUseItemProbability(struct entity *target_pokemon, struct item *item, u32 item_target_flags);
extern bool8 MonsterCanThrowItems(struct monster *pokemon);
bool8 EntityIsValid__0230E8F0(struct entity *entity)
{
if (entity == NULL)
{
return FALSE;
}
return entity->type != ENTITY_NOTHING;
}
void AiDecideUseItem(struct entity *pokemon)
{
struct monster *pokemon_info = GetEntInfo(pokemon);
struct item *item;
struct position potential_target_positions[NUM_POTENTIAL_ROCK_TARGETS];
s32 i;
u32 chosen_target_index;
if (CheckVariousConditions(pokemon))
{
pokemon_info->use_held_item = FALSE;
return;
}
if (pokemon_info->use_held_item)
{
u8 selected_toolbox_index;
item = &pokemon_info->held_item;
if (!ItemExists(item->flags))
return;
selected_toolbox_index = HELD_ITEM_TOOLBOX_INDEX;
enum item_category item_type = GetItemCategoryVeneer(item->id);
if (item_type == CATEGORY_THROWN_LINE)
{
GetPossibleAiThrownItemDirections(pokemon, ITEM_AI_FLAG_TARGET_ENEMY, item, TRUE);
for (i = 0; i < AI_THROWN_ITEM_ACTION_CHOICE_COUNT; i++)
{
if (DungeonRandOutcome__022EAB20(AI_THROWN_ITEM_PROBABILITIES[i]))
{
SetMonsterActionFields(&pokemon_info->action, ACTION_THROW_ITEM_AI);
pokemon_info->action.action_parameters[0].action_use_idx = selected_toolbox_index;
pokemon_info->action.action_parameters[0].item_pos.x = pokemon->pos.x;
pokemon_info->action.action_parameters[0].item_pos.y = pokemon->pos.y;
pokemon_info->action.direction = (enum direction_id) (AI_THROWN_ITEM_DIRECTIONS[i] & DIRECTION_MASK);
break;
}
}
if (i == AI_THROWN_ITEM_ACTION_CHOICE_COUNT)
{
SetMonsterActionFields(&pokemon_info->action, ACTION_SECOND_THOUGHTS);
}
}
else if (item_type == CATEGORY_THROWN_ARC)
{
GetPossibleAiArcItemTargets(pokemon, item, potential_target_positions, TRUE);
if (AI_THROWN_ITEM_ACTION_CHOICE_COUNT != 0)
{
chosen_target_index = DungeonRandInt(AI_THROWN_ITEM_ACTION_CHOICE_COUNT);
SetMonsterActionFields(&pokemon_info->action, ACTION_THROW_ITEM_AI);
pokemon_info->action.action_parameters[0].action_use_idx = selected_toolbox_index;
pokemon_info->action.action_parameters[0].item_pos.x = pokemon->pos.x;
pokemon_info->action.action_parameters[0].item_pos.y = pokemon->pos.y;
pokemon_info->action.direction = (enum direction_id) (GetDirectionTowardsPosition(&pokemon->pos, &potential_target_positions[chosen_target_index]) & DIRECTION_MASK);
pokemon_info->action.item_target_position = potential_target_positions[chosen_target_index];
}
else
{
SetMonsterActionFields(&pokemon_info->action, ACTION_SECOND_THOUGHTS);
}
}
else if (item_type == CATEGORY_BERRIES_SEEDS_VITAMINS || item_type == CATEGORY_FOOD_GUMMIES)
{
SetMonsterActionFields(&pokemon_info->action, ACTION_EAT_AI);
pokemon_info->action.action_parameters[0].action_use_idx = selected_toolbox_index;
pokemon_info->action.action_parameters[0].item_pos.x = pokemon->pos.x;
pokemon_info->action.action_parameters[0].item_pos.y = pokemon->pos.y;
}
else
{
SetMonsterActionFields(&pokemon_info->action, ACTION_SECOND_THOUGHTS);
}
}
else if (IqSkillIsEnabled(pokemon, IQ_ITEM_MASTER))
{
s32 thrown_ai_flag;
for (s32 toolbox_index = 1; toolbox_index < INVENTORY_SIZE; toolbox_index++)
{
u8 selected_toolbox_index;
if (toolbox_index == 1)
{
item = &pokemon_info->held_item;
selected_toolbox_index = HELD_ITEM_TOOLBOX_INDEX;
}
else if (toolbox_index == 0)
{
// This seems unused. toolbox_index can never be 0.
const struct tile *map_tile = GetTile(pokemon->pos.x, pokemon->pos.y);
if (map_tile->object != NULL && map_tile->object->type == ENTITY_ITEM)
{
item = GetItemInfo(map_tile->object);
selected_toolbox_index = GROUND_ITEM_TOOLBOX_INDEX;
}
else
{
continue;
}
}
else if (pokemon_info->is_team_leader)
{
item = &BAG_ITEMS_PTR_MIRROR->bag_items->bag_items[toolbox_index - 2];
selected_toolbox_index = toolbox_index - 1;
}
else
{
return;
}
u8 item_flags = item->flags;
if (!ItemExists(item_flags) || item->flags & ITEM_FLAG_IN_SHOP)
continue;
if (ItemSticky(item_flags))
continue;
if (TestItemAiFlag(item->id, ITEM_AI_FLAG_TARGET_SELF))
{
u32 item_weight = GetAiUseItemProbability(pokemon, item, ITEM_TARGET_ALLY);
if (item_weight != 0)
{
enum item_category item_type = GetItemCategoryVeneer(item->id);
if (!(item_type == CATEGORY_ORBS && !pokemon_info->is_not_team_member) && DungeonRandOutcome__022EAB20(item_weight))
{
if (item_type == CATEGORY_ORBS)
SetMonsterActionFields(&pokemon_info->action, ACTION_USE_ORB);
else
SetMonsterActionFields(&pokemon_info->action, ACTION_EAT_AI);
pokemon_info->action.action_parameters[0].action_use_idx = selected_toolbox_index;
pokemon_info->action.action_parameters[0].item_pos.x = pokemon->pos.x;
pokemon_info->action.action_parameters[0].item_pos.y = pokemon->pos.y;
return;
}
}
}
if (MonsterCanThrowItems(pokemon_info))
{
for (thrown_ai_flag = ITEM_AI_FLAG_TARGET_ALLY; thrown_ai_flag < NUM_ITEM_AI_FLAGS; thrown_ai_flag++)
{
if (TestItemAiFlag(item->id, thrown_ai_flag))
{
if (GetItemCategoryVeneer(item->id) == CATEGORY_THROWN_ARC)
{
GetPossibleAiArcItemTargets(pokemon, item, potential_target_positions, FALSE);
if (AI_THROWN_ITEM_ACTION_CHOICE_COUNT != 0)
{
chosen_target_index = DungeonRandInt(AI_THROWN_ITEM_ACTION_CHOICE_COUNT);
SetMonsterActionFields(&pokemon_info->action, ACTION_THROW_ITEM_AI);
pokemon_info->action.action_parameters[0].action_use_idx = selected_toolbox_index;
pokemon_info->action.action_parameters[0].item_pos.x = pokemon->pos.x;
pokemon_info->action.action_parameters[0].item_pos.y = pokemon->pos.y;
pokemon_info->action.direction = (enum direction_id) (GetDirectionTowardsPosition(&pokemon->pos, &potential_target_positions[chosen_target_index]) & DIRECTION_MASK);
pokemon_info->action.item_target_position = potential_target_positions[chosen_target_index];
return;
}
}
else
{
GetPossibleAiThrownItemDirections(pokemon, thrown_ai_flag, item, FALSE);
for (i = 0; i < AI_THROWN_ITEM_ACTION_CHOICE_COUNT; i++)
{
if (DungeonRandOutcome__022EAB20(AI_THROWN_ITEM_PROBABILITIES[i]))
{
SetMonsterActionFields(&pokemon_info->action, ACTION_THROW_ITEM_AI);
pokemon_info->action.action_parameters[0].action_use_idx = selected_toolbox_index;
pokemon_info->action.action_parameters[0].item_pos.x = pokemon->pos.x;
pokemon_info->action.action_parameters[0].item_pos.y = pokemon->pos.y;
pokemon_info->action.direction = (enum direction_id) (AI_THROWN_ITEM_DIRECTIONS[i] & DIRECTION_MASK);
return;
}
}
}
}
}
}
}
}
}

View File

@ -1,7 +1,7 @@
#include "dungeon_ai_targeting.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_pokemon_attributes_1.h"
#include "dungeon_util.h"
#include "dungeon_util_static.h"
#include "overlay_29_023000E4.h"
bool8 ShouldMonsterRunAway(struct entity *pokemon)

View File

@ -1,6 +1,6 @@
#include "dungeon_capabilities.h"
#include "dungeon_statuses.h"
#include "dungeon_util.h"
#include "dungeon_util_static.h"
extern bool8 CheckVariousStatuses(struct entity *entity);

View File

@ -3,7 +3,7 @@
#include "dungeon_capabilities.h"
#include "dungeon_capabilities_2.h"
#include "dungeon_move.h"
#include "dungeon_util.h"
#include "dungeon_util_static.h"
#include "joined_at_checks.h"
bool8 CheckVariousConditions(struct entity *pokemon)

View File

@ -1,5 +1,5 @@
#include "dungeon_capabilities_2.h"
#include "dungeon_util.h"
#include "dungeon_util_static.h"
bool8 CheckVariousStatuses(struct entity *pokemon)
{

View File

@ -1,5 +1,5 @@
#include "dungeon_move.h"
#include "dungeon_util.h"
#include "dungeon_util_static.h"
#include "overlay_29_02321438.h"
const enum status_two_turn_id TWO_TURN_STATUSES[11] =

View File

@ -1,5 +1,5 @@
#include "dungeon_pokemon_attributes.h"
#include "dungeon_util.h"
#include "dungeon_util_static.h"
#include "overlay_29_02301A60.h"
bool8 NoGastroAcidStatus(struct entity *entity, enum ability_id ability)

View File

@ -1,5 +1,5 @@
#include "dungeon_pokemon_attributes_1.h"
#include "dungeon_util.h"
#include "dungeon_util_static.h"
bool8 IsTacticSet(struct entity *pokemon, enum tactic_id tactic_id)
{

View File

@ -1,5 +1,6 @@
#include "dungeon_statuses.h"
#include "dungeon_util.h"
#include "dungeon_util_static.h"
#include "item.h"
#include "overlay_29_02315118.h"
extern bool8 ItemIsActive__0231513C(struct entity *entity, enum item_id item_id);

View File

@ -1,5 +1,5 @@
#include "dungeon_util_1.h"
#include "dungeon_util.h"
#include "dungeon_util_static.h"
bool8 ShouldRunMonsterAi(struct entity *pokemon)
{

View File

@ -1,10 +0,0 @@
#include "overlay_29_0230E8F0.h"
bool8 EntityIsValid__0230E8F0(struct entity *entity)
{
if (entity == NULL)
{
return FALSE;
}
return entity->type != ENTITY_NOTHING;
}

View File

@ -30,12 +30,16 @@ SYMBOL_START = '\t.global '
symbol_line = None
new_symbol_address = None
hex_regex = re.compile('_[0-9A-F]{8}$')
data_type = None
for i, line in enumerate(original_lines):
if line.startswith(f'{SYMBOL_START}{symbol_name}'):
symbol_line = i
elif line.startswith('\t.data') or line.startswith('\t.rodata') or line.startswith('\t.bss'):
data_type = line[line.index('.') + 1:].rstrip()
if symbol_line is not None and line.startswith(SYMBOL_START) and hex_regex.search(line) is not None:
new_symbol_address = line[-9:-1]
break
if symbol_line is None:
print(f'Failed to find symbol {symbol_name}.')
@ -55,9 +59,7 @@ LSF_FILE_PATH = 'main.lsf'
with open(LSF_FILE_PATH, 'r') as lsf_file:
lsf_lines = lsf_file.readlines()
extract_file_name = f'{file_prefix}{new_symbol_address}'
new_asm_base_name = f"{file_prefix}{new_symbol_address}"
new_asm_base_name = f"{file_prefix}{data_type}_{new_symbol_address}"
# If needed, add the extracted function's new .o file to main.lsf.
merge_prev_file = None
@ -82,7 +84,7 @@ new_asm_name = f'{new_asm_base_name}.s'
new_asm_header = f"""\t.include "asm/macros.inc"
\t.include "{new_inc_file_name}"
\t.rodata
\t.{data_type}
"""
new_asm_file_path = os.path.join(ASM_FOLDER, new_asm_name)
print('Creating', new_asm_file_path)