Skip to content

Commit f185338

Browse files
Merge pull request #243 from SethBarberee/decomp_jan_2026
Decomp jan 2026
2 parents f4f4e97 + 6218fc0 commit f185338

21 files changed

Lines changed: 182 additions & 275 deletions

asm/include/main_0200EB30.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
.public IsItemValid
55
.public ITEM_DATA_TABLE_PTRS
66
.public ItemZInit
7+
.public SetActiveInventory
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#pragma once
22
.public GravityIsActive
3+
.public IsTypeAffectedByGravity

asm/main_0200EB30.s

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -68,107 +68,3 @@ _0200EBB8:
6868
_0200EBC8: .word BABY_EXCLUSIVE_ITEM_PAIRS
6969
arm_func_end ReturnEggExclusiveItem
7070

71-
arm_func_start SetActiveInventoryToMain
72-
SetActiveInventoryToMain: ; 0x0200EBCC
73-
ldr ip, _0200EBD8 ; =SetActiveInventory
74-
mov r0, #0
75-
bx ip
76-
.align 2, 0
77-
_0200EBD8: .word SetActiveInventory
78-
arm_func_end SetActiveInventoryToMain
79-
80-
arm_func_start AllInventoriesZInit
81-
AllInventoriesZInit: ; 0x0200EBDC
82-
stmdb sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, lr}
83-
mov sl, #0
84-
ldr r6, _0200EC44 ; =BAG_ITEMS_PTR_MIRROR
85-
mov r7, sl
86-
mov fp, sl
87-
mov r4, #6
88-
mov r5, #0x12c
89-
_0200EBF8:
90-
mul sb, sl, r5
91-
mov r8, fp
92-
_0200EC00:
93-
ldr r0, [r6]
94-
add r0, r0, sb
95-
mla r0, r8, r4, r0
96-
bl ItemZInit
97-
add r8, r8, #1
98-
cmp r8, #0x32
99-
blt _0200EC00
100-
ldr r0, [r6]
101-
add r0, r0, sl, lsl #2
102-
add r0, r0, #0x1000
103-
add sl, sl, #1
104-
str r7, [r0, #0x394]
105-
cmp sl, #3
106-
blt _0200EBF8
107-
mov r0, r7
108-
bl SetActiveInventory
109-
ldmia sp!, {r3, r4, r5, r6, r7, r8, sb, sl, fp, pc}
110-
.align 2, 0
111-
_0200EC44: .word BAG_ITEMS_PTR_MIRROR
112-
arm_func_end AllInventoriesZInit
113-
114-
arm_func_start SpecialEpisodeInventoryZInit
115-
SpecialEpisodeInventoryZInit: ; 0x0200EC48
116-
stmdb sp!, {r4, r5, r6, lr}
117-
ldr r5, _0200EC8C ; =BAG_ITEMS_PTR_MIRROR
118-
mov r6, #0
119-
mov r4, #6
120-
_0200EC58:
121-
ldr r0, [r5]
122-
add r0, r0, #0x12c
123-
mla r0, r6, r4, r0
124-
bl ItemZInit
125-
add r6, r6, #1
126-
cmp r6, #0x32
127-
blt _0200EC58
128-
ldr r0, _0200EC8C ; =BAG_ITEMS_PTR_MIRROR
129-
mov r1, #0
130-
ldr r0, [r0]
131-
add r0, r0, #0x1000
132-
str r1, [r0, #0x398]
133-
ldmia sp!, {r4, r5, r6, pc}
134-
.align 2, 0
135-
_0200EC8C: .word BAG_ITEMS_PTR_MIRROR
136-
arm_func_end SpecialEpisodeInventoryZInit
137-
138-
arm_func_start RescueInventoryZInit
139-
RescueInventoryZInit: ; 0x0200EC90
140-
stmdb sp!, {r4, r5, r6, lr}
141-
ldr r5, _0200ECD4 ; =BAG_ITEMS_PTR_MIRROR
142-
mov r6, #0
143-
mov r4, #6
144-
_0200ECA0:
145-
ldr r0, [r5]
146-
add r0, r0, #0x258
147-
mla r0, r6, r4, r0
148-
bl ItemZInit
149-
add r6, r6, #1
150-
cmp r6, #0x32
151-
blt _0200ECA0
152-
ldr r0, _0200ECD4 ; =BAG_ITEMS_PTR_MIRROR
153-
mov r1, #0
154-
ldr r0, [r0]
155-
add r0, r0, #0x1000
156-
str r1, [r0, #0x39c]
157-
ldmia sp!, {r4, r5, r6, pc}
158-
.align 2, 0
159-
_0200ECD4: .word BAG_ITEMS_PTR_MIRROR
160-
arm_func_end RescueInventoryZInit
161-
162-
arm_func_start SetActiveInventory
163-
SetActiveInventory: ; 0x0200ECD8
164-
ldr r2, _0200ECF8 ; =BAG_ITEMS_PTR_MIRROR
165-
mov r1, #0x12c
166-
ldr r3, [r2]
167-
strb r0, [r3, #0x388]
168-
ldr r2, [r2]
169-
mla r1, r0, r1, r2
170-
str r1, [r2, #0x384]
171-
bx lr
172-
.align 2, 0
173-
_0200ECF8: .word BAG_ITEMS_PTR_MIRROR
174-
arm_func_end SetActiveInventory

asm/main_0200ED1C.s

Lines changed: 0 additions & 41 deletions
This file was deleted.

asm/main_02052B44.s

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,6 @@
33

44
.text
55

6-
arm_func_start GetSpawnThreshold
7-
GetSpawnThreshold: ; 0x02052B44
8-
ldr r2, _02052B5C ; =MONSTER_DATA_TABLE_PTR
9-
mov r1, #0x44
10-
ldr r2, [r2]
11-
smlabb r0, r0, r1, r2
12-
ldrb r0, [r0, #0x31]
13-
bx lr
14-
.align 2, 0
15-
_02052B5C: .word MONSTER_DATA_TABLE_PTR
16-
arm_func_end GetSpawnThreshold
17-
18-
arm_func_start NeedsItemToSpawn
19-
NeedsItemToSpawn: ; 0x02052B60
20-
ldr r2, _02052B88 ; =MONSTER_DATA_TABLE_PTR
21-
mov r1, #0x44
22-
ldr r2, [r2]
23-
smlabb r0, r0, r1, r2
24-
ldrb r0, [r0, #0x1a]
25-
tst r0, #0x80
26-
movne r0, #1
27-
moveq r0, #0
28-
and r0, r0, #0xff
29-
bx lr
30-
.align 2, 0
31-
_02052B88: .word MONSTER_DATA_TABLE_PTR
32-
arm_func_end NeedsItemToSpawn
33-
34-
arm_func_start GetExclusiveItem
35-
GetExclusiveItem: ; 0x02052B8C
36-
ldr r2, _02052BB4 ; =MONSTER_DATA_TABLE_PTR
37-
mov r3, r1, lsr #0x1f
38-
ldr ip, [r2]
39-
mov r2, #0x44
40-
rsb r1, r3, r1, lsl #30
41-
smlabb r2, r0, r2, ip
42-
add r0, r3, r1, ror #30
43-
add r0, r2, r0, lsl #1
44-
ldrsh r0, [r0, #0x34]
45-
bx lr
46-
.align 2, 0
47-
_02052BB4: .word MONSTER_DATA_TABLE_PTR
48-
arm_func_end GetExclusiveItem
49-
506
arm_func_start GetFamilyIndex
517
GetFamilyIndex: ; 0x02052BB8
528
ldr r2, _02052BD0 ; =MONSTER_DATA_TABLE_PTR

asm/overlay_29_02301E88.s

Lines changed: 0 additions & 39 deletions
This file was deleted.

asm/overlay_29_02318A90.s

Lines changed: 0 additions & 20 deletions
This file was deleted.

include/dungeon_logic_3.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,10 @@ bool8 LevitateIsActive(struct entity* entity);
88
// Checks if a monster is a given type.
99
bool8 MonsterIsType(struct entity *entity, enum type_id type_id);
1010

11+
// Checks if the type affected by Gravity
12+
bool8 IsTypeAffectedByGravity(struct entity *entity, enum type_id type);
13+
14+
// Checks if the monster has a type affected by Gravity
15+
bool8 HasTypeAffectedByGravity(struct entity* entity, enum type_id type);
16+
1117
#endif //PMDSKY_DUNGEON_LOGIC_3_H

include/item.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,7 @@ enum exclusive_item_effect_id {
15961596

15971597
#define GROUND_ITEM_TOOLBOX_INDEX 0x80
15981598
#define HELD_ITEM_TOOLBOX_INDEX 0x81
1599-
#define INVENTORY_SIZE 52
1599+
#define INVENTORY_SIZE 50
16001600
#define NUMBER_OF_ITEM_IDS (ITEM_UNNAMED_0x577 + 1)
16011601

16021602
// Item info
@@ -1634,12 +1634,25 @@ struct item_volatile {
16341634
};
16351635

16361636
struct bag_items_inner {
1637-
/* 0x0 */ struct item bag_items[INVENTORY_SIZE];
1637+
/* 0x0 */ struct item bag_items[INVENTORY_SIZE];
1638+
// NOTE: I don't know why we have to do the subtraction - Seth
16381639
};
16391640

1641+
#define MAIN_INVENTORY_INDEX 0
1642+
#define SPECIAL_EPISODE_INVENTORY_INDEX 1
1643+
#define RESCUE_INVENTORY_INDEX 2
1644+
#define NUM_INVENTORIES 3
1645+
16401646
struct bag_items {
1641-
u8 fill0[0x384];
1647+
// Indexes:
1648+
// 0x0 - Main, default
1649+
// 0x1 - Special Episode
1650+
// 0x2 - Rescue
1651+
/* 0x0 */ struct bag_items_inner inventories[NUM_INVENTORIES];
16421652
/* 0x384 */ struct bag_items_inner *bag_items;
1653+
/* 0x388 */ u8 active_inventory_idx;
1654+
u8 fill2[0x1009];
1655+
u32 maybeMoney[NUM_INVENTORIES]; // indexed with an u8, uses same indexes as Inventory
16431656
};
16441657

16451658
struct bulk_item

include/main_0200ECFC.h

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
#ifndef PMDSKY_MAIN_0200ECFC_H
22
#define PMDSKY_MAIN_0200ECFC_H
33

4-
typedef struct {
5-
u8 fill1[0x388];
6-
u8 unk388;
7-
u8 fill2[0x1009];
8-
u32 maybeMoney[]; // Unknown size, but indexed with an u8
9-
} bag_items;
4+
// Set the active inventory to the main inventory
5+
void SetActiveInventoryToMain(void);
6+
7+
// Init all inventories, all money the player is carrying, and set default active inventory
8+
void AllInventoriesZInit(void);
9+
10+
// Init the special episode inventory and money the player is carrying
11+
void SpecialEpisodeInventoryZInit(void);
12+
13+
// Init the rescue inventory and money the player is carrying
14+
void RescueInventoryZInit(void);
15+
16+
// Set the active inventory to the current index
17+
void SetActiveInventory(s8 index);
1018

1119
// Gets the amount of money the player is carrying.
1220
// return: value
1321
u32 GetMoneyCarried(void);
1422

23+
// Sets the amount of money the player is carrying.
24+
void SetMoneyCarried(s32 amount);
25+
26+
// Adds the amount of to the money the player is carrying.
27+
void AddMoneyCarried(s32 amount);
28+
1529
#endif //PMDSKY_MAIN_0200ECFC_H

0 commit comments

Comments
 (0)