Decompile 11 more callees; give them headers and drop 40 call-site declarations

Each function 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_020517D4.c           GetRankUpEntry
  main_02001188.c           MemAlloc
  main_0203088C.c           CloseAdvancedTextBox
  main_020114F8.c           ApplyGummiBoostsToGroundMonster
  main_0205283C.c           GetExp
  overlay_29_02305C04.c     EndNegativeStatusConditionWrapper
  overlay_29_02338350.c     NearbyAllyIqSkillIsEnabled
  overlay_29_022E9FC0.c     AdvanceFrame
  overlay_29_022E99F0.c     TickStatusTurnCounter
  overlay_29_0234B4BC.c     LogMessageByIdWithPopup
  overlay_29_0234B340.c     LogMessageByIdWithPopupCheckUserTarget

All eleven sat at the head or tail of their .s, so every one merges into the
adjacent source file and no assembly file is split.

Forty call-site declarations of these functions are replaced by an include of
the owning header. Two of them disagreed with the real signature, and one had to
be fixed for the tree to compile at all:

  MemAlloc      was declared six different ways. src/overlay_24_end.c spelled it
                `void* MemAlloc(s32, s32);` -- signed -- and that file already
                includes main_02001188.h, so the contradiction became a hard
                compile error the moment MemAlloc had a header to contradict.
                It had been harmless only because the function had none.
  AdvanceFrame  was declared `void AdvanceFrame(u8);` in two overlay_31 files
                against the real u32. Byte-neutral in practice, since every call
                site passes the literal 0x62, but wrong.

struct unk_020517F4 was defined file-locally in src/main_0203D538.c. It now has
one definition, in include/main_020517D4.h, and both local copies are gone --
otherwise including that header where GetRankUpEntry is called would collide.

Two generated headers are made self-contained. extract_function.py emits a
header that names types it does not include, and since the .c includes it first,
the prototype builds its own scoped tag: include/main_020114F8.h declaring
`struct ground_monster *` before common.h defines it made 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 00:32:46 -07:00
parent 3fd44e5988
commit 7e1755ddf8
69 changed files with 174 additions and 217 deletions

View File

@@ -1,4 +1,8 @@
#pragma once
.public DEFAULT_MEMORY_ARENA_MEMORY
.public Debug_FatalError
.public Debug_Print0
.public MEMORY_ALLOCATION_ARENA_GETTERS
.public _02090B40
.public _02090B70
.public _02090BA0
@@ -7,11 +11,6 @@
.public _020B3384
.public _020B33A0
.public _020B33C0
.public Debug_FatalError
.public Debug_Print0
.public DEFAULT_MEMORY_ARENA_MEMORY
.public MemLocateSet
.public MEMORY_ALLOCATION_ARENA_GETTERS
.public sub_02002C40
.public sub_02002CAC
.public sub_02002CB4

View File

@@ -1,9 +1,9 @@
#pragma once
.public ApplyGummiBoostsGroundMode
.public CALCIUM_STAT_BOOST
.public GINSENG_CHANCE_3
.public GetMoveBasePowerGround
.public GetMoveMaxGinsengBoostGround
.public GINSENG_CHANCE_3
.public IRON_STAT_BOOST
.public LIFE_SEED_HP_BOOST
.public ModifyDefensiveStat

View File

@@ -1,8 +1,6 @@
#pragma once
.public DeleteWindow
.public GetSelectedItemOnPage
.public GetSelectedMenuItemIdx
.public GetWindowContents
.public MemFree
.public sub_020289B8
.public sub_02028A08

View File

@@ -1,13 +1,12 @@
#pragma once
.public _020B09B0
.public CopyColorToPaletteDataRgba
.public MTi_CpuClear32
.public MTi_CpuCopy32
.public MarkPaletteDataAsNeedingUpdate
.public MemAlloc
.public MemFree
.public MemZero
.public MTi_CpuClear32
.public MTi_CpuCopy32
.public RANK_UP_TABLE
.public _020B09B0
.public sub_0200302C
.public sub_020030FC
.public sub_0200A124

View File

@@ -1,11 +1,10 @@
#pragma once
.public _s32_div_f
.public ChangeSimpleObjTexture
.public DisplayMonstersAndItems
.public DisplayUi
.public DUNGEON_BUTTON_INPUT
.public DUNGEON_FRAMES_PASSED
.public DUNGEON_PTR
.public DisplayMonstersAndItems
.public DisplayUi
.public FlashLeaderIcon
.public GetAlertBoxLoadingStatus
.public GetBottomScreenOption
@@ -14,6 +13,10 @@
.public HandleTopScreenFades
.public InitWeirdMinimapMatrix
.public OBJ_GRAPHICS_CONTROLS_PTR
.public RenderWeather3D
.public UpdateCamera
.public UpdateMinimap
.public _s32_div_f
.public ov29_022DD8B4
.public ov29_022DDEF8
.public ov29_022DE11C
@@ -30,7 +33,4 @@
.public ov29_0234B854
.public ov29_02353540
.public ov29_02353560
.public RenderWeather3D
.public sub_02051E20
.public UpdateCamera
.public UpdateMinimap

View File

@@ -1,5 +1,5 @@
#pragma once
.public LogMessage
.public ov29_022E2CA0
.public ShouldDisplayEntityWrapper
.public StringFromId
.public ov29_022E2CA0

View File

@@ -283,14 +283,3 @@ _02001148:
_02001168: .word _02090B40
_0200116C: .word _02090BA0
arm_func_end SplitMemBlock
arm_func_start MemAlloc
MemAlloc: ; 0x02001170
ldr ip, _02001184 ; =MemLocateSet
mov r2, r1
mov r1, r0
mov r0, #0
bx ip
.align 2, 0
_02001184: .word MemLocateSet
arm_func_end MemAlloc

