This commit is contained in:
AnonymousRandomPerson 2025-10-01 21:52:08 -04:00
commit 7d347d9c77
13 changed files with 188 additions and 148 deletions

View File

@ -1,12 +1,10 @@
#pragma once
.public _020A0C68
.public _020A0C69
.public _020A0C6A
.public _020A0C6C
.public _020A0C6E
.public _020AFF7C
.public _020AFF80
.public _020AFF88
.public CopyBitsFrom
.public CopyBitsTo
.public DUNGEON_RESTRICTIONS
.public _020A0C68
.public _020A0C69
.public _020A0C6C
.public _020AFF7C
.public _020AFF80
.public _020AFF88

View File

@ -0,0 +1,4 @@
#pragma once
.public DUNGEON_RESTRICTIONS
.public _020A0C6A
.public _020A0C6E

View File

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

View File

@ -259,114 +259,3 @@ GetMaxRescueAttempts: ; 0x02051380
.align 2, 0
_02051394: .word _020A0C68
arm_func_end GetMaxRescueAttempts
arm_func_start IsRecruitingAllowed
IsRecruitingAllowed: ; 0x02051398
mov r1, #0xc
mul r1, r0, r1
ldr r0, _020513BC ; =DUNGEON_RESTRICTIONS
ldr r0, [r0, r1]
tst r0, #8
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
bx lr
.align 2, 0
_020513BC: .word DUNGEON_RESTRICTIONS
arm_func_end IsRecruitingAllowed
arm_func_start GetLeaderChangeFlag
GetLeaderChangeFlag: ; 0x020513C0
mov r1, #0xc
mul r1, r0, r1
ldr r0, _020513E4 ; =DUNGEON_RESTRICTIONS
ldr r0, [r0, r1]
tst r0, #0x40
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
bx lr
.align 2, 0
_020513E4: .word DUNGEON_RESTRICTIONS
arm_func_end GetLeaderChangeFlag
arm_func_start GetRandomMovementChance
GetRandomMovementChance: ; 0x020513E8
mov r1, #0xc
mul r1, r0, r1
ldr r0, _020513FC ; =_020A0C6E
ldrsh r0, [r0, r1]
bx lr
.align 2, 0
_020513FC: .word _020A0C6E
arm_func_end GetRandomMovementChance
arm_func_start CanEnemyEvolve
CanEnemyEvolve: ; 0x02051400
mov r1, #0xc
mul r1, r0, r1
ldr r0, _02051424 ; =DUNGEON_RESTRICTIONS
ldr r0, [r0, r1]
tst r0, #2
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
bx lr
.align 2, 0
_02051424: .word DUNGEON_RESTRICTIONS
arm_func_end CanEnemyEvolve
arm_func_start GetMaxMembersAllowed
GetMaxMembersAllowed: ; 0x02051428
mov r1, #0xc
mul r1, r0, r1
ldr r0, _0205143C ; =_020A0C6A
ldrb r0, [r0, r1]
bx lr
.align 2, 0
_0205143C: .word _020A0C6A
arm_func_end GetMaxMembersAllowed
arm_func_start IsIqEnabled
IsIqEnabled: ; 0x02051440
mov r1, #0xc
mul r1, r0, r1
ldr r0, _02051464 ; =DUNGEON_RESTRICTIONS
ldr r0, [r0, r1]
tst r0, #0x100
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
bx lr
.align 2, 0
_02051464: .word DUNGEON_RESTRICTIONS
arm_func_end IsIqEnabled
arm_func_start IsTrapInvisibleWhenAttacking
IsTrapInvisibleWhenAttacking: ; 0x02051468
mov r1, #0xc
mul r1, r0, r1
ldr r0, _0205148C ; =DUNGEON_RESTRICTIONS
ldr r0, [r0, r1]
tst r0, #0x200
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
bx lr
.align 2, 0
_0205148C: .word DUNGEON_RESTRICTIONS
arm_func_end IsTrapInvisibleWhenAttacking
arm_func_start JoinedAtRangeCheck
JoinedAtRangeCheck: ; 0x02051490
cmp r0, #0xd9
blo _020514A4
cmp r0, #0xe4
movlo r0, #1
blo _020514A8
_020514A4:
mov r0, #0
_020514A8:
and r0, r0, #0xff
bx lr
arm_func_end JoinedAtRangeCheck

