Decompile 13 more callees; all merge at a file boundary

Each was verified at score 0 against its NORTH_AMERICA, EUROPE and JAPAN targets
before landing, with the address walk closing exactly in each region, and by a
matching US build after.

  main_0200224C.c           sub_02002228, ClampedLn
  main_020114F8.c           ApplyGummiBoostsToTeamMember
  main_0200F798.c           RemoveItemNoHoleCheck
  main_02062A58.c           CanMonsterBeUsedForMission
  main_0205D11C.c           CountAndPopulateValidMissionTableMonsters
  overlay_10_022BCC60.c     ov10_022BCDF4
  overlay_29_022E4338.c     PlayEffectAnimationEntityStandard
  overlay_29_022EAC7C.c     MusicTableIdxToMusicId
  overlay_29_022ECDC0.c     ov29_022ECD84
  overlay_29_022F0590.c     ov29_022F0534
  overlay_29_0230A9DC.c     AftermathCheck
  dungeon_logic_6.c         ov29_022EFB20

Every one sat at the head or tail of its .s, so all thirteen merge into an
adjacent source file and no assembly file is split. sub_02002228 is one
instruction and was taken only because it is the single function standing between
ClampedLn and the end of its file.

Ten call-site declarations are replaced by an include of the owning header,
including three unprototyped `extern int ov29_...();` forms in
src/overlay_29_02308FBC.c that became hard conflicts the moment these functions
had real headers to contradict.

Three implicit-conversion errors were fixed by correcting a declaration rather
than by adding a cast, which is the better repair when the declaration is ours:

  RANDOM_MUSIC_ID_TABLE had no C declaration anywhere, so the u16 in the first
  draft was a guess. It is declared `enum music_id[30][4]` here; -enum min sizes
  that enum (max 999) to two bytes, so the layout is unchanged and the cast is
  unnecessary.

  GetBaseForm and IsMonsterMissionAllowed had no declaration either, and the
  invented `enum monster_id` parameters created the conversions. They take s16
  here, matching the tree's own FemaleToMaleForm(s16) and
  HasMonsterBeenAttackedInDungeons(s16) for the same ids.

One cast is kept deliberately: MUSIC_ID_TABLE entries carry a 0x8000 flag bit
that the source tests and masks off, so an entry is not a valid music_id
enumerator and typing that table as the enum would be false.

Two generated headers are made self-contained -- overlay_29_022EAC7C.h named
enum music_id and main_0200224C.h named struct fixed_point_64 without including
anything, so each prototype built its own scoped tag and the definition read as a
redeclaration with a different type.

Authored by Claude (Opus 5) under human direction. Confirmed by a matching
build: build/pmdsky.us/pmdsky.us.nds: OK.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
cecilarmitais
2026-09-13 02:25:04 -07:00
parent 7e1755ddf8
commit 2cfa18739d
51 changed files with 298 additions and 439 deletions

View File

@@ -1,6 +1,5 @@
#pragma once
.public FixedPoint64IsNegative
.public FixedPoint64IsZero
.public NATURAL_LOG_VALUE_TABLE
.public NegateFixedPoint64
.public UFixedPoint64CmpLt

View File

@@ -1,5 +1,4 @@
#pragma once
.public ApplyGummiBoostsGroundMode
.public CALCIUM_STAT_BOOST
.public GINSENG_CHANCE_3
.public GetMoveBasePowerGround

View File

@@ -1,4 +0,0 @@
#pragma once
.public CanMonsterBeUsedForMissionWrapper
.public MemAlloc
.public sub_020627F4

View File

@@ -1,14 +1,8 @@
#pragma once
.public _020A3CAD
.public _020A46B0
.public _020A46D0
.public _020AFC70
.public _020B0B04
.public _s32_div_f
.public CAFE_MISSION_REWARD_TYPE_WEIGHTS
.public CopyColorToPaletteDataRgba
.public Debug_Print0
.public DEFAULT_MISSION_REWARD_TYPE_WEIGHTS
.public Debug_Print0
.public DirectoryFileMngr_OpenDirectoryFile
.public DungeonSwapIdToIdx
.public EnqueueRender3dTiling
@@ -26,31 +20,36 @@
.public GetScenarioBalance
.public GetType
.public HandleSir0TranslationVeneer
.public HasMonsterBeenAttackedInDungeons
.public ITEM_DELIVERY_TABLE
.public IsForbiddenFloor
.public IsItemAvailableInDungeonGroup
.public IsItemInTimeDarkness
.public IsMonsterMissionAllowed
.public IsMonsterValid
.public IsStoryBeforePoint
.public ITEM_DELIVERY_TABLE
.public MarkPaletteDataAsNeedingUpdate
.public MemAlloc
.public MemcpySimple
.public MemFree
.public MemZero
.public MISSION_BANNED_STORY_MONSTERS
.public MISSION_DUNGEON_UNLOCK_TABLE
.public MISSION_RANK_POINTS
.public MarkPaletteDataAsNeedingUpdate
.public MemAlloc
.public MemFree
.public MemZero
.public MemcpySimple
.public MultiplyByFixedPoint
.public NO_SEND_ITEM_TABLE
.public OUTLAW_MISSION_REWARD_TYPE_WEIGHTS
.public RANK_STRING_PTR_TABLE
.public RESCUE_BIN_UNPACK
.public RandInt
.public RandIntSafe
.public RandRangeSafe
.public RANK_STRING_PTR_TABLE
.public RESCUE_BIN_UNPACK
.public RetrieveFromItemList2
.public UnloadFile
.public _020A3CAD
.public _020A46B0
.public _020A46D0
.public _020AFC70
.public _020B0B04
.public _s32_div_f
.public sub_02001AB0
.public sub_020090A0
.public sub_020090C0
@@ -70,4 +69,3 @@
.public sub_0205E090
.public sub_0206220C
.public sub_02064FE4
.public UnloadFile

View File

