Decompile 26 more callees; clear three asm files entirely

Closes the three near-match groups left from the previous batch. All of

  asm/overlay_29_02337EC0.s    6 functions
  asm/overlay_29_022E335C.s   10 functions
  asm/overlay_29_0230F02C.s   10 functions

now match, so the three objects leave main.lsf and the .s/.inc files go.

struct dungeon gains struct unk_02337EE8, grouping the ten members from
0x286B0 through spawn_table_entries_chosen into one sub-object at unchanged
offsets. ov29_02337EE8 and GetRandomSpawnMonsterID reach spawn_entries_master
through a local pointer to that member, which is what makes mwcc form the
member base and the inner offset as two additions the way the target does;
the sub-object alone, or the local alone, still scores 225. The spelling is
already in the tree at src/overlay_29_022FBBEC.c:72 for the other grouped
member. Eighteen expressions in seven files gain field_0x286b0; four of them are in
upstream's src/overlay_30_init.c, which reaches highest_enemy_level and
spawn_table_entries_chosen directly.

Two width corrections, each replacing adjacent u8 members with one wider
member at the same offset, so no following offset or alignment moves:
dungeon::number_completed_floors u8 -> s16, absorbing speed_boost_counter at
0x1F (read ldrsh in three places, written strh in a fourth); and
monster::field_0x188, four u8 -> one s32 (read ldr twice here, written str in
overlay_29_022E0378).

src/dg_camera.c declares DUNGEON_PTR as struct dungeon *[2] rather than the
incomplete *[]. A complete type is what makes mwcc reload the pointer across
an intervening store, which ov29_022E34C8 needs; [] and [2] are compatible
types, so no use site changes. src/dungeon_map_access_1.c takes the scalar
form for the same reason.

Sixteen call-site-derived declarations in twelve files are replaced by an
include of the owning header. Eight of them declared PlayEffectAnimationEntity
with the wrong tail types -- s32, s32, s32 where its prologue reads u8, s16
and a pointer. Every affected call site passes literals, so the correction is
byte-neutral, which the build confirms.

Authored by Claude (Opus 5) under human direction. Confirmed by matching
builds in all three regions: build/pmdsky.us/pmdsky.us.nds: OK,
build/pmdsky.eu/pmdsky.eu.nds: OK, build/pmdsky.jp/pmdsky.jp.nds: OK.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
cecilarmitais
2026-09-14 01:37:20 -07:00
parent 967fe53b74
commit 0f3cbcbcd2
35 changed files with 762 additions and 1410 deletions

View File

@@ -1,23 +0,0 @@
#pragma once
.public AdvanceFrame
.public AnimationDelayOrSomething
.public AnimationHasMoreFrames
.public DisplayUi
.public DUNGEON_PTR
.public EntityIsValid__022E37B8
.public GetEffectAnimationWanOffset
.public GetPixelOffsetFromSprite
.public GetTileSafe
.public InitOamAdjustmentInfo
.public LogMessageByIdWithPopupCheckUser
.public ov10_022BF274
.public ov10_022BF2B4
.public ov10_022BFD20
.public ov29_022E2C6C
.public ov29_0235110C
.public ov29_0235354C
.public ScreenEffectActive
.public ShouldDisplayEntityAdvanced
.public UpdateCamera
.public UpdateMinimap
.public UpdateTrapsVisibility

View File

@@ -1,39 +0,0 @@
#pragma once
.public AbilityIsActiveVeneer
.public abs
.public AddMoneyCarried
.public AI_THROWN_ITEM_ACTION_CHOICE_COUNT
.public BAG_ITEMS_PTR_MIRROR
.public CanSeeTarget
.public DUNGEON_PTR
.public DungeonRandOutcome__022EAB20
.public EntityIsValid__0230F008
.public GetAiUseItemProbability
.public GetCurrentBagCapacity
.public GetExclusiveItemForMonsterFromBag
.public GetItemCategoryVeneer
.public GetItemInfo
.public GetMoneyQuantity
.public GetTileAtEntity
.public GetTreatmentBetweenMonsters
.public HasHeldItem
.public IqSkillIsEnabled
.public IsAuraBow
.public IsExperienceLocked
.public IsFloorOver
.public IsItemUnkMissionItem2
.public ItemIsActive__0230F810
.public LogMessageByIdWithPopup
.public ov29_022F9EA0
.public ov29_02345004
.public ov29_02347040
.public ov29_02348D3C
.public ov29_02348DD8
.public ov29_02348ECC
.public PlaySeByIdIfNotSilence
.public PrepareItemForPrinting__02345728
.public RemoveGroundItem
.public ShouldMonsterRunAwayAndShowEffect
.public SubstitutePlaceholderStringTags
.public UseSingleUseItemSelf
.public UseThrowableItem

View File

@@ -1,13 +0,0 @@
#pragma once
.public DIRECTIONS_XY
.public DUNGEON_PTR
.public DungeonRandInt
.public DungeonRandRange
.public GetMonsterIdFromSpawnEntry
.public GetTile
.public GetTileSafe
.public IqSkillIsEnabled
.public MemAlloc
.public MemFree
.public RandInt
.public ShouldTreatMonsterAsAlly

View File

