diff --git a/asm/include/main_020307B8.inc b/asm/include/main_020307B8.inc deleted file mode 100644 index bc3bf7bb..00000000 --- a/asm/include/main_020307B8.inc +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once -.public GetWindowContents -.public sub_02032984 diff --git a/asm/include/main_02058C4C.inc b/asm/include/main_02058C4C.inc deleted file mode 100644 index ccf8ec4d..00000000 --- a/asm/include/main_02058C4C.inc +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -.public TACTICS_UNLOCK_LEVEL_TABLE diff --git a/asm/include/main_02058D04.inc b/asm/include/main_02058D04.inc deleted file mode 100644 index 2e2dac5e..00000000 --- a/asm/include/main_02058D04.inc +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once -.public CanLearnIqSkill -.public GetIqGroup -.public GetResolvedPerformanceProgressFlag -.public IQ_GROUP_SKILLS diff --git a/asm/include/main_02058E8C.inc b/asm/include/main_02058E8C.inc deleted file mode 100644 index 17dc6634..00000000 --- a/asm/include/main_02058E8C.inc +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once -.public EnableIqSkill -.public GetLearnableIqSkills diff --git a/asm/include/main_0206A750.inc b/asm/include/main_0206A750.inc deleted file mode 100644 index a48baebe..00000000 --- a/asm/include/main_0206A750.inc +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once -.public GetExecuteSpecialEpisodeType -.public LoadScriptVariableValue -.public sub_0204E6FC -.public sub_0204E770 -.public sub_0204E780 diff --git a/asm/include/overlay_29_022E28D4.inc b/asm/include/overlay_29_022E28D4.inc deleted file mode 100644 index 47350e70..00000000 --- a/asm/include/overlay_29_022E28D4.inc +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once -.public EntityIsValid__022E1A1C -.public HasDropeyeStatus -.public IsPositionActuallyInSight diff --git a/asm/include/overlay_29_022E66D8.inc b/asm/include/overlay_29_022E66D8.inc deleted file mode 100644 index 264700b1..00000000 --- a/asm/include/overlay_29_022E66D8.inc +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once -.public GetEffectAnimationField0x19 -.public PlayEffectAnimationEntity diff --git a/asm/include/overlay_29_02300D50.inc b/asm/include/overlay_29_02300D50.inc deleted file mode 100644 index d7b0028f..00000000 --- a/asm/include/overlay_29_02300D50.inc +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -.public CheckVariousStatuses__023016DC diff --git a/asm/include/overlay_29_0234921C.inc b/asm/include/overlay_29_0234921C.inc deleted file mode 100644 index a00f434c..00000000 --- a/asm/include/overlay_29_0234921C.inc +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -.public DUNGEON_PTR diff --git a/asm/main_020307B8.s b/asm/main_020307B8.s deleted file mode 100644 index 0ac2c021..00000000 --- a/asm/main_020307B8.s +++ /dev/null @@ -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 diff --git a/asm/main_02058C4C.s b/asm/main_02058C4C.s deleted file mode 100644 index 0236b7c3..00000000 --- a/asm/main_02058C4C.s +++ /dev/null @@ -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 diff --git a/asm/main_02058D04.s b/asm/main_02058D04.s deleted file mode 100644 index f0c6c40b..00000000 --- a/asm/main_02058D04.s +++ /dev/null @@ -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 diff --git a/asm/main_02058E8C.s b/asm/main_02058E8C.s deleted file mode 100644 index 7ad4f03d..00000000 --- a/asm/main_02058E8C.s +++ /dev/null @@ -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 diff --git a/asm/main_0206A750.s b/asm/main_0206A750.s deleted file mode 100644 index 2a169a06..00000000 --- a/asm/main_0206A750.s +++ /dev/null @@ -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 diff --git a/asm/overlay_29_022E28D4.s b/asm/overlay_29_022E28D4.s deleted file mode 100644 index c269f682..00000000 --- a/asm/overlay_29_022E28D4.s +++ /dev/null @@ -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 diff --git a/asm/overlay_29_022E66D8.s b/asm/overlay_29_022E66D8.s deleted file mode 100644 index 37a5f5a2..00000000 --- a/asm/overlay_29_022E66D8.s +++ /dev/null @@ -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 diff --git a/asm/overlay_29_02300D50.s b/asm/overlay_29_02300D50.s deleted file mode 100644 index 7d0399a2..00000000 --- a/asm/overlay_29_02300D50.s +++ /dev/null @@ -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 diff --git a/asm/overlay_29_0234921C.s b/asm/overlay_29_0234921C.s deleted file mode 100644 index d63c8871..00000000 --- a/asm/overlay_29_0234921C.s +++ /dev/null @@ -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 diff --git a/include/dungeon_capabilities_1.h b/include/dungeon_capabilities_1.h index 5b02a89b..8150bfec 100644 --- a/include/dungeon_capabilities_1.h +++ b/include/dungeon_capabilities_1.h @@ -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 \ No newline at end of file diff --git a/include/dungeon_init_2.h b/include/dungeon_init_2.h index 6eec2104..89ddb324 100644 --- a/include/dungeon_init_2.h +++ b/include/dungeon_init_2.h @@ -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 diff --git a/include/dungeon_visibility.h b/include/dungeon_visibility.h index 6b678e2b..81f06d82 100644 --- a/include/dungeon_visibility.h +++ b/include/dungeon_visibility.h @@ -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 diff --git a/include/main_0202AAA8.h b/include/main_0202AAA8.h index b204bed3..32805a1e 100644 --- a/include/main_0202AAA8.h +++ b/include/main_0202AAA8.h @@ -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; diff --git a/include/main_020307A4.h b/include/main_020307A4.h index 55d39db2..f796de18 100644 --- a/include/main_020307A4.h +++ b/include/main_020307A4.h @@ -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 diff --git a/include/main_02058C3C.h b/include/main_02058C3C.h index ab1685d5..2d7acff7 100644 --- a/include/main_02058C3C.h +++ b/include/main_02058C3C.h @@ -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 diff --git a/include/main_02058CD8.h b/include/main_02058CD8.h index 22a88d5d..b258a0b0 100644 --- a/include/main_02058CD8.h +++ b/include/main_02058CD8.h @@ -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 diff --git a/include/main_02058E68.h b/include/main_02058E68.h index a9693f5b..6ed3759b 100644 --- a/include/main_02058E68.h +++ b/include/main_02058E68.h @@ -9,5 +9,7 @@ void DisableIqSkill(u32 *iq_skills_flags, s32 iq_id); void EnableIqSkill(u32 *iq_skills_flags, u32 iq_id); // Gets the 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 diff --git a/include/overlay_29_022E66C4.h b/include/overlay_29_022E66C4.h index fe14943a..25080519 100644 --- a/include/overlay_29_022E66C4.h +++ b/include/overlay_29_022E66C4.h @@ -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 diff --git a/include/overlay_29_02349208.h b/include/overlay_29_02349208.h index 82ca6881..14fd78dc 100644 --- a/include/overlay_29_02349208.h +++ b/include/overlay_29_02349208.h @@ -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 diff --git a/main.lsf b/main.lsf index bb51128e..112bc170 100644 --- a/main.lsf +++ b/main.lsf @@ -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 diff --git a/src/dungeon_capabilities_1.c b/src/dungeon_capabilities_1.c index 96586e12..f026669b 100644 --- a/src/dungeon_capabilities_1.c +++ b/src/dungeon_capabilities_1.c @@ -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); +} diff --git a/src/dungeon_init_2.c b/src/dungeon_init_2.c index ece8a906..c8a57d16 100644 --- a/src/dungeon_init_2.c +++ b/src/dungeon_init_2.c @@ -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; +} diff --git a/src/dungeon_recruitment.c b/src/dungeon_recruitment.c index c2a36155..8b98eb3d 100644 --- a/src/dungeon_recruitment.c +++ b/src/dungeon_recruitment.c @@ -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); diff --git a/src/dungeon_visibility.c b/src/dungeon_visibility.c index 7453183e..070be1b5 100644 --- a/src/dungeon_visibility.c +++ b/src/dungeon_visibility.c @@ -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)); +} diff --git a/src/main_020307A4.c b/src/main_020307A4.c index f8d4afda..a86d9ae4 100644 --- a/src/main_020307A4.c +++ b/src/main_020307A4.c @@ -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; + } +} diff --git a/src/main_02058C3C.c b/src/main_02058C3C.c index ecd2d0c1..7e8172c0 100644 --- a/src/main_02058C3C.c +++ b/src/main_02058C3C.c @@ -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; + } + } +} diff --git a/src/main_02058CD8.c b/src/main_02058CD8.c index f1244058..16bb6a7d 100644 --- a/src/main_02058CD8.c +++ b/src/main_02058CD8.c @@ -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; +} diff --git a/src/main_02058E68.c b/src/main_02058E68.c index 9dd7dc5c..b61ff97f 100644 --- a/src/main_02058E68.c +++ b/src/main_02058E68.c @@ -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]); + } +} diff --git a/src/overlay_29_022E66C4.c b/src/overlay_29_022E66C4.c index 07436f69..f46a8eb2 100644 --- a/src/overlay_29_022E66C4.c +++ b/src/overlay_29_022E66C4.c @@ -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); +} diff --git a/src/overlay_29_02349188.c b/src/overlay_29_02349188.c index 43c0e42e..e2ac2417 100644 --- a/src/overlay_29_02349188.c +++ b/src/overlay_29_02349188.c @@ -24,6 +24,7 @@ s32 ov29_023491B8(void) return GetFirstExperienceLockedTeamMember(); } +#include "overlay_29_02349208.h" bool8 IsOutlawOrChallengeRequestFloor(void) { if (IsCurrentMissionType(MISSION_CHALLENGE_REQUEST) != 0 || diff --git a/src/overlay_29_02349208.c b/src/overlay_29_02349208.c index d618c0da..6fb719db 100644 --- a/src/overlay_29_02349208.c +++ b/src/overlay_29_02349208.c @@ -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; +}