View File

@@ -1,23 +1,8 @@
.include "asm/macros.inc"
.include "main_02011528.inc"
.include "main_02011554.inc"
.text
arm_func_start ApplyGummiBoostsToGroundMonster
ApplyGummiBoostsToGroundMonster: ; 0x02011528
stmdb sp!, {lr}
sub sp, sp, #0xc
mov ip, r0
stmia sp, {r1, r2, r3}
add r0, ip, #4
add r1, ip, #8
add r2, ip, #0xc
add r3, ip, #0xe
bl ApplyGummiBoostsGroundMode
add sp, sp, #0xc
ldmia sp!, {pc}
arm_func_end ApplyGummiBoostsToGroundMonster
arm_func_start ApplyGummiBoostsToTeamMember
ApplyGummiBoostsToTeamMember: ; 0x02011554
stmdb sp!, {lr}

View File

@@ -1,21 +1,8 @@
.include "asm/macros.inc"
.include "main_020308A0.inc"
.include "main_020308C4.inc"
.text
arm_func_start CloseAdvancedTextBox
CloseAdvancedTextBox: ; 0x020308A0
stmdb sp!, {r3, r4, r5, lr}
mov r5, r0
bl GetWindowContents
mov r4, r0
mov r0, r5
bl DeleteWindow
mov r0, r4
bl MemFree
ldmia sp!, {r3, r4, r5, pc}
arm_func_end CloseAdvancedTextBox
arm_func_start IsAdvancedTextBoxActive
IsAdvancedTextBoxActive: ; 0x020308C4
stmdb sp!, {r3, lr}

View File

@@ -1,17 +1,8 @@
.include "asm/macros.inc"
.include "main_020517F4.inc"
.include "main_02051804.inc"
.text
arm_func_start GetRankUpEntry
GetRankUpEntry: ; 0x020517F4
ldr r1, _02051800 ; =RANK_UP_TABLE
add r0, r1, r0, lsl #4
bx lr
.align 2, 0
_02051800: .word RANK_UP_TABLE
arm_func_end GetRankUpEntry
arm_func_start sub_02051804
sub_02051804: ; 0x02051804
stmdb sp!, {r4, lr}

View File

@@ -1,22 +1,8 @@
.include "asm/macros.inc"
.include "overlay_29_022E9A44.inc"
.include "overlay_29_022E9A6C.inc"
.text
arm_func_start TickStatusTurnCounter
TickStatusTurnCounter: ; 0x022E9A44
ldrb r1, [r0]
cmp r1, #0x7f
moveq r0, r1
bxeq lr
cmp r1, #0
moveq r0, r1
subne r1, r1, #1
strneb r1, [r0]
andne r0, r1, #0xff
bx lr
arm_func_end TickStatusTurnCounter
arm_func_start ov29_022E9A6C
ov29_022E9A6C: ; 0x022E9A6C
ldrh r2, [r0]

View File

