Decomp nine mission predicates against a faithful scratch context

Decompile from asm:

  IsOutlawMonsterHouseFloor    IsDestinationFloorWithMonster
  IsGoldenChamber              MissionTargetEnemyIsDefeated
  IsJirachiChallengeFloor      SetMissionTargetEnemyDefeated
  IsDestinationFloorWithFixedRoom
  IsDestinationFloorWithHiddenOutlaw
  GetMissionEnemyMinionGroup

These are the functions the two previous commits could not land. The obstacle was
the scratch context, not the C, and this commit is the result of replacing it.

The context is now the real headers rather than a hand-written struct: mwccarm
-E over a file including global.pch, dungeon.h and mission.h, with
LM_LICENSE_FILE set, gives 14500 lines reproducing what the build actually sees.
Two things that took finding. global.pch is required -- without it util.h fails
at typedef s32 fx32_8, because s32 comes from nitro.h, which the build supplies
through -prefix rather than through any include in dungeon.h. And -E consumes
every macro, so TRUE, FALSE and NULL have to be restored by hand afterwards;
their values are taken from lib/include/nitro/types.h, NULL being ((void *)0) on
the C branch.

Against that context the earlier verdicts change. All eight functions landed in
the two previous commits still score 0, which is the check that the new oracle
agrees with the build. Eight of the thirteen unlanded ones score 0 unchanged and
are landed here as written. GetMissionEnemyMinionGroup does not: the real headers
let the compiler fold the +1 of enemy_species[index + 1] into the load
displacement, one instruction shorter than the target. Binding index + 1 to a
local first blocks the fold and scores 0, which is what is landed.

Four remain unmatched and are genuinely unmatched rather than mis-measured:
IsCurrentMissionType and IsCurrentMissionTypeExact at 515, where the target
branches to separate return blocks and every spelling tried so far produces
predicated moves; GetItemToRetrieve at 665 and GetItemToDeliver at 1530. Their
scores are identical under both contexts, so the context was never their problem.

The mission_type arguments use the enumerators from mission.h -- ARREST_OUTLAW,
EXPLORE_WITH_CLIENT, TAKE_ITEM_FROM_OUTLAW and CHALLENGE_REQUEST -- because the
build rejects the implicit conversion from int. The values agree with the
function names rather than being chosen to fit them.

No comments are added to any pmd-sky file.

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-18 01:38:01 -07:00
parent 0fbdb57210
commit 5c895f8a1d
23 changed files with 390 additions and 337 deletions

View File

@@ -1,5 +1,2 @@
#pragma once
.public DUNGEON_PTR
.public FloorHasMissionMonster
.public GetSpriteFileSize
.public LoadMonsterSprite

View File

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

View File

@@ -0,0 +1,5 @@
#pragma once
.public DUNGEON_PTR
.public FloorHasMissionMonster
.public GetSpriteFileSize
.public LoadMonsterSprite

View File

@@ -0,0 +1,4 @@
#pragma once
.public DUNGEON_PTR
.public IsCurrentMissionType
.public IsCurrentMissionTypeExact

View File

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

View File