100
asm/main_020513C0.s Normal file
View File

@ -0,0 +1,100 @@
.include "asm/macros.inc"
.include "main_020513C0.inc"
.text
arm_func_start GetLeaderChangeFlag
GetLeaderChangeFlag: ; 0x020513C0
mov r1, #0xc
mul r1, r0, r1
ldr r0, _020513E4 ; =DUNGEON_RESTRICTIONS
ldr r0, [r0, r1]
tst r0, #0x40
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
bx lr
.align 2, 0
_020513E4: .word DUNGEON_RESTRICTIONS
arm_func_end GetLeaderChangeFlag
arm_func_start GetRandomMovementChance
GetRandomMovementChance: ; 0x020513E8
mov r1, #0xc
mul r1, r0, r1
ldr r0, _020513FC ; =_020A0C6E
ldrsh r0, [r0, r1]
bx lr
.align 2, 0
_020513FC: .word _020A0C6E
arm_func_end GetRandomMovementChance
arm_func_start CanEnemyEvolve
CanEnemyEvolve: ; 0x02051400
mov r1, #0xc
mul r1, r0, r1
ldr r0, _02051424 ; =DUNGEON_RESTRICTIONS
ldr r0, [r0, r1]
tst r0, #2
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
bx lr
.align 2, 0
_02051424: .word DUNGEON_RESTRICTIONS
arm_func_end CanEnemyEvolve
arm_func_start GetMaxMembersAllowed
GetMaxMembersAllowed: ; 0x02051428
mov r1, #0xc
mul r1, r0, r1
ldr r0, _0205143C ; =_020A0C6A
ldrb r0, [r0, r1]
bx lr
.align 2, 0
_0205143C: .word _020A0C6A
arm_func_end GetMaxMembersAllowed
arm_func_start IsIqEnabled
IsIqEnabled: ; 0x02051440
mov r1, #0xc
mul r1, r0, r1
ldr r0, _02051464 ; =DUNGEON_RESTRICTIONS
ldr r0, [r0, r1]
tst r0, #0x100
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
bx lr
.align 2, 0
_02051464: .word DUNGEON_RESTRICTIONS
arm_func_end IsIqEnabled
arm_func_start IsTrapInvisibleWhenAttacking
IsTrapInvisibleWhenAttacking: ; 0x02051468
mov r1, #0xc
mul r1, r0, r1
ldr r0, _0205148C ; =DUNGEON_RESTRICTIONS
ldr r0, [r0, r1]
tst r0, #0x200
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
bx lr
.align 2, 0
_0205148C: .word DUNGEON_RESTRICTIONS
arm_func_end IsTrapInvisibleWhenAttacking
arm_func_start JoinedAtRangeCheck
JoinedAtRangeCheck: ; 0x02051490
cmp r0, #0xd9
blo _020514A4
cmp r0, #0xe4
movlo r0, #1
blo _020514A8
_020514A4:
mov r0, #0
_020514A8:
and r0, r0, #0xff
bx lr
arm_func_end JoinedAtRangeCheck

View File

