Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disassemble more dungeon functions #83

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion asm/include/overlay_29_0231CBEC.inc
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
.public ov29_02305814
.public ov29_0233665C
.public ov29_0233785C
.public ov29_02338530
.public GetDoughSeedFlag
.public ov29_02339FF4
.public ov29_0233FB1C
.public ov29_02344B44
Expand Down
4 changes: 0 additions & 4 deletions asm/include/overlay_29_02337CCC.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
.public GetVictoriesOnOneFloor
.public HiddenStairsTrigger
.public IqSkillIsEnabled
.public IsFullFloorFixedRoom
.public LogMessageByIdWithPopupCheckUser
.public MemAlloc
.public MemFree
Expand All @@ -21,7 +20,6 @@
.public RandInt
.public SECONDARY_TERRAIN_TYPES
.public SetVictoriesOnOneFloor
.public TeamMemberHasExclusiveItemEffectActive
.public UpdateTrapsVisibility
.public ov10_022C6327
.public ov29_022E66C4
Expand All @@ -30,5 +28,3 @@
.public ov29_02304BAC
.public ov29_02306D54
.public ov29_02336694
.public ov29_02344E88
.public ov29_02352B5C
5 changes: 5 additions & 0 deletions asm/include/overlay_29_02338560.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once
.public DUNGEON_PTR
.public IsFullFloorFixedRoom
.public ov29_02344E88
.public ov29_02352B5C
2 changes: 1 addition & 1 deletion asm/overlay_29_0231CBEC.s
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ ApplyDoughSeedEffect: ; 0x0231D6E0
ldrb r0, [r0, #6]
cmp r0, #0
bne _0231D730
bl ov29_02338530
bl GetDoughSeedFlag
cmp r0, #0
bne _0231D730
mov r0, #1
Expand Down
162 changes: 0 additions & 162 deletions asm/overlay_29_02337CCC.s
Original file line number Diff line number Diff line change
Expand Up @@ -694,165 +694,3 @@ _023384BC: .word 0x00012A5A
_023384BC: .word 0x00012AFE
#endif
arm_func_end ov29_0233847C

arm_func_start ShouldBoostKecleonShopSpawnChance
ShouldBoostKecleonShopSpawnChance: ; 0x023384C0
ldr r0, _023384D4 ; =DUNGEON_PTR
ldr r0, [r0]
add r0, r0, #0x12000
#ifdef JAPAN
ldrb r0, [r0, #0xa80]
#else
ldrb r0, [r0, #0xb24]
#endif
bx lr
.align 2, 0
_023384D4: .word DUNGEON_PTR
arm_func_end ShouldBoostKecleonShopSpawnChance

arm_func_start SetShouldBoostKecleonShopSpawnChance
SetShouldBoostKecleonShopSpawnChance: ; 0x023384D8
ldr r1, _023384EC ; =DUNGEON_PTR
ldr r1, [r1]
add r1, r1, #0x12000
#ifdef JAPAN
strb r0, [r1, #0xa80]
#else
strb r0, [r1, #0xb24]
#endif
bx lr
.align 2, 0
_023384EC: .word DUNGEON_PTR
arm_func_end SetShouldBoostKecleonShopSpawnChance

arm_func_start UpdateShouldBoostKecleonShopSpawnChance
UpdateShouldBoostKecleonShopSpawnChance: ; 0x023384F0
stmdb sp!, {r3, lr}
ldr r0, _0233852C ; =DUNGEON_PTR
mov r2, #0
ldr r1, [r0]
mov r0, #0x5e
add r1, r1, #0x12000
#ifdef JAPAN
strb r2, [r1, #0xa80]
#else
strb r2, [r1, #0xb24]
#endif
bl TeamMemberHasExclusiveItemEffectActive
cmp r0, #0
ldrne r0, _0233852C ; =DUNGEON_PTR
movne r1, #1
ldrne r0, [r0]
addne r0, r0, #0x12000
#ifdef JAPAN
strneb r1, [r0, #0xa80]
#else
strneb r1, [r0, #0xb24]
#endif
ldmia sp!, {r3, pc}
.align 2, 0
_0233852C: .word DUNGEON_PTR
arm_func_end UpdateShouldBoostKecleonShopSpawnChance

arm_func_start ov29_02338530
ov29_02338530: ; 0x02338530
ldr r0, _02338544 ; =DUNGEON_PTR
ldr r0, [r0]
add r0, r0, #0x4000
#ifdef JAPAN
ldrb r0, [r0, #0x24]
#else
ldrb r0, [r0, #0xc8]
#endif
bx lr
.align 2, 0
_02338544: .word DUNGEON_PTR
arm_func_end ov29_02338530

arm_func_start SetDoughSeedFlag
SetDoughSeedFlag: ; 0x02338548
ldr r1, _0233855C ; =DUNGEON_PTR
ldr r1, [r1]
add r1, r1, #0x4000
#ifdef JAPAN
strb r0, [r1, #0x24]
#else
strb r0, [r1, #0xc8]
#endif
bx lr
.align 2, 0
_0233855C: .word DUNGEON_PTR
arm_func_end SetDoughSeedFlag

arm_func_start TrySpawnDoughSeedPoke
TrySpawnDoughSeedPoke: ; 0x02338560
stmdb sp!, {r3, lr}
ldr r0, _023385BC ; =DUNGEON_PTR
ldr r0, [r0]
add r0, r0, #0x4000
#ifdef JAPAN
ldrb r0, [r0, #0x24]
#else
ldrb r0, [r0, #0xc8]
#endif
cmp r0, #0
ldmeqia sp!, {r3, pc}
bl IsFullFloorFixedRoom
cmp r0, #0
bne _023385A4
ldr r1, _023385C0 ; =ov29_02352B5C
add r0, sp, #0
ldrh r2, [r1]
strh r2, [sp]
ldrh r1, [r1, #2]
strh r1, [sp, #2]
bl ov29_02344E88
_023385A4:
ldr r0, _023385BC ; =DUNGEON_PTR
mov r1, #0
ldr r0, [r0]
add r0, r0, #0x4000
#ifdef JAPAN
strb r1, [r0, #0x24]
#else
strb r1, [r0, #0xc8]
#endif
ldmia sp!, {r3, pc}
.align 2, 0
_023385BC: .word DUNGEON_PTR
_023385C0: .word ov29_02352B5C
arm_func_end TrySpawnDoughSeedPoke

arm_func_start IsSecretBazaar
IsSecretBazaar: ; 0x023385C4
ldr r0, _023385E8 ; =DUNGEON_PTR
ldr r0, [r0]
add r0, r0, #0x4000
#ifdef JAPAN
ldrb r0, [r0, #0x36]
#else
ldrb r0, [r0, #0xda]
#endif
cmp r0, #0x70
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
.align 2, 0
_023385E8: .word DUNGEON_PTR
arm_func_end IsSecretBazaar

arm_func_start ShouldBoostHiddenStairsSpawnChance
ShouldBoostHiddenStairsSpawnChance: ; 0x023385EC
ldr r0, _02338600 ; =DUNGEON_PTR
ldr r0, [r0]
add r0, r0, #0x12000
#ifdef JAPAN
ldrb r0, [r0, #0xa81]
#else
ldrb r0, [r0, #0xb25]
#endif
bx lr
.align 2, 0
_02338600: .word DUNGEON_PTR
arm_func_end ShouldBoostHiddenStairsSpawnChance
43 changes: 43 additions & 0 deletions asm/overlay_29_02338560.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
.include "asm/macros.inc"
.include "overlay_29_02338560.inc"

.text

arm_func_start TrySpawnDoughSeedPoke
TrySpawnDoughSeedPoke: ; 0x02338560
stmdb sp!, {r3, lr}
ldr r0, _023385BC ; =DUNGEON_PTR
ldr r0, [r0]
add r0, r0, #0x4000
#ifdef JAPAN
ldrb r0, [r0, #0x24]
#else
ldrb r0, [r0, #0xc8]
#endif
cmp r0, #0
ldmeqia sp!, {r3, pc}
bl IsFullFloorFixedRoom
cmp r0, #0
bne _023385A4
ldr r1, _023385C0 ; =ov29_02352B5C
add r0, sp, #0
ldrh r2, [r1]
strh r2, [sp]
ldrh r1, [r1, #2]
strh r1, [sp, #2]
bl ov29_02344E88
_023385A4:
ldr r0, _023385BC ; =DUNGEON_PTR
mov r1, #0
ldr r0, [r0]
add r0, r0, #0x4000
#ifdef JAPAN
strb r1, [r0, #0x24]
#else
strb r1, [r0, #0xc8]
#endif
ldmia sp!, {r3, pc}
.align 2, 0
_023385BC: .word DUNGEON_PTR
_023385C0: .word ov29_02352B5C
arm_func_end TrySpawnDoughSeedPoke
12 changes: 12 additions & 0 deletions include/overlay_29_02338548.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef PMDSKY_OVERLAY_29_02338548_H
#define PMDSKY_OVERLAY_29_02338548_H

#include "util.h"

bool ShouldBoostKecleonShopSpawnChance(void);
void SetShouldBoostKecleonShopSpawnChance(bool boost);
void UpdateShouldBoostKecleonShopSpawnChance(void);
bool GetDoughSeedFlag(void);
void SetDoughSeedFlag(bool flag);

#endif //PMDSKY_OVERLAY_29_02338548_H
2 changes: 2 additions & 0 deletions include/overlay_29_02338604.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef PMDSKY_OVERLAY_29_02338604_H
#define PMDSKY_OVERLAY_29_02338604_H

u8 IsSecretBazaar();
u8 ShouldBoostHiddenStairsSpawnChance();
void SetShouldBoostHiddenStairsSpawnChance(u8 should_boost);

#endif //PMDSKY_OVERLAY_29_02338604_H
2 changes: 2 additions & 0 deletions main.lsf
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ Overlay OVY_29
Object asm/overlay_29_023350FC.o
Object src/overlay_29_02337CA8.o
Object asm/overlay_29_02337CCC.o
Object src/overlay_29_02338548.o
Object asm/overlay_29_02338560.o
Object src/overlay_29_02338604.o
Object asm/overlay_29_0233861C.o
Object src/overlay_29_02344AF8.o
Expand Down
35 changes: 35 additions & 0 deletions src/overlay_29_02338548.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "overlay_29_02338548.h"

#include "dungeon.h"

extern struct dungeon* DUNGEON_PTR[];
bool TeamMemberHasExclusiveItemEffectActive(u8);

bool ShouldBoostKecleonShopSpawnChance(void)
{
return DUNGEON_PTR[0]->boost_kecleon_shop_spawn_chance;
}

void SetShouldBoostKecleonShopSpawnChance(bool boost)
{
DUNGEON_PTR[0]->boost_kecleon_shop_spawn_chance=boost;
}

void UpdateShouldBoostKecleonShopSpawnChance(void)
{
DUNGEON_PTR[0]->boost_kecleon_shop_spawn_chance = FALSE;
if (TeamMemberHasExclusiveItemEffectActive(0x5e)) {
DUNGEON_PTR[0]->boost_kecleon_shop_spawn_chance = TRUE;
}
}

bool GetDoughSeedFlag(void)
{
return DUNGEON_PTR[0]->gen_info.dough_seed_extra_poke_flag;
}


void SetDoughSeedFlag(bool flag)
{
DUNGEON_PTR[0]->gen_info.dough_seed_extra_poke_flag=flag;
}
15 changes: 15 additions & 0 deletions src/overlay_29_02338604.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@

extern struct dungeon* DUNGEON_PTR[];

u8 IsSecretBazaar()
{
return DUNGEON_PTR[0]->gen_info.fixed_room_id==FIXED_SECRET_BAZAAR;
}


u8 ShouldBoostHiddenStairsSpawnChance()
{
#ifdef JAPAN
return DUNGEON_PTR[0]->boost_hidden_stairs_spawn_chance;
chordtoll marked this conversation as resolved.
Show resolved Hide resolved
#else
return DUNGEON_PTR[0]->boost_hidden_stairs_spawn_chance;
#endif
}

void SetShouldBoostHiddenStairsSpawnChance(u8 should_boost)
{
#ifdef JAPAN
Expand Down
Loading