Decomp 16 functions, emptying nine asm files

Third cleanup batch. Nine asm/*.s files and their .inc files are removed;
main.lsf drops from 1168 to 1159 objects.

  overlay_29_0234921C  IsCurrentMissionType, IsCurrentMissionTypeExact
  main_02058E8C        DisableAllIqSkills, EnableAllLearnableIqSkills
  main_02058D04        GetLearnableIqSkills
  main_02058C4C        GetUnlockedTactics, GetUnlockedTacticFlags
  main_020307B8        sub_020307B8, sub_020307EC
  overlay_29_02300D50  ov29_02300D50, ov29_02300DC0
  overlay_29_022E28D4  IsValidTargetEntity, CanSeePosition
  main_0206A750        sub_0206A7CC
  overlay_29_022E66D8  ov29_022E66D8, ov29_022E6724

main_0202AAA8.h: the coarse field_0xFC[0x9C] placeholder is split into
field_0xFC[8] / u32 field_0x104 / field_0x108[0x90]. Byte-neutral, and
nothing in the tree referenced the placeholder by name.

Two pre-existing declarations of landed functions are replaced with an
include of the header that now declares them. dungeon_recruitment.c
declared IsCurrentMissionTypeExact as (u32, u32) where it takes
(enum mission_type, u8); both call sites pass enum constants, so the ROM
is unchanged.

TACTICS_UNLOCK_LEVEL_TABLE, sub_02032984 and sub_0204E6FC/0204E770/
0204E780 are declared provisionally at the call site; no header declares
them yet.

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-08-21 01:41:15 -07:00
parent d9df74f0f6
commit 6425efdd8d
40 changed files with 293 additions and 472 deletions

View File

@@ -1,3 +0,0 @@
#pragma once
.public GetWindowContents
.public sub_02032984

View File

@@ -1,2 +0,0 @@
#pragma once
.public TACTICS_UNLOCK_LEVEL_TABLE

View File

@@ -1,5 +0,0 @@
#pragma once
.public CanLearnIqSkill
.public GetIqGroup
.public GetResolvedPerformanceProgressFlag
.public IQ_GROUP_SKILLS

View File

@@ -1,3 +0,0 @@
#pragma once
.public EnableIqSkill
.public GetLearnableIqSkills

View File

@@ -1,6 +0,0 @@
#pragma once
.public GetExecuteSpecialEpisodeType
.public LoadScriptVariableValue
.public sub_0204E6FC
.public sub_0204E770
.public sub_0204E780

View File

@@ -1,4 +0,0 @@
#pragma once
.public EntityIsValid__022E1A1C
.public HasDropeyeStatus
.public IsPositionActuallyInSight

View File

@@ -1,3 +0,0 @@
#pragma once
.public GetEffectAnimationField0x19
.public PlayEffectAnimationEntity

View File

@@ -1,2 +0,0 @@
#pragma once
.public CheckVariousStatuses__023016DC

View File

@@ -1,2 +0,0 @@
#pragma once
.public DUNGEON_PTR

View File

@@ -1,46 +0,0 @@
.include "asm/macros.inc"
.include "main_020307B8.inc"
.text
arm_func_start sub_020307B8
sub_020307B8: ; 0x020307B8
stmdb sp!, {r3, lr}
bl GetWindowContents
mov r1, #1
str r1, [r0, #0x1bc]
mov r1, #0
strb r1, [r0, #0x1c0]
strb r1, [r0, #0x1c1]
ldr r1, [r0, #0x104]
bic r1, r1, #0x800000
str r1, [r0, #0x104]
add r0, r0, #4
bl sub_02032984
ldmia sp!, {r3, pc}
arm_func_end sub_020307B8
arm_func_start sub_020307EC
sub_020307EC: ; 0x020307EC
stmdb sp!, {r3, r4, r5, lr}
mov r5, r0
bl GetWindowContents
mov r4, r0
mov r0, r5
bl GetWindowContents
ldr r0, [r0, #0x1bc]
cmp r0, #7
moveq r0, #1
movne r0, #0
tst r0, #0xff
beq _02030828
mov r0, r5
bl sub_020307B8
ldmia sp!, {r3, r4, r5, pc}
_02030828:
ldr r0, [r4, #0x1bc]
cmp r0, #6
moveq r0, #0
streq r0, [r4, #0x1bc]
ldmia sp!, {r3, r4, r5, pc}
arm_func_end sub_020307EC

View File

@@ -1,53 +0,0 @@
.include "asm/macros.inc"
.include "main_02058C4C.inc"
.text
arm_func_start GetUnlockedTactics
GetUnlockedTactics: ; 0x02058C4C
stmdb sp!, {r3, lr}
mov lr, #0
ldr r3, _02058C98 ; =TACTICS_UNLOCK_LEVEL_TABLE
mov ip, lr
_02058C5C:
mov r2, ip, lsl #1
ldrsh r2, [r3, r2]
cmp r2, r1
strleb ip, [r0, lr]
add ip, ip, #1
addle lr, lr, #1
cmp ip, #0xc
blt _02058C5C
mov r1, #0xb
b _02058C8C
_02058C84:
strb r1, [r0, lr]
add lr, lr, #1
_02058C8C:
cmp lr, #0xc
blt _02058C84
ldmia sp!, {r3, pc}
.align 2, 0
_02058C98: .word TACTICS_UNLOCK_LEVEL_TABLE
arm_func_end GetUnlockedTactics
arm_func_start GetUnlockedTacticFlags
GetUnlockedTacticFlags: ; 0x02058C9C
stmdb sp!, {r4, lr}
mov r4, #0
ldr lr, _02058CD4 ; =TACTICS_UNLOCK_LEVEL_TABLE
mov r2, r4
mov r3, #1
_02058CB0:
mov ip, r4, lsl #1
ldrsh ip, [lr, ip]
cmp ip, r1
strleb r3, [r0, r4]
strgtb r2, [r0, r4]
add r4, r4, #1
cmp r4, #0xc
blt _02058CB0
ldmia sp!, {r4, pc}
.align 2, 0
_02058CD4: .word TACTICS_UNLOCK_LEVEL_TABLE
arm_func_end GetUnlockedTacticFlags

View File

@@ -1,56 +0,0 @@
.include "asm/macros.inc"
.include "main_02058D04.inc"
.text
arm_func_start GetLearnableIqSkills
GetLearnableIqSkills: ; 0x02058D04
stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr}
mov r6, #0
mov sl, r0
mov sb, r1
mov r8, r2
mov r5, r6
ldr r4, _02058DA0 ; =IQ_GROUP_SKILLS
mov fp, #0x19
b _02058D74
_02058D28:
mov r0, sb
bl GetIqGroup
mla r1, r0, fp, r4
and r0, r5, #0xff
ldrb r7, [r0, r1]
cmp r7, #0xff
beq _02058D7C
cmp r7, #0x18
bne _02058D58
mov r0, #3
bl GetResolvedPerformanceProgressFlag
b _02058D64
_02058D58:
mov r0, r8
mov r1, r7
bl CanLearnIqSkill
_02058D64:
cmp r0, #0
strneb r7, [sl, r6]
addne r6, r6, #1
add r5, r5, #1
_02058D74:
cmp r5, #0x19
blt _02058D28
_02058D7C:
mov r1, r6
mov r0, #0
b _02058D90
_02058D88:
strb r0, [sl, r1]
add r1, r1, #1
_02058D90:
cmp r1, #0x45
blt _02058D88
mov r0, r6
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
.align 2, 0
_02058DA0: .word IQ_GROUP_SKILLS
arm_func_end GetLearnableIqSkills

View File

@@ -1,46 +0,0 @@
.include "asm/macros.inc"
.include "main_02058E8C.inc"
.text
arm_func_start DisableAllIqSkills
DisableAllIqSkills: ; 0x02058E8C
mov r3, #0
mov r2, r3
_02058E94:
add r1, r3, #1
mov r1, r1, lsl #0x10
str r2, [r0, r3, lsl #2]
mov r3, r1, asr #0x10
cmp r3, #3
blt _02058E94
bx lr
arm_func_end DisableAllIqSkills
arm_func_start EnableAllLearnableIqSkills
EnableAllLearnableIqSkills: ; 0x02058EB0
stmdb sp!, {r4, r5, r6, lr}
sub sp, sp, #0x48
mov r6, r0
add r0, sp, #0
bl GetLearnableIqSkills
mov r0, r6
bl DisableAllIqSkills
mov r5, #0
add r4, sp, #0
b _02058EF4
_02058ED8:
ldrb r0, [r4, r5]
cmp r0, #0
beq _02058EFC
ldrb r1, [r4, r5]
mov r0, r6
bl EnableIqSkill
add r5, r5, #1
_02058EF4:
cmp r5, #0x45
blt _02058ED8
_02058EFC:
add sp, sp, #0x48
ldmia sp!, {r4, r5, r6, pc}
arm_func_end EnableAllLearnableIqSkills

View File

@@ -1,46 +0,0 @@
.include "asm/macros.inc"
.include "main_0206A750.inc"
.text
arm_func_start sub_0206A7CC
sub_0206A7CC: ; 0x0206A7CC
stmdb sp!, {r4, lr}
mov r4, r0
cmp r4, #0x3e8
bne _0206A7F4
mov r0, #0
mov r1, #0x20
bl LoadScriptVariableValue
mov r0, r0, lsl #0x10
mov r4, r0, asr #0x10
b _0206A82C
_0206A7F4:
ldr r0, _0206A848 ; =0x000003E9
cmp r4, r0
bne _0206A82C
bl sub_0204E6FC
cmp r0, #2
bne _0206A814
bl sub_0204E780
b _0206A818
_0206A814:
bl sub_0204E770
_0206A818:
cmp r0, #0xff
addne r0, r0, #1
mvneq r4, #0
movne r0, r0, lsl #0x10
movne r4, r0, asr #0x10
_0206A82C:
cmp r4, #0xd1
bne _0206A840
bl GetExecuteSpecialEpisodeType
cmp r0, #4
moveq r4, #0xd2
_0206A840:
mov r0, r4
ldmia sp!, {r4, pc}
.align 2, 0
_0206A848: .word 0x000003E9
arm_func_end sub_0206A7CC

View File

@@ -1,44 +0,0 @@
.include "asm/macros.inc"
.include "overlay_29_022E28D4.inc"
.text
arm_func_start IsValidTargetEntity
IsValidTargetEntity: ; 0x022E28D4
stmdb sp!, {r3, r4, r5, lr}
mov r5, r0
mov r4, r1
bl EntityIsValid__022E1A1C
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, pc}
mov r0, r4
bl EntityIsValid__022E1A1C
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, pc}
ldrb r0, [r4, #0x20]
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, pc}
mov r0, r5
bl HasDropeyeStatus
mov r2, r0
add r0, r5, #4
add r1, r4, #4
bl IsPositionActuallyInSight
ldmia sp!, {r3, r4, r5, pc}
arm_func_end IsValidTargetEntity
arm_func_start CanSeePosition
CanSeePosition: ; 0x022E2930
stmdb sp!, {r3, r4, r5, lr}
mov r5, r0
mov r4, r1
bl HasDropeyeStatus
mov r2, r0
mov r1, r4
add r0, r5, #4
bl IsPositionActuallyInSight
ldmia sp!, {r3, r4, r5, pc}
arm_func_end CanSeePosition

View File

@@ -1,50 +0,0 @@
.include "asm/macros.inc"
.include "overlay_29_022E66D8.inc"
.text
arm_func_start ov29_022E66D8
ov29_022E66D8: ; 0x022E66D8
stmdb sp!, {r4, lr}
sub sp, sp, #0x10
mov r4, r0
mov r0, #0x15
bl GetEffectAnimationField0x19
mov r1, r0
and r3, r1, #0xff
mov r0, #2
mov ip, #0
stmia sp, {r0, ip}
sub r0, ip, #1
str r0, [sp, #8]
mov r0, r4
mov r1, #0x15
mov r2, #1
str ip, [sp, #0xc]
bl PlayEffectAnimationEntity
add sp, sp, #0x10
ldmia sp!, {r4, pc}
arm_func_end ov29_022E66D8
arm_func_start ov29_022E6724
ov29_022E6724: ; 0x022E6724
stmdb sp!, {r4, lr}
sub sp, sp, #0x10
mov r4, r0
mov r0, #0x1b4
bl GetEffectAnimationField0x19
mov r1, r0
and r3, r1, #0xff
mov r0, #2
mov ip, #0
stmia sp, {r0, ip}
sub r0, ip, #1
str r0, [sp, #8]
mov r0, r4
mov r1, #0x1b4
mov r2, #1
str ip, [sp, #0xc]
bl PlayEffectAnimationEntity
add sp, sp, #0x10
ldmia sp!, {r4, pc}
arm_func_end ov29_022E6724

View File

@@ -1,44 +0,0 @@
.include "asm/macros.inc"
.include "overlay_29_02300D50.inc"
.text
arm_func_start ov29_02300D50
ov29_02300D50: ; 0x02300D50
stmdb sp!, {r3, lr}
ldr r1, [r0, #0xb4]
ldrb r3, [r1, #0xc4]
cmp r3, #3
moveq r0, #1
ldmeqia sp!, {r3, pc}
cmp r3, #4
moveq r0, #1
ldmeqia sp!, {r3, pc}
ldrb r2, [r1, #0xd0]
cmp r2, #7
moveq r0, #1
ldmeqia sp!, {r3, pc}
cmp r2, #3
moveq r0, #1
ldmeqia sp!, {r3, pc}
ldrb r1, [r1, #0xbf]
cmp r1, #4
moveq r0, #1
ldmeqia sp!, {r3, pc}
cmp r3, #6
moveq r0, #1
ldmeqia sp!, {r3, pc}
cmp r2, #1
moveq r0, #1
ldmeqia sp!, {r3, pc}
bl CheckVariousStatuses__023016DC
ldmia sp!, {r3, pc}
arm_func_end ov29_02300D50
arm_func_start ov29_02300DC0
ov29_02300DC0: ; 0x02300DC0
ldr ip, _02300DC8 ; =ov29_02300D50
bx ip
.align 2, 0
_02300DC8: .word ov29_02300D50
arm_func_end ov29_02300DC0

View File

@@ -1,46 +0,0 @@
.include "asm/macros.inc"
.include "overlay_29_0234921C.inc"
.text
arm_func_start IsCurrentMissionType
IsCurrentMissionType: ; 0x0234921C
ldr r1, _0234924C ; =DUNGEON_PTR
ldr r2, [r1]
ldrb r1, [r2, #0x760]
cmp r1, #0
beq _0234923C
ldrb r1, [r2, #0x761]
cmp r1, r0
beq _02349244
_0234923C:
mov r0, #0
bx lr
_02349244:
mov r0, #1
bx lr
.align 2, 0
_0234924C: .word DUNGEON_PTR
arm_func_end IsCurrentMissionType
arm_func_start IsCurrentMissionTypeExact
IsCurrentMissionTypeExact: ; 0x02349250
ldr r2, _02349288 ; =DUNGEON_PTR
ldr r3, [r2]
ldrb r2, [r3, #0x760]
cmp r2, #0
beq _02349278
ldrb r2, [r3, #0x761]
cmp r2, r0
ldreqb r0, [r3, #0x762]
cmpeq r0, r1
beq _02349280
_02349278:
mov r0, #0
bx lr
_02349280:
mov r0, #1
bx lr
.align 2, 0
_02349288: .word DUNGEON_PTR
arm_func_end IsCurrentMissionTypeExact

View File

@@ -1,6 +1,8 @@
#ifndef PMDSKY_DUNGEON_CAPABILITIES_1_H
#define PMDSKY_DUNGEON_CAPABILITIES_1_H
#include "util.h"
#include "dungeon_mode.h"
// Returns 0 if none of these conditions holds for the given entity: is a rescue client,
@@ -15,5 +17,7 @@ bool8 CheckVariousConditions__02301624(struct entity *entity);
bool8 CheckVariousStatuses__023016DC(struct entity *entity);
// Returns false if none of these conditions holds for the given entity: asleep, frozen, petrified, biding.
bool8 CheckVariousStatuses__0230172C(struct entity *entity);
bool8 ov29_02300D50(struct entity *entity);
bool8 ov29_02300DC0(struct entity *entity);
#endif //PMDSKY_DUNGEON_CAPABILITIES_H

View File

@@ -4,5 +4,6 @@
s16 DungeonSwapIdToIdx(s16 id);
s16 DungeonSwapIdxToId(s16 idx);
s32 GetDungeonModeSpecial(s16 dungeon_id);
s16 sub_0206A7CC(s16 a);
#endif //PMDSKY_MAIN_DUNGEON_INIT_2

View File

@@ -1,6 +1,8 @@
#ifndef PMDSKY_DUNGEON_VISIBILITY_H
#define PMDSKY_DUNGEON_VISIBILITY_H
#include "util.h"
#include "dungeon_mode.h"
// Checks if a given monster can see another monster.
@@ -11,5 +13,7 @@ bool8 CanSeeTarget(struct entity *user, struct entity *target);
// More specifically, it checks if the target is invisible, if the user can see invisible monsters, if the user is blinded and if the target position is in sight from the position of the user (this last check is done by calling IsPositionInSight with the user's and the target's position).
// This function is almost the same as CanSeeTarget, the only difference is that the latter calls IsPositionActuallyInSight instead.
bool8 CanTargetEntity(struct entity *user, struct entity *target);
bool8 IsValidTargetEntity(struct entity *user, struct entity *target);
bool8 CanSeePosition(struct entity *user, struct position *target);
#endif //PMDSKY_DUNGEON_VISIBILITY_H

View File

@@ -13,7 +13,9 @@ struct unk_0202AAA8 {
s32 field_0xA0;
u8 field_0xA4[0x54];
u32 field_0xF8;
u8 field_0xFC[0x9C];
u8 field_0xFC[8];
u32 field_0x104;
u8 field_0x108[0x90];
void *field_0x198;
s32 field_0x19C;
u8 field_0x1A0;

View File

@@ -1,6 +1,10 @@
#ifndef PMDSKY_MAIN_020307A4_H
#define PMDSKY_MAIN_020307A4_H
#include "util.h"
void SetAdvancedTextBoxField0x1C4(s32 window_id, u8 value);
void sub_020307B8(s32 window_id);
void sub_020307EC(s32 window_id);
#endif

View File

@@ -6,5 +6,7 @@
// Returns whether or not the tactic involves following the team leader.
bool8 DoesTacticFollowLeader(enum tactic_id tactic_id);
void GetUnlockedTactics(u8 *out, s32 level);
void GetUnlockedTacticFlags(u8 *out, s32 level);
#endif //PMDSKY_MAIN_02058C3C_H

View File

@@ -7,5 +7,6 @@
// Returns whether an IQ skill can be learned with a given IQ amount or not.
// If the specified amount is 0, it always returns false.
bool8 CanLearnIqSkill(s32 iq_amount, enum iq_skill_id iq_id);
s32 GetLearnableIqSkills(u8 *out, s16 monster_id, s32 iq);
#endif //PMDSKY_MAIN_02058CD8_H

View File

@@ -9,5 +9,7 @@ void DisableIqSkill(u32 *iq_skills_flags, s32 iq_id);
void EnableIqSkill(u32 *iq_skills_flags, u32 iq_id);
// Gets the <index>th skill on the list of IQ skills that a given monster species can learn.
enum iq_skill_id GetSpeciesIqSkill(s16 monster_id, u8 index);
void DisableAllIqSkills(u32 *flags);
void EnableAllLearnableIqSkills(u32 *flags, s16 monster_id, s32 iq);
#endif //PMDSKY_MAIN_02058E68_H

View File

@@ -6,5 +6,7 @@
#include "move.h"
void ov29_022E66C4(struct entity *entity);
void ov29_022E66D8(struct entity *entity);
void ov29_022E6724(struct entity *entity);
#endif

View File

@@ -5,5 +5,7 @@
#include "util.h"
bool8 IsDestinationFloor(void);
bool8 IsCurrentMissionType(enum mission_type type);
bool8 IsCurrentMissionTypeExact(enum mission_type type, u8 subtype);
#endif

View File

@@ -193,7 +193,6 @@ Static main
Object src/main_0202FD3C.o
Object asm/main_0202FD50.o
Object src/main_020307A4.o
Object asm/main_020307B8.o
Object src/main_0203083C.o
Object src/main_0203088C.o
Object asm/main_020308A0.o
@@ -319,11 +318,8 @@ Static main
Object src/main_02056D70.o
Object asm/main_02056EB8.o
Object src/main_02058C3C.o
Object asm/main_02058C4C.o
Object src/main_02058CD8.o
Object asm/main_02058D04.o
Object src/main_02058E68.o
Object asm/main_02058E8C.o
Object src/pokemon.o
Object asm/main_02058F24.o
Object src/main_02058FA4.o
@@ -384,7 +380,6 @@ Static main
Object src/main_020663C8.o
Object asm/main_020664B8.o
Object src/dungeon_init_2.o
Object asm/main_0206A750.o
Object src/main_0206A84C.o
Object asm/main_0206A878.o
Object src/main_0206C0D8.o
@@ -810,7 +805,6 @@ Overlay OVY_29
Object asm/overlay_29_022E1AD4.o
Object src/overlay_29_022E272C.o
Object src/dungeon_visibility.o
Object asm/overlay_29_022E28D4.o
Object src/dungeon_util_2.o
Object asm/overlay_29_022E2978.o
Object src/dg_camera.o
@@ -833,7 +827,6 @@ Overlay OVY_29
Object src/overlay_29_022E563C.o
Object asm/overlay_29_022E5650.o
Object src/overlay_29_022E66C4.o
Object asm/overlay_29_022E66D8.o
Object src/overlay_29_022E6770.o
Object asm/overlay_29_022E6798.o
Object src/overlay_29_022E68BC.o
@@ -952,7 +945,6 @@ Overlay OVY_29
Object src/dungeon_capabilities.o
Object asm/overlay_29_023009A0.o
Object src/dungeon_capabilities_1.o
Object asm/overlay_29_02300D50.o
Object src/directional_bit_masks.o
Object src/dungeon_capabilities_3.o
Object asm/overlay_29_02300FCC.o
@@ -1265,7 +1257,6 @@ Overlay OVY_29
Object asm/overlay_29_02348D3C.o
Object src/overlay_29_02349188.o
Object src/overlay_29_02349208.o
Object asm/overlay_29_0234921C.o
Object src/overlay_29_0234928C.o
Object src/overlay_29_02349314.o
Object asm/overlay_29_02349378.o

View File

@@ -102,3 +102,45 @@ bool8 CheckVariousStatuses__0230172C(struct entity *entity)
return FALSE;
}
bool8 ov29_02300D50(struct entity *entity)
{
struct monster *m;
m = entity->info;
if (m->frozen_class_status.freeze == STATUS_FROZEN_WRAP) {
return 1;
}
if (m->frozen_class_status.freeze == STATUS_FROZEN_WRAPPED) {
return 1;
}
if (m->cringe_class_status.cringe == STATUS_CRINGE_INFATUATED) {
return 1;
}
if (m->cringe_class_status.cringe == STATUS_CRINGE_PAUSED) {
return 1;
}
if (m->burn_class_status.burn == STATUS_BURN_PARALYSIS) {
return 1;
}
if (m->frozen_class_status.freeze == STATUS_FROZEN_PETRIFIED) {
return 1;
}
if (m->cringe_class_status.cringe == STATUS_CRINGE_CRINGE) {
return 1;
}
return CheckVariousStatuses__023016DC(entity);
}
bool8 ov29_02300DC0(struct entity *entity)
{
return ov29_02300D50(entity);
}

View File

@@ -1,4 +1,12 @@
#include "dungeon_init_2.h"
#include "script_variable.h"
#include "special_episode.h"
extern s32 sub_0204E6FC(void);
extern s32 sub_0204E780(void);
extern s32 sub_0204E770(void);
#include "enums.h"
extern u8 DUNGEON_SWAP_ID_TABLE[];
@@ -46,3 +54,30 @@ s32 GetDungeonModeSpecial(s16 dungeon_id) {
return DMODE_OPEN;
}
s16 sub_0206A7CC(s16 a)
{
s32 v;
if (a == 0x3E8) {
a = (s16) LoadScriptVariableValue(NULL, 0x20);
} else if (a == 0x3E9) {
if (sub_0204E6FC() == 2) {
v = sub_0204E780();
} else {
v = sub_0204E770();
}
if (v == 0xFF) {
a = -1;
} else {
a = (s16) (v + 1);
}
}
if (a == 0xD1 && GetExecuteSpecialEpisodeType() == 4) {
a = 0xD2;
}
return a;
}

View File

@@ -14,9 +14,9 @@
#include "math.h"
#include "overlay_29_0230E578.h" // ItemIsActive__0230E578
#include "progression.h"
#include "overlay_29_02349208.h"
extern bool8 IsLegendaryChallengeFloor(void);
extern bool8 IsCurrentMissionTypeExact(u32 mission_type, u32 mission_subtype);
extern bool8 IsMonsterOnTeam(s16 monsterId, s32 checkType);
extern void ov29_022E1B28(s32);
extern void ov29_022E81F8(void);

View File

@@ -59,3 +59,26 @@ bool8 CanTargetEntity(struct entity *user, struct entity *target)
}
return IsPositionInSight(&user->pos, &target->pos, HasDropeyeStatus(user));
}
bool8 IsValidTargetEntity(struct entity *user, struct entity *target)
{
if (!EntityIsValid__022E1A1C(user)) {
return 0;
}
if (!EntityIsValid__022E1A1C(target)) {
return 0;
}
if (!target->is_visible) {
return 0;
}
return IsPositionActuallyInSight(&user->pos, &target->pos,
HasDropeyeStatus(user));
}
bool8 CanSeePosition(struct entity *user, struct position *target)
{
return IsPositionActuallyInSight(&user->pos, target, HasDropeyeStatus(user));
}

View File

@@ -1,4 +1,6 @@
#include "main_020307A4.h"
extern void sub_02032984(void *p);
#include "main_0202AAA8.h"
#include "main_02001188.h"
@@ -8,3 +10,33 @@ void SetAdvancedTextBoxField0x1C4(s32 window_id, u8 value)
w->field_0x1C4 = value;
}
void sub_020307B8(s32 window_id)
{
struct unk_0202AAA8 *w;
w = GetWindowContents(window_id);
w->field_0x1BC = 1;
w->field_0x1C0[0] = 0;
w->field_0x1C0[1] = 0;
w->field_0x104 &= ~0x800000;
sub_02032984((u8 *) w + 4);
}
void sub_020307EC(s32 window_id)
{
struct unk_0202AAA8 *w;
bool8 f;
w = GetWindowContents(window_id);
f = ((struct unk_0202AAA8 *) GetWindowContents(window_id))->field_0x1BC == 7;
if (f) {
sub_020307B8(window_id);
return;
}
if (w->field_0x1BC == 6) {
w->field_0x1BC = 0;
}
}

View File

@@ -1,7 +1,41 @@
#include "main_02058C3C.h"
extern s16 TACTICS_UNLOCK_LEVEL_TABLE[];
#include "tactics_data.h"
bool8 DoesTacticFollowLeader(enum tactic_id tactic_id)
{
return TACTICS_FOLLOW_LEADER[tactic_id];
}
void GetUnlockedTactics(u8 *out, s32 level)
{
s32 i;
s32 n;
n = 0;
for (i = 0; i < 0xC; i++) {
if (TACTICS_UNLOCK_LEVEL_TABLE[i] <= level) {
out[n] = i;
n++;
}
}
for (; n < 0xC; n++) {
out[n] = 0xB;
}
}
void GetUnlockedTacticFlags(u8 *out, s32 level)
{
s32 i;
for (i = 0; i < 0xC; i++) {
if (TACTICS_UNLOCK_LEVEL_TABLE[i] <= level) {
out[i] = 1;
} else {
out[i] = 0;
}
}
}

View File

@@ -1,4 +1,6 @@
#include "main_02058CD8.h"
#include "main_02052B28.h"
#include "progression.h"
#include "iq_skills.h"
bool8 CanLearnIqSkill(s32 iq_amount, enum iq_skill_id iq_id)
@@ -8,3 +10,38 @@ bool8 CanLearnIqSkill(s32 iq_amount, enum iq_skill_id iq_id)
return IQ_SKILLS[iq_id] <= iq_amount;
}
s32 GetLearnableIqSkills(u8 *out, s16 monster_id, s32 iq)
{
s32 i;
s32 n;
u8 skill;
bool8 ok;
n = 0;
for (i = 0; i < 25; i++) {
skill = IQ_GROUP_SKILLS[GetIqGroup(monster_id)][i & 0xFF];
if (skill == 0xFF) {
break;
}
if (skill == 0x18) {
ok = GetResolvedPerformanceProgressFlag(3);
} else {
ok = CanLearnIqSkill(iq, (enum iq_skill_id) skill);
}
if (ok) {
out[n] = skill;
n++;
}
}
for (i = n; i < 0x45; i++) {
out[i] = 0;
}
return n;
}

View File

@@ -1,4 +1,5 @@
#include "main_02058E68.h"
#include "main_02058CD8.h"
#include "iq_skills.h"
#include "main_02052B28.h"
#include "monster_parameters.h"
@@ -34,3 +35,29 @@ enum iq_skill_id GetSpeciesIqSkill(s16 monster_id, u8 index)
{
return IQ_GROUP_SKILLS[GetIqGroup(monster_id)][index];
}
void DisableAllIqSkills(u32 *flags)
{
s16 i;
for (i = 0; i < 3; i++) {
flags[i] = 0;
}
}
void EnableAllLearnableIqSkills(u32 *flags, s16 monster_id, s32 iq)
{
u8 skills[0x48];
s32 i;
GetLearnableIqSkills(skills, monster_id, iq);
DisableAllIqSkills(flags);
for (i = 0; i < 0x45; i++) {
if (skills[i] == 0) {
break;
}
EnableIqSkill(flags, *(volatile u8 *) &skills[i]);
}
}

View File

@@ -1,8 +1,25 @@
#include "overlay_29_022E66C4.h"
extern s32 GetEffectAnimationField0x19(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)
{
PlayEffectAnimationPos(entity, 0x36, 1);
}
void ov29_022E66D8(struct entity *entity)
{
PlayEffectAnimationEntity(entity, 0x15, 1, GetEffectAnimationField0x19(0x15),
2, 0, -1, 0);
}
void ov29_022E6724(struct entity *entity)
{
PlayEffectAnimationEntity(entity, 0x1B4, 1, GetEffectAnimationField0x19(0x1B4),
2, 0, -1, 0);
}

View File

@@ -24,6 +24,7 @@ s32 ov29_023491B8(void)
return GetFirstExperienceLockedTeamMember();
}
#include "overlay_29_02349208.h"
bool8 IsOutlawOrChallengeRequestFloor(void)
{
if (IsCurrentMissionType(MISSION_CHALLENGE_REQUEST) != 0 ||

View File

@@ -10,3 +10,22 @@ bool8 IsDestinationFloor(void)
{
return DUNGEON_PTR->mission_destination.is_destination_floor;
}
bool8 IsCurrentMissionType(enum mission_type type)
{
if (!(DUNGEON_PTR->mission_destination.is_destination_floor && DUNGEON_PTR->mission_destination.type == type)) {
return FALSE;
}
return TRUE;
}
bool8 IsCurrentMissionTypeExact(enum mission_type type, u8 subtype)
{
if (!(DUNGEON_PTR->mission_destination.is_destination_floor && DUNGEON_PTR->mission_destination.type == type &&
DUNGEON_PTR->mission_destination.subtype == subtype)) {
return FALSE;
}
return TRUE;
}