@@ -1,6 +1,4 @@
#pragma once
.public _s32_div_f
.public abs
.public CreateInventoryMenu
.public Debug_Print0
.public DeleteWanTableEntryVeneer
@@ -25,6 +23,17 @@
.public MemFree
.public MemZero
.public OBJ_GRAPHICS_CONTROLS_PTR
.public PlaySeByIdVolumeWrapper
.public SetAnimationControlPausedFlag
.public SetAnimationForAnimationControl
.public SetSpriteIdForAnimationControl
.public SwitchAnimationControlToNextFrame
.public TEAM_MEMBER_TABLE_PTR
.public UnkMapRelatedFunc
.public UpdateWindow
.public WAN_TABLE
.public _s32_div_f
.public abs
.public ov10_022BCCB0
.public ov10_022BFE3C
.public ov10_022BFE54
@@ -70,10 +79,6 @@
.public ov11_023061CC
.public ov11_02306C64
.public ov11_02306C9C
.public PlaySeByIdVolumeWrapper
.public SetAnimationControlPausedFlag
.public SetAnimationForAnimationControl
.public SetSpriteIdForAnimationControl
.public strcpy
.public sub_02001808
.public sub_0201C108
@@ -87,7 +92,6 @@
.public sub_02027B1C
.public sub_0202810C
.public sub_0202812C
.public sub_0202830C
.public sub_020287C4
.public sub_02028980
.public sub_0202A0B0
@@ -118,9 +122,4 @@
.public sub_020640DC
.public sub_0206423C
.public sub_020642A8
.public SwitchAnimationControlToNextFrame
.public TEAM_MEMBER_TABLE_PTR
.public UnkMapRelatedFunc
.public UpdateWindow
.public vsprintf
.public WAN_TABLE

View File

@@ -1,13 +1,10 @@
#pragma once
.public _s32_div_f
.public AdvanceFrame
.public ChangeDungeonMusic
.public DUNGEON_PTR
.public DungeonRandInt
.public FIXED_ROOM_PROPERTIES_TABLE
.public IsCurrentFixedRoomBossFight
.public MUSIC_ID_TABLE
.public MusicTableIdxToMusicId
.public ov29_022EAE40
.public RANDOM_MUSIC_ID_TABLE
.public sub_02017B18
.public sub_02017C68

View File

@@ -3,10 +3,8 @@
.public ChangeDungeonMusic
.public DUNGEON_PTR
.public DisplayActions
.public EntityIsValid__022ECDC0
.public GetForcedLossReason
.public GetLeader
.public GetMonsterName
.public HandleFaint
.public IsFloorOver
.public LogMessageByIdWithPopupCheckUser
@@ -19,4 +17,3 @@
.public ov29_02352380
.public ov29_02352390
.public ov29_02353598
.public ov29_0237C974

View File

@@ -1,12 +0,0 @@
#pragma once
.public DUNGEON_PTR
.public EntityIsValid__022F0590
.public ov29_022DE5F0
.public ov29_022EA370
.public ov29_0234B1A4
.public ov29_0234D630
.public ov29_0234D8A0
.public ov29_023535A4
.public ov29_0237C9A0
.public SetAnimationControlPausedFlag
.public WaitUntilAlertBoxPauseIsOver

View File

@@ -0,0 +1,4 @@
#pragma once
.public SetAnimationControlPausedFlag
.public ov29_022EA370
.public ov29_0234D8A0

View File

@@ -1,12 +1,8 @@
#pragma once
.public AFTERMATH_CHANCE
.public DefenderAbilityIsActive__0230A940
.public DUNGEON_PTR
.public DungeonRandOutcome__022EAB20
.public GetTypeMatchup
.public GhostImmunityIsActive
.public IsTypeIneffectiveAgainstGhost
.public ov29_02352838
.public ScrappyShouldActivate
.public TryAftermathExplosion
.public TYPE_MATCHUP_COMBINATOR_TABLE
.public ov29_02352838

View File

@@ -337,26 +337,3 @@ AddFixedPoint64: ; 0x020021C8
stmia r0, {r1, r2}
ldmia sp!, {r3, pc}
arm_func_end AddFixedPoint64
arm_func_start ClampedLn
ClampedLn: ; 0x020021F4
cmp r1, #1
movlt r1, #1
cmp r1, #0x800
ldrge r1, _02002220 ; =0x000007FF
ldr r2, _02002224 ; =NATURAL_LOG_VALUE_TABLE
mov r1, r1, lsl #1
ldrsh r2, [r2, r1]
mov r1, #0
mov r2, r2, lsl #4
stmia r0, {r1, r2}
bx lr
.align 2, 0
_02002220: .word 0x000007FF
_02002224: .word NATURAL_LOG_VALUE_TABLE
arm_func_end ClampedLn
arm_func_start sub_02002228
sub_02002228: ; 0x02002228
bx lr
arm_func_end sub_02002228

View File