@@ -44,322 +44,3 @@ _02349280:
.align 2, 0
_02349288: .word DUNGEON_PTR
arm_func_end IsCurrentMissionTypeExact
arm_func_start IsOutlawMonsterHouseFloor
IsOutlawMonsterHouseFloor: ; 0x0234928C
stmdb sp!, {r3, lr}
mov r0, #0xa
mov r1, #7
bl IsCurrentMissionTypeExact
cmp r0, #0
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
ldmia sp!, {r3, pc}
arm_func_end IsOutlawMonsterHouseFloor
arm_func_start IsGoldenChamber
IsGoldenChamber: ; 0x023492B0
stmdb sp!, {r3, lr}
mov r0, #3
mov r1, #2
bl IsCurrentMissionTypeExact
cmp r0, #0
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
ldmia sp!, {r3, pc}
arm_func_end IsGoldenChamber
arm_func_start IsLegendaryChallengeFloor
IsLegendaryChallengeFloor: ; 0x023492D4
stmdb sp!, {r3, lr}
mov r0, #0xb
bl IsCurrentMissionType
cmp r0, #0
beq _02349308
ldr r0, _02349310 ; =DUNGEON_PTR
ldr r0, [r0]
ldrb r0, [r0, #0x762]
add r0, r0, #0xff
and r0, r0, #0xff
cmp r0, #4
movls r0, #1
ldmlsia sp!, {r3, pc}
_02349308:
mov r0, #0
ldmia sp!, {r3, pc}
.align 2, 0
_02349310: .word DUNGEON_PTR
arm_func_end IsLegendaryChallengeFloor
arm_func_start IsJirachiChallengeFloor
IsJirachiChallengeFloor: ; 0x02349314
stmdb sp!, {r3, lr}
mov r0, #0xb
bl IsCurrentMissionType
cmp r0, #0
beq _02349340
ldr r0, _02349348 ; =DUNGEON_PTR
ldr r0, [r0]
ldrb r0, [r0, #0x762]
cmp r0, #5
moveq r0, #1
ldmeqia sp!, {r3, pc}
_02349340:
mov r0, #0
ldmia sp!, {r3, pc}
.align 2, 0
_02349348: .word DUNGEON_PTR
arm_func_end IsJirachiChallengeFloor
arm_func_start IsDestinationFloorWithMonster
IsDestinationFloorWithMonster: ; 0x0234934C
stmdb sp!, {r3, lr}
ldr r0, _02349374 ; =DUNGEON_PTR
ldr r0, [r0]
add r0, r0, #0x760
bl FloorHasMissionMonster
cmp r0, #0
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
ldmia sp!, {r3, pc}
.align 2, 0
_02349374: .word DUNGEON_PTR
arm_func_end IsDestinationFloorWithMonster
arm_func_start ov29_02349378
ov29_02349378: ; 0x02349378
stmdb sp!, {r4, r5, r6, lr}
ldr r0, _023493F4 ; =DUNGEON_PTR
ldr r0, [r0]
add r6, r0, #0x760
mov r0, r6
bl FloorHasMissionMonster
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r4, r5, r6, pc}
ldrsh r0, [r6, #0xc]
mov r4, #0
mov r5, r4
cmp r0, #0
beq _023493E0
bl GetSpriteFileSize
add r4, r4, r0
b _023493E0
_023493BC:
add r0, r6, r5, lsl #1
ldrsh r0, [r0, #0xe]
cmp r0, #0
beq _023493D4
bl GetSpriteFileSize
add r4, r4, r0
_023493D4:
add r0, r5, #1
mov r0, r0, lsl #0x10
mov r5, r0, asr #0x10
_023493E0:
ldrsh r0, [r6, #0x14]
cmp r5, r0
blt _023493BC
mov r0, r4
ldmia sp!, {r4, r5, r6, pc}
.align 2, 0
_023493F4: .word DUNGEON_PTR
arm_func_end ov29_02349378
arm_func_start LoadMissionMonsterSprites
LoadMissionMonsterSprites: ; 0x023493F8
stmdb sp!, {r4, r5, r6, lr}
ldr r0, _0234946C ; =DUNGEON_PTR
ldr r0, [r0]
add r6, r0, #0x760
mov r0, r6
bl FloorHasMissionMonster
cmp r0, #0
ldmeqia sp!, {r4, r5, r6, pc}
ldrsh r0, [r6, #0xc]
cmp r0, #0
beq _0234942C
mov r1, #1
bl LoadMonsterSprite
_0234942C:
mov r5, #0
mov r4, #1
b _0234945C
_02349438:
add r0, r6, r5, lsl #1
ldrsh r0, [r0, #0xe]
cmp r0, #0
beq _02349450
mov r1, r4
bl LoadMonsterSprite
_02349450:
add r0, r5, #1
mov r0, r0, lsl #0x10
mov r5, r0, asr #0x10
_0234945C:
ldrsh r0, [r6, #0x14]
cmp r5, r0
blt _02349438
ldmia sp!, {r4, r5, r6, pc}
.align 2, 0
_0234946C: .word DUNGEON_PTR
arm_func_end LoadMissionMonsterSprites
arm_func_start MissionTargetEnemyIsDefeated
MissionTargetEnemyIsDefeated: ; 0x02349470
ldr r0, _0234948C ; =DUNGEON_PTR
ldr r1, [r0]
ldrb r0, [r1, #0x760]
cmp r0, #0
ldrneb r0, [r1, #0x77b]
moveq r0, #0
bx lr
.align 2, 0
_0234948C: .word DUNGEON_PTR
arm_func_end MissionTargetEnemyIsDefeated
arm_func_start SetMissionTargetEnemyDefeated
SetMissionTargetEnemyDefeated: ; 0x02349490
ldr r1, _023494A0 ; =DUNGEON_PTR
ldr r1, [r1]
strb r0, [r1, #0x77b]
bx lr
.align 2, 0
_023494A0: .word DUNGEON_PTR
arm_func_end SetMissionTargetEnemyDefeated
arm_func_start IsDestinationFloorWithFixedRoom
IsDestinationFloorWithFixedRoom: ; 0x023494A4
ldr r0, _023494C8 ; =DUNGEON_PTR
ldr r1, [r0]
ldrb r0, [r1, #0x760]
cmp r0, #0
ldrneb r0, [r1, #0x776]
cmpne r0, #0
moveq r0, #0
movne r0, #1
bx lr
.align 2, 0
_023494C8: .word DUNGEON_PTR
arm_func_end IsDestinationFloorWithFixedRoom
arm_func_start GetItemToRetrieve
GetItemToRetrieve: ; 0x023494CC
ldr r0, _023494EC ; =DUNGEON_PTR
ldr r1, [r0]
ldrb r0, [r1, #0x760]
add r1, r1, #0x760
cmp r0, #0
ldrnesh r0, [r1, #4]
moveq r0, #0
bx lr
.align 2, 0
_023494EC: .word DUNGEON_PTR
arm_func_end GetItemToRetrieve
arm_func_start GetItemToDeliver
GetItemToDeliver: ; 0x023494F0
stmdb sp!, {r4, lr}
ldr r1, _02349518 ; =DUNGEON_PTR
mov r0, #7
ldr r1, [r1]
add r4, r1, #0x760
bl IsCurrentMissionType
cmp r0, #0
ldrnesh r0, [r4, #6]
moveq r0, #0
ldmia sp!, {r4, pc}
.align 2, 0
_02349518: .word DUNGEON_PTR
arm_func_end GetItemToDeliver
arm_func_start GetSpecialTargetItem
GetSpecialTargetItem: ; 0x0234951C
stmdb sp!, {r4, lr}
ldr r1, _02349560 ; =DUNGEON_PTR
mov r0, #3
ldr r2, [r1]
mov r1, #1
add r4, r2, #0x760
bl IsCurrentMissionTypeExact
cmp r0, #0
bne _02349550
mov r0, #0xc
bl IsCurrentMissionType
cmp r0, #0
beq _02349558
_02349550:
ldrsh r0, [r4, #8]
ldmia sp!, {r4, pc}
_02349558:
mov r0, #0
ldmia sp!, {r4, pc}
.align 2, 0
_02349560: .word DUNGEON_PTR
arm_func_end GetSpecialTargetItem
arm_func_start IsDestinationFloorWithItem
IsDestinationFloorWithItem: ; 0x02349564
stmdb sp!, {r4, lr}
ldr r0, _023495C0 ; =DUNGEON_PTR
ldr r1, [r0]
ldrb r0, [r1, #0x760]
add r4, r1, #0x760
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r4, pc}
mov r0, #9
bl IsCurrentMissionType
cmp r0, #0
bne _023495B0
mov r0, #7
bl IsCurrentMissionType
cmp r0, #0
bne _023495B0
ldrsh r0, [r4, #4]
cmp r0, #0
bne _023495B8
_023495B0:
mov r0, #0
ldmia sp!, {r4, pc}
_023495B8:
mov r0, #1
ldmia sp!, {r4, pc}
.align 2, 0
_023495C0: .word DUNGEON_PTR
arm_func_end IsDestinationFloorWithItem
arm_func_start IsDestinationFloorWithHiddenOutlaw
IsDestinationFloorWithHiddenOutlaw: ; 0x023495C4
stmdb sp!, {r3, lr}
mov r0, #9
mov r1, #1
bl IsCurrentMissionTypeExact
cmp r0, #0
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
ldmia sp!, {r3, pc}
arm_func_end IsDestinationFloorWithHiddenOutlaw
arm_func_start IsDestinationFloorWithFleeingOutlaw
IsDestinationFloorWithFleeingOutlaw: ; 0x023495E8
stmdb sp!, {r3, lr}
mov r0, #0xa
mov r1, #5
bl IsCurrentMissionTypeExact
cmp r0, #0
bne _02349618
mov r0, #9
mov r1, #2
bl IsCurrentMissionTypeExact
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r3, pc}
_02349618:
mov r0, #1
ldmia sp!, {r3, pc}
arm_func_end IsDestinationFloorWithFleeingOutlaw

26
asm/overlay_29_023492D4.s Normal file
View File

@@ -0,0 +1,26 @@
.include "asm/macros.inc"
.include "overlay_29_023492D4.inc"
.text
arm_func_start IsLegendaryChallengeFloor
IsLegendaryChallengeFloor: ; 0x023492D4
stmdb sp!, {r3, lr}
mov r0, #0xb
bl IsCurrentMissionType
cmp r0, #0
beq _02349308
ldr r0, _02349310 ; =DUNGEON_PTR
ldr r0, [r0]
ldrb r0, [r0, #0x762]
add r0, r0, #0xff
and r0, r0, #0xff
cmp r0, #4
movls r0, #1
ldmlsia sp!, {r3, pc}
_02349308:
mov r0, #0
ldmia sp!, {r3, pc}
.align 2, 0
_02349310: .word DUNGEON_PTR
arm_func_end IsLegendaryChallengeFloor

83
asm/overlay_29_02349378.s Normal file
View File

@@ -0,0 +1,83 @@
.include "asm/macros.inc"
.include "overlay_29_02349378.inc"
.text
arm_func_start ov29_02349378
ov29_02349378: ; 0x02349378
stmdb sp!, {r4, r5, r6, lr}
ldr r0, _023493F4 ; =DUNGEON_PTR
ldr r0, [r0]
add r6, r0, #0x760
mov r0, r6
bl FloorHasMissionMonster
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r4, r5, r6, pc}
ldrsh r0, [r6, #0xc]
mov r4, #0
mov r5, r4
cmp r0, #0
beq _023493E0
bl GetSpriteFileSize
add r4, r4, r0
b _023493E0
_023493BC:
add r0, r6, r5, lsl #1
ldrsh r0, [r0, #0xe]
cmp r0, #0
beq _023493D4
bl GetSpriteFileSize
add r4, r4, r0
_023493D4:
add r0, r5, #1
mov r0, r0, lsl #0x10
mov r5, r0, asr #0x10
_023493E0:
ldrsh r0, [r6, #0x14]
cmp r5, r0
blt _023493BC
mov r0, r4
ldmia sp!, {r4, r5, r6, pc}
.align 2, 0
_023493F4: .word DUNGEON_PTR
arm_func_end ov29_02349378
arm_func_start LoadMissionMonsterSprites
LoadMissionMonsterSprites: ; 0x023493F8
stmdb sp!, {r4, r5, r6, lr}
ldr r0, _0234946C ; =DUNGEON_PTR
ldr r0, [r0]
add r6, r0, #0x760
mov r0, r6
bl FloorHasMissionMonster
cmp r0, #0
ldmeqia sp!, {r4, r5, r6, pc}
ldrsh r0, [r6, #0xc]
cmp r0, #0
beq _0234942C
mov r1, #1
bl LoadMonsterSprite
_0234942C:
mov r5, #0
mov r4, #1
b _0234945C
_02349438:
add r0, r6, r5, lsl #1
ldrsh r0, [r0, #0xe]
cmp r0, #0
beq _02349450
mov r1, r4
bl LoadMonsterSprite
_02349450:
add r0, r5, #1
mov r0, r0, lsl #0x10
mov r5, r0, asr #0x10
_0234945C:
ldrsh r0, [r6, #0x14]
cmp r5, r0
blt _02349438
ldmia sp!, {r4, r5, r6, pc}
.align 2, 0
_0234946C: .word DUNGEON_PTR
arm_func_end LoadMissionMonsterSprites

90
asm/overlay_29_023494CC.s Normal file
View File

@@ -0,0 +1,90 @@
.include "asm/macros.inc"
.include "overlay_29_023494CC.inc"
.text
arm_func_start GetItemToRetrieve
GetItemToRetrieve: ; 0x023494CC
ldr r0, _023494EC ; =DUNGEON_PTR
ldr r1, [r0]
ldrb r0, [r1, #0x760]
add r1, r1, #0x760
cmp r0, #0
ldrnesh r0, [r1, #4]
moveq r0, #0
bx lr
.align 2, 0
_023494EC: .word DUNGEON_PTR
arm_func_end GetItemToRetrieve
arm_func_start GetItemToDeliver
GetItemToDeliver: ; 0x023494F0
stmdb sp!, {r4, lr}
ldr r1, _02349518 ; =DUNGEON_PTR
mov r0, #7
ldr r1, [r1]
add r4, r1, #0x760
bl IsCurrentMissionType
cmp r0, #0
ldrnesh r0, [r4, #6]
moveq r0, #0
ldmia sp!, {r4, pc}
.align 2, 0
_02349518: .word DUNGEON_PTR
arm_func_end GetItemToDeliver
arm_func_start GetSpecialTargetItem
GetSpecialTargetItem: ; 0x0234951C
stmdb sp!, {r4, lr}
ldr r1, _02349560 ; =DUNGEON_PTR
mov r0, #3
ldr r2, [r1]
mov r1, #1
add r4, r2, #0x760
bl IsCurrentMissionTypeExact
cmp r0, #0
bne _02349550
mov r0, #0xc
bl IsCurrentMissionType
cmp r0, #0
beq _02349558
_02349550:
ldrsh r0, [r4, #8]
ldmia sp!, {r4, pc}
_02349558:
mov r0, #0
ldmia sp!, {r4, pc}
.align 2, 0
_02349560: .word DUNGEON_PTR
arm_func_end GetSpecialTargetItem
arm_func_start IsDestinationFloorWithItem
IsDestinationFloorWithItem: ; 0x02349564
stmdb sp!, {r4, lr}
ldr r0, _023495C0 ; =DUNGEON_PTR
ldr r1, [r0]
ldrb r0, [r1, #0x760]
add r4, r1, #0x760
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r4, pc}
mov r0, #9
bl IsCurrentMissionType
cmp r0, #0
bne _023495B0
mov r0, #7
bl IsCurrentMissionType
cmp r0, #0
bne _023495B0
ldrsh r0, [r4, #4]
cmp r0, #0
bne _023495B8
_023495B0:
mov r0, #0
ldmia sp!, {r4, pc}
_023495B8:
mov r0, #1
ldmia sp!, {r4, pc}
.align 2, 0
_023495C0: .word DUNGEON_PTR
arm_func_end IsDestinationFloorWithItem

23
asm/overlay_29_023495E8.s Normal file
View File

@@ -0,0 +1,23 @@
.include "asm/macros.inc"
.include "overlay_29_023495E8.inc"
.text
arm_func_start IsDestinationFloorWithFleeingOutlaw
IsDestinationFloorWithFleeingOutlaw: ; 0x023495E8
stmdb sp!, {r3, lr}
mov r0, #0xa
mov r1, #5
bl IsCurrentMissionTypeExact
cmp r0, #0
bne _02349618
mov r0, #9
mov r1, #2
bl IsCurrentMissionTypeExact
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r3, pc}
_02349618:
mov r0, #1
ldmia sp!, {r3, pc}
arm_func_end IsDestinationFloorWithFleeingOutlaw

View File

@@ -1,21 +1,8 @@
.include "asm/macros.inc"
.include "overlay_29_02349638.inc"
.include "overlay_29_02349658.inc"
.text
arm_func_start GetMissionEnemyMinionGroup
GetMissionEnemyMinionGroup: ; 0x02349638
ldr r1, _02349654 ; =DUNGEON_PTR
add r0, r0, #1
ldr r1, [r1]
add r0, r1, r0, lsl #1
add r0, r0, #0x700
ldrsh r0, [r0, #0x6e]
bx lr
.align 2, 0
_02349654: .word DUNGEON_PTR
arm_func_end GetMissionEnemyMinionGroup
arm_func_start ov29_02349658
ov29_02349658: ; 0x02349658
ldr r0, _02349684 ; =DUNGEON_PTR

View File

@@ -0,0 +1,10 @@
#ifndef PMDSKY_OVERLAY_29_0234928C_H
#define PMDSKY_OVERLAY_29_0234928C_H
#include "dungeon.h"
#include "util.h"
bool8 IsOutlawMonsterHouseFloor(void);
bool8 IsGoldenChamber(void);
#endif

View File

@@ -0,0 +1,10 @@
#ifndef PMDSKY_OVERLAY_29_02349314_H
#define PMDSKY_OVERLAY_29_02349314_H
#include "dungeon.h"
#include "util.h"
bool8 IsJirachiChallengeFloor(void);
bool8 IsDestinationFloorWithMonster(void);
#endif

View File

@@ -0,0 +1,11 @@
#ifndef PMDSKY_OVERLAY_29_02349470_H
#define PMDSKY_OVERLAY_29_02349470_H
#include "dungeon.h"
#include "util.h"
s32 MissionTargetEnemyIsDefeated(void);
void SetMissionTargetEnemyDefeated(bool8 defeated);
s32 IsDestinationFloorWithFixedRoom(void);
#endif

View File

@@ -0,0 +1,9 @@
#ifndef PMDSKY_OVERLAY_29_023495C4_H
#define PMDSKY_OVERLAY_29_023495C4_H
#include "dungeon.h"
#include "util.h"
bool8 IsDestinationFloorWithHiddenOutlaw(void);
#endif

View File

@@ -5,5 +5,6 @@
#include "util.h"
enum monster_id GetMissionTargetEnemy(void);
enum monster_id GetMissionEnemyMinionGroup(s32 index);
#endif

View File

@@ -1038,8 +1038,16 @@ Overlay OVY_29
Object asm/overlay_29_023491C4.o
Object src/overlay_29_02349208.o
Object asm/overlay_29_0234921C.o
Object src/overlay_29_0234928C.o
Object asm/overlay_29_023492D4.o
Object src/overlay_29_02349314.o
Object asm/overlay_29_02349378.o
Object src/overlay_29_02349470.o
Object asm/overlay_29_023494CC.o
Object src/overlay_29_023495C4.o
Object asm/overlay_29_023495E8.o
Object src/overlay_29_02349620.o
Object asm/overlay_29_02349638.o
Object asm/overlay_29_02349658.o
Object src/overlay_29_02349688.o
Object asm/overlay_29_0234969C.o
Object src/overlay_29_023496D8.o

21
src/overlay_29_0234928C.c Normal file
View File

@@ -0,0 +1,21 @@
#include "overlay_29_0234928C.h"
#include "dungeon.h"
#include "mission.h"
extern struct dungeon *DUNGEON_PTR;
void ClearMissionDestinationInfo(struct mission_destination_info *info);
s32 GetFirstExperienceLockedTeamMember(void);
bool8 FloorHasMissionMonster(struct mission_destination_info *info);
bool8 IsCurrentMissionType(enum mission_type type);
bool8 IsCurrentMissionTypeExact(enum mission_type type, u8 subtype);
bool8 IsOutlawMonsterHouseFloor(void)
{
return IsCurrentMissionTypeExact(MISSION_ARREST_OUTLAW, 7) != 0;
}
bool8 IsGoldenChamber(void)
{
return IsCurrentMissionTypeExact(MISSION_EXPLORE_WITH_CLIENT, 2) != 0;
}

24
src/overlay_29_02349314.c Normal file
View File

@@ -0,0 +1,24 @@
#include "overlay_29_02349314.h"
#include "dungeon.h"
#include "mission.h"
extern struct dungeon *DUNGEON_PTR;
void ClearMissionDestinationInfo(struct mission_destination_info *info);
s32 GetFirstExperienceLockedTeamMember(void);
bool8 FloorHasMissionMonster(struct mission_destination_info *info);
bool8 IsCurrentMissionType(enum mission_type type);
bool8 IsCurrentMissionTypeExact(enum mission_type type, u8 subtype);
bool8 IsJirachiChallengeFloor(void)
{
if (IsCurrentMissionType(MISSION_CHALLENGE_REQUEST) && DUNGEON_PTR->mission_destination.subtype == 5) {
return TRUE;
}
return FALSE;
}
bool8 IsDestinationFloorWithMonster(void)
{
return FloorHasMissionMonster(&DUNGEON_PTR->mission_destination) != 0;
}

35
src/overlay_29_02349470.c Normal file
View File

@@ -0,0 +1,35 @@
#include "overlay_29_02349470.h"
#include "dungeon.h"
#include "mission.h"
extern struct dungeon *DUNGEON_PTR;
void ClearMissionDestinationInfo(struct mission_destination_info *info);
s32 GetFirstExperienceLockedTeamMember(void);
bool8 FloorHasMissionMonster(struct mission_destination_info *info);
bool8 IsCurrentMissionType(enum mission_type type);
bool8 IsCurrentMissionTypeExact(enum mission_type type, u8 subtype);
s32 MissionTargetEnemyIsDefeated(void)
{
struct dungeon *dungeon = DUNGEON_PTR;
return dungeon->mission_destination.is_destination_floor
? dungeon->mission_destination.target_enemy_is_defeated : FALSE;
}
void SetMissionTargetEnemyDefeated(bool8 defeated)
{
DUNGEON_PTR->mission_destination.target_enemy_is_defeated = defeated;
}
s32 IsDestinationFloorWithFixedRoom(void)
{
struct dungeon *dungeon = DUNGEON_PTR;
if (dungeon->mission_destination.is_destination_floor == FALSE ||
dungeon->mission_destination.fixed_room_id == 0) {
return FALSE;
}
return TRUE;
}

16
src/overlay_29_023495C4.c Normal file
View File

@@ -0,0 +1,16 @@
#include "overlay_29_023495C4.h"
#include "dungeon.h"
#include "mission.h"
extern struct dungeon *DUNGEON_PTR;
void ClearMissionDestinationInfo(struct mission_destination_info *info);
s32 GetFirstExperienceLockedTeamMember(void);
bool8 FloorHasMissionMonster(struct mission_destination_info *info);
bool8 IsCurrentMissionType(enum mission_type type);
bool8 IsCurrentMissionTypeExact(enum mission_type type, u8 subtype);
bool8 IsDestinationFloorWithHiddenOutlaw(void)
{
return IsCurrentMissionTypeExact(MISSION_TAKE_ITEM_FROM_OUTLAW, 1) != 0;
}

View File

@@ -14,3 +14,10 @@ enum monster_id GetMissionTargetEnemy(void)
{
return DUNGEON_PTR->mission_destination.enemy_species[0];
}
enum monster_id GetMissionEnemyMinionGroup(s32 index)
{
s32 i = index + 1;
return DUNGEON_PTR->mission_destination.enemy_species[i];
}