@@ -1,24 +1,8 @@
.include "asm/macros.inc"
.include "overlay_29_022E9FE0.inc"
.include "overlay_29_022EA008.inc"
.text
arm_func_start AdvanceFrame
AdvanceFrame: ; 0x022E9FE0
stmdb sp!, {r3, lr}
ldr r1, _022EA004 ; =ov29_02353560
ldrb r1, [r1, #3]
cmp r1, #0
beq _022E9FFC
bl ov29_022EA2A4
ldmia sp!, {r3, pc}
_022E9FFC:
bl ov29_022EA324
ldmia sp!, {r3, pc}
.align 2, 0
_022EA004: .word ov29_02353560
arm_func_end AdvanceFrame
arm_func_start ov29_022EA008
ov29_022EA008: ; 0x022EA008
#ifdef JAPAN

View File

@@ -1,17 +1,8 @@
.include "asm/macros.inc"
.include "overlay_29_02305C28.inc"
.include "overlay_29_02305C3C.inc"
.text
arm_func_start EndNegativeStatusConditionWrapper
EndNegativeStatusConditionWrapper: ; 0x02305C28
stmdb sp!, {r3, lr}
mov ip, #0
str ip, [sp]
bl EndNegativeStatusCondition
ldmia sp!, {r3, pc}
arm_func_end EndNegativeStatusConditionWrapper
arm_func_start TransferNegativeStatusCondition
TransferNegativeStatusCondition: ; 0x02305C3C
#ifdef JAPAN

View File

@@ -301,15 +301,3 @@ _02338274:
.align 2, 0
_02338284: .word DIRECTIONS_XY
arm_func_end ov29_023381C0
arm_func_start NearbyAllyIqSkillIsEnabled
NearbyAllyIqSkillIsEnabled: ; 0x02338288
stmdb sp!, {r3, lr}
mov r2, #0
bl ov29_023381C0
cmp r0, #0
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
ldmia sp!, {r3, pc}
arm_func_end NearbyAllyIqSkillIsEnabled

View File

@@ -1,33 +1,8 @@
.include "asm/macros.inc"
.include "overlay_29_0234B350.inc"
.include "overlay_29_0234B3A4.inc"
.text
arm_func_start LogMessageByIdWithPopupCheckUserTarget
LogMessageByIdWithPopupCheckUserTarget: ; 0x0234B350
stmdb sp!, {r3, r4, r5, r6, r7, lr}
mov r6, r1
mov r4, #0
mov r7, r0
mov r5, r2
bl ShouldDisplayEntityWrapper
cmp r0, #0
movne r4, #1
mov r0, r6
bl ShouldDisplayEntityWrapper
cmp r0, #0
movne r4, #1
cmp r4, #0
ldmeqia sp!, {r3, r4, r5, r6, r7, pc}
mov r0, r5
bl StringFromId
mov r1, r0
mov r0, r7
mov r2, #1
bl LogMessage
ldmia sp!, {r3, r4, r5, r6, r7, pc}
arm_func_end LogMessageByIdWithPopupCheckUserTarget
arm_func_start LogMessageWithPopupCheckUserTarget
LogMessageWithPopupCheckUserTarget: ; 0x0234B3A4
stmdb sp!, {r3, r4, r5, r6, r7, lr}
@@ -100,16 +75,3 @@ LogMessageByIdWithPopupCheckUserUnknown: ; 0x0234B444
bl LogMessage
ldmia sp!, {r3, r4, r5, r6, r7, pc}
arm_func_end LogMessageByIdWithPopupCheckUserUnknown
arm_func_start LogMessageByIdWithPopup
LogMessageByIdWithPopup: ; 0x0234B498
stmdb sp!, {r4, lr}
mov r4, r0
mov r0, r1
bl StringFromId
mov r1, r0
mov r0, r4
mov r2, #1
bl LogMessage
ldmia sp!, {r4, pc}
arm_func_end LogMessageByIdWithPopup

View File

@@ -1,6 +1,7 @@
#ifndef PMDSKY_MAIN_02001188_H
#define PMDSKY_MAIN_02001188_H
void* MemAlloc(u32 len, u32 flags);
// Unclear if these structs match, since they haven't been used other than in extern prototypes. Hopefully they do, though.
struct mem_block {
u32 content_flags; // Bit 0: in_use. Bit 1: object. Bit 2: arena. Bits 3-31: Unused?

View File

@@ -1,6 +1,9 @@
#ifndef PMDSKY_MAIN_020114F8_H
#define PMDSKY_MAIN_020114F8_H
#include "common.h"
void SwapShopFreeDoublePointer(void** p);
void ApplyGummiBoostsToGroundMonster(struct ground_monster *monster, s16 item_id, int a3, void *a4);
#endif

View File

@@ -2,5 +2,6 @@
#define PMDSKY_MAIN_0203088C_H
void SetAdvancedTextBoxState5(s32 window_id);
void CloseAdvancedTextBox(s32 window_id);
#endif

View File

@@ -4,5 +4,13 @@
// Returns the player's bag capacity for a given point in the game.
u32 GetBagCapacity(s32 scenario_balance);
u32 GetBagCapacitySpecialEpisode(s32 se_type);
struct unk_020517F4 {
u8 field_0x0[8];
s32 field_0x8;
s16 field_0xc;
u8 field_0xe[2];
};
struct unk_020517F4* GetRankUpEntry(s32 rank);
#endif //PMDSKY_MAIN_020517D4_H

View File

@@ -6,5 +6,6 @@
struct position* FindClosestUnoccupiedTileWithin2(struct position* out, struct position* origin, bool8 a);
struct position* FindFarthestUnoccupiedTileWithin2(struct position* out, struct position* origin, bool8 a);
struct position* FindUnoccupiedTileWithin3(struct position* out, struct position* origin, bool8 a);
u8 TickStatusTurnCounter(u8 *counter);
#endif

View File

@@ -3,5 +3,6 @@
u8 ov29_022E9FC0(void);
void ov29_022E9FD0(u8 value);
void AdvanceFrame(u32 param_1);
#endif

View File

@@ -5,5 +5,6 @@
// Checks if an entity pointer points to a valid entity (not entity type 0, which represents no entity).
bool8 EntityIsValid__02305C04(struct entity *entity);
void EndNegativeStatusConditionWrapper(struct entity *user, struct entity *target, bool8 displayMessage, bool8 fromMove);
#endif //PMDSKY_OVERLAY_29_02305C04_H

View File

@@ -3,6 +3,7 @@
#include "dungeon_mode.h"
bool8 NearbyAllyIqSkillIsEnabled(struct entity *entity, enum iq_skill_id iq_skill);
struct entity* FindAdjacentEnemy(struct entity *monster);
bool8 IsAdjacentToEnemyIgnoreTreatment(struct entity *monster);

View File

@@ -6,5 +6,6 @@
#include "move.h"
void LogMessageQuiet(struct entity *user, const char *message);
void LogMessageByIdWithPopupCheckUserTarget(struct entity *user, struct entity *target, u32 message_id);
#endif

View File

@@ -5,6 +5,7 @@
#include "item.h"
#include "move.h"
void LogMessageByIdWithPopup(struct entity *user, s32 message_id);
void LogMessageWithPopup(struct entity *user, const char *message);
#endif

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_02011528.o
Object asm/main_02011554.o
Object src/main_02011830.o
Object asm/main_02011850.o
Object src/main_02011DF0.o
@@ -188,7 +188,7 @@ Static main
Object src/main_020307A4.o
Object src/main_0203083C.o
Object src/main_0203088C.o
Object asm/main_020308A0.o
Object asm/main_020308C4.o
Object src/main_02030A18.o
Object src/main_02030A40.o
Object asm/main_02030A90.o
@@ -282,7 +282,7 @@ Static main
Object src/iq_skills.o
Object asm/main_rodata_020A20B1.o
Object src/main_020517D4.o
Object asm/main_020517F4.o
Object asm/main_02051804.o
Object src/main_02051FF0.o
Object asm/main_02052060.o
Object src/main_020526EC.o
@@ -841,9 +841,9 @@ Overlay OVY_29
Object src/dg_uty.o
Object asm/overlay_29_022E9628.o
Object src/overlay_29_022E99F0.o
Object asm/overlay_29_022E9A44.o
Object asm/overlay_29_022E9A6C.o
Object src/overlay_29_022E9FC0.o
Object asm/overlay_29_022E9FE0.o
Object asm/overlay_29_022EA008.o
Object src/overlay_29_022EA968.o
Object src/overlay_29_022EA9CC.o
Object src/dg_random.o
@@ -968,7 +968,7 @@ Overlay OVY_29
Object src/overlay_29_0230558C.o
Object asm/overlay_29_023055B0.o
Object src/overlay_29_02305C04.o
Object asm/overlay_29_02305C28.o
Object asm/overlay_29_02305C3C.o
Object src/overlay_29_023061A8.o
Object asm/overlay_29_02306258.o
Object src/overlay_29_02306728.o
@@ -1282,7 +1282,7 @@ Overlay OVY_29
Object src/overlay_29_0234B104.o
Object asm/overlay_29_0234B130.o
Object src/overlay_29_0234B340.o
Object asm/overlay_29_0234B350.o
Object asm/overlay_29_0234B3A4.o
Object src/overlay_29_0234B4BC.o
Object asm/overlay_29_0234B4CC.o
Object src/overlay_29_0234BA54.o

View File

@@ -4,8 +4,8 @@ extern const struct unk_02094C18 _02094C18;
#include "file_rom.h"
#include "debug.h"
#include "main_02001188.h"
extern void* MemAlloc(u32 len, u32 flags);
extern char STRING_FILE_DIRECTORY_INIT;

View File

@@ -1,7 +1,7 @@
#include "directory_file_mngr.h"
#include "directory_file.h"
#include "main_02001188.h"
extern void* MemAlloc(u32 len, u32 flags);
extern void MemZero(void* ptr, u32 len);
extern struct directory *DIRECTORY_FILES_EXTRACTED;

View File

@@ -12,6 +12,8 @@
#include "moves_1.h"
#include "overlay_29_02344AF8.h"
#include "dungeon_util_2.h"
#include "overlay_29_022E9FC0.h"
#include "overlay_29_0234B340.h"
#ifdef JAPAN
#define CURVED_PROJECTILE_LOG_MESSAGE_1 0x920
@@ -30,11 +32,9 @@ extern void ov29_0234B4CC(bool8 val);
extern s32 SinAbs4096(s32 x);
extern bool8 DisplayThrownItemShadow(s32 x, s32 y, u8 index);
extern bool8 DisplayItem(struct entity *item, bool8 hallucinate, u8 on_floor, u8 dir, u8 priority);
extern void AdvanceFrame(u32 param_1);
extern bool8 TwoTurnMoveForcedMiss(struct entity *target, struct move *move);
extern bool8 DoesProjectileHitTarget(struct entity *user, struct entity *target);
extern void ChangeMonsterAnimationToHurt(struct entity *monster, u32 direction);
extern void LogMessageByIdWithPopupCheckUserTarget(struct entity *user, struct entity *target, u32 message_id);
extern bool8 TryEndPetrifiedOrSleepStatus(struct entity *user, struct entity *target);
extern bool8 SpawnDroppedItem(struct entity *entity, struct entity *item_entity, struct item *item, bool8 param_4, struct position *dir_xy, u32 param_6);

View File

@@ -7,7 +7,6 @@
#define VRAM 0x6000000
extern void FileClose(struct file_stream* file);
extern void* MemAlloc(u32 len, u32 flags);
extern s32 sprintf(u8* str, const u8* format, ...);
extern void LoadFileFromRom(struct iovec* iov, const char* filepath, u32 flags);

View File

@@ -1,5 +1,12 @@
#include "main_02001188.h"
extern void *MemLocateSet(struct mem_arena *arena, u32 len, u32 flags);
void* MemAlloc(u32 len, u32 flags)
{
return MemLocateSet(0, len, flags);
}
extern void MemLocateUnset(struct mem_arena *arena, void *ptr);
void MemFree(void * ptr)

View File

@@ -1,5 +1,8 @@
#include "main_020114F8.h"
#include "main_02001188.h"
#include "common.h"
extern void ApplyGummiBoostsGroundMode(s16 *monster_id, u16 *iq, u8 *offensive_stats, u8 *defensive_stats, s16 item_id, int a6, void *a7);
void SwapShopFreeDoublePointer(void** p)
{
@@ -10,3 +13,9 @@ void SwapShopFreeDoublePointer(void** p)
MemFree(*p);
*p = NULL;
}
void ApplyGummiBoostsToGroundMonster(struct ground_monster *monster, s16 item_id, int a3, void *a4)
{
ApplyGummiBoostsGroundMode(&monster->id, &monster->iq, monster->offensive_stats,
monster->defensive_stats, item_id, a3, a4);
}

View File

@@ -8,3 +8,12 @@ void SetAdvancedTextBoxState5(s32 window_id)
w->field_0x1BC = 5;
}
void CloseAdvancedTextBox(s32 window_id)
{
void *contents;
contents = GetWindowContents(window_id);
DeleteWindow(window_id);
MemFree(contents);
}

View File

@@ -17,13 +17,7 @@
#include "main_0203755C.h"
#include "progression.h"
#include "script_variable.h"
struct unk_020517F4 {
u8 field_0x0[8];
s32 field_0x8;
s16 field_0xc;
u8 field_0xe[2];
};
#include "main_020517D4.h"
struct unk_020AFE74 {
s32 field_0x0;
@@ -98,7 +92,6 @@ extern void sub_02045FD0(struct item *out);
extern bool8 AddItemToStorage(struct item *item);
extern void InitUnkStorageStruct0x410(struct item *, u8);
extern s32 GetRank(void);
extern struct unk_020517F4 *GetRankUpEntry(s32 rank);
extern void sub_0203F00C(void);
extern void MissionRewardCloseAllBoxes(void);
extern struct ground_monster *sub_02055D4C(struct ground_monster *mon);

View File

@@ -2,7 +2,6 @@
#include "main_02042AF8.h"
#include "main_02001188.h"
void *MemAlloc(u32 size, u32 nmemb);
s32 IsBagItemIndexSelected(s32 idx)
{

View File

@@ -1,6 +1,8 @@
#include "main_020517D4.h"
#include "enums.h"
extern struct unk_020517F4 RANK_UP_TABLE[];
// Array of 4-byte integers containing the bag capacity for each bag level.
const u32 BAG_CAPACITY_TABLE[8] = { 16, 24, 32, 40, 40, 40, 48, 48 };
const u32 BAG_CAPACITY_TABLE_SPECIAL_EPISODES[NUM_SPECIAL_EPISODES] =
@@ -21,3 +23,8 @@ u32 GetBagCapacitySpecialEpisode(s32 se_type)
{
return BAG_CAPACITY_TABLE_SPECIAL_EPISODES[se_type];
}
struct unk_020517F4* GetRankUpEntry(s32 rank)
{
return &RANK_UP_TABLE[rank];
}

View File

@@ -1,9 +1,9 @@
#include "main_02051FF0.h"
#include "main_02008BD4.h"
#include "main_02001188.h"
extern void LoadFileFromRom(struct iovec *handle, u32 fileId, s32 param2);
extern s32 GetAtSize(void *data);
extern void *MemAlloc(u32 size, u32 heapId);
extern void DecompressAtNormalVeneer(void *dest, u32 size, void *src);
s32 sub_02051FF0(u32 fileId, void **outPtr, s32 param2)

View File

@@ -28,7 +28,6 @@ extern const char _020A3B18[];
extern s32 RandIntSafe(s32 n);
extern void ClearMissionData(struct mission *mission);
extern void *MemAlloc(u32 len, u32 flags);
extern struct mission_deliver_list MISSION_DELIVER_LIST_PTR;
extern s32 CanDungeonBeUsedForMission(enum dungeon_id);
extern s32 CountAndPopulateValidMissionTableMonsters(s16 **out, struct unk_0205DFAC *spec);

View File

@@ -11,6 +11,7 @@
#include "overlay_29_02344AF8.h"
#include "dungeon_util_2.h"
#include "overlay_29_022E3F20.h"
#include "overlay_29_0234B340.h"
extern u8* AllocateTemp1024ByteBufferFromPool(void);
extern void CopyStringFromId(u8* buf, u32 string_id);
@@ -26,7 +27,6 @@ extern void PlayDefensiveStatMultiplierDownEffect(struct entity *entity, struct
extern void PlayDefensiveStatMultiplierUpEffect(struct entity *entity, struct StatIndex stat_index);
extern void PlayHitChanceUpEffect(struct entity *entity, struct StatIndex stat_index);
extern void PlayHitChanceDownEffect(struct entity *entity, struct StatIndex stat_index);
extern void LogMessageByIdWithPopupCheckUserTarget(struct entity *user, struct entity *target, u32 message_id);
extern void ov29_022E4338(struct entity *);
extern void PlayExclamationPointEffect__022E5D4C(struct entity *entity);
extern void PlayParalysisEffect(struct entity *entity);

View File

@@ -1,8 +1,8 @@
#include "overlay_10_022BFD58.h"
#include "main_02001188.h"
extern struct unk_022DC1C4 *ov10_022DC1C4;
extern void *MemAlloc(u32 size, u32 flags);
extern void MemZero(void *p, s32 n);

View File

@@ -18,6 +18,8 @@
#include "main_02058E68.h"
#include "overlay_10_022BCC60.h"
#include "overlay_31_02382820.h"
#include "main_020114F8.h"
#include "main_0203088C.h"
struct unk_02309DAC {
s32 field_0x0;
@@ -100,9 +102,7 @@ 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 ApplyGummiBoostsToGroundMonster(struct ground_monster *, s16, int, void *);
extern void ApplyGummiBoostsToTeamMember(struct team_member *, s16, int, void *);
extern void CloseAdvancedTextBox(s32 window_id);
extern s8 CreateInventoryMenuOuter(s32, s32, s32, void *, void *, void *, u8);
extern bool8 IsBagNotEmpty(void);
extern u8 PopInventoryMenuField0x1A3(s32 window_id);

View File

@@ -2,7 +2,6 @@
#include "overlay_13_0238BDA8.h"
#include "main_02001188.h"
extern void* MemAlloc(u32 len, u32 flags);
void sub_0201F2E4(void);
void InitMenu(const u8 *);
extern void ReturnScriptMenuResult(u32);

View File

@@ -1,8 +1,8 @@
#include "overlay_15_0238A140.h"
#include "main_02001188.h"
extern unkBankStruct* DUSKULL_BANK_STRUCT_PTR;
extern void* MemAlloc(u32 len, u32 flags);
extern void InitPreprocessorArgs(preprocessor_args*);
extern u32 CreateDialogueBox(u32);
extern u32 CreatePortraitBox(u32, u32, u32);

View File

@@ -17,7 +17,6 @@ void GetNameRaw(unsigned char *, s32);
void GetNameWithGender(unsigned char*, s32, char color_id);
s8 GetUnkGameState0x13a6();
extern void InitPreprocessorArgs(void* args);
void* MemAlloc(s32, s32);
s16 ReturnEggExclusiveItem(s32);
void SetUnkGameState0x13a6(s32);
void StrcpyName(const unsigned char*, const unsigned char*);

View File

@@ -1,6 +1,7 @@
#include "overlay_25.h"
#include "main_0200C4FC.h"
#include "item.h"
#include "main_02001188.h"
extern void CloseDialogueBox(s8);
@@ -50,7 +51,6 @@ extern void ShowPortraitInPortraitBox(s8, void*);
extern void SwapShopInventoryManager(s32, s32);
extern void ov11_022DC504();
extern void ov11_0230C910();
extern void* MemAlloc(s32, s32);
extern void MemFree(void *ptr);
extern BOOL IsScriptMenuReturnDisabled();
extern void ReturnScriptMenuResult(s32);

View File

@@ -1,9 +1,9 @@
#include "overlay_29_022DEAB0.h"
#include "dungeon.h"
#include "main_02001188.h"
void MemFree(void* ptr);
void MemZero(void* ptr, u32 len);
void* MemAlloc(u32 len, u32 flags);
void ov29_0234C654(s32);
void sub_020091B0(s32, s32);
void sub_02009194(s32, s32);

View File

@@ -23,3 +23,15 @@ struct position* FindUnoccupiedTileWithin3(struct position* out, struct position
{
return FindNearbyUnoccupiedTile(out, origin, DISPLACEMENTS_WITHIN_3, 0x31, a);
}
u8 TickStatusTurnCounter(u8 *counter)
{
u8 turns = *counter;
if (turns == 0x7F)
return turns;
if (turns == 0)
return turns;
*counter = turns - 1;
return *counter;
}

View File

@@ -1,5 +1,8 @@
#include "overlay_29_022E9FC0.h"
extern void ov29_022EA2A4(u32 param_1);
extern void ov29_022EA324(u32 param_1);
struct unk_02353560 {
u8 field_0x0;
u8 field_0x1;
@@ -19,3 +22,13 @@ void ov29_022E9FD0(u8 value)
{
ov29_02353560.field_0x3 = value;
}
void AdvanceFrame(u32 param_1)
{
if (ov29_02353560.field_0x3) {
ov29_022EA2A4(param_1);
}
else {
ov29_022EA324(param_1);
}
}

View File

@@ -19,6 +19,7 @@
#include "position_util.h"
#include "dungeon_util_2.h"
#include "overlay_29_022EC7E8.h"
#include "overlay_29_022E9FC0.h"
#ifdef JAPAN
#define SET_LEADER_ACTION_DATA_OFFSET -0x2C1
@@ -47,7 +48,6 @@ extern struct unk_0237C9A4 ov29_0237C9A4;
extern u16 DUNGEON_BUTTON_INPUT[8];
extern u16 ov29_0237C6A4;
extern void AdvanceFrame(u32);
extern bool8 CanSeeTarget(struct entity *user, struct entity *target);
extern bool8 IsBlinded(struct entity *entity, bool8 check_held_item);
extern void MemZero(u8 *ptr, s32 len);

View File

@@ -1,6 +1,8 @@
#include "overlay_29_02305C04.h"
#include "dungeon_util_static.h"
extern s32 EndNegativeStatusCondition(struct entity *user, struct entity *target, bool8 a, bool8 b, bool8 c);
bool8 EntityIsValid__02305C04(struct entity *entity)
{
if (entity == NULL)
@@ -8,3 +10,8 @@ bool8 EntityIsValid__02305C04(struct entity *entity)
return GetEntityType(entity) != ENTITY_NOTHING;
}
void EndNegativeStatusConditionWrapper(struct entity *user, struct entity *target, bool8 displayMessage, bool8 fromMove)
{
EndNegativeStatusCondition(user, target, displayMessage, fromMove, FALSE);
}

View File

@@ -3,6 +3,7 @@
#include "dungeon_util_2.h"
#include "overlay_29_022E3F20.h"
#include "dungeon_util_static.h"
#include "overlay_29_0234B340.h"
#ifdef JAPAN
#define JPN_MSG_OFFSET -0x2C0
@@ -10,7 +11,6 @@
#define JPN_MSG_OFFSET 0
#endif
extern void LogMessageByIdWithPopupCheckUserTarget(struct entity *user, struct entity *target, u32 message_id);
void EndBurnClassStatus(struct entity *user, struct entity *target)
{

View File

@@ -47,6 +47,10 @@
#include "overlay_29_02345A3C.h"
#include "overlay_29_02306728.h"
#include "overlay_29_02336F4C.h"
#include "main_0205283C.h"
#include "overlay_29_022E9FC0.h"
#include "overlay_29_0234B340.h"
#include "overlay_29_0234B4BC.h"
struct unk_023535DC {
u8 field_0x0;
@@ -95,7 +99,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 void AdvanceFrame(u32);
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);
@@ -106,13 +109,10 @@ extern bool8 ExclusiveItemEffectIsActiveWithLogging(struct entity* user, struct
extern void FillRecruitInfo(void *recruit_info, struct entity *monster);
extern void FreeOtherWrappedMonsters(u32 unique_id);
extern struct team_member* GetActiveTeamMember(s32 roster_idx);
extern s32 GetExp(enum monster_id monster_id, s32 level);
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 LogMessageByIdWithPopup(struct entity* user, s32 message_id);
extern void LogMessageByIdWithPopupCheckUser(struct entity *user, u32 message_id);
extern void LogMessageByIdWithPopupCheckUserTarget(struct entity *user, struct entity *target, 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);

View File

@@ -25,13 +25,14 @@
#include "type_effectiveness.h"
#include "weather.h"
#include "dungeon_util_2.h"
#include "overlay_29_02338350.h"
#include "overlay_29_0234B340.h"
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 int MoveIsNotPhysical(enum move_id move_id);
extern bool8 NearbyAllyIqSkillIsEnabled(struct entity *entity, enum iq_skill_id iq_skill);
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);
@@ -45,7 +46,6 @@ extern void DivideFixedPoint64(struct fixed_point_64 *out, struct fixed_point_64
extern void ResetDamageCalcDiagnostics(void);
extern bool8 OtherMonsterAbilityIsActive(struct entity *entity, enum ability_id ability_id);
extern void MultiplyFixedPoint64(struct fixed_point_64 *out, const struct fixed_point_64 *a, const struct fixed_point_64 *b);
extern void LogMessageByIdWithPopupCheckUserTarget(struct entity *user, struct entity *target, u32 message_id);
extern bool8 UpdateStateFlags(struct monster *info, s32 flag, bool8 value);
extern void ResetDamageData(struct unk_02308FE0 *damage_data);
extern bool8 ExclusiveItemEffectIsActiveWithLogging(struct entity *user, struct entity *target, bool8 should_log, s32 message_id, enum exclusive_item_effect_id effect_id);

View File

@@ -23,6 +23,8 @@
#include "dungeon_util_2.h"
#include "overlay_29_022EC7E8.h"
#include "overlay_29_023061A8.h"
#include "overlay_29_022E99F0.h"
#include "overlay_29_02305C04.h"
#ifdef JAPAN
#define MESSAGE_DE6 0xB26
@@ -58,12 +60,10 @@ extern void LogMessageByIdWithPopupCheckUser(struct entity *user, u32 message_id
extern void TryIncreaseHp(struct entity *user, struct entity *target, s32 hp, s32 a, bool8 b);
extern void TryWarp(struct entity *user, struct entity *target, s32 a, s32 b);
extern void MultiplyFixedPoint64(struct fixed_point_64 *out, const struct fixed_point_64 *a, const struct fixed_point_64 *b);
extern void EndNegativeStatusConditionWrapper(struct entity *user, struct entity *target, bool8 displayMessage, bool8 fromMove);
extern void ov29_022EA370(s32 a, s32 b);
extern s32 ov29_022F2FE4();
extern void WaitUntilAlertBoxTextIsLoadedWrapper(void);
extern u8 TickStatusTurnCounter(u8 *counter);
extern void EnsureCanStandCurrentTile(struct entity *entity);
extern void ov29_022E543C(struct entity *entity);
extern void ov29_022E53F0(struct entity *entity);

View File

@@ -12,6 +12,8 @@
#include "overlay_29_0234BA54.h"
#include "dungeon_util_2.h"
#include "overlay_29_02345A3C.h"
#include "overlay_29_02305C04.h"
#include "overlay_29_0234B340.h"
#ifdef JAPAN
#define MESSAGE_BE6 0x925
@@ -36,9 +38,7 @@
extern void ov29_022FB920(bool8 a);
#endif
extern void LogMessageByIdWithPopupCheckUserTarget(struct entity *user, struct entity *target, u32 message_id);
extern void TryIncreaseHp(struct entity *user, struct entity *target, s32 hp, s32 a, bool8 b);
extern void EndNegativeStatusConditionWrapper(struct entity *user, struct entity *target, bool8 displayMessage, bool8 fromMove);
extern void TryWarp(struct entity *user, struct entity *target, s32 a, s32 b);
extern void BoostIQ(struct entity *entity, s16 iq, bool8 a);
extern void UpdateShopkeeperModeAfterAttack(struct entity *attacker, struct entity *defender);

View File

@@ -3,6 +3,7 @@
#include "item.h"
#include "move.h"
#include "move_orb_effects.h"
#include "overlay_29_02305C04.h"
extern const s16 BUBBLE_LOWER_SPEED_CHANCE;
@@ -10,7 +11,6 @@ extern s32 DealDamage(struct entity *attacker, struct entity *defender, struct m
extern bool8 DungeonRandOutcomeUserTargetInteraction(struct entity *user, struct entity *target, s16 chance);
extern void EndNegativeStatusConditionWrapper(struct entity *user, struct entity *target, bool8 displayMessage, bool8 fromMove);
bool8 DoMoveHealStatus(struct entity* attacker, struct entity* defender, struct move* move, enum item_id item_id)
{

View File

@@ -1,5 +1,6 @@
#include "overlay_29_02329664.h"
#include "move_orb_effects.h"
#include "overlay_29_0234B340.h"
#ifdef JAPAN
#define HELPING_HAND_LOG_MESSAGE 0xC1C
@@ -8,7 +9,6 @@
#endif
extern void LogMessageByIdWithPopupCheckUserTarget(struct entity *user, struct entity *target, u32 message_id);
extern const struct StatIndex ATK_STAT_IDX;

View File

@@ -1,5 +1,6 @@
#include "overlay_29_0232A480.h"
#include "dungeon_util_static.h"
#include "overlay_29_0234B340.h"
#ifdef JAPAN
#define SWALLOW_LOG_MESSAGE 0xC26
@@ -8,7 +9,6 @@
#endif
extern void LogMessageByIdWithPopupCheckUserTarget(struct entity *user, struct entity *target, u32 message_id);
extern const s32 ov10_022C49D4[];

View File

@@ -1,4 +1,5 @@
#include "overlay_29_0232CE40.h"
#include "overlay_29_0234B340.h"
#ifdef JAPAN
#define REVIVER_LOG_MESSAGE 0xC4B
@@ -7,7 +8,6 @@
#endif
extern void LogMessageByIdWithPopupCheckUserTarget(struct entity *user, struct entity *target, u32 message_id);
extern s16 ov10_022C456C;

View File

@@ -1,5 +1,6 @@
#include "overlay_29_0232D368.h"
#include "dungeon_util_2.h"
#include "overlay_29_0234B340.h"
#ifdef JAPAN
#define GUARD_SWAP_LOG_MESSAGE 0x2495
@@ -7,7 +8,6 @@
#define GUARD_SWAP_LOG_MESSAGE 0xF2E
#endif
extern void LogMessageByIdWithPopupCheckUserTarget(struct entity *user, struct entity *target, u32 message_id);
extern void SwapDefensiveStages(struct entity *attacker, struct entity *defender, s32 log_message);
extern void SwapDefensiveMultipliers(struct entity *attacker, struct entity *defender, s32 log_message);
extern void TryInflictLuckyChantStatus(struct entity *user, struct entity *target);

View File

@@ -3,6 +3,13 @@
#include "dungeon_util.h"
#include "dungeon_util_static.h"
extern 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)
{
return ov29_023381C0(entity, iq_skill, FALSE) != NULL;
}
struct entity* FindAdjacentEnemy(struct entity *monster)
{
s16 i;

View File

@@ -1,4 +1,6 @@
#include "overlay_29_0234B340.h"
#include "main_0202593C.h"
#include "overlay_29_022E272C.h"
extern void LogMessage(struct entity *user, const char *message, bool8 show_popup);
@@ -6,3 +8,16 @@ void LogMessageQuiet(struct entity *user, const char *message)
{
LogMessage(user, message, FALSE);
}
void LogMessageByIdWithPopupCheckUserTarget(struct entity *user, struct entity *target, u32 message_id)
{
bool8 display = FALSE;
if (ShouldDisplayEntityWrapper(user))
display = TRUE;
if (ShouldDisplayEntityWrapper(target))
display = TRUE;
if (display)
LogMessage(user, (char *)StringFromId(message_id), TRUE);
}

View File

@@ -1,7 +1,13 @@
#include "overlay_29_0234B4BC.h"
#include "main_0202593C.h"
extern void LogMessage(struct entity *user, const char *message, bool8 show_popup);
void LogMessageByIdWithPopup(struct entity *user, s32 message_id)
{
LogMessage(user, (char *)StringFromId(message_id), TRUE);
}
void LogMessageWithPopup(struct entity *user, const char *message)
{
LogMessage(user, message, TRUE);

View File

@@ -1,5 +1,6 @@
#include "overlay_29_0234BA54.h"
#include "overlay_29_0234B024.h"
#include "overlay_29_022E9FC0.h"
extern struct message_log_info MESSAGE_LOG_INFO;
extern u16 DUNGEON_BUTTON_INPUT[8];
@@ -18,7 +19,6 @@ extern void sub_02047FFC(s32 a);
extern void InitPortraitParams(portrait_params *portrait);
extern void AllowPortraitDefault(portrait_params *portrait, bool32 allow);
extern void WaitUntilAlertBoxTextIsLoaded(u32 param_1);
extern void AdvanceFrame(u32 param_1);
void WaitUntilAlertBoxPauseIsOver(u32 param_1)
{

View File

@@ -9,6 +9,7 @@
#include "window.h"
#include "main_02027AF0.h"
#include "dungeon_util_2.h"
#include "overlay_29_022E9FC0.h"
extern struct dungeon *DUNGEON_PTR[];
@@ -28,7 +29,6 @@ extern struct struct_1 OVERLAY31_UNKNOWN_STRUCT__NA_2389E30;
extern u16 ov31_02389E22[];
extern void* MemAlloc(u32 size, u32 nmemb);
extern u32 GetMoneyCarried(void);
extern u32 sub_0204F9E0(void);
@@ -53,7 +53,6 @@ extern void CloseTextBox(s8);
extern void CloseParentMenu(s8);
extern void UnkMapRelatedFunc(u32, u32);
extern void AdvanceFrame(u8);
extern u32 GetLeaderActionId(void);
extern void ov29_022E0C2C(u32);

View File

@@ -4,13 +4,13 @@
#include "overlay_31_02383478.h"
#include "main_02001188.h"
#include "main_020282F4.h"
#include "overlay_29_022E9FC0.h"
extern struct dungeon *DUNGEON_PTR[];
extern struct loc_struct* OVERLAY31_UNKNOWN_POINTER__NA_238A26C;
extern u8 PositionHasItem(struct position* pos);
extern bool8 ov10_022BCD10(s8);
extern void AdvanceFrame(u8);
extern void CloseInventoryMenu(s8);
extern void ov29_0234E988(u8*);
extern void CloseTextBox2();

View File

@@ -12,11 +12,11 @@
#include "overlay_29_0233836C.h"
#include "type_matchup_table.h"
#include "weather.h"
#include "overlay_29_0234B340.h"
extern struct dungeon *DUNGEON_PTR;
extern bool8 UpdateStateFlags(struct monster *info, s32 flag, bool8 value);
extern void LogMessageByIdWithPopupCheckUserTarget(struct entity *user, struct entity *target, u32 message_id);
extern void LogMessageByIdWithPopupCheckParticipants(struct entity *user, struct entity *target, u32 message_id, s32 a4, s32 a5);
extern void MultiplyFixedPoint64(struct fixed_point_64 *out, const struct fixed_point_64 *a, const struct fixed_point_64 *b);
extern bool8 GhostImmunityIsActive(struct entity *attacker, struct entity *defender, s16 target_type_idx);