@@ -283,42 +283,3 @@ _0200F704:
.align 2, 0
_0200F714: .word BAG_ITEMS_PTR_MIRROR
arm_func_end DecrementStackItem
arm_func_start RemoveItemNoHoleCheck
RemoveItemNoHoleCheck: ; 0x0200F718
stmdb sp!, {r4, lr}
mvn r1, #0
cmp r0, r1
beq _0200F78C
ldr r2, _0200F794 ; =BAG_ITEMS_PTR_MIRROR
mov r1, #6
ldr r2, [r2]
smulbb r1, r0, r1
ldr r2, [r2, #0x384]
ldrb r0, [r2, r1]
add r4, r2, r1
tst r0, #1
movne r0, #1
moveq r0, #0
tst r0, #0xff
beq _0200F78C
ldrb r0, [r4, #1]
cmp r0, #0
beq _0200F768
bl sub_020582E0
_0200F768:
mov r0, r4
bl ItemZInit
ldr r0, _0200F794 ; =BAG_ITEMS_PTR_MIRROR
mov r1, #0x32
ldr r0, [r0]
ldr r0, [r0, #0x384]
bl RemoveEmptyItems
mov r0, #1
ldmia sp!, {r4, pc}
_0200F78C:
mov r0, #0
ldmia sp!, {r4, pc}
.align 2, 0
_0200F794: .word BAG_ITEMS_PTR_MIRROR
arm_func_end RemoveItemNoHoleCheck

View File

@@ -1,23 +1,8 @@
.include "asm/macros.inc"
.include "main_02011554.inc"
.include "main_02011580.inc"
.text
arm_func_start ApplyGummiBoostsToTeamMember
ApplyGummiBoostsToTeamMember: ; 0x02011554
stmdb sp!, {lr}
sub sp, sp, #0xc
mov ip, r0
stmia sp, {r1, r2, r3}
add r0, ip, #0xc
add r1, ip, #6
add r2, ip, #0x12
add r3, ip, #0x14
bl ApplyGummiBoostsGroundMode
add sp, sp, #0xc
ldmia sp!, {pc}
arm_func_end ApplyGummiBoostsToTeamMember
arm_func_start ApplySitrusBerryBoostToGroundMonster
ApplySitrusBerryBoostToGroundMonster: ; 0x02011580
stmdb sp!, {r3, r4, r5, r6, r7, lr}

View File

@@ -1,38 +0,0 @@
.include "asm/macros.inc"
.include "main_0205DFAC.inc"
.text
arm_func_start CountAndPopulateValidMissionTableMonsters
CountAndPopulateValidMissionTableMonsters: ; 0x0205DFAC
stmdb sp!, {r4, r5, r6, r7, r8, sb, sl, lr}
ldrh r6, [r1, #2]
ldrh r8, [r1, #4]
mov sl, r0
mov r7, #0
bl sub_020627F4
mov r4, r0
mov r0, r6, lsl #1
mov r1, #0xf
bl MemAlloc
mov sb, r0
mov r5, r7
add r4, r4, r8, lsl #1
b _0205E008
_0205DFE4:
mov r0, r5, lsl #1
ldrsh r8, [r0, r4]
mov r0, r8
bl CanMonsterBeUsedForMissionWrapper
cmp r0, #0
movne r0, r7, lsl #1
strneh r8, [sb, r0]
addne r7, r7, #1
add r5, r5, #1
_0205E008:
cmp r5, r6
blt _0205DFE4
mov r0, r7
str sb, [sl]
ldmia sp!, {r4, r5, r6, r7, r8, sb, sl, pc}
arm_func_end CountAndPopulateValidMissionTableMonsters

View File

@@ -1,39 +1,8 @@
.include "asm/macros.inc"
.include "main_02062A68.inc"
.include "main_02062AD0.inc"
.text
arm_func_start CanMonsterBeUsedForMission
CanMonsterBeUsedForMission: ; 0x02062A68
stmdb sp!, {r3, r4, r5, lr}
mov r5, r1
bl FemaleToMaleForm
mov r4, r0
bl HasMonsterBeenAttackedInDungeons
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, pc}
mov r0, r4
bl GetBaseForm
cmp r4, r0
movne r0, #0
ldmneia sp!, {r3, r4, r5, pc}
cmp r5, #0
beq _02062AB8
mov r0, r4
bl IsMonsterMissionAllowed
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, pc}
_02062AB8:
mov r0, r4
bl IsMonsterMissionAllowedStory
cmp r0, #0
moveq r0, #0
movne r0, #1
ldmia sp!, {r3, r4, r5, pc}
arm_func_end CanMonsterBeUsedForMission
arm_func_start sub_02062AD0
sub_02062AD0: ; 0x02062AD0
stmdb sp!, {r3, lr}

View File

@@ -1,33 +1,8 @@
.include "asm/macros.inc"
.include "overlay_10_022BCDF4.inc"
.include "overlay_10_022BCE44.inc"
.text
arm_func_start ov10_022BCDF4
ov10_022BCDF4: ; 0x022BCDF4
stmdb sp!, {r3, r4, r5, lr}
mov r5, r0
bl GetWindowContents
mov r4, r0
mov r0, #1
mov r1, #0
strb r0, [r4, #0x1a0]
mov r0, r5
strb r1, [r4, #0x1a1]
sub r1, r1, #4
bl sub_0202830C
ldr r0, [r4, #0xf8]
tst r0, #0x400000
beq _022BCE38
mov r0, r5
add r1, r4, #4
bl sub_02028980
_022BCE38:
mov r0, #5
str r0, [r4, #0x19c]
ldmia sp!, {r3, r4, r5, pc}
arm_func_end ov10_022BCDF4
arm_func_start ov10_022BCE44
ov10_022BCE44: ; 0x022BCE44
stmdb sp!, {r3, lr}

View File

@@ -90,27 +90,3 @@ ov29_022E42E0: ; 0x022E42E0
ov29_022E42E4: ; 0x022E42E4
bx lr
arm_func_end ov29_022E42E4
arm_func_start PlayEffectAnimationEntityStandard
PlayEffectAnimationEntityStandard: ; 0x022E42E8
stmdb sp!, {r3, r4, r5, lr}
sub sp, sp, #0x10
mov r4, r1
mov r5, r0
mov r0, r4
bl GetEffectAnimationWanOffset
mov r2, r0
and r3, r2, #0xff
mov r0, #2
mov ip, #0
stmia sp, {r0, ip}
sub r0, ip, #1
str r0, [sp, #8]
mov r0, r5
mov r1, r4
mov r2, #1
str ip, [sp, #0xc]
bl PlayEffectAnimationEntity
add sp, sp, #0x10
ldmia sp!, {r3, r4, r5, pc}
arm_func_end PlayEffectAnimationEntityStandard

View File

@@ -1,39 +1,8 @@
.include "asm/macros.inc"
.include "overlay_29_022EAD00.inc"
.include "overlay_29_022EAD68.inc"
.text
arm_func_start MusicTableIdxToMusicId
MusicTableIdxToMusicId: ; 0x022EAD00
stmdb sp!, {r4, lr}
mov r1, #0xaa
bl _s32_div_f
ldr r0, _022EAD5C ; =MUSIC_ID_TABLE
mov r1, r1, lsl #1
ldrh r4, [r0, r1]
tst r4, #0x8000
ldreq r0, _022EAD60 ; =0x00007FFF
andeq r0, r4, r0
moveq r0, r0, lsl #0x10
moveq r0, r0, lsr #0x10
ldmeqia sp!, {r4, pc}
mov r0, #4
bl DungeonRandInt
ldr r1, _022EAD60 ; =0x00007FFF
mov r0, r0, lsl #0x10
and r1, r4, r1
ldr r3, _022EAD64 ; =RANDOM_MUSIC_ID_TABLE
mov r1, r1, lsl #0x10
mov r2, r0, asr #0xf
add r0, r3, r1, lsr #13
ldrh r0, [r2, r0]
ldmia sp!, {r4, pc}
.align 2, 0
_022EAD5C: .word MUSIC_ID_TABLE
_022EAD60: .word 0x00007FFF
_022EAD64: .word RANDOM_MUSIC_ID_TABLE
arm_func_end MusicTableIdxToMusicId
arm_func_start ov29_022EAD68
ov29_022EAD68: ; 0x022EAD68
#ifdef JAPAN

View File

@@ -425,23 +425,3 @@ _022ECD0C:
_022ECD7C: .word DUNGEON_PTR
_022ECD80: .word 0x0000025D
arm_func_end DecrementWindCounter
arm_func_start ov29_022ECD84
ov29_022ECD84: ; 0x022ECD84
stmdb sp!, {r4, lr}
mov r4, r0
bl EntityIsValid__022ECDC0
cmp r0, #0
ldmeqia sp!, {r4, pc}
ldr r0, [r4]
cmp r0, #1
ldmneia sp!, {r4, pc}
ldr r1, [r4, #0xb4]
cmp r1, #0
ldmeqia sp!, {r4, pc}
ldr r0, _022ECDBC ; =ov29_0237C974
bl GetMonsterName
ldmia sp!, {r4, pc}
.align 2, 0
_022ECDBC: .word ov29_0237C974
arm_func_end ov29_022ECD84

View File

@@ -1,39 +1,8 @@
.include "asm/macros.inc"
.include "overlay_29_022EFB20.inc"
.include "overlay_29_022EFB84.inc"
.text
arm_func_start ov29_022EFB20
ov29_022EFB20: ; 0x022EFB20
stmdb sp!, {r3, lr}
cmp r0, #0
beq _022EFB48
mov r0, #0xa
bl WaitUntilAlertBoxPauseIsOver
mov r0, #0
bl ov29_0234B1A4
mov r0, #0xa
mov r1, #0x62
bl ov29_022EA370
_022EFB48:
bl ov29_0234D630
ldr r1, _022EFB7C ; =ov29_023535A4
mvn r2, #1
mov r0, #1
strb r2, [r1]
bl ov29_022DE5F0
ldr r1, _022EFB80 ; =ov29_0237C9A0
strh r0, [r1, #2]
mov r0, #0
bl ov29_022DE5F0
ldr r1, _022EFB80 ; =ov29_0237C9A0
strh r0, [r1]
ldmia sp!, {r3, pc}
.align 2, 0
_022EFB7C: .word ov29_023535A4
_022EFB80: .word ov29_0237C9A0
arm_func_end ov29_022EFB20
arm_func_start ov29_022EFB84
ov29_022EFB84: ; 0x022EFB84
stmdb sp!, {r4, lr}
@@ -719,38 +688,3 @@ UnfreezeAnim: ; 0x022F0518
.align 2, 0
_022F0530: .word SetAnimationControlPausedFlag
arm_func_end UnfreezeAnim
arm_func_start ov29_022F0534
ov29_022F0534: ; 0x022F0534
stmdb sp!, {r3, r4, r5, r6, r7, lr}
ldr r4, _022F058C ; =DUNGEON_PTR
mov r7, r0
mov r5, #0
_022F0544:
ldr r0, [r4]
add r0, r0, r5, lsl #2
add r0, r0, #0x12000
#ifdef JAPAN
ldr r6, [r0, #0xad4]
#else
ldr r6, [r0, #0xb78]
#endif
mov r0, r6
bl EntityIsValid__022F0590
cmp r0, #0
beq _022F057C
cmp r7, #0
mov r0, r6
bne _022F0578
bl UnfreezeAnim
b _022F057C
_022F0578:
bl FreezeAnim
_022F057C:
add r5, r5, #1
cmp r5, #0x14
blt _022F0544
ldmia sp!, {r3, r4, r5, r6, r7, pc}
.align 2, 0
_022F058C: .word DUNGEON_PTR
arm_func_end ov29_022F0534

View File

@@ -1,49 +1,8 @@
.include "asm/macros.inc"
.include "overlay_29_0230AA0C.inc"
.include "overlay_29_0230AA8C.inc"
.text
arm_func_start AftermathCheck
AftermathCheck: ; 0x0230AA0C
stmdb sp!, {r4, r5, r6, lr}
sub sp, sp, #8
mov r4, r2
mov r2, #0x76
#ifndef JAPAN
mov r3, #1
#endif
mov r6, r0
mov r5, r1
bl DefenderAbilityIsActive__0230A940
cmp r0, #0
beq _0230AA78
ldr r0, _0230AA84 ; =AFTERMATH_CHANCE
ldrsh r0, [r0]
bl DungeonRandOutcome__022EAB20
cmp r0, #0
ldrne ip, _0230AA88 ; =0x0000026F
cmpne r4, ip
beq _0230AA78
mov r0, #0
str r0, [sp]
mov r0, r6
mov r1, r5
add r2, r5, #4
mov r3, #1
str ip, [sp, #4]
bl TryAftermathExplosion
mov r0, #1
b _0230AA7C
_0230AA78:
mov r0, #0
_0230AA7C:
add sp, sp, #8
ldmia sp!, {r4, r5, r6, pc}
.align 2, 0
_0230AA84: .word AFTERMATH_CHANCE
_0230AA88: .word 0x0000026F
arm_func_end AftermathCheck
arm_func_start GetTypeMatchupBothTypes
GetTypeMatchupBothTypes: ; 0x0230AA8C
stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr}

View File

@@ -7,5 +7,6 @@
bool8 IsBehaviorLoneOutlaw(enum monster_behavior behavior);
// Checks if a behavior ID corresponds to one of the Secret Bazaar NPCs.
bool8 IsSecretBazaarNpcBehavior(enum monster_behavior behavior);
void ov29_022EFB20(bool8 param_1);
#endif //PMDSKY_DUNGEON_LOGIC_6_H

View File

@@ -1,6 +1,10 @@
#ifndef PMDSKY_MAIN_0200224C_H
#define PMDSKY_MAIN_0200224C_H
#include "main_02001BB4.h"
void ClampedLn(struct fixed_point_64 *out, s32 x);
void sub_02002228(u32 param_1);
u16 GetRngSeed(void);
void SetRngSeed(u16 seed);
u16 Rand16Bit();

View File

@@ -3,6 +3,7 @@
#include "item.h"
u32 RemoveItemNoHoleCheck(s16 index);
s16 GetFirstUnequippedItemOfType(s16 type);
u32 RemoveItemNoHoleCheck(s16 index);

View File

@@ -5,5 +5,6 @@
void SwapShopFreeDoublePointer(void** p);
void ApplyGummiBoostsToGroundMonster(struct ground_monster *monster, s16 item_id, int a3, void *a4);
void ApplyGummiBoostsToTeamMember(struct team_member *member, s16 item_id, int a3, void *a4);
#endif

View File

@@ -23,5 +23,6 @@ bool8 CheckMonsterForMissionType(enum mission_type type, union mission_subtype*
bool8 CheckItemForMissionType(u32 r0, union mission_subtype *r1, s16 r2);
bool8 sub_0205D1F4(struct mission *mission);
s32 GenerateMission(struct unk_0205D224 *tmpl, struct mission *mission);
s32 CountAndPopulateValidMissionTableMonsters(s16 **out, struct unk_0205DFAC *spec);
#endif //PMDSKY_MAIN_0205D11C_H

View File

@@ -6,5 +6,6 @@
bool8 CanMonsterBeUsedForMission(s16 id, bool8 flag);
bool8 CanMonsterBeUsedForMissionWrapper(s16 id);
bool8 CanMonsterBeUsedForMission(s16 id, bool8 flag);
#endif

View File

@@ -14,5 +14,6 @@ s32 IsInventoryMenuActive(s32 window_id);
bool8 CheckInventoryMenuField0x1A0(s32 window_id);
s32 ov10_022BCDA8(s32 window_id);
s32 ov10_022BCDBC(s32 window_id);
void ov10_022BCDF4(s32 window_id);
#endif //PMDSKY_OVERLAY_10_022BCC60_H

View File

@@ -3,6 +3,7 @@
#include "dungeon_mode.h"
void PlayEffectAnimationEntityStandard(struct entity *entity, s32 anim_id);
void ov29_022E4338(struct entity *entity);
void ov29_022E4388(struct entity *entity);
void ov29_022E43D8(struct entity *entity);

View File

@@ -1,6 +1,8 @@
#ifndef PMDSKY_OVERLAY_29_022EAC7C_H
#define PMDSKY_OVERLAY_29_022EAC7C_H
#include "dungeon.h"
void PlayLevelUpSound(void);
void PlayDungeonTipSound__022EB63C(void);
void ov29_022EAC9C(void);
@@ -8,5 +10,6 @@ void ov29_022EACAC(void);
void PlayDungeonTipSound__022EB66C(void);
void PlaySeByIdIfNotSilence(s32 id);
void PlayMeByIdIfNot998(s32 id);
enum music_id MusicTableIdxToMusicId(s32 music_table_idx);
#endif

View File

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

View File

@@ -5,6 +5,7 @@
#include "dungeon_mode.h"
void ov29_022F0534(bool8 freeze);
// Checks if an entity pointer points to a valid entity (not entity type 0, which represents no entity).
bool8 EntityIsValid__022F0590(struct entity *entity);
void ov29_022F05B4(struct entity* a, struct entity* b, bool8 freeze);

View File

@@ -5,5 +5,6 @@
// Checks if a monster is holding a certain item that isn't disabled by Klutz.
bool8 ItemIsActive__0230A9DC(struct entity *entity, enum item_id item_id);
bool8 AftermathCheck(struct entity *attacker, struct entity *defender, s32 damage_source);
#endif //PMDSKY_OVERLAY_29_0230A9DC_H

View File

@@ -95,7 +95,7 @@ Static main
Object src/exclusive_item.o
Object asm/main_02010FC4.o
Object src/main_020114F8.o
Object asm/main_02011554.o
Object asm/main_02011580.o
Object src/main_02011830.o
Object asm/main_02011850.o
Object src/main_02011DF0.o
@@ -348,7 +348,6 @@ Static main
Object src/main_0205C73C.o
Object asm/main_0205CA40.o
Object src/main_0205D11C.o
Object asm/main_0205DFAC.o
Object src/main_0205E01C.o
Object src/main_0205E288.o
Object asm/main_0205E48C.o
@@ -363,7 +362,7 @@ Static main
Object src/main_0205ED84.o
Object asm/main_0205EDA4.o
Object src/main_02062A58.o
Object asm/main_02062A68.o
Object asm/main_02062AD0.o
Object src/main_02064FFC.o
Object src/main_02065974.o
Object asm/main_02065998.o
@@ -612,7 +611,7 @@ Overlay OVY_10
After main
Object asm/overlay_10.o
Object src/overlay_10_022BCC60.o
Object asm/overlay_10_022BCDF4.o
Object asm/overlay_10_022BCE44.o
Object src/overlay_10_022BFD58.o
Object asm/overlay_10_022BFF78.o
Object src/overlay_10_022C2574.o
@@ -850,7 +849,7 @@ Overlay OVY_29
Object asm/overlay_29_022EAB50.o
Object src/overlay_29_022EAC34.o
Object src/overlay_29_022EAC7C.o
Object asm/overlay_29_022EAD00.o
Object asm/overlay_29_022EAD68.o
Object src/overlay_29_022EAE14.o
Object asm/overlay_29_022EAE40.o
Object src/overlay_29_022EAEFC.o
@@ -884,7 +883,7 @@ Overlay OVY_29
Object asm/overlay_29_rodata_0235179C.o
Object src/overlay_29_022EFA6C.o
Object src/dungeon_logic_6.o
Object asm/overlay_29_022EFB20.o
Object asm/overlay_29_022EFB84.o
Object src/overlay_29_022F0590.o
Object asm/overlay_29_022F0654.o
Object src/overlay_29_022F0EDC.o
@@ -981,7 +980,7 @@ Overlay OVY_29
Object src/overlay_29_02308FBC.o
Object src/overlay_29_0230A994.o
Object src/overlay_29_0230A9DC.o
Object asm/overlay_29_0230AA0C.o
Object asm/overlay_29_0230AA8C.o
Object src/overlay_29_0230AB58.o
Object asm/overlay_29_0230ABF0.o
Object src/type_effectiveness.o

View File

@@ -3,6 +3,15 @@
#include "dungeon_mode.h"
#include "util.h"
#include "overlay_29_0234BA54.h"
extern s16 ov29_022DE5F0(s32 index);
extern void ov29_022EA370(s32 a, s32 b);
extern int ov29_0234B1A4();
extern void ov29_0234D630(void);
extern s8 ov29_023535A4;
extern s16 ov29_0237C9A0[2];
bool8 IsBehaviorLoneOutlaw(enum monster_behavior behavior)
{
bool8 result;
@@ -28,3 +37,16 @@ bool8 IsSecretBazaarNpcBehavior(enum monster_behavior behavior)
return TRUE;
return FALSE;
}
void ov29_022EFB20(bool8 param_1)
{
if (param_1) {
WaitUntilAlertBoxPauseIsOver(10);
ov29_0234B1A4(0);
ov29_022EA370(10, 0x62);
}
ov29_0234D630();
ov29_023535A4 = -2;
ov29_0237C9A0[1] = ov29_022DE5F0(1);
ov29_0237C9A0[0] = ov29_022DE5F0(0);
}

View File

@@ -1,10 +1,10 @@
#include "main_02000C6C.h"
#include <nitro.h>
#include "main_0200224C.h"
extern u32 _02092448;
extern u32 _02092460;
extern void sub_02002228(u32);
extern void sub_020024D4();
extern void sub_020024E4();
extern void sub_020028AC();

View File

@@ -1,5 +1,24 @@
#include "main_0200224C.h"
extern s16 NATURAL_LOG_VALUE_TABLE[];
void ClampedLn(struct fixed_point_64 *out, s32 x)
{
if (x < 1) {
x = 1;
}
if (x >= 0x800) {
x = 0x7FF;
}
out->lower = NATURAL_LOG_VALUE_TABLE[x] << 4;
out->upper = 0;
}
void sub_02002228(u32 param_1)
{
}
extern u16 PRNG_SEQUENCE_NUM;
u16 GetRngSeed(void)

View File

@@ -1,5 +1,30 @@
#include "main_0200F798.h"
#include "main_0200D81C.h"
#include "item.h"
extern struct bag_items *BAG_ITEMS_PTR_MIRROR;
extern u32 RemoveEmptyItems(struct item *items, s32 count);
extern void sub_020582E0(u8 held_by);
u32 RemoveItemNoHoleCheck(s16 index)
{
if (index != -1) {
struct item *item = &BAG_ITEMS_PTR_MIRROR->bag_items->bag_items[index];
bool8 exists = (item->flags & ITEM_FLAG_EXISTS) != 0;
if (exists) {
if (item->held_by != 0)
sub_020582E0(item->held_by);
ItemZInit(item);
RemoveEmptyItems(BAG_ITEMS_PTR_MIRROR->bag_items->bag_items, INVENTORY_SIZE);
return 1;
}
}
return 0;
}
u32 RemoveFirstUnequippedItemOfType(s16 type)
{
return RemoveItemNoHoleCheck(GetFirstUnequippedItemOfType(type));

View File

@@ -19,3 +19,9 @@ void ApplyGummiBoostsToGroundMonster(struct ground_monster *monster, s16 item_id
ApplyGummiBoostsGroundMode(&monster->id, &monster->iq, monster->offensive_stats,
monster->defensive_stats, item_id, a3, a4);
}
void ApplyGummiBoostsToTeamMember(struct team_member *member, s16 item_id, int a3, void *a4)
{
ApplyGummiBoostsGroundMode((s16 *)&member->id, &member->iq, member->offensive_stats,
member->defensive_stats, item_id, a3, a4);
}

View File

@@ -30,7 +30,6 @@ extern s32 RandIntSafe(s32 n);
extern void ClearMissionData(struct mission *mission);
extern struct mission_deliver_list MISSION_DELIVER_LIST_PTR;
extern s32 CanDungeonBeUsedForMission(enum dungeon_id);
extern s32 CountAndPopulateValidMissionTableMonsters(s16 **out, struct unk_0205DFAC *spec);
extern s32 GetAllPossibleMonsters(s16 **out);
extern u8 GetMissionSpecificFixedRoom(enum mission_type, u32);
extern bool8 IsAvailableItem(s16 item_id);
@@ -744,3 +743,29 @@ s32 GenerateMission(struct unk_0205D224 *tmpl, struct mission *mission)
return 0;
}
s32 CountAndPopulateValidMissionTableMonsters(s16 **out, struct unk_0205DFAC *spec)
{
s16 *base;
s32 i;
s32 n;
s32 k;
s16 v;
s16 *buf;
s32 off;
n = spec->field_0x2;
off = (u16)spec->field_0x4;
k = 0;
base = sub_020627F4();
buf = (s16 *)MemAlloc(n * 2, 0xf);
for (i = 0; i < n; i++) {
v = base[off + i];
if (CanMonsterBeUsedForMissionWrapper(v) != 0) {
buf[k] = v;
k++;
}
}
*out = buf;
return k;
}

View File

@@ -1,6 +1,36 @@
#include "main_02062A58.h"
#include "main_02054BE0.h"
#include "main_0204D188.h"
#include "enums.h"
extern s16 GetBaseForm(s16 id);
extern bool8 IsMonsterMissionAllowed(s16 id);
extern bool8 IsMonsterMissionAllowedStory(s16 id);
bool8 CanMonsterBeUsedForMissionWrapper(s16 id)
{
return CanMonsterBeUsedForMission(id, TRUE);
}
bool8 CanMonsterBeUsedForMission(s16 id, bool8 flag)
{
s16 m;
m = FemaleToMaleForm(id);
if (!HasMonsterBeenAttackedInDungeons(m)) {
return FALSE;
}
if (m != GetBaseForm(m)) {
return FALSE;
}
if (flag) {
if (!IsMonsterMissionAllowed(m)) {
return FALSE;
}
}
if (!IsMonsterMissionAllowedStory(m)) {
return FALSE;
}
return TRUE;
}

View File

@@ -3,6 +3,7 @@
#include "main_02001188.h"
#include "main_02028080.h"
#include "main_020282F4.h"
extern void sub_02028980(s32 window_id, void *p);
extern void sub_020333FC(void *p);
@@ -116,3 +117,16 @@ s32 ov10_022BCDBC(s32 window_id)
return -1;
}
void ov10_022BCDF4(s32 window_id)
{
struct unk_0202AAA8 *w = GetWindowContents(window_id);
w->field_0x1A0 = 1;
w->field_0x1A1 = 0;
sub_0202830C(window_id, -4);
if (w->field_0xF8 & 0x400000) {
sub_02028980(window_id, (void *) w + 4);
}
w->field_0x19C = 5;
}

View File

@@ -102,14 +102,12 @@ extern void InitPreprocessorArgs(struct preprocessor_args *);
extern s32 IsScrollBoxActive(s8); extern void ShowDialogueBox(s8); extern void ShowStringIdInDialogueBox(s8, s32, s32, void *); extern void ov11_022DC504(void);
extern u8 *strcpy(u8 *dest, const u8 *src);
extern void ApplyGummiBoostsToTeamMember(struct team_member *, s16, int, void *);
extern s8 CreateInventoryMenuOuter(s32, s32, s32, void *, void *, void *, u8);
extern bool8 IsBagNotEmpty(void);
extern u8 PopInventoryMenuField0x1A3(s32 window_id);
extern void SetItemAcquired(struct item *);
extern void SortItemsInBag(void);
extern void *memcpy(void *, const void *, u32);
extern void ov10_022BCDF4(s32 window_id);
extern void ov11_02308D48(void);
extern void *ov11_02308DD8(void *);
extern void ov11_02308EDC(void);

View File

@@ -1,5 +1,16 @@
#include "overlay_29_022E4338.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)
{
PlayEffectAnimationEntity(entity, anim_id, 1, GetEffectAnimationWanOffset(anim_id),
2, 0, -1, 0);
}
extern s32 GetEffectAnimationWanOffset(s32 id);
extern void PlayEffectAnimationEntity(struct entity *entity, s32 id, s32 a, u8 b,

View File

@@ -1,5 +1,10 @@
#include "overlay_29_022EAC7C.h"
#include "dg_random.h"
extern u16 MUSIC_ID_TABLE[170];
extern enum music_id RANDOM_MUSIC_ID_TABLE[30][4];
extern void sub_02017C50(s32 id);
extern void sub_02017C74(s32, s32);
@@ -45,3 +50,14 @@ void PlayMeByIdIfNot998(s32 id)
sub_02017C50(id);
}
enum music_id MusicTableIdxToMusicId(s32 music_table_idx)
{
s32 music = MUSIC_ID_TABLE[music_table_idx % 170];
if (music & 0x8000) {
s16 rand = DungeonRandInt(4);
return RANDOM_MUSIC_ID_TABLE[(u16)(music & 0x7FFF)][rand];
}
return (enum music_id)(music & 0x7FFF);
}

View File

@@ -1,5 +1,19 @@
#include "overlay_29_022ECDC0.h"
#include "dungeon_util_static.h"
#include "overlay_29_023000E4.h"
extern char ov29_0237C974[40];
void ov29_022ECD84(struct entity *entity)
{
if (!EntityIsValid__022ECDC0(entity))
return;
if (entity->type != ENTITY_MONSTER)
return;
if (entity->info == 0)
return;
GetMonsterName(ov29_0237C974, (struct monster *)entity->info);
}
bool8 EntityIsValid__022ECDC0(struct entity *entity)
{

View File

@@ -1,10 +1,31 @@
#include "overlay_29_022F0590.h"
#include "dungeon.h"
extern struct dungeon *DUNGEON_PTR[];
extern bool8 EntityIsValid__022F0590(struct entity *entity);
extern void FreezeAnim(struct entity *e);
extern void UnfreezeAnim(struct entity *e);
void ov29_022F0534(bool8 freeze)
{
s32 i;
for (i = 0; i < 20; i++)
{
struct entity *entity = DUNGEON_PTR[0]->active_monster_ptrs[i];
if (EntityIsValid__022F0590(entity))
{
if (!freeze)
UnfreezeAnim(entity);
else
FreezeAnim(entity);
}
}
}
extern void ov29_022F0AE0(void);
extern void ov29_0234D668(void);
@@ -16,6 +37,9 @@ extern void ov29_022EA370(s32 a, s32 b);
extern s32 TalkToSecretBazaarNpc(s32 a, struct entity *b, s32 c, s32 d, s32 e);
#include "dungeon_util_static.h"
extern void FreezeAnim(struct entity *e);
extern void UnfreezeAnim(struct entity *e);
bool8 EntityIsValid__022F0590(struct entity *entity)
{
if (entity == NULL)

View File

@@ -51,6 +51,8 @@
#include "overlay_29_022E9FC0.h"
#include "overlay_29_0234B340.h"
#include "overlay_29_0234B4BC.h"
#include "overlay_29_022EAC7C.h"
#include "overlay_29_022ECDC0.h"
struct unk_023535DC {
u8 field_0x0;
@@ -99,7 +101,6 @@ extern s16 ov10_022C45C0;
extern s16 ov10_022C4638;
extern s16 ov10_022C467C;
extern void AddExpSpecial(struct entity* attacker, struct entity* defender, s32 base_exp);
extern bool8 AftermathCheck(struct entity *attacker, struct entity *defender, s32 damage_source);
extern void ChangeMonsterAnimation(struct entity *entity, s32 animation_id, s32 direction);
extern void ChangeMonsterAnimationToIdle(struct entity* monster, enum direction_id direction);
extern void DisplayAnimatedNumbers(s32 amount, struct entity *entity, bool8 display_sign, s32 number_color);
@@ -114,7 +115,6 @@ extern void HandleFaint(struct entity *fainted_entity, s32 damage_source, struct
extern bool8 IsMonsterIdInNormalRangeVeneer(enum monster_id monster_id);
extern void LogMessageByIdWithPopupCheckUser(struct entity *user, u32 message_id);
extern void MoveMonsterToPos(struct entity* entity, s32 x_pos, s32 y_pos, bool8 reset_prev_pos_fields);
extern enum music_id MusicTableIdxToMusicId(s32 music_table_idx);
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();
@@ -136,10 +136,7 @@ extern int ov29_022E5478();
extern int ov29_022E550C();
extern void ov29_022E81F8(void);
extern void ov29_022EA370(s32 a, s32 b);
extern int ov29_022ECD84();
extern int ov29_022EFB20();
extern int ov29_022EFB84();
extern int ov29_022F0534();
extern int ov29_022F0780();
extern int ov29_022F9AF4();
extern int ov29_022FB98C();

View File

@@ -2,6 +2,13 @@
#include "dungeon_items.h"
#include "dungeon_pokemon_attributes.h"
#include "overlay_29_0230A994.h"
#include "enums.h"
extern bool8 DungeonRandOutcome__022EAB20(s32 percentChance);
extern void TryAftermathExplosion(struct entity *attacker, struct entity *defender, struct position *pos, s32 radius, s32 a, s32 damage_source);
extern const s16 AFTERMATH_CHANCE;
bool8 ItemIsActive__0230A9DC(struct entity *entity, enum item_id item_id)
{
if (AbilityIsActiveVeneer(entity, ABILITY_KLUTZ))
@@ -9,3 +16,18 @@ bool8 ItemIsActive__0230A9DC(struct entity *entity, enum item_id item_id)
return HasHeldItem(entity, item_id);
}
bool8 AftermathCheck(struct entity *attacker, struct entity *defender, s32 damage_source)
{
#ifdef JAPAN
if (DefenderAbilityIsActive__0230A940(attacker, defender, ABILITY_AFTERMATH)
#else
if (DefenderAbilityIsActive__0230A940(attacker, defender, ABILITY_AFTERMATH, TRUE)
#endif
&& DungeonRandOutcome__022EAB20(AFTERMATH_CHANCE)
&& damage_source != DAMAGE_SOURCE_EXPLOSION) {
TryAftermathExplosion(attacker, defender, &defender->pos, 1, 0, DAMAGE_SOURCE_EXPLOSION);
return TRUE;
}
return FALSE;
}

View File

@@ -27,6 +27,7 @@
#include "dungeon_util_2.h"
#include "overlay_29_02338350.h"
#include "overlay_29_0234B340.h"
#include "main_0200224C.h"
extern struct dungeon *DUNGEON_PTR;
extern u8 GetMonsterGenderVeneer(s16 monster_id);
@@ -35,7 +36,6 @@ extern u8 ExclusiveItemDefenseBoost(struct entity *entity, s32 idx);
extern int MoveIsNotPhysical(enum move_id move_id);
extern s32 FixedPoint64ToInt(struct fixed_point_64 *x);
extern void AddFixedPoint64(struct fixed_point_64 *out, struct fixed_point_64 *a, struct fixed_point_64 *b);
extern void ClampedLn(struct fixed_point_64 *out, s32 x);
extern int IsRecoilMove(enum move_id move_id);
extern void PlayEffectAnimation0x1A9__022E6130(struct entity *entity);
extern void PlayEffectAnimation0x1A9__022E617C(struct entity *entity);

View File

@@ -25,6 +25,7 @@
#include "overlay_29_023061A8.h"
#include "overlay_29_022E99F0.h"
#include "overlay_29_02305C04.h"
#include "overlay_29_022E4338.h"
#ifdef JAPAN
#define MESSAGE_DE6 0xB26
@@ -67,7 +68,6 @@ extern void WaitUntilAlertBoxTextIsLoadedWrapper(void);
extern void EnsureCanStandCurrentTile(struct entity *entity);
extern void ov29_022E543C(struct entity *entity);
extern void ov29_022E53F0(struct entity *entity);
extern void PlayEffectAnimationEntityStandard(struct entity *entity, s32 anim_id);
extern void ov29_022F42F8(struct entity *entity);
extern void EndMagnetRiseStatus(struct entity *user, struct entity *target);
extern void TickNoSlipCap(struct entity *entity);