@ -1,26 +0,0 @@
.include "asm/macros.inc"
.include "overlay_29_023361D4.inc"
.text
arm_func_start IsFullFloorFixedRoom
IsFullFloorFixedRoom: ; 0x023361D4
ldr r0, _02336200 ; =DUNGEON_PTR
ldr r0, [r0]
add r0, r0, #0x4000
#ifdef JAPAN
ldrb r0, [r0, #0x36]
#else
ldrb r0, [r0, #0xda]
#endif
cmp r0, #0
beq _023361F8
cmp r0, #0xa5
movlo r0, #1
bxlo lr
_023361F8:
mov r0, #0
bx lr
.align 2, 0
_02336200: .word DUNGEON_PTR
arm_func_end IsFullFloorFixedRoom

View File

@ -1779,4 +1779,14 @@ struct dungeon {
u8 field_0x2cb13;
};
struct dungeon_restriction {
u32 flags;
u8 max_rescue_attempts;
u8 max_items_allowed;
u8 max_party_size;
u8 pad;
u16 turn_limit_per_floor;
u16 random_movement_chance;
};
#endif // PMDSKY_DUNGEON_H

View File

@ -0,0 +1,9 @@
#ifndef PMDSKY_MAIN_02051398_H
#define PMDSKY_MAIN_02051398_H
#include "enums.h"
#include "util.h"
bool8 IsRecruitingAllowed(enum dungeon_id dungeon_id);
#endif //PMDSKY_MAIN_02051398_H

View File

@ -2946,4 +2946,19 @@ enum pack_file_id {
PACK_ARCHIVE_M_LEVEL = 5,
};
enum dungeon_restriction_flags {
DUNGEON_ASCENDS = 1 << 0, // 0 if dungeon goes down, 1 if it goes up
ENEMIES_CAN_EVOLVE = 1 << 1,
GRANT_XP = 1 << 2, // when defeating enemies
ALLOW_RECRUITING = 1 << 3,
RESET_TEAM_LEVEL_TO_1 = 1 << 4, // when entering
KEEP_MONEY_ON_ENTRY = 1 << 5, // 0 if money is lost when entering
ALLOW_LEADER_CHANGE = 1 << 6,
NO_SAVE_ON_ENTRY = 1 << 7,
DISABLE_IQ_SKILLS = 1 << 8,
TRAPS_STAY_HIDDEN_ON_ATTACK = 1 << 9, // true if traps remain invisible when attacked / item-thrown
ENEMIES_DROP_CHESTS = 1 << 10
// Remaining flags are unused
};
#endif //PMDSKY_ENUMS_H

View File

@ -0,0 +1,8 @@
#ifndef PMDSKY_FIXED_ROOM_DATA_1_H
#define PMDSKY_FIXED_ROOM_DATA_1_HH
#include "util.h"
bool8 IsFullFloorFixedRoom();
#endif //PMDSKY_FIXED_ROOM_DATA_1_H

View File

@ -83,6 +83,8 @@ Static main
Object asm/main_0204DE7C.o
Object src/number_util.o
Object asm/main_02051098.o
Object src/dungeon_recruitment_2.o
Object asm/main_020513C0.o
Object src/main_020514CC.o
Object asm/main_02051504.o
Object src/main_02051760.o
@ -588,7 +590,7 @@ Overlay OVY_29
Object src/overlay_29_023350D8.o
Object asm/overlay_29_023350FC.o
Object src/dungeon_map_access.o
Object asm/overlay_29_023361D4.o
Object src/fixed_room_data_1.o
Object src/run_dungeon.o
Object asm/overlay_29_02336224.o
Object src/overlay_29_02337CA8.o

View File

@ -0,0 +1,19 @@
#include "dungeon_recruitment_2.h"
#include "dungeon.h"
#include "enums.h"
#include "util.h"
extern struct dungeon_restriction DUNGEON_RESTRICTIONS[];
bool8 IsRecruitingAllowed(enum dungeon_id dungeon_id)
{
bool8 return_val;
if (DUNGEON_RESTRICTIONS[dungeon_id].flags & ALLOW_RECRUITING) {
return_val = TRUE;
} else {
return_val = FALSE;
}
return return_val;
}

14
src/fixed_room_data_1.c Normal file
View File

@ -0,0 +1,14 @@
#include "fixed_room_data_1.h"
#include "dungeon.h"
bool8 IsFullFloorFixedRoom()
{
u8 fixed_room_id = DUNGEON_PTR[0]->gen_info.fixed_room_id;
if(fixed_room_id != 0 && fixed_room_id < FIXED_SEALED_CHAMBER) {
return TRUE;
}
return FALSE;
}