@@ -1,386 +0,0 @@
.include "asm/macros.inc"
.include "overlay_29_022E335C.inc"
.text
arm_func_start ov29_022E335C
ov29_022E335C: ; 0x022E335C
#ifdef JAPAN
#define OV29_022E335C_OFFSET -0xA4
#else
#define OV29_022E335C_OFFSET 0
#endif
stmdb sp!, {r3, r4, r5, lr}
ldr r0, _022E3428 ; =DUNGEON_PTR
mov r5, #0
ldr r0, [r0]
add r0, r0, #0x1a000
ldrb r1, [r0, #0x24d + OV29_022E335C_OFFSET]
ldr r4, [r0, #0x22c + OV29_022E335C_OFFSET]
cmp r1, #0
bne _022E33A0
bl ov10_022BFD20
cmp r0, #0
bne _022E33A0
cmp r4, #0
beq _022E33A0
ldr r0, [r4]
cmp r0, #1
moveq r5, #1
_022E33A0:
cmp r5, #0
bne _022E33B0
bl ov29_022E2C6C
ldmia sp!, {r3, r4, r5, pc}
_022E33B0:
ldr r0, _022E3428 ; =DUNGEON_PTR
ldr r0, [r0]
add r0, r0, #0x21c + OV29_022E335C_OFFSET
add r4, r0, #0x1a000
ldr r0, [r4, #0x10]
ldr r5, [r0, #0xb4]
bl DisplayUi
ldr r1, _022E3428 ; =DUNGEON_PTR
ldr r0, _022E342C ; =0x000003E7
ldr r1, [r1]
ldrb r2, [r1, #0x749]
ldrsh r1, [r1, #0x1e]
add r1, r2, r1
strh r1, [r4, #0x3c]
ldrsh r2, [r5, #0x12]
ldrsh r1, [r5, #0x16]
add r1, r2, r1
cmp r1, r0
movgt r1, r0
strh r1, [r4, #0x42]
ldrsh r0, [r5, #0x10]
strh r0, [r4, #0x40]
ldrb r0, [r5, #0xa]
strh r0, [r4, #0x3e]
ldrsh r1, [r4, #0x42]
mov r0, r1, asr #2
add r0, r1, r0, lsr #29
mov r0, r0, asr #3
strh r0, [r4, #0x44]
ldmia sp!, {r3, r4, r5, pc}
.align 2, 0
_022E3428: .word DUNGEON_PTR
_022E342C: .word 0x000003E7
arm_func_end ov29_022E335C
arm_func_start RevealWholeFloor
RevealWholeFloor: ; 0x022E3430
stmdb sp!, {r3, r4, r5, r6, r7, lr}
ldr r1, _022E34A8 ; =DUNGEON_PTR
mov r7, #0
ldr r1, [r1]
mov r4, r0
mov r2, #1
add r0, r1, #0x1a000
#ifdef JAPAN
strb r2, [r0, #0x19b]
#else
strb r2, [r0, #0x23f]
#endif
mov r5, r7
_022E3454:
mov r6, r5
_022E3458:
mov r0, r6
mov r1, r7
bl GetTileSafe
ldrh r1, [r0, #2]
add r6, r6, #1
cmp r6, #0x38
orr r1, r1, #1
strh r1, [r0, #2]
blt _022E3458
add r7, r7, #1
cmp r7, #0x20
blt _022E3454
mov r0, #0
bl UpdateCamera
bl UpdateTrapsVisibility
bl UpdateMinimap
ldr r1, _022E34AC ; =0x00000B77
mov r0, r4
bl LogMessageByIdWithPopupCheckUser
ldmia sp!, {r3, r4, r5, r6, r7, pc}
.align 2, 0
_022E34A8: .word DUNGEON_PTR
#ifdef JAPAN
_022E34AC: .word 0x00000888
#else
_022E34AC: .word 0x00000B77
#endif
arm_func_end RevealWholeFloor
arm_func_start ov29_022E34B0
ov29_022E34B0: ; 0x022E34B0
ldr r1, _022E34C4 ; =DUNGEON_PTR
ldr r1, [r1]
add r1, r1, #0x1a000
#ifdef JAPAN
strb r0, [r1, #0x1a8]
#else
strb r0, [r1, #0x24c]
#endif
bx lr
.align 2, 0
_022E34C4: .word DUNGEON_PTR
arm_func_end ov29_022E34B0
arm_func_start ov29_022E34C8
ov29_022E34C8: ; 0x022E34C8
#ifdef JAPAN
#define OV29_022E34C8_OFFSET -0xA4
#else
#define OV29_022E34C8_OFFSET 0
#endif
ldr r0, _022E352C ; =DUNGEON_PTR
ldr r3, [r0]
add r0, r3, #0x1a000
ldr r2, [r0, #0x234 + OV29_022E34C8_OFFSET]
cmp r2, #0
bxeq lr
ldr r1, _022E3530 ; =ov29_0235110C
cmp r2, #0x1f
movge r2, #0x1f
ldr r2, [r1, r2, lsl #2]
add r0, r3, #0x1a000
ldr r1, _022E352C ; =DUNGEON_PTR
str r2, [r0, #0x230 + OV29_022E34C8_OFFSET]
ldr r0, [r1]
add r0, r0, #0x1a000
ldr r2, [r0, #0x234 + OV29_022E34C8_OFFSET]
sub r2, r2, #1
str r2, [r0, #0x234 + OV29_022E34C8_OFFSET]
ldr r0, [r1]
add r0, r0, #0x1a000
ldr r1, [r0, #0x234 + OV29_022E34C8_OFFSET]
cmp r1, #0
ldreq r1, [r0, #0x238 + OV29_022E34C8_OFFSET]
streq r1, [r0, #0x234 + OV29_022E34C8_OFFSET]
bx lr
.align 2, 0
_022E352C: .word DUNGEON_PTR
_022E3530: .word ov29_0235110C
arm_func_end ov29_022E34C8
arm_func_start ov29_022E3534
ov29_022E3534: ; 0x022E3534
ldrb r1, [r0, #0x34]
cmp r1, #0
bne _022E3558
ldrb r1, [r0, #0x23]
cmp r1, #0
ldreqb r0, [r0, #0x24]
cmpeq r0, #0
movne r0, #1
bxne lr
_022E3558:
mov r0, #0
bx lr
arm_func_end ov29_022E3534
arm_func_start ov29_022E3560
ov29_022E3560: ; 0x022E3560
ldr r1, _022E356C ; =ov29_0235354C
strb r0, [r1]
bx lr
.align 2, 0
_022E356C: .word ov29_0235354C
arm_func_end ov29_022E3560
arm_func_start ov29_022E3570
ov29_022E3570: ; 0x022E3570
ldr r0, _022E357C ; =ov29_0235354C
ldrb r0, [r0]
bx lr
.align 2, 0
_022E357C: .word ov29_0235354C
arm_func_end ov29_022E3570
arm_func_start DungeonScreenEffectActive
DungeonScreenEffectActive: ; 0x022E3580
ldr ip, _022E358C ; =ScreenEffectActive
mov r0, #0
bx ip
.align 2, 0
_022E358C: .word ScreenEffectActive
arm_func_end DungeonScreenEffectActive
arm_func_start ov29_022E3590
ov29_022E3590: ; 0x022E3590
stmdb sp!, {r4, r5, r6, lr}
sub sp, sp, #0x10
mov r5, r1
mov r6, r0
mov r0, r5
mov r4, r2
bl GetEffectAnimationWanOffset
mov r3, r0
mov r0, #2
mov ip, #0
stmia sp, {r0, ip}
sub r0, ip, #1
str r0, [sp, #8]
mov r0, r6
mov r1, r5
mov r2, r4
and r3, r3, #0xff
str ip, [sp, #0xc]
bl PlayEffectAnimationEntity
add sp, sp, #0x10
ldmia sp!, {r4, r5, r6, pc}
arm_func_end ov29_022E3590
arm_func_start PlayEffectAnimationEntity
PlayEffectAnimationEntity: ; 0x022E35E4
stmdb sp!, {r4, r5, r6, r7, r8, lr}
sub sp, sp, #0x30
mov r8, r0
mov r5, r1
mov r4, r2
mov r7, r3
bl EntityIsValid__022E37B8
cmp r0, #0
mvneq r0, #0
beq _022E37A8
mov r0, r8
ldr r6, [r8, #0xb4]
bl ShouldDisplayEntityAdvanced
cmp r0, #0
mvneq r0, #0
beq _022E37A8
ldrb r0, [sp, #0x4c]
cmp r0, #0
#ifdef JAPAN
ldreqb r0, [r6, #0x10a]
#else
ldreqb r0, [r6, #0x10b]
#endif
cmpeq r0, #2
mvneq r0, #0
beq _022E37A8
ldr r0, [sp, #0x48]
cmp r0, #0
beq _022E365C
cmp r0, #2
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bl AnimationDelayOrSomething
_022E365C:
add r0, sp, #0
mov r2, r7
add r1, r8, #0x2c
bl GetPixelOffsetFromSprite
ldrsh r7, [sp]
cmp r7, #0x63
ldrnesh r2, [sp, #2]
cmpne r2, #0x63
ldreq r1, [r8, #0x10]
#ifdef JAPAN
ldreq r0, [r6, #0x184]
#else
ldreq r0, [r6, #0x188]
#endif
ldreq r7, [r8, #0xc]
subeq r8, r1, r0
beq _022E36A8
ldr r1, [r8, #0x10]
ldr r3, [r8, #0xc]
#ifdef JAPAN
ldr r0, [r6, #0x184]
#else
ldr r0, [r6, #0x188]
#endif
add r2, r1, r2, lsl #8
add r7, r3, r7, lsl #8
sub r8, r2, r0
_022E36A8:
ldr r0, _022E37B0 ; =DUNGEON_PTR
ldr r2, _022E37B4 ; =0x0001A226
ldr r3, [r0]
add r0, sp, #4
ldrsh r2, [r3, r2]
rsb r6, r2, r1, asr #8
bl ov10_022BF274
ldrsh r0, [sp, #0x50]
mov r1, #0
str r5, [sp, #4]
str r1, [sp, #8]
cmp r0, #0
blt _022E36E4
cmp r0, #8
ble _022E36F0
_022E36E4:
mvn r0, #0
str r0, [sp, #0xc]
b _022E36F4
_022E36F0:
str r0, [sp, #0xc]
_022E36F4:
add r0, r6, r6, lsr #31
mov r0, r0, asr #1
mov r1, #0
ldr r3, [sp, #0x54]
mov r6, r7, asr #8
mov r5, r8, asr #8
add r0, r0, #1
mvn r2, #0
strh r6, [sp, #0x10]
strh r5, [sp, #0x12]
strb r2, [sp, #0x18]
strh r1, [sp, #0x14]
strh r1, [sp, #0x16]
str r0, [sp, #0x1c]
cmp r3, #0
bne _022E3740
add r0, sp, #0x20
bl InitOamAdjustmentInfo
b _022E3758
_022E3740:
add r2, sp, #0x20
mov r1, #6
_022E3748:
ldrh r0, [r3], #2
subs r1, r1, #1
strh r0, [r2], #2
bne _022E3748
_022E3758:
add r0, sp, #4
mov r1, #0
bl ov10_022BF2B4
cmp r4, #0
beq _022E37A8
mov r0, r0, lsl #0x10
mov r6, #0
mov r5, r0, asr #0x10
mov r4, #0x42
b _022E379C
_022E3780:
mov r0, r5
bl AnimationHasMoreFrames
cmp r0, #0
beq _022E37A4
mov r0, r4
bl AdvanceFrame
add r6, r6, #1
_022E379C:
cmp r6, #0x64
blt _022E3780
_022E37A4:
mvn r0, #0
_022E37A8:
add sp, sp, #0x30
ldmia sp!, {r4, r5, r6, r7, r8, pc}
.align 2, 0
_022E37B0: .word DUNGEON_PTR
#ifdef JAPAN
_022E37B4: .word 0x0001A182
#else
_022E37B4: .word 0x0001A226
#endif
arm_func_end PlayEffectAnimationEntity

View File

@@ -1,561 +0,0 @@
.include "asm/macros.inc"
.include "overlay_29_0230F02C.inc"
.text
arm_func_start ov29_0230F140
ov29_0230F140: ; 0x0230F140
ldr ip, _0230F148 ; =UseSingleUseItemSelf
bx ip
.align 2, 0
_0230F148: .word UseSingleUseItemSelf
arm_func_end ov29_0230F140
arm_func_start ov29_0230F14C
ov29_0230F14C: ; 0x0230F14C
ldr ip, _0230F154 ; =UseThrowableItem
bx ip
.align 2, 0
_0230F154: .word UseThrowableItem
arm_func_end ov29_0230F14C
arm_func_start ov29_0230F158
ov29_0230F158: ; 0x0230F158
ldr ip, _0230F160 ; =TryNonLeaderItemPickUp
bx ip
.align 2, 0
_0230F160: .word TryNonLeaderItemPickUp
arm_func_end ov29_0230F158
arm_func_start TryNonLeaderItemPickUp
TryNonLeaderItemPickUp: ; 0x0230F164
stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr}
sub sp, sp, #0x198
mov r8, r0
ldr r6, [r8, #0xb4]
bl GetTileAtEntity
mov r5, r0
ldr r4, [r5, #0x10]
cmp r4, #0
beq _0230F624
bl IsFloorOver
cmp r0, #0
bne _0230F624
mov r0, #0
mov r1, r8
mov r2, r0
bl SubstitutePlaceholderStringTags
ldrb r0, [r6, #7]
cmp r0, #0
bne _0230F624
ldrb r0, [r6, #9]
cmp r0, #1
beq _0230F624
mov r0, r6
bl IsExperienceLocked
cmp r0, #0
bne _0230F624
ldrb r0, [r6, #0xbc]
cmp r0, #7
beq _0230F624
ldr r6, [r8, #0xb4]
mov r0, r4
mov r7, #1
bl GetItemInfo
ldrb r1, [r6, #6]
mov r4, r0
cmp r1, #0
beq _0230F204
bl IsItemUnkMissionItem2
cmp r0, #0
bne _0230F624
_0230F204:
ldrb r0, [r4]
tst r0, #2
bne _0230F228
ldrb r0, [r6, #6]
cmp r0, #0
bne _0230F22C
ldrh r0, [r5]
tst r0, #0x20
beq _0230F22C
_0230F228:
mov r7, #0
_0230F22C:
cmp r7, #0
beq _0230F624
mov r0, r8
mov r1, #1
bl ShouldMonsterRunAwayAndShowEffect
cmp r0, #0
beq _0230F274
mov r1, r4
mov r0, #0
bl PrepareItemForPrinting__02345728
mov r0, #0
mov r1, r8
mov r2, r0
bl SubstitutePlaceholderStringTags
ldr r1, _0230F62C ; =0x00000C5E
mov r0, r8
bl LogMessageByIdWithPopup
b _0230F624
_0230F274:
ldrb r0, [r6, #6]
cmp r0, #0
bne _0230F300
ldrsh r0, [r4, #4]
bl GetItemCategoryVeneer
cmp r0, #6
bne _0230F300
ldrb r0, [r6, #6]
cmp r0, #0
beq _0230F2A8
ldr r0, _0230F630 ; =0x00001305
bl PlaySeByIdIfNotSilence
b _0230F2B0
_0230F2A8:
ldr r0, _0230F634 ; =0x00001308
bl PlaySeByIdIfNotSilence
_0230F2B0:
mov r0, r8
mov r1, #0x1b
bl IqSkillIsEnabled
cmp r0, #0
ldrneb r0, [r4]
orrne r0, r0, #0x20
strneb r0, [r4]
mov r0, r4
bl GetMoneyQuantity
bl AddMoneyCarried
mov r1, r4
mov r0, #0
bl PrepareItemForPrinting__02345728
add r0, r8, #4
mov r1, #1
bl RemoveGroundItem
ldr r1, _0230F638 ; =0x00000C5F
mov r0, r8
bl LogMessageByIdWithPopup
b _0230F624
_0230F300:
ldr r0, _0230F63C ; =DUNGEON_PTR
ldr r0, [r0]
ldrb sb, [r0, #0x75b]
cmp sb, #0
beq _0230F36C
ldrb r0, [r6, #6]
cmp r0, #0
bne _0230F36C
ldr r0, _0230F640 ; =BAG_ITEMS_PTR_MIRROR
mov r5, #0
ldr r0, [r0]
add r2, sp, #0
ldr r7, [r0, #0x384]
add r1, sp, #0xcc
mov r0, #6
_0230F33C:
mla r3, r5, r0, r7
str r3, [r2, r5, lsl #2]
str r5, [r1, r5, lsl #2]
add r5, r5, #1
cmp r5, #0x32
blt _0230F33C
add r1, r6, #0x62
mvn r0, #0
str r1, [sp, #0xc8]
str r0, [sp, #0x194]
mov r5, #0x33
b _0230F380
_0230F36C:
add r1, r6, #0x62
mvn r0, #0
str r1, [sp]
str r0, [sp, #0xcc]
mov r5, #1
_0230F380:
ldrsh lr, [r4, #4]
cmp lr, #0xb
bge _0230F4B0
ldrb r0, [r4]
tst r0, #2
bne _0230F4B0
mvn r7, #0
mov ip, r7
mov sl, #0
and r0, r0, #8
add fp, sp, #0
b _0230F408
_0230F3B0:
ldr r1, [fp, sl, lsl #2]
ldrb r1, [r1]
tst r1, #1
movne r1, #1
moveq r1, #0
tst r1, #0xff
beq _0230F404
ldr r3, [fp, sl, lsl #2]
ldrb r2, [r3]
tst r2, #2
ldreqsh r1, [r3, #4]
cmpeq lr, r1
andeq r1, r2, #8
cmpeq r0, r1
bne _0230F404
ldrh r1, [r3, #2]
cmp r1, #0x63
beq _0230F404
cmp ip, r1
movlt ip, r1
movlt r7, sl
_0230F404:
add sl, sl, #1
_0230F408:
cmp sl, r5
blt _0230F3B0
mvn r0, #0
cmp r7, r0
beq _0230F4B0
add r1, sp, #0
ldr r2, [r1, r7, lsl #2]
ldrh r0, [r4, #2]
ldrh r1, [r2, #2]
add r0, r1, r0
cmp r0, #0x63
movge r0, #0x63
strh r0, [r2, #2]
ldrb r0, [r4]
tst r0, #8
movne r0, #1
moveq r0, #0
tst r0, #0xff
ldrneb r0, [r2]
orrne r0, r0, #8
strneb r0, [r2]
bl ov29_02347040
mov r1, r4
mov r0, #0
bl PrepareItemForPrinting__02345728
add r0, r8, #4
mov r1, #1
bl RemoveGroundItem
ldr r0, _0230F644 ; =0x00001304
bl PlaySeByIdIfNotSilence
add r0, sp, #0xcc
ldr r0, [r0, r7, lsl #2]
cmp r0, #0
bge _0230F4A0
#ifdef JAPAN
ldr r1, _02310B84 ; =0x0000099F
mov r0, r8
#else
mov r0, r8
mov r1, #0xc60
#endif
bl LogMessageByIdWithPopup
b _0230F624
_0230F4A0:
#ifdef JAPAN
mov r0, r8
mov r1, #0x9a0
#else
ldr r1, _0230F648 ; =0x00000C61
mov r0, r8
#endif
bl LogMessageByIdWithPopup
b _0230F624
_0230F4B0:
cmp sb, #0
beq _0230F4CC
ldrb r0, [r6, #6]
cmp r0, #0
bne _0230F4CC
bl GetCurrentBagCapacity
mov r5, r0
_0230F4CC:
mov r7, #0
add r3, sp, #0
mov r0, r7
mov r1, #1
b _0230F500
_0230F4E0:
ldr r2, [r3, r7, lsl #2]
ldrb r2, [r2]
tst r2, #1
movne r2, r1
moveq r2, r0
tst r2, #0xff
beq _0230F508
add r7, r7, #1
_0230F500:
cmp r7, r5
blt _0230F4E0
_0230F508:
mov r0, r8
mov r1, r4
mov r2, #1
bl ov29_02348DD8
cmp r0, #0
bne _0230F624
cmp r7, r5
bne _0230F544
mov r1, r4
mov r0, #0
bl PrepareItemForPrinting__02345728
ldr r1, _0230F64C ; =0x00000C62
mov r0, r8
bl LogMessageByIdWithPopup
b _0230F624
_0230F544:
ldrb r0, [r6, #6]
cmp r0, #0
beq _0230F55C
ldr r0, _0230F630 ; =0x00001305
bl PlaySeByIdIfNotSilence
b _0230F564
_0230F55C:
ldr r0, _0230F644 ; =0x00001304
bl PlaySeByIdIfNotSilence
_0230F564:
add r0, sp, #0xcc
ldr r0, [r0, r7, lsl #2]
cmp r0, #0
bge _0230F5BC
ldrh r1, [r4]
mov r0, r8
strh r1, [r6, #0x62]
ldrh r1, [r4, #2]
strh r1, [r6, #0x64]
ldrh r1, [r4, #4]
strh r1, [r6, #0x66]
bl ov29_022F9EA0
mov r1, r4
mov r0, #0
bl PrepareItemForPrinting__02345728
add r0, r8, #4
mov r1, #1
bl RemoveGroundItem
#ifdef JAPAN
ldr r1, _02310B84 ; =0x0000099F
mov r0, r8
#else
mov r0, r8
mov r1, #0xc60
#endif
bl LogMessageByIdWithPopup
b _0230F624
_0230F5BC:
mov r0, r4
bl ov29_02348D3C
mov r5, r0
mov r0, r4
bl ov29_02345004
cmp r0, #0
mov r0, #0
beq _0230F5F8
mov r1, r8
mov r2, r0
bl SubstitutePlaceholderStringTags
ldr r1, _0230F650 ; =0x00000C63
mov r0, r8
bl LogMessageByIdWithPopup
b _0230F624
_0230F5F8:
mov r1, r4
bl PrepareItemForPrinting__02345728
add r0, r8, #4
mov r1, #1
bl RemoveGroundItem
#ifdef JAPAN
mov r0, r8
mov r1, #0x9a0
#else
ldr r1, _0230F648 ; =0x00000C61
mov r0, r8
#endif
bl LogMessageByIdWithPopup
mov r0, r4
mov r1, r5
bl ov29_02348ECC
_0230F624:
add sp, sp, #0x198
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
.align 2, 0
#ifdef JAPAN
#define TRY_NON_LEADER_ITEM_PICK_UP_OFFSET -0x2C1
#else
#define TRY_NON_LEADER_ITEM_PICK_UP_OFFSET 0
#endif
_0230F62C: .word 0x00000C5E + TRY_NON_LEADER_ITEM_PICK_UP_OFFSET
_0230F630: .word 0x00001305
_0230F634: .word 0x00001308
_0230F638: .word 0x00000C5F + TRY_NON_LEADER_ITEM_PICK_UP_OFFSET
_0230F63C: .word DUNGEON_PTR
_0230F640: .word BAG_ITEMS_PTR_MIRROR
_0230F644: .word 0x00001304
#ifdef JAPAN
_02310B84: .word 0x0000099F
#else
_0230F648: .word 0x00000C61
#endif
_0230F64C: .word 0x00000C62 + TRY_NON_LEADER_ITEM_PICK_UP_OFFSET
_0230F650: .word 0x00000C63 + TRY_NON_LEADER_ITEM_PICK_UP_OFFSET
arm_func_end TryNonLeaderItemPickUp
arm_func_start GetExclusiveItemWithEffectFromBag
GetExclusiveItemWithEffectFromBag: ; 0x0230F654
stmdb sp!, {r3, r4, r5, r6, lr}
sub sp, sp, #0xc
mov r6, r0
mov r5, r1
mov r4, r2
bl EntityIsValid__0230F008
cmp r0, #0
moveq r0, #0
beq _0230F6C0
ldr r3, [r6, #0xb4]
add r0, sp, #4
ldrb r2, [r3, #0x5f]
mov r1, r5
str r2, [sp]
ldrsh r2, [r3, #4]
ldrb r3, [r3, #0x5e]
bl GetExclusiveItemForMonsterFromBag
cmp r0, #0
moveq r0, #0
beq _0230F6C0
ldrh r1, [sp, #4]
mov r0, #1
strh r1, [r4]
ldrh r1, [sp, #6]
strh r1, [r4, #2]
ldrh r1, [sp, #8]
strh r1, [r4, #4]
_0230F6C0:
add sp, sp, #0xc
ldmia sp!, {r3, r4, r5, r6, pc}
arm_func_end GetExclusiveItemWithEffectFromBag
arm_func_start AuraBowIsActive
AuraBowIsActive: ; 0x0230F6C8
stmdb sp!, {r3, r4, r5, lr}
mov r5, r0
ldr r4, [r5, #0xb4]
mov r1, #0x6f
bl AbilityIsActiveVeneer
cmp r0, #0
movne r0, #0
ldmneia sp!, {r3, r4, r5, pc}
ldrb r0, [r4, #0x62]
tst r0, #1
movne r0, #1
moveq r0, #0
tst r0, #0xff
beq _0230F710
ldrsh r0, [r4, #0x66]
bl IsAuraBow
cmp r0, #0
bne _0230F718
_0230F710:
mov r0, #0
ldmia sp!, {r3, r4, r5, pc}
_0230F718:
ldrsh r1, [r4, #0x66]
mov r0, r5
bl HasHeldItem
ldmia sp!, {r3, r4, r5, pc}
arm_func_end AuraBowIsActive
arm_func_start ov29_0230F728
ov29_0230F728: ; 0x0230F728
#ifdef JAPAN
#define OV29_0230F728_OFFSET -4
#else
#define OV29_0230F728_OFFSET 0
#endif
stmdb sp!, {r4, r5, lr}
sub sp, sp, #0xc
ldr ip, [r1, #0xb4]
ldr r4, [r0, #0xb4]
ldrb r0, [ip, #0x5f]
mov r5, r3
mov r1, r2
str r0, [sp]
ldrsh r2, [ip, #4]
ldrb r3, [ip, #0x5e]
add r0, sp, #4
bl GetExclusiveItemForMonsterFromBag
ldr r1, [r4, #0x18c + OV29_0230F728_OFFSET]
add r0, r4, #0x100
orr r1, r1, r5
str r1, [r4, #0x18c + OV29_0230F728_OFFSET]
ldrsh r1, [sp, #8]
strh r1, [r0, #0x90 + OV29_0230F728_OFFSET]
add sp, sp, #0xc
ldmia sp!, {r4, r5, pc}
arm_func_end ov29_0230F728
arm_func_start ExclusiveItemOffenseBoost
ExclusiveItemOffenseBoost: ; 0x0230F778
ldr r0, [r0, #0xb4]
add r0, r0, r1
#ifdef JAPAN
ldrb r0, [r0, #0x220]
#else
ldrb r0, [r0, #0x224]
#endif
bx lr
arm_func_end ExclusiveItemOffenseBoost
arm_func_start ExclusiveItemDefenseBoost
ExclusiveItemDefenseBoost: ; 0x0230F788
ldr r0, [r0, #0xb4]
add r0, r0, r1
#ifdef JAPAN
ldrb r0, [r0, #0x222]
#else
ldrb r0, [r0, #0x226]
#endif
bx lr
arm_func_end ExclusiveItemDefenseBoost
arm_func_start TeamMemberHasItemActive
TeamMemberHasItemActive: ; 0x0230F798
stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr}
mov r6, #0
ldr r4, _0230F80C ; =DUNGEON_PTR
mov sb, r0
mov r8, r1
mov r5, r6
_0230F7B0:
ldr r0, [r4]
add r0, r0, r5, lsl #2
add r0, r0, #0x12000
#ifdef JAPAN
ldr r7, [r0, #0xa84]
#else
ldr r7, [r0, #0xb28]
#endif
mov r0, r7
bl EntityIsValid__0230F008
cmp r0, #0
beq _0230F7F0
mov r0, r7
mov r1, r8
bl ItemIsActive__0230F810
cmp r0, #0
addne r0, r6, #1
movne r0, r0, lsl #0x10
strne r7, [sb, r6, lsl #2]
movne r6, r0, asr #0x10
_0230F7F0:
add r0, r5, #1
mov r0, r0, lsl #0x10
mov r5, r0, asr #0x10
cmp r5, #4
blt _0230F7B0
mov r0, r6
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc}
.align 2, 0
_0230F80C: .word DUNGEON_PTR
arm_func_end TeamMemberHasItemActive

View File

@@ -1,303 +0,0 @@
.include "asm/macros.inc"
.include "overlay_29_02337EC0.inc"
.text
arm_func_start RemoveMonsterFromTile
RemoveMonsterFromTile: ; 0x02337EC0
stmdb sp!, {r4, lr}
mov r4, r0
mov r0, r1
mov r1, r2
bl GetTileSafe
ldr r1, [r0, #0xc]
cmp r1, r4
moveq r1, #0
streq r1, [r0, #0xc]
ldmia sp!, {r4, pc}
arm_func_end RemoveMonsterFromTile
arm_func_start ov29_02337EE8
ov29_02337EE8: ; 0x02337EE8
stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr}
sub sp, sp, #0x20
ldr r0, _02337F8C ; =DUNGEON_PTR
ldr r4, _02337F90 ; =0x0000022A
ldr r0, [r0]
ldr r6, _02337F94 ; =0x000003D7
#ifdef JAPAN
add r0, r0, #0x20c
add r0, r0, #0x28400
#else
add r0, r0, #0x6b0
add r0, r0, #0x28000
#endif
mov sl, #0
add r0, r0, #0x2b4
mov sb, sl
add r8, r0, #0x4000
sub r5, r4, #1
sub r7, r6, #0x258
add fp, sp, #0
b _02337F68
_02337F28:
add r0, r8, sb, lsl #3
bl GetMonsterIdFromSpawnEntry
cmp r0, #0
beq _02337F70
cmp r0, r7
cmpne r0, r6
cmpne r0, r5
cmpne r0, r4
movne r2, sl, lsl #1
addne r1, sl, #1
strneh r0, [fp, r2]
add r0, sb, #1
movne r1, r1, lsl #0x10
mov r0, r0, lsl #0x10
movne sl, r1, asr #0x10
mov sb, r0, asr #0x10
_02337F68:
cmp sb, #0x10
blt _02337F28
_02337F70:
mov r0, sl
bl RandInt
add r1, sp, #0
mov r0, r0, lsl #1
ldrsh r0, [r1, r0]
add sp, sp, #0x20
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
.align 2, 0
_02337F8C: .word DUNGEON_PTR
_02337F90: .word 0x0000022A
_02337F94: .word 0x000003D7
arm_func_end ov29_02337EE8
arm_func_start GetRandomSpawnMonsterID
GetRandomSpawnMonsterID: ; 0x02337F98
stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr}
sub sp, sp, #0x20
ldr r0, _02338040 ; =DUNGEON_PTR
ldr r4, _02338044 ; =0x0000022A
ldr r0, [r0]
ldr r6, _02338048 ; =0x000003D7
#ifdef JAPAN
add r0, r0, #0x20c
add r0, r0, #0x28400
#else
add r0, r0, #0x6b0
add r0, r0, #0x28000
#endif
mov sl, #0
add r0, r0, #0x2b4
mov sb, sl
add r8, r0, #0x4000
sub r5, r4, #1
sub r7, r6, #0x258
add fp, sp, #0
b _0233801C
_02337FD8:
add r0, r8, sb, lsl #3
bl GetMonsterIdFromSpawnEntry
cmp r0, #0
beq _02338024
cmp r0, r7
cmpne r0, r6
cmpne r0, r5
cmpne r0, r4
cmpne r0, #0x84
movne r2, sl, lsl #1
addne r1, sl, #1
strneh r0, [fp, r2]
add r0, sb, #1
movne r1, r1, lsl #0x10
mov r0, r0, lsl #0x10
movne sl, r1, asr #0x10
mov sb, r0, asr #0x10
_0233801C:
cmp sb, #0x10
blt _02337FD8
_02338024:
mov r0, sl
bl DungeonRandInt
add r1, sp, #0
mov r0, r0, lsl #1
ldrsh r0, [r1, r0]
add sp, sp, #0x20
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
.align 2, 0
_02338040: .word DUNGEON_PTR
_02338044: .word 0x0000022A
_02338048: .word 0x000003D7
arm_func_end GetRandomSpawnMonsterID
arm_func_start ov29_0233804C
ov29_0233804C: ; 0x0233804C
stmdb sp!, {r3, r4, r5, lr}
mov r0, #0x2d8
mov r1, #0x10
bl MemAlloc
mov r4, r0
mov r0, #1
mov r1, #0x16c
bl DungeonRandRange
mov r1, r0, lsl #0x10
mov r0, #0
mov r3, r1, asr #0x10
ldr r5, _023380F4 ; =DUNGEON_PTR
ldr lr, _023380F8 ; =0x000286F2
mov r2, r0
mov r1, r0
_02338088:
ldr ip, [r5]
cmp r3, #0x16c
movge r3, r1
add ip, ip, r3, lsl #1
ldrsh ip, [ip, lr]
add r2, r2, #1
mov r2, r2, lsl #0x10
cmp ip, #0
addne ip, r0, #1
movne r0, r0, lsl #1
strneh r3, [r4, r0]
add r3, r3, #1
movne ip, ip, lsl #0x10
mov r3, r3, lsl #0x10
mov r2, r2, asr #0x10
movne r0, ip, asr #0x10
cmp r2, #0x16c
mov r3, r3, asr #0x10
blt _02338088
bl DungeonRandInt
mov r0, r0, lsl #0x10
mov r1, r0, asr #0xf
mov r0, r4
ldrsh r4, [r4, r1]
bl MemFree
mov r0, r4
ldmia sp!, {r3, r4, r5, pc}
.align 2, 0
_023380F4: .word DUNGEON_PTR
#ifdef JAPAN
_023380F8: .word 0x0002864E
#else
_023380F8: .word 0x000286F2
#endif
arm_func_end ov29_0233804C
arm_func_start ov29_023380FC
ov29_023380FC: ; 0x023380FC
stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr}
mov sb, r0
ldr r0, [sb, #0xb4]
mov r6, #0
ldrb r0, [r0, #6]
ldr r4, _023381BC ; =DIRECTIONS_XY
mov r8, r1
mov r7, r6
cmp r0, #0
movne r6, #1
mov r5, #0
_02338128:
mov r1, r5, lsl #2
add r0, r4, r5, lsl #2
ldrsh ip, [sb, #4]
ldrsh r3, [r4, r1]
ldrsh r2, [sb, #6]
ldrsh r1, [r0, #2]
add r0, ip, r3
add r1, r2, r1
bl GetTile
ldr r0, [r0, #0xc]
cmp r0, #0
beq _023381A0
ldr r1, [r0]
cmp r1, #1
bne _023381A0
ldr r1, [r0, #0xb4]
cmp r6, #0
ldrb r1, [r1, #6]
beq _0233818C
cmp r1, #0
addeq r1, r7, #1
moveq r1, r1, lsl #0x10
streq r0, [r8, r7, lsl #2]
moveq r7, r1, asr #0x10
b _023381A0
_0233818C:
cmp r1, #0
addne r1, r7, #1
movne r1, r1, lsl #0x10
strne r0, [r8, r7, lsl #2]
movne r7, r1, asr #0x10
_023381A0:
add r0, r5, #1
mov r0, r0, lsl #0x10
mov r5, r0, asr #0x10
cmp r5, #8
blt _02338128
mov r0, r7
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc}
.align 2, 0
_023381BC: .word DIRECTIONS_XY
arm_func_end ov29_023380FC
arm_func_start ov29_023381C0
ov29_023381C0: ; 0x023381C0
stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, lr}
mov r8, r0
mov r7, r1
mov r6, r2
mov r5, #0
ldr r4, _02338284 ; =DIRECTIONS_XY
b _02338274
_023381DC:
mov r1, r5, lsl #2
add r0, r4, r5, lsl #2
ldrsh ip, [r8, #4]
ldrsh r3, [r4, r1]
ldrsh r2, [r8, #6]
ldrsh r1, [r0, #2]
add r0, ip, r3
add r1, r2, r1
bl GetTile
ldr sb, [r0, #0xc]
cmp sb, #0
beq _02338268
ldr r0, [sb]
cmp r0, #1
bne _02338268
mov r0, sb
mov r1, r7
bl IqSkillIsEnabled
cmp r0, #0
beq _02338268
cmp r6, #0
beq _02338250
mov r0, sb
mov r1, r8
bl ShouldTreatMonsterAsAlly
cmp r0, #0
beq _02338268
mov r0, sb
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc}
_02338250:
mov r0, r8
mov r1, sb
bl ShouldTreatMonsterAsAlly
cmp r0, #0
movne r0, sb
ldmneia sp!, {r3, r4, r5, r6, r7, r8, sb, pc}
_02338268:
add r0, r5, #1
mov r0, r0, lsl #0x10
mov r5, r0, asr #0x10
_02338274:
cmp r5, #8
blt _023381DC
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, pc}
.align 2, 0
_02338284: .word DIRECTIONS_XY
arm_func_end ov29_023381C0

View File

@@ -8,5 +8,14 @@ bool8 EntityIsValid__022E32E8(struct entity *entity);
// Checks if a monster is holding a certain item that isn't disabled by Klutz.
bool8 ItemIsActive__022E330C(struct entity *entity, enum item_id item_id);
s16 GetVisibilityRange();
void ov29_022E335C(void);
void RevealWholeFloor(struct entity *user, struct entity *target);
void ov29_022E34B0(u8 param_1);
void ov29_022E34C8(void);
bool8 ov29_022E3534(struct display_data *display);
void ov29_022E3560(u8 param_1);
u8 ov29_022E3570(void);
bool8 DungeonScreenEffectActive(void);
void ov29_022E3590(struct entity *entity, s32 id, s32 param_3);
#endif //PMDSKY_OVERLAY_29_022E32E8_H

View File

@@ -3,6 +3,30 @@
#include "dungeon_mode.h"
struct unk_0201C000 {
u16 field_0x0;
u16 field_0x2;
u16 field_0x4;
u16 field_0x6;
u16 field_0x8;
u16 field_0xa;
};
struct unk_022BF274 {
s32 field_0x0;
s32 field_0x4;
s32 field_0x8;
s16 field_0xc;
s16 field_0xe;
s16 field_0x10;
s16 field_0x12;
s8 field_0x14;
s32 field_0x18;
struct unk_0201C000 field_0x1c;
s32 field_0x28;
};
s32 PlayEffectAnimationEntity(struct entity *entity, s32 id, s32 param_3, u8 param_4, s32 param_5, u8 param_6, s16 param_7, struct unk_0201C000 *param_8);
// Checks if an entity pointer points to a valid entity (not entity type 0, which represents no entity).
bool8 EntityIsValid__022E37B8(struct entity *entity);

View File

@@ -120,6 +120,33 @@ struct unk_022FBD24 {
u32 unique_id_index;
};
struct unk_02337EE8 {
// 0x286B0: Initialized to 0xFF, then set to a copy of dungeon::group_id
enum dungeon_group_id group_id_copy;
// 0x286B1: Initialized to 0xFF, then set to a copy of dungeon::0x74B
u8 field_0x286b1;
struct floor_properties floor_properties; // 0x286B2: Properties about the current floor
// Spawn weights for items in different contexts.
// 0 = regular, 1 = Kecleon shop, 2 = monster house, 3 buried,
// 4 = bazaar, 5 = secret room
struct item_spawn_weights item_spawn_weights[6];
// 0x2C932: Spawn weights for traps.
u16 trap_weights[25];
// 0x2C964: List of spawn entries on this floor
// This is used during initialization, enemies are spawned using the copy at 0x3974
struct monster_spawn_entry spawn_entries_master[16];
// 0x2C9E4: The total number of spawn entries loaded or to be loaded?
u16 number_sprites_loaded;
// 0x2C9E6: Highest level among all the enemies that spawn on this floor
s16 highest_enemy_level;
// 0x2C9E8: ID of an item guaranteed to spawn on the floor, if applicable
// (e.g., certain mission types)
enum item_id guaranteed_item_id;
// 0x2C9EA: List of the indices in the complete monster spawn table for this floor that were
// chosen to spawn on it. It gets rerandomized at the start of each new floor.
u16 spawn_table_entries_chosen[16];
};
// Dungeon state
struct dungeon {
u8 field_0x0; // 0x0: Initialized to 0x0.
@@ -176,9 +203,7 @@ struct dungeon {
u8 field_0x1d;
// 0x1E: Number of floors completed? (Guess). Initialized to 0.
// If this is a floor tracker, odd it is not a u16 like the others.
u8 number_completed_floors;
// 0x1F: Turn counter, Speed Boost triggers every 250 turns, then the counter is reset.
u8 speed_boost_counter;
s16 number_completed_floors;
// 0x20: Total amount of floors summed by all the previous dungeons in its group
u16 number_preceding_floors;
// 0x22: Total amount of floors passed including those in its group? (Guess)
@@ -1498,30 +1523,7 @@ struct dungeon {
// 0x1A21C: Data about the map, the camera and the touchscreen numbers
struct display_data display_data;
struct minimap_display_data minimap_display_data; // 0x1A264: Data used to display the minimap
// 0x286B0: Initialized to 0xFF, then set to a copy of dungeon::group_id
enum dungeon_group_id group_id_copy;
// 0x286B1: Initialized to 0xFF, then set to a copy of dungeon::0x74B
u8 field_0x286b1;
struct floor_properties floor_properties; // 0x286B2: Properties about the current floor
// Spawn weights for items in different contexts.
// 0 = regular, 1 = Kecleon shop, 2 = monster house, 3 buried,
// 4 = bazaar, 5 = secret room
struct item_spawn_weights item_spawn_weights[6];
// 0x2C932: Spawn weights for traps.
u16 trap_weights[25];
// 0x2C964: List of spawn entries on this floor
// This is used during initialization, enemies are spawned using the copy at 0x3974
struct monster_spawn_entry spawn_entries_master[16];
// 0x2C9E4: The total number of spawn entries loaded or to be loaded?
u16 number_sprites_loaded;
// 0x2C9E6: Highest level among all the enemies that spawn on this floor
s16 highest_enemy_level;
// 0x2C9E8: ID of an item guaranteed to spawn on the floor, if applicable
// (e.g., certain mission types)
enum item_id guaranteed_item_id;
// 0x2C9EA: List of the indices in the complete monster spawn table for this floor that were
// chosen to spawn on it. It gets rerandomized at the start of each new floor.
u16 spawn_table_entries_chosen[16];
struct unk_02337EE8 field_0x286b0;
u8 field_0x2ca0a;
u8 field_0x2ca0b;
// 0x2CA0C: Holds the name for the entity that caused the faint. The exact size is a guess.

View File

@@ -8,5 +8,8 @@
bool8 IsTileGround(struct tile *tile);
// Returns flag tileset_property::is_water_tileset for the current tileset
bool8 IsWaterTileset();
void RemoveMonsterFromTile(struct entity *entity, s32 x, s32 y);
s16 ov29_02337EE8(void);
s16 GetRandomSpawnMonsterID(void);
#endif //PMDSKY_DUNGEON_MAP_ACCESS_1_H

View File

@@ -5,6 +5,16 @@
#include "dungeon_mode.h"
void ov29_0230F140(struct entity *entity);
void ov29_0230F14C(struct entity *entity);
void ov29_0230F158(struct entity *entity);
void TryNonLeaderItemPickUp(struct entity *entity);
bool8 GetExclusiveItemWithEffectFromBag(struct entity *entity, enum exclusive_item_effect_id effect_id, struct item *out);
bool8 AuraBowIsActive(struct entity *entity);
void ov29_0230F728(struct entity *attacker, struct entity *defender, enum exclusive_item_effect_id effect_id, s32 flags);
u8 ExclusiveItemOffenseBoost(struct entity *entity, s32 idx);
u8 ExclusiveItemDefenseBoost(struct entity *entity, s32 idx);
s32 TeamMemberHasItemActive(struct entity **buf, enum item_id item_id);
// Checks if a monster is holding a certain item that isn't disabled by Klutz.
bool8 ItemIsActive__0230F810(struct entity *entity, enum item_id item_id);
bool8 TeamMemberHasExclusiveItemEffectActive(enum exclusive_item_effect_id effect_id);

View File

@@ -3,6 +3,9 @@
#include "dungeon_mode.h"
s16 ov29_0233804C(void);
s32 ov29_023380FC(struct entity *entity, struct entity **targets);
struct entity* ov29_023381C0(struct entity *entity, enum iq_skill_id iq_skill, bool8 param_3);
bool8 NearbyAllyIqSkillIsEnabled(struct entity *entity, enum iq_skill_id iq_skill);
struct entity* FindAdjacentEnemy(struct entity *monster);
bool8 IsAdjacentToEnemyIgnoreTreatment(struct entity *monster);

View File

@@ -800,7 +800,6 @@ Overlay OVY_29
Object src/dungeon_util_2.o
Object asm/overlay_29_022E34A8.o
Object src/dg_camera.o
Object asm/overlay_29_022E335C.o
Object src/dg_effect.o
Object asm/overlay_29_022E37DC.o
Object src/overlay_29_022E3F20.o
@@ -987,7 +986,6 @@ Overlay OVY_29
Object src/dungeon_ai_items.o
Object src/dungeon_ai_items_1.o
Object asm/overlay_29_data_02353700.o
Object asm/overlay_29_0230F02C.o
Object src/overlay_29_0230F810.o
Object src/overlay_29_0230F8AC.o
Object asm/overlay_29_0230FB30.o
@@ -1204,7 +1202,6 @@ Overlay OVY_29
Object src/overlay_29_02337CA8.o
Object asm/overlay_29_02337CCC.o
Object src/dungeon_map_access_1.o
Object asm/overlay_29_02337EC0.o
Object src/overlay_29_02338350.o
Object src/overlay_29_0233836C.o
Object src/overlay_29_023383a8_0.o

View File

@@ -1,12 +1,41 @@
#include "dg_camera.h"
#include "dg_effect.h"
#include "dungeon.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_util_static.h"
#include "overlay_29_02336F4C.h"
#include "overlay_29_0234B104.h"
// file starts at 0x022e26b68
extern struct dungeon *DUNGEON_PTR[];
#ifdef JAPAN
#define REVEAL_WHOLE_FLOOR_MESSAGE 0x888
#else
#define REVEAL_WHOLE_FLOOR_MESSAGE 0xB77
#endif
struct unk_0235354C {
u8 field_0x0;
u8 field_0x1;
u8 field_0x2;
u8 field_0x3;
void *field_0x4;
};
extern struct dungeon *DUNGEON_PTR[2];
extern const s32 ov29_0235110C[32];
extern struct unk_0235354C ov29_0235354C;
extern bool8 ov10_022BFD20(void);
extern void ov29_022E2C6C(void);
extern void DisplayUi(void);
extern void UpdateCamera(s32 param_1);
extern void UpdateMinimap(void);
extern bool8 ScreenEffectActive(s32 param_1);
extern s32 GetEffectAnimationWanOffset(s32 id);
bool8 EntityIsValid__022E32E8(struct entity *entity)
{
@@ -32,3 +61,108 @@ s16 GetVisibilityRange()
return visibility_range;
}
void ov29_022E335C(void)
{
struct display_data *display;
struct monster *info;
struct entity *camera_target;
s32 max_hp;
bool8 ok;
ok = FALSE;
camera_target = DUNGEON_PTR[0]->display_data.camera_target;
if (!DUNGEON_PTR[0]->display_data.unk_fade_to_black_tracker && !ov10_022BFD20() &&
camera_target != NULL && camera_target->type == ENTITY_MONSTER) {
ok = TRUE;
}
if (!ok) {
ov29_022E2C6C();
return;
}
display = &DUNGEON_PTR[0]->display_data;
info = GetEntInfo(display->camera_target);
DisplayUi();
display->floor_touch_screen =
DUNGEON_PTR[0]->floor + DUNGEON_PTR[0]->number_completed_floors;
max_hp = info->max_hp_stat + info->max_hp_boost;
if (max_hp > MAX_HP_LIMIT)
max_hp = MAX_HP_LIMIT;
display->leader_max_hp_touch_screen = max_hp;
display->leader_hp_touch_screen = info->hp;
display->leader_level_touch_screen = info->level;
display->field_0x44 = display->leader_max_hp_touch_screen / 8;
}
void RevealWholeFloor(struct entity *user, struct entity *target)
{
s32 x;
s32 y;
DUNGEON_PTR[0]->display_data.luminous = TRUE;
for (y = 0; y < DUNGEON_MAX_SIZE_Y; y++) {
for (x = 0; x < DUNGEON_MAX_SIZE_X; x++) {
GetTileSafe(x, y)->spawn_or_visibility_flags.visibility |= 1;
}
}
UpdateCamera(0);
UpdateTrapsVisibility();
UpdateMinimap();
LogMessageByIdWithPopupCheckUser(user, REVEAL_WHOLE_FLOOR_MESSAGE);
}
void ov29_022E34B0(u8 param_1)
{
DUNGEON_PTR[0]->display_data.field_0x30 = param_1;
}
void ov29_022E34C8(void)
{
struct dungeon *dungeon;
s32 intensity;
dungeon = DUNGEON_PTR[0];
intensity = dungeon->display_data.screen_shake_intensity;
if (intensity == 0)
return;
if (intensity >= 0x1F)
intensity = 0x1F;
dungeon->display_data.screen_shake_offset = ov29_0235110C[intensity];
DUNGEON_PTR[0]->display_data.screen_shake_intensity--;
if (DUNGEON_PTR[0]->display_data.screen_shake_intensity == 0) {
DUNGEON_PTR[0]->display_data.screen_shake_intensity =
DUNGEON_PTR[0]->display_data.screen_shake_intensity_reset;
}
}
bool8 ov29_022E3534(struct display_data *display)
{
if (display->field_0x34 == 0) {
if (display->luminous || display->natural_lighting)
return TRUE;
}
return FALSE;
}
void ov29_022E3560(u8 param_1)
{
ov29_0235354C.field_0x0 = param_1;
}
u8 ov29_022E3570(void)
{
return ov29_0235354C.field_0x0;
}
bool8 DungeonScreenEffectActive(void)
{
return ScreenEffectActive(0);
}
void ov29_022E3590(struct entity *entity, s32 id, s32 param_3)
{
PlayEffectAnimationEntity(entity, id, param_3, GetEffectAnimationWanOffset(id),
2, 0, -1, NULL);
}

View File

@@ -1,5 +1,85 @@
#include "dg_effect.h"
#include "dungeon.h"
#include "dungeon_util_static.h"
#include "overlay_29_022E9FC0.h"
extern struct dungeon *DUNGEON_PTR[];
extern bool8 ShouldDisplayEntityAdvanced(struct entity *entity);
extern void AnimationDelayOrSomething(bool8 param_1);
extern void GetPixelOffsetFromSprite(struct position *offset,
struct animation_control *anim_ctrl, u32 idx);
extern void ov10_022BF274(struct unk_022BF274 *params);
extern s32 ov10_022BF2B4(struct unk_022BF274 *params, s32 param_2);
extern void InitOamAdjustmentInfo(struct unk_0201C000 *oam);
extern bool8 AnimationHasMoreFrames(s16 param_1);
s32 PlayEffectAnimationEntity(struct entity *entity, s32 id, s32 param_3, u8 param_4,
s32 param_5, u8 param_6, s16 param_7,
struct unk_0201C000 *param_8)
{
struct position offset;
struct unk_022BF274 params;
struct monster *info;
s32 dy;
s32 px;
s32 py;
s32 handle;
s32 i;
if (!EntityIsValid__022E37B8(entity))
return -1;
info = GetEntInfo(entity);
if (!ShouldDisplayEntityAdvanced(entity))
return -1;
if (param_6 == 0 && info->two_turn_move_invincible == 2)
return -1;
if (param_5 != 0)
AnimationDelayOrSomething(param_5 == 2);
GetPixelOffsetFromSprite(&offset, &entity->anim_ctrl, param_4);
if (offset.x == 0x63 || offset.y == 0x63) {
px = entity->pixel_pos.x;
py = entity->pixel_pos.y - info->field_0x188;
} else {
px = entity->pixel_pos.x + (offset.x << 8);
py = entity->pixel_pos.y + (offset.y << 8) - info->field_0x188;
}
dy = ((s32)entity->pixel_pos.y >> 8) -
DUNGEON_PTR[0]->display_data.camera_pixel_pos.y;
ov10_022BF274(&params);
params.field_0x0 = id;
params.field_0x4 = 0;
if (param_7 < 0 || param_7 > 8)
params.field_0x8 = -1;
else
params.field_0x8 = param_7;
params.field_0xc = px >> 8;
params.field_0xe = py >> 8;
params.field_0x14 = -1;
params.field_0x10 = 0;
params.field_0x12 = 0;
params.field_0x18 = dy / 2 + 1;
if (param_8 == NULL)
InitOamAdjustmentInfo(&params.field_0x1c);
else
params.field_0x1c = *param_8;
handle = ov10_022BF2B4(&params, 0);
if (param_3 == 0)
return handle;
for (i = 0; i < 100; i++) {
if (!AnimationHasMoreFrames(handle))
break;
AdvanceFrame(0x42);
}
return -1;
}
// file starts at 0x022e35e4

View File

@@ -1,4 +1,5 @@
#include "dungeon_logic_2.h"
#include "overlay_29_0230F810.h"
#include "main_0205283C.h"
#include "dungeon.h"
#include "dungeon_pokemon_attributes_1.h"
@@ -29,7 +30,6 @@ extern const s16 EXCLUSIVE_ITEM_EXP_BOOST;
extern bool8 LeafGuardIsActive(struct entity *user, struct entity *target, bool8 log_message);
extern bool8 ov29_02301A84(struct entity *user, struct entity *target, bool8 log_message);
extern bool8 GetExclusiveItemWithEffectFromBag(struct entity *, enum exclusive_item_effect_id effect_id, struct item *item);
bool8 MonsterCanThrowItems(struct monster *monster)
{

View File

@@ -1,10 +1,15 @@
#include "dungeon_map_access_1.h"
#include "dg_random.h"
#include "dungeon.h"
#include "dungeon_map_access.h"
#include "dungeon_util_static.h"
#include "main_0200224C.h"
#include "secondary_terrain_types.h"
#include "tileset.h"
extern struct dungeon *DUNGEON_PTR[];
extern struct dungeon *DUNGEON_PTR;
extern s32 GetMonsterIdFromSpawnEntry(struct monster_spawn_entry *entry);
bool8 IsTileGround(struct tile *tile)
{
@@ -15,7 +20,7 @@ bool8 IsTileGround(struct tile *tile)
is_ground = TRUE;
}
else if (GetTerrainType(tile) != TERRAIN_TYPE_SECONDARY ||
SECONDARY_TERRAIN_TYPES[DUNGEON_PTR[0]->gen_info.tileset_id] == SECONDARY_TERRAIN_LAVA)
SECONDARY_TERRAIN_TYPES[DUNGEON_PTR->gen_info.tileset_id] == SECONDARY_TERRAIN_LAVA)
{
is_ground = TRUE;
}
@@ -24,5 +29,52 @@ bool8 IsTileGround(struct tile *tile)
bool8 IsWaterTileset()
{
return TILESET_PROPERTIES[DUNGEON_PTR[0]->gen_info.tileset_id].is_water_tileset;
return TILESET_PROPERTIES[DUNGEON_PTR->gen_info.tileset_id].is_water_tileset;
}
void RemoveMonsterFromTile(struct entity *entity, s32 x, s32 y)
{
struct tile *tile = GetTileSafe(x, y);
if (tile->monster == entity)
tile->monster = NULL;
}
s16 ov29_02337EE8(void)
{
struct dungeon *dungeon = DUNGEON_PTR;
struct unk_02337EE8 *p = &dungeon->field_0x286b0;
s16 ids[16];
s16 i;
s16 count = 0;
for (i = 0; i < 16; i = (s16)(i + 1)) {
s32 id = GetMonsterIdFromSpawnEntry(&p->spawn_entries_master[i]);
if (id == 0)
break;
if (id != MONSTER_KECLEON && id != MONSTER_KECLEON_SECONDARY &&
id != MONSTER_DECOY && id != MONSTER_STATUE) {
ids[count] = id;
count = (s16)(count + 1);
}
}
return ids[RandInt(count)];
}
s16 GetRandomSpawnMonsterID(void)
{
struct dungeon *dungeon = DUNGEON_PTR;
struct unk_02337EE8 *p = &dungeon->field_0x286b0;
s16 ids[16];
s16 i;
s16 count = 0;
for (i = 0; i < 16; i = (s16)(i + 1)) {
s32 id = GetMonsterIdFromSpawnEntry(&p->spawn_entries_master[i]);
if (id == 0)
break;
if (id != MONSTER_KECLEON && id != MONSTER_KECLEON_SECONDARY &&
id != MONSTER_DECOY && id != MONSTER_STATUE && id != MONSTER_DITTO) {
ids[count] = id;
count = (s16)(count + 1);
}
}
return ids[DungeonRandInt(count)];
}

View File

@@ -4,6 +4,7 @@
#include "dungeon_mode.h"
#include "dungeon_pokemon_attributes_1.h"
#include "dungeon_recruitment.h"
#include "dungeon_map_access_1.h"
#include "dungeon_recruitment_2.h"
#include "dg_random.h"
#include "dungeon_visibility.h"
@@ -66,7 +67,6 @@ s32 ov29_0234D7C0(s32 message_id, struct preprocessor_args *args, s32 param_3,
void ov29_0234D8A0(s32 param_1);
struct entity *ov29_0234EE10(struct entity *entity, char *name);
bool8 DungeonModeSetupAndShowNameKeyboard(char *name, char *param_2, s32 param_3);
void RemoveMonsterFromTile(struct entity *entity, s32 x, s32 y);
bool8 ov29_0230E5A8(struct entity *user, struct entity *target, s32 x, s32 y);
s32 ov29_0230E5FC(struct team_member *member, s32 param_2);
void ov29_0230E658(s32 message_id);

View File

@@ -1,4 +1,5 @@
#include "dungeon_pokemon_attributes.h"
#include "overlay_29_0230F810.h"
#include "dungeon_map_access.h"
#include "dungeon_util_static.h"
#include "dungeon_util.h"
@@ -38,7 +39,6 @@ extern bool8 SafeguardIsActive(struct entity *user ,struct entity *target, bool8
extern void TryActivateSteadfast(struct entity *attacker, struct entity *defender);
extern void TryActivateQuickFeet(struct entity *attacker ,struct entity *defender);
extern s32 CalcStatusDuration(struct entity *entity, const s16 *turn_range, bool8 iq_skill_effects);
extern bool8 GetExclusiveItemWithEffectFromBag(struct entity *, enum exclusive_item_effect_id effect_id, struct item *item);
extern struct preprocessor_args* GetMessageLogPreprocessorArgs(void);
extern void SetPreprocessorArgsStringToName(struct preprocessor_args* preprocessor_args, s32 pos, struct monster* monster, u32 param_4, u8 name_type);
extern int CalcSpeedStageWrapper(struct entity* entity);

View File

@@ -9,9 +9,6 @@ extern void PlaySeByIdIfShouldDisplayEntity(struct entity *entity, s32 se_id);
extern s32 GetEffectAnimationWanOffset(s32 id);
extern void PlayEffectAnimationEntity(struct entity *entity, s32 id, s32 a, u8 b,
s32 c, s32 d, s32 e, s32 f);
extern const u64 STATUS_ICON_ARRAY_SLEEP[];
extern const u64 STATUS_ICON_ARRAY_BURN[];
extern const u64 STATUS_ICON_ARRAY_FREEZE[];

View File

@@ -1,10 +1,8 @@
#include "overlay_29_022E406C.h"
#include "dg_effect.h"
extern s32 GetEffectAnimationWanOffset(s32 id);
extern void PlayEffectAnimationEntity(struct entity *entity, s32 id, s32 a, u8 b,
s32 c, s32 d, s32 e, s32 f);
void PlayEffectAnimation0x171(struct entity *entity)
{
PlayEffectAnimationEntity(entity, 0x171, 0, GetEffectAnimationWanOffset(0x171),

View File

@@ -1,9 +1,7 @@
#include "overlay_29_022E4338.h"
#include "dg_effect.h"
extern s32 GetEffectAnimationWanOffset(s32 id);
extern void PlayEffectAnimationEntity(struct entity *entity, s32 id, s32 a, u8 b,
s32 c, s32 d, s32 e, s32 f);
void PlayEffectAnimationEntityStandard(struct entity *entity, s32 anim_id)
{
@@ -13,9 +11,6 @@ void PlayEffectAnimationEntityStandard(struct entity *entity, s32 anim_id)
extern s32 GetEffectAnimationWanOffset(s32 id);
extern void PlayEffectAnimationEntity(struct entity *entity, s32 id, s32 a, u8 b,
s32 c, s32 d, s32 e, s32 f);
void ov29_022E4338(struct entity *entity)
{
PlayEffectAnimationEntity(entity, 0x1A9, 1, GetEffectAnimationWanOffset(0x1A9),

View File

@@ -1,9 +1,7 @@
#include "overlay_29_022E45B8.h"
#include "dg_effect.h"
extern s32 GetEffectAnimationWanOffset(s32 id);
extern void PlayEffectAnimationEntity(struct entity *entity, s32 id, s32 a, u8 b,
s32 c, s32 d, s32 e, s32 f);
extern void PlaySeByIdIfShouldDisplayEntity(struct entity *entity, s32 se_id);
void ov29_022E45B8(struct entity *entity)

View File

@@ -1,12 +1,10 @@
#include "overlay_29_022E4704.h"
#include "dg_effect.h"
extern bool8 MonsterIsType(struct entity *entity, enum type_id type_id);
extern s32 GetEffectAnimationWanOffset(s32 id);
extern void PlayEffectAnimationEntity(struct entity *entity, s32 id, s32 a, u8 b,
s32 c, s32 d, s32 e, s32 f);
extern void PlaySeByIdIfShouldDisplayEntity(struct entity *entity, s32 se_id);
void PlayInvisifySeIfShouldDisplayEntity(struct entity *entity)

View File

@@ -1,10 +1,8 @@
#include "overlay_29_022E66C4.h"
#include "dg_effect.h"
extern s32 GetEffectAnimationWanOffset(s32 id);
extern void PlayEffectAnimationEntity(struct entity *entity, s32 id, s32 a, u8 b,
s32 c, s32 d, s32 e, s32 f);
extern void PlayEffectAnimationPos(struct entity *entity, s32 effect_id, s32 a);
void ov29_022E66C4(struct entity *entity)

View File

@@ -1,9 +1,9 @@
#include "overlay_29_022EFA6C.h"
#include "overlay_29_0230F810.h"
#include "dungeon.h"
extern struct dungeon *DUNGEON_PTR[];
extern s32 TeamMemberHasItemActive(struct entity **buf, enum item_id item_id);
extern void BoostIQ(struct entity *entity, s16 iq, bool8 a);
@@ -19,7 +19,7 @@ void TryActivateIqBooster(void)
s32 n;
s32 i;
iq = DUNGEON_PTR[0]->floor_properties.iq_booster_value;
iq = DUNGEON_PTR[0]->field_0x286b0.floor_properties.iq_booster_value;
if (iq <= 0) {
return;
}

View File

@@ -1,4 +1,7 @@
#include "overlay_29_02308FBC.h"
#include "dg_effect.h"
#include "overlay_29_0230F810.h"
#include "overlay_29_02338350.h"
#include "common.h"
#include "dg_object.h"
#include "dg_random.h"
@@ -87,8 +90,6 @@ extern bool8 IsEitherMonsterInvalid(struct entity *a, struct entity *b);
extern void ResetDamageData(struct unk_02308FE0 *damage_data);
extern void ov29_022E57D4(struct entity *entity);
extern void ov29_022E5E84(struct entity *a, struct entity *b);
extern void ov29_0230F728(struct entity *attacker, struct entity *defender, enum exclusive_item_effect_id effect_id, s32 a);
extern s32 ov29_023380FC(struct entity *entity, struct entity **targets);
extern struct unk_023535DC ov29_023535DC[];
extern s16 ARENA_TRAP_ACTIVATION_CHANCE;
extern s16 CUTE_CHARM_INFATUATE_CHANCE;
@@ -117,7 +118,6 @@ extern s32 GetIdleAnimationId(struct entity *entity);
extern void HandleFaint(struct entity *fainted_entity, s32 damage_source, struct entity *killer);
extern bool8 IsMonsterIdInNormalRangeVeneer(enum monster_id monster_id);
extern void MoveMonsterToPos(struct entity* entity, s32 x_pos, s32 y_pos, bool8 reset_prev_pos_fields);
extern s32 PlayEffectAnimationEntity(struct entity *entity, s32 id, s32 a, u8 b, s32 c, s32 d, s32 e, s32 f);
extern int PlayMissSfx__022E611C();
extern int PlayMissSfx__022E6150();
extern void RemoveHolderForItemInBag(struct item* item);

View File

@@ -1,4 +1,5 @@
#include "overlay_29_0230BBAC.h"
#include "overlay_29_0230F810.h"
#include "debug.h"
#include "dg_random.h"
#include "dungeon.h"
@@ -34,13 +35,10 @@
extern struct dungeon *DUNGEON_PTR;
extern u8 GetMonsterGenderVeneer(s16 monster_id);
extern u8 ExclusiveItemOffenseBoost(struct entity *entity, s32 idx);
extern u8 ExclusiveItemDefenseBoost(struct entity *entity, s32 idx);
extern s32 FixedPoint64ToInt(struct fixed_point_64 *x);
extern void PlayEffectAnimation0x1A9__022E6130(struct entity *entity);
extern void PlayEffectAnimation0x1A9__022E617C(struct entity *entity);
extern void PlayEffectAnimation0x18E(struct entity *entity);
extern bool8 AuraBowIsActive(struct entity *entity);
extern bool8 FixedPoint64CmpLt(const struct fixed_point_64 *a, const struct fixed_point_64 *b);
extern void DivideFixedPoint64(struct fixed_point_64 *out, struct fixed_point_64 *a, struct fixed_point_64 *b);
extern void ResetDamageCalcDiagnostics(void);

View File

@@ -1,11 +1,318 @@
#include "overlay_29_0230F810.h"
#include "dungeon.h"
#include "dungeon_ai_items_1.h"
#include "overlay_29_0230F8AC.h"
extern struct dungeon *DUNGEON_PTR[];
#include "dungeon_ai_targeting.h"
#include "dungeon_items.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_pokemon_attributes_1.h"
#include "dungeon_util_1.h"
#include "dungeon_util_2.h"
#include "dungeon_util_static.h"
#include "item_util.h"
#include "joined_at_checks.h"
#include "main_0200D81C.h"
#include "main_0200ECFC.h"
#include "main_0200EDC0.h"
#include "overlay_29_0230F8AC.h"
#include "overlay_29_022E1610.h"
#include "overlay_29_022EAC7C.h"
#include "overlay_29_022EC7E8.h"
#include "overlay_29_022F52BC.h"
#include "overlay_29_02344AF8.h"
#include "overlay_29_02348D00.h"
#include "overlay_29_0234B4BC.h"
#ifdef JAPAN
#define MESSAGE_C5E 0x99D
#define MESSAGE_C5F 0x99E
#define MESSAGE_C60 0x99F
#define MESSAGE_C61 0x9A0
#define MESSAGE_C62 0x9A1
#define MESSAGE_C63 0x9A2
#else
#define MESSAGE_C5E 0xC5E
#define MESSAGE_C5F 0xC5F
#define MESSAGE_C60 0xC60
#define MESSAGE_C61 0xC61
#define MESSAGE_C62 0xC62
#define MESSAGE_C63 0xC63
#endif
extern struct dungeon *DUNGEON_PTR[];
extern struct bag_items *BAG_ITEMS_PTR_MIRROR;
extern void RemoveGroundItem(struct position *pos, bool8 a);
extern bool8 GetExclusiveItemForMonsterFromBag(struct item *item,
enum exclusive_item_effect_id effect_id,
s16 monster_id, enum type_id type1,
enum type_id type2);
extern void UseThrowableItem(struct entity *entity);
extern void ov29_022F9EA0(struct entity *entity);
extern void ov29_02347040(void);
extern bool8 ov29_02345004(struct item *item);
extern s32 ov29_02348D3C(struct item *item);
extern bool8 ov29_02348DD8(struct entity *entity, struct item *item, bool8 a);
extern void ov29_02348ECC(struct item *item, s32 a);
void ov29_0230F140(struct entity *entity)
{
UseSingleUseItemSelf(entity);
}
void ov29_0230F14C(struct entity *entity)
{
UseThrowableItem(entity);
}
void ov29_0230F158(struct entity *entity)
{
TryNonLeaderItemPickUp(entity);
}
void TryNonLeaderItemPickUp(struct entity *entity)
{
s32 slot_ids[INVENTORY_SIZE + 1];
struct item *slots[INVENTORY_SIZE + 1];
struct monster *monster;
struct tile *tile;
struct entity *object;
struct item *item;
struct item *slot;
bool8 pick_up;
s32 count;
s32 best;
struct item *bag;
s32 best_quantity;
s32 item_id;
int i;
bool8 bag_enabled;
s32 quantity;
monster = GetEntInfo(entity);
tile = GetTileAtEntity(entity);
object = tile->object;
if (object == NULL)
return;
if (IsFloorOver())
return;
SubstitutePlaceholderStringTags(0, entity, 0);
if (monster->is_team_leader)
return;
if (monster->shopkeeper == SHOPKEEPER_MODE_SHOPKEEPER)
return;
if (IsExperienceLocked(monster))
return;
if (monster->monster_behavior == BEHAVIOR_RESCUE_TARGET)
return;
monster = GetEntInfo(entity);
pick_up = TRUE;
item = GetItemInfo(object);
if (monster->is_not_team_member && IsItemUnkMissionItem2(item))
return;
if ((item->flags & ITEM_FLAG_IN_SHOP)
|| (!monster->is_not_team_member && (tile->terrain_flags & TERRAIN_TYPE_SHOP)))
pick_up = FALSE;
if (!pick_up)
return;
if (ShouldMonsterRunAwayAndShowEffect(entity, TRUE)) {
PrepareItemForPrinting__02345728(0, item);
SubstitutePlaceholderStringTags(0, entity, 0);
LogMessageByIdWithPopup(entity, MESSAGE_C5E);
return;
}
if (!monster->is_not_team_member
&& GetItemCategoryVeneer(item->id) == CATEGORY_POKE) {
if (monster->is_not_team_member)
PlaySeByIdIfNotSilence(0x1305);
else
PlaySeByIdIfNotSilence(0x1308);
if (IqSkillIsEnabled(entity, IQ_COIN_WATCHER))
item->flags |= ITEM_FLAG_UNK_MONEY_QUANTITY;
AddMoneyCarried(GetMoneyQuantity(item));
PrepareItemForPrinting__02345728(0, item);
RemoveGroundItem(&entity->pos, TRUE);
LogMessageByIdWithPopup(entity, MESSAGE_C5F);
return;
}
bag_enabled = DUNGEON_PTR[0]->bag_enabled;
if (bag_enabled && !monster->is_not_team_member) {
bag = BAG_ITEMS_PTR_MIRROR->bag_items->bag_items;
for (best = 0; best < INVENTORY_SIZE; best++) {
slots[best] = &bag[best];
slot_ids[best] = best;
}
slots[INVENTORY_SIZE] = &monster->held_item;
slot_ids[INVENTORY_SIZE] = -1;
count = INVENTORY_SIZE + 1;
}
else {
slots[0] = &monster->held_item;
slot_ids[0] = -1;
count = 1;
}
item_id = item->id;
if (item_id < 0xB && !(item->flags & ITEM_FLAG_IN_SHOP)) {
best = -1;
best_quantity = -1;
for (i = 0; i < count; i++) {
if (!ItemExists(((const struct item **)slots)[i]->flags))
continue;
if (!(slots[i]->flags & ITEM_FLAG_IN_SHOP) && item_id == slots[i]->id
&& (item->flags & ITEM_FLAG_STICKY)
== (slots[i]->flags & ITEM_FLAG_STICKY)) {
if (slots[i]->quantity == 99)
continue;
if (best_quantity < slots[i]->quantity) {
best_quantity = slots[i]->quantity;
best = i;
}
}
}
if (best != -1) {
slot = slots[best];
quantity = slot->quantity + item->quantity;
if (quantity >= 99)
quantity = 99;
slot->quantity = quantity;
if (ItemSticky(item->flags))
slot->flags |= ITEM_FLAG_STICKY;
ov29_02347040();
PrepareItemForPrinting__02345728(0, item);
RemoveGroundItem(&entity->pos, TRUE);
PlaySeByIdIfNotSilence(0x1304);
if (slot_ids[best] < 0)
LogMessageByIdWithPopup(entity, MESSAGE_C60);
else
LogMessageByIdWithPopup(entity, MESSAGE_C61);
return;
}
}
if (bag_enabled && !monster->is_not_team_member)
count = GetCurrentBagCapacity();
for (i = 0; i < count; i++) {
if (!ItemExists(slots[i]->flags))
break;
}
if (ov29_02348DD8(entity, item, TRUE))
return;
if (i == count) {
PrepareItemForPrinting__02345728(0, item);
LogMessageByIdWithPopup(entity, MESSAGE_C62);
return;
}
if (monster->is_not_team_member)
PlaySeByIdIfNotSilence(0x1305);
else
PlaySeByIdIfNotSilence(0x1304);
if (slot_ids[i] < 0) {
monster->held_item = *item;
ov29_022F9EA0(entity);
PrepareItemForPrinting__02345728(0, item);
RemoveGroundItem(&entity->pos, TRUE);
LogMessageByIdWithPopup(entity, MESSAGE_C60);
return;
}
quantity = ov29_02348D3C(item);
if (ov29_02345004(item)) {
SubstitutePlaceholderStringTags(0, entity, 0);
LogMessageByIdWithPopup(entity, MESSAGE_C63);
return;
}
PrepareItemForPrinting__02345728(0, item);
RemoveGroundItem(&entity->pos, TRUE);
LogMessageByIdWithPopup(entity, MESSAGE_C61);
ov29_02348ECC(item, quantity);
}
bool8 GetExclusiveItemWithEffectFromBag(struct entity *entity, enum exclusive_item_effect_id effect_id, struct item *out)
{
struct item item;
struct monster *monster;
if (!EntityIsValid__0230F008(entity))
return FALSE;
monster = GetEntInfo(entity);
if (!GetExclusiveItemForMonsterFromBag(&item, effect_id, monster->apparent_id,
monster->types[0], monster->types[1]))
return FALSE;
*out = item;
return TRUE;
}
bool8 AuraBowIsActive(struct entity *entity)
{
struct monster *monster;
monster = GetEntInfo(entity);
if (AbilityIsActiveVeneer(entity, ABILITY_KLUTZ))
return FALSE;
if (!ItemExists(monster->held_item.flags) || !IsAuraBow(monster->held_item.id))
return FALSE;
return HasHeldItem(entity, (enum item_id)monster->held_item.id);
}
void ov29_0230F728(struct entity *attacker, struct entity *defender, enum exclusive_item_effect_id effect_id, s32 flags)
{
struct item item;
struct monster *attacker_info;
struct monster *defender_info;
defender_info = GetEntInfo(defender);
attacker_info = GetEntInfo(attacker);
GetExclusiveItemForMonsterFromBag(&item, effect_id, defender_info->apparent_id,
defender_info->types[0], defender_info->types[1]);
attacker_info->exclusive_item_trigger_bitflags |= flags;
attacker_info->field_0x190 = item.id;
}
u8 ExclusiveItemOffenseBoost(struct entity *entity, s32 idx)
{
struct monster *monster = GetEntInfo(entity);
return monster->exclusive_item_offense_boosts[idx];
}
u8 ExclusiveItemDefenseBoost(struct entity *entity, s32 idx)
{
struct monster *monster = GetEntInfo(entity);
return monster->exclusive_item_defense_boosts[idx];
}
s32 TeamMemberHasItemActive(struct entity **buf, enum item_id item_id)
{
s16 i;
s16 count;
count = 0;
for (i = 0; i < 4; i++) {
struct entity *member = DUNGEON_PTR[0]->monster_slot_ptrs[i];
if (EntityIsValid__0230F008(member) && ItemIsActive__0230F810(member, item_id)) {
buf[count] = member;
count++;
}
}
return count;
}
bool8 ItemIsActive__0230F810(struct entity *entity, enum item_id item_id)
{

View File

@@ -1,7 +1,7 @@
#include "overlay_29_0232CA14.h"
#include "dg_camera.h"
#include "move_orb_effects.h"
extern void RevealWholeFloor(struct entity *user, struct entity *target);
extern void TryInflictPetrifiedStatus(struct entity *user, struct entity *target);
extern void TryPounce(struct entity *user, struct entity *target, s32);
extern void TryTrawl(struct entity *user, struct entity *target);

View File

@@ -1,9 +1,83 @@
#include "overlay_29_02338350.h"
#include "dg_random.h"
#include "dungeon.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes_1.h"
#include "dungeon_util.h"
#include "dungeon_util_static.h"
#include "main_02001188.h"
extern struct entity *ov29_023381C0(struct entity *entity, enum iq_skill_id iq_skill, bool8 param_3);
extern struct dungeon *DUNGEON_PTR;
extern bool8 ShouldTreatMonsterAsAlly(struct entity *monster, struct entity *other);
s16 ov29_0233804C(void)
{
s16 *ids = (s16 *)MemAlloc(0x2d8, 0x10);
s16 i;
s16 idx = DungeonRandRange(1, 0x16c);
s16 count = 0;
s16 chosen;
for (i = 0; i < 0x16c; i++) {
if (idx >= 0x16c)
idx = 0;
if (DUNGEON_PTR->field_0x286b0.item_spawn_weights[0].item_threshold[idx] != 0)
ids[count++] = idx;
idx++;
}
chosen = DungeonRandInt(count);
chosen = ids[chosen];
MemFree(ids);
return chosen;
}
s32 ov29_023380FC(struct entity *entity, struct entity **targets)
{
s16 i;
bool8 is_not_team_member = FALSE;
s16 count = 0;
if (GetEntInfo(entity)->is_not_team_member)
is_not_team_member = TRUE;
for (i = 0; i < NUM_DIRECTIONS; i++) {
struct entity *other = GetTile(entity->pos.x + DIRECTIONS_XY[i].x,
entity->pos.y + DIRECTIONS_XY[i].y)->monster;
if (other != NULL && GetEntityType(other) == ENTITY_MONSTER) {
bool8 other_not_team_member = GetEntInfo(other)->is_not_team_member;
if (is_not_team_member) {
if (!other_not_team_member) {
targets[count] = other;
count = (s16)(count + 1);
}
}
else if (other_not_team_member) {
targets[count] = other;
count = (s16)(count + 1);
}
}
}
return count;
}
struct entity* ov29_023381C0(struct entity *entity, enum iq_skill_id iq_skill, bool8 param_3)
{
s16 i;
for (i = 0; i < NUM_DIRECTIONS; i = (s16)(i + 1)) {
struct entity *other = GetTile(entity->pos.x + DIRECTIONS_XY[i].x,
entity->pos.y + DIRECTIONS_XY[i].y)->monster;
if (other != NULL && GetEntityType(other) == ENTITY_MONSTER &&
IqSkillIsEnabled(other, iq_skill)) {
if (param_3) {
if (ShouldTreatMonsterAsAlly(other, entity))
return other;
}
else if (ShouldTreatMonsterAsAlly(entity, other)) {
return other;
}
}
}
return NULL;
}
bool8 NearbyAllyIqSkillIsEnabled(struct entity *entity, enum iq_skill_id iq_skill)
{

View File

@@ -255,10 +255,10 @@ void WriteQuicksaveData(void *buffer, s32 size)
ov30_02385CE0(&sp4, OVERLAY30_JP_STRING_1);
WriteBitsToDataSerializer(&sp4, &DUNGEON_PTR->id, 0xAC);
ov30_02385CE0(&sp4, OVERLAY30_JP_STRING_1);
ov30_02385D34(&sp4, DUNGEON_PTR->highest_enemy_level);
ov30_02385D34(&sp4, DUNGEON_PTR->field_0x286b0.highest_enemy_level);
for(index = 0; index < 0x10; index++)
{
ov30_02385D14(&sp4, DUNGEON_PTR->spawn_table_entries_chosen[index]);
ov30_02385D14(&sp4, DUNGEON_PTR->field_0x286b0.spawn_table_entries_chosen[index]);
}
ov30_02383C70(&sp4);
@@ -806,11 +806,11 @@ void ov30_023842F4(void *buffer, s32 arg1)
ReadBitsFromDataSerializer(&sp4, &DUNGEON_PTR->id, 0xAC);
ov30_02385CF0(&sp4, OVERLAY30_JP_STRING_1);
DUNGEON_PTR->highest_enemy_level = ov30_02385EDC(&sp4);
DUNGEON_PTR->field_0x286b0.highest_enemy_level = ov30_02385EDC(&sp4);
for(int var_r4 = 0; var_r4 < 0x10; var_r4++)
{
DUNGEON_PTR->spawn_table_entries_chosen[var_r4] = ov30_02385EC4(&sp4);
DUNGEON_PTR->field_0x286b0.spawn_table_entries_chosen[var_r4] = ov30_02385EC4(&sp4);
}
ov30_02384400(&sp4);

View File

@@ -9,7 +9,7 @@ u8 GetRandomSpawnTrapId() {
s32 rnd = DungeonRandInt(10000);
for(s32 i = 0; i < TRAP_NONE; i++) {
u16 weight = DUNGEON_PTR[0]->trap_weights[i];
u16 weight = DUNGEON_PTR[0]->field_0x286b0.trap_weights[i];
if(weight == 0) {
continue;
}

View File

@@ -15,7 +15,7 @@ s16 GetItemIdToSpawn(enum spawn_weight_type spawn_type) {
s32 rnd = DungeonRandInt(10000);
enum item_category category = CATEGORY_DUMMY;
for(idx = 0; idx < 16; idx++) {
s16 threshold = DUNGEON_PTR->item_spawn_weights[spawn_type].category_threshold[idx];
s16 threshold = DUNGEON_PTR->field_0x286b0.item_spawn_weights[spawn_type].category_threshold[idx];
if(threshold == 0) {
continue;
}
@@ -32,7 +32,7 @@ s16 GetItemIdToSpawn(enum spawn_weight_type spawn_type) {
rnd = DungeonRandInt(10000);
for(idx = 0; idx < 0x16c; idx++) {
s16 threshold = DUNGEON_PTR->item_spawn_weights[spawn_type].item_threshold[idx];
s16 threshold = DUNGEON_PTR->field_0x286b0.item_spawn_weights[spawn_type].item_threshold[idx];
if(threshold == 0) {
continue;
}
@@ -41,7 +41,7 @@ s16 GetItemIdToSpawn(enum spawn_weight_type spawn_type) {
continue;
}
threshold = DUNGEON_PTR->item_spawn_weights[spawn_type].item_threshold[idx];
threshold = DUNGEON_PTR->field_0x286b0.item_spawn_weights[spawn_type].item_threshold[idx];
if(threshold >= rnd) {
return idx;
}
@@ -68,12 +68,12 @@ s32 GetRandomSecretRoomItem() {
s32 CopySpawnEntriesMaster(struct monster_spawn_entry out[], s32 idx_out) {
for(s32 i = 0; i < 16; i++) {
s32 monster_id = GetMonsterIdFromSpawnEntry(&(DUNGEON_PTR->spawn_entries_master[i]));
s32 monster_id = GetMonsterIdFromSpawnEntry(&(DUNGEON_PTR->field_0x286b0.spawn_entries_master[i]));
if(monster_id == 0) {
break;
}
out[idx_out] = DUNGEON_PTR->spawn_entries_master[i];
out[idx_out] = DUNGEON_PTR->field_0x286b0.spawn_entries_master[i];
idx_out++;
}
@@ -82,7 +82,7 @@ s32 CopySpawnEntriesMaster(struct monster_spawn_entry out[], s32 idx_out) {
s32 MonsterSpawnListPartialCopy(struct monster_spawn_entry entry_out[], s32 idx_out) {
for(s32 i = 0; i < 16; i++) {
s32 monster_id = GetMonsterIdFromSpawnEntry(&(DUNGEON_PTR->spawn_entries_master[i]));
s32 monster_id = GetMonsterIdFromSpawnEntry(&(DUNGEON_PTR->field_0x286b0.spawn_entries_master[i]));
if(monster_id == 0) {
break;
}
@@ -91,11 +91,11 @@ s32 MonsterSpawnListPartialCopy(struct monster_spawn_entry entry_out[], s32 idx_
continue;
}
if(DUNGEON_PTR->spawn_entries_master[i].incremental_spawn_weight[0] == 0) {
if(DUNGEON_PTR->field_0x286b0.spawn_entries_master[i].incremental_spawn_weight[0] == 0) {
continue;
}
entry_out[idx_out] = DUNGEON_PTR->spawn_entries_master[i];
entry_out[idx_out] = DUNGEON_PTR->field_0x286b0.spawn_entries_master[i];
idx_out++;
}
return idx_out;

View File

@@ -11,7 +11,7 @@ extern s32 GetMonsterLevelFromSpawnEntry(struct monster_spawn_entry *);
s32 IsOnMonsterSpawnList(s32 monster_id) {
for(s32 i = 0; i < 16; i++) {
s32 entity_monster_id = GetMonsterIdFromSpawnEntry(
&DUNGEON_PTR[0]->spawn_entries_master[i]);
&DUNGEON_PTR[0]->field_0x286b0.spawn_entries_master[i]);
if(entity_monster_id == 0) {
break;