summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenny022p <info@henny022.de>2025-03-04 21:00:25 +0000
committerHenny022p <info@henny022.de>2025-03-09 18:57:57 +0000
commite3022b8b039214f4aaec895558ec94931c5ed3a5 (patch)
tree94214e474aebdc708d808bb19ad3d33ff8296ee0
parentb19f86852b486b44c67f782914cfd208bb313bcf (diff)
cleanup hole manager
-rw-r--r--assets/assets.json54
-rw-r--r--data/const/manager/holeManager.s189
-rw-r--r--include/functions.h1
-rw-r--r--include/manager/holeManager.h16
-rw-r--r--include/manager/lightManager.h2
-rw-r--r--linker.ld1
-rw-r--r--src/manager/holeManager.c322
-rw-r--r--src/manager/lightManager.c2
-rw-r--r--src/object/chestSpawner.c7
-rw-r--r--src/object/fourElements.c5
-rw-r--r--src/object/minishPortalStone.c5
-rw-r--r--src/roomInit.c6
-rw-r--r--tools/src/asset_processor/offsets.cpp4
13 files changed, 268 insertions, 346 deletions
diff --git a/assets/assets.json b/assets/assets.json
index 159dcb76..e56d5b4a 100644
--- a/assets/assets.json
+++ b/assets/assets.json
@@ -13037,137 +13037,137 @@
"size": 8
},
{
- "path": "holeManager/gUnk_08108764.bin",
+ "path": "holeManager/gHoleTransitions.bin",
"start": 1083236,
"size": 32
},
{
- "path": "holeManager/gUnk_08108764_1.bin",
+ "path": "holeManager/gHoleTransitions_1.bin",
"start": 1083272,
"size": 16
},
{
- "path": "holeManager/gUnk_08108764_2.bin",
+ "path": "holeManager/gHoleTransitions_2.bin",
"start": 1083292,
"size": 20
},
{
- "path": "holeManager/gUnk_08108764_3.bin",
+ "path": "holeManager/gHoleTransitions_3.bin",
"start": 1083316,
"size": 12
},
{
- "path": "holeManager/gUnk_08108764_4.bin",
+ "path": "holeManager/gHoleTransitions_4.bin",
"start": 1083332,
"size": 16
},
{
- "path": "holeManager/gUnk_08108764_5.bin",
+ "path": "holeManager/gHoleTransitions_5.bin",
"start": 1083352,
"size": 16
},
{
- "path": "holeManager/gUnk_08108764_6.bin",
+ "path": "holeManager/gHoleTransitions_6.bin",
"start": 1083372,
"size": 40
},
{
- "path": "holeManager/gUnk_08108764_7.bin",
+ "path": "holeManager/gHoleTransitions_7.bin",
"start": 1083416,
"size": 16
},
{
- "path": "holeManager/gUnk_08108764_8.bin",
+ "path": "holeManager/gHoleTransitions_8.bin",
"start": 1083436,
"size": 16
},
{
- "path": "holeManager/gUnk_08108764_9.bin",
+ "path": "holeManager/gHoleTransitions_9.bin",
"start": 1083456,
"size": 16
},
{
- "path": "holeManager/gUnk_08108764_10.bin",
+ "path": "holeManager/gHoleTransitions_10.bin",
"start": 1083476,
"size": 32
},
{
- "path": "holeManager/gUnk_08108764_11.bin",
+ "path": "holeManager/gHoleTransitions_11.bin",
"start": 1083512,
"size": 440
},
{
- "path": "holeManager/gUnk_08108764_12.bin",
+ "path": "holeManager/gHoleTransitions_12.bin",
"start": 1083956,
"size": 16
},
{
- "path": "holeManager/gUnk_08108764_13.bin",
+ "path": "holeManager/gHoleTransitions_13.bin",
"start": 1083976,
"size": 36
},
{
- "path": "holeManager/gUnk_08108764_14.bin",
+ "path": "holeManager/gHoleTransitions_14.bin",
"start": 1084016,
"size": 16
},
{
- "path": "holeManager/gUnk_08108764_15.bin",
+ "path": "holeManager/gHoleTransitions_15.bin",
"start": 1084036,
"size": 16
},
{
- "path": "holeManager/gUnk_08108764_16.bin",
+ "path": "holeManager/gHoleTransitions_16.bin",
"start": 1084056,
"size": 36
},
{
- "path": "holeManager/gUnk_08108764_17.bin",
+ "path": "holeManager/gHoleTransitions_17.bin",
"start": 1084096,
"size": 16
},
{
- "path": "holeManager/gUnk_08108764_18.bin",
+ "path": "holeManager/gHoleTransitions_18.bin",
"start": 1084116,
"size": 36
},
{
- "path": "holeManager/gUnk_08108764_19.bin",
+ "path": "holeManager/gHoleTransitions_19.bin",
"start": 1084156,
"size": 36
},
{
- "path": "holeManager/gUnk_08108764_20.bin",
+ "path": "holeManager/gHoleTransitions_20.bin",
"start": 1084196,
"size": 16
},
{
- "path": "holeManager/gUnk_08108764_21.bin",
+ "path": "holeManager/gHoleTransitions_21.bin",
"start": 1084216,
"size": 16
},
{
- "path": "holeManager/gUnk_08108764_22.bin",
+ "path": "holeManager/gHoleTransitions_22.bin",
"start": 1084236,
"size": 16
},
{
- "path": "holeManager/gUnk_08108764_23.bin",
+ "path": "holeManager/gHoleTransitions_23.bin",
"start": 1084256,
"size": 32
},
{
- "path": "holeManager/gUnk_08108764_24.bin",
+ "path": "holeManager/gHoleTransitions_24.bin",
"start": 1084292,
"size": 16
},
{
- "path": "holeManager/gUnk_08108764_25.bin",
+ "path": "holeManager/gHoleTransitions_25.bin",
"start": 1084312,
"size": 16
},
{
- "path": "holeManager/gUnk_08108764_26.bin",
+ "path": "holeManager/gHoleTransitions_26.bin",
"start": 1084332,
"size": 124
},
diff --git a/data/const/manager/holeManager.s b/data/const/manager/holeManager.s
index 1ad9d330..d721bc55 100644
--- a/data/const/manager/holeManager.s
+++ b/data/const/manager/holeManager.s
@@ -3,192 +3,3 @@
.section .rodata
.align 2
-
-HoleManager_Actions:: @ 08108668
- .4byte sub_0805B048
- .4byte sub_0805B168
-
-gUnk_08108670:: @ 08108670
-.ifdef EU
- @ TODO only small differences
- .incbin "holeManager/gUnk_08108670_EU.bin"
-.else
- .incbin "holeManager/gUnk_08108670_1_USA-JP-DEMO_USA-DEMO_JP.bin"
-.endif
-
-gUnk_0810867C:: @ 0810867C
-.ifdef EU
- @ TODO only small differences
- .incbin "holeManager/gUnk_0810867C_EU.bin"
-.else
- .incbin "holeManager/gUnk_0810867C_1_USA-JP-DEMO_USA-DEMO_JP.bin"
-.endif
-
-gUnk_08108688:: @ 08108688
-.ifdef EU
- @ TODO only small differences
- .incbin "holeManager/gUnk_08108688_EU.bin"
-.else
- .incbin "holeManager/gUnk_08108688_1_USA-JP-DEMO_USA-DEMO_JP.bin"
-.endif
-
-gUnk_08108694:: @ 08108694
-.ifdef EU
- @ TODO only small differences
- .incbin "holeManager/gUnk_08108694_EU.bin"
-.else
- .incbin "holeManager/gUnk_08108694_1_USA-JP-DEMO_USA-DEMO_JP.bin"
-.endif
-
-gUnk_081086A0:: @ 081086A0
-.ifdef EU
- @ TODO only small differences
- .incbin "holeManager/gUnk_081086A0_EU.bin"
-.else
- .incbin "holeManager/gUnk_081086A0_1_USA-JP-DEMO_USA-DEMO_JP.bin"
-.endif
- .incbin "holeManager/gUnk_081086A0_2.bin"
-
-gUnk_081086AC:: @ 081086AC
-.ifdef EU
- @ TODO only small differences
- .incbin "holeManager/gUnk_081086AC_EU.bin"
-.else
- .incbin "holeManager/gUnk_081086AC_1_USA-JP-DEMO_USA-DEMO_JP.bin"
-.endif
-
-gUnk_081086B8:: @ 081086B8
-.ifdef EU
- @ TODO only small differences
- .incbin "holeManager/gUnk_081086B8_EU.bin"
-.else
- .incbin "holeManager/gUnk_081086B8_1_USA-JP-DEMO_USA-DEMO_JP.bin"
-.endif
-
-gUnk_081086C4:: @ 081086C4
-.ifdef EU
- @ TODO only small differences
- .incbin "holeManager/gUnk_081086C4_EU.bin"
-.else
- .incbin "holeManager/gUnk_081086C4_1_USA-JP-DEMO_USA-DEMO_JP.bin"
-.endif
-
-gUnk_081086D0:: @ 081086D0
-.ifdef EU
- @ TODO only small differences
- .incbin "holeManager/gUnk_081086D0_EU.bin"
-.else
- .incbin "holeManager/gUnk_081086D0_1_USA-JP-DEMO_USA-DEMO_JP.bin"
-.endif
-.ifdef EU
- @ TODO only small differences
- .incbin "holeManager/gUnk_081086D0_2_EU.bin"
-.else
- .incbin "holeManager/gUnk_081086D0_3_USA-JP-DEMO_USA-DEMO_JP.bin"
-.endif
-
-gUnk_081086DC:: @ 081086DC
- .incbin "holeManager/gUnk_081086DC.bin"
-
-gUnk_081086E4:: @ 081086E4
- .incbin "holeManager/gUnk_081086E4.bin"
-
-gUnk_081086EC:: @ 081086EC
- .incbin "holeManager/gUnk_081086EC.bin"
-
-gUnk_081086F4:: @ 081086F4
- .incbin "holeManager/gUnk_081086F4.bin"
-
-gUnk_081086FC:: @ 081086FC
- .incbin "holeManager/gUnk_081086FC.bin"
-
-gUnk_08108704:: @ 08108704
- .incbin "holeManager/gUnk_08108704.bin"
-
-gUnk_0810870C:: @ 0810870C
- .incbin "holeManager/gUnk_0810870C.bin"
-
-gUnk_08108714:: @ 08108714
- .incbin "holeManager/gUnk_08108714.bin"
-
-gUnk_0810871C:: @ 0810871C
- .incbin "holeManager/gUnk_0810871C.bin"
-
-gUnk_08108724:: @ 08108724
- .incbin "holeManager/gUnk_08108724.bin"
-
-gUnk_0810872C:: @ 0810872C
- .incbin "holeManager/gUnk_0810872C.bin"
-
-gUnk_08108734:: @ 08108734
- .incbin "holeManager/gUnk_08108734.bin"
-
-gUnk_0810873C:: @ 0810873C
- .incbin "holeManager/gUnk_0810873C.bin"
-
-gUnk_08108744:: @ 08108744
- .incbin "holeManager/gUnk_08108744.bin"
-
-gUnk_0810874C:: @ 0810874C
- .incbin "holeManager/gUnk_0810874C.bin"
-
-gUnk_08108754:: @ 08108754
- .incbin "holeManager/gUnk_08108754.bin"
-
-gUnk_0810875C:: @ 0810875C
- .incbin "holeManager/gUnk_0810875C.bin"
-
-gUnk_08108764:: @ 08108764
- .incbin "holeManager/gUnk_08108764.bin"
- .4byte gUnk_08108670
- .incbin "holeManager/gUnk_08108764_1.bin"
- .4byte gUnk_08108688
- .incbin "holeManager/gUnk_08108764_2.bin"
- .4byte gUnk_0810875C
- .incbin "holeManager/gUnk_08108764_3.bin"
- .4byte gUnk_08108694
- .incbin "holeManager/gUnk_08108764_4.bin"
- .4byte gUnk_081086A0
- .incbin "holeManager/gUnk_08108764_5.bin"
- .4byte gUnk_081086AC
- .incbin "holeManager/gUnk_08108764_6.bin"
- .4byte gUnk_081086DC
- .incbin "holeManager/gUnk_08108764_7.bin"
- .4byte gUnk_081086E4
- .incbin "holeManager/gUnk_08108764_8.bin"
- .4byte gUnk_081086EC
- .incbin "holeManager/gUnk_08108764_9.bin"
- .4byte gUnk_081086F4
- .incbin "holeManager/gUnk_08108764_10.bin"
- .4byte gUnk_0810867C
- .incbin "holeManager/gUnk_08108764_11.bin"
- .4byte gUnk_081086FC
- .incbin "holeManager/gUnk_08108764_12.bin"
- .4byte gUnk_08108704
- .incbin "holeManager/gUnk_08108764_13.bin"
- .4byte gUnk_0810870C
- .incbin "holeManager/gUnk_08108764_14.bin"
- .4byte gUnk_08108714
- .incbin "holeManager/gUnk_08108764_15.bin"
- .4byte gUnk_0810871C
- .incbin "holeManager/gUnk_08108764_16.bin"
- .4byte gUnk_08108724
- .incbin "holeManager/gUnk_08108764_17.bin"
- .4byte gUnk_0810872C
- .incbin "holeManager/gUnk_08108764_18.bin"
- .4byte gUnk_08108734
- .incbin "holeManager/gUnk_08108764_19.bin"
- .4byte gUnk_0810873C
- .incbin "holeManager/gUnk_08108764_20.bin"
- .4byte gUnk_08108744
- .incbin "holeManager/gUnk_08108764_21.bin"
- .4byte gUnk_0810874C
- .incbin "holeManager/gUnk_08108764_22.bin"
- .4byte gUnk_08108754
- .incbin "holeManager/gUnk_08108764_23.bin"
- .4byte gUnk_081086B8
- .incbin "holeManager/gUnk_08108764_24.bin"
- .4byte gUnk_081086C4
- .incbin "holeManager/gUnk_08108764_25.bin"
- .4byte gUnk_081086D0
- .incbin "holeManager/gUnk_08108764_26.bin"
diff --git a/include/functions.h b/include/functions.h
index 9460e06e..5f16e8d5 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -85,7 +85,6 @@ extern void sub_080580B0(u32);
extern void sub_08058324(u32);
extern void sub_08059278(void);
extern void LoadStaticBackground(u32);
-extern void sub_0805BC4C(void);
extern void sub_0805EC60(Entity*);
extern void InitPlayerMacro(PlayerMacroEntry*);
extern u32* sub_0805F25C(u32);
diff --git a/include/manager/holeManager.h b/include/manager/holeManager.h
index 59bb8d66..6bf14c93 100644
--- a/include/manager/holeManager.h
+++ b/include/manager/holeManager.h
@@ -5,15 +5,15 @@
typedef struct {
Manager base;
- s16 unk_20;
- s16 unk_22;
- u16 unk_24;
- u16 unk_26;
+ s16 x;
+ s16 y;
+ u16 width;
+ u16 height;
u8 unk_28[8];
- u16 unk_30;
- u16 unk_32;
- u16 unk_34;
- u16 unk_36;
+ u16 persistance_x;
+ u16 persistance_y;
+ u16 persistance_offset_x;
+ u16 persistance_offset_y;
u8 unk_38[7];
u8 unk_3f;
} HoleManager;
diff --git a/include/manager/lightManager.h b/include/manager/lightManager.h
index 9bbb1c6b..4a49d488 100644
--- a/include/manager/lightManager.h
+++ b/include/manager/lightManager.h
@@ -8,4 +8,6 @@ typedef struct {
s32 unk20;
} LightManager;
+extern void UnDarkRoom(void);
+
#endif // LIGHTMANAGER_H
diff --git a/linker.ld b/linker.ld
index 4ed6e5b1..a6805557 100644
--- a/linker.ld
+++ b/linker.ld
@@ -1145,6 +1145,7 @@ SECTIONS {
src/manager/templeOfDropletsManager.o(.rodata);
src/manager/fallingItemManager.o(.rodata);
src/manager/cloudOverlayManager.o(.rodata);
+ src/manager/holeManager.o(.rodata);
data/const/manager/holeManager.o(.rodata);
src/manager/staticBackgroundManager.o(.rodata);
src/manager/rainfallManager.o(.rodata);
diff --git a/src/manager/holeManager.c b/src/manager/holeManager.c
index c83ed3ea..4517f41d 100644
--- a/src/manager/holeManager.c
+++ b/src/manager/holeManager.c
@@ -7,105 +7,210 @@
#include "manager/holeManager.h"
#include "common.h"
#include "flags.h"
-#include "functions.h"
#include "object.h"
#include "room.h"
#include "screen.h"
+#include "manager/lightManager.h"
+#include "assets/gfx_offsets.h"
+#include "functions.h"
+
+typedef enum {
+ HOLE_TRANSITION_ABSOLUTE,
+ HOLE_TRANSITION_RELATIVE,
+ HOLE_TRANSITION_ABSOLUTE_MINISH,
+} HoleTransitionType;
+
+typedef struct {
+ u32 gfx;
+ u16 offset_x;
+ u16 offset_y;
+ u16 x;
+ u16 y;
+} HoleTransitionPersistance;
+
+typedef struct {
+ u8 type;
+ u8 subtype;
+ u8 unk_2;
+ u8 unk_3;
+ u16 x;
+ u16 y;
+} HoleTransitionParallax;
+
+typedef struct HoleTransition {
+ u8 type;
+ u8 area;
+ u8 room;
+ u8 layer;
+ u16 x;
+ u16 y;
+ u8 hole_x;
+ u8 hole_y;
+ u8 hole_width;
+ u8 hole_height;
+ const HoleTransitionPersistance* persistance;
+ const HoleTransitionParallax* parallax;
+} HoleTransition;
+
+void HoleManager_Init(HoleManager*);
+void HoleManager_Update(HoleManager*);
-extern void (*const HoleManager_Actions[])(HoleManager*);
+void (*const HoleManager_Actions[])(HoleManager*) = {
+ HoleManager_Init,
+ HoleManager_Update,
+};
+
+const HoleTransitionPersistance gHoleTransitionPersistances[] = {
+ { offset_gfx_unknown_6, 0x00c4, 0x0030, 0x0310, 0x13c8 },
+ { offset_gfx_unknown_6 + 0x800, 0x00c4, 0x0030, 0x0310, 0x13c8 },
+ { offset_gfx_unknown_6 + 0x800 * 2, 0xfffa, 0x00de, 0x05d0, 0x0410 },
+ { offset_gfx_unknown_6 + 0x800 * 3, 0x0024, 0x0004, 0x0290, 0x04e0 },
+ { offset_gfx_unknown_6 + 0x800 * 4, 0x0058, 0x0014, 0x0280, 0x0cf0 },
+ { offset_gfx_unknown_6 + 0x800 * 5, 0x002c, 0x0004, 0x04a0, 0x0cf0 },
+ { offset_gfx_unknown_7, 0x0060, 0x0010, 0x0170, 0x08e0 },
+ { offset_gfx_unknown_7 + 0x800, 0x001c, 0x00d0, 0x05b0, 0x0e20 },
+ { offset_gfx_unknown_7 + 0x800 * 2, 0x005c, 0x00a4, 0x0290, 0x1b48 },
+};
+
+const HoleTransitionParallax gHoleTransitionParallaxes[] = {
+ { 0x00, 0x00, 0x00, 0x00, 0x0088, 0x0068 }, { 0x01, 0x01, 0x00, 0x00, 0x0088, 0x0068 },
+ { 0x02, 0x02, 0x00, 0x00, 0x00b8, 0x0068 }, { 0x04, 0x04, 0x00, 0x00, 0x00b8, 0x0068 },
+ { 0x05, 0x00, 0x00, 0x00, 0x0078, 0x00b8 }, { 0x06, 0x01, 0x00, 0x00, 0x0048, 0x0040 },
+ { 0x07, 0x02, 0x00, 0x00, 0x0090, 0x0040 }, { 0x07, 0x03, 0x00, 0x00, 0x0240, 0x0050 },
+ { 0x07, 0x04, 0x00, 0x00, 0x0158, 0x0100 }, { 0x08, 0x05, 0x00, 0x00, 0x007c, 0x0050 },
+ { 0x09, 0x06, 0x00, 0x00, 0x0078, 0x0070 }, { 0x0a, 0x07, 0x00, 0x00, 0x0060, 0x0058 },
+ { 0x0b, 0x08, 0x00, 0x00, 0x0081, 0x005e }, { 0x0c, 0x09, 0x00, 0x00, 0x0080, 0x0058 },
+ { 0x0d, 0x0a, 0x00, 0x00, 0x0060, 0x0038 }, { 0x0e, 0x0b, 0x00, 0x00, 0x0260, 0x0064 },
+ { 0x0f, 0x00, 0x00, 0x00, 0x00a8, 0x0148 },
+};
+
+const HoleTransition gHoleTransitions[] = {
+ { 0x00, 0x48, 0x14, 0x02, 0x00e8, 0x00c8, 0x00, 0x00, 0x00, 0x00, NULL, NULL },
+ { 0x00, 0x51, 0x00, 0x02, 0x00c0, 0x00f8, 0x00, 0x00, 0x00, 0x00, &gHoleTransitionPersistances[0], NULL },
+ { 0x01, 0x58, 0x1b, 0x02, 0xfeb0, 0x0000, 0x1d, 0x06, 0x05, 0x02, &gHoleTransitionPersistances[2], NULL },
+ { 0x01, 0x58, 0x1d, 0x01, 0xffe0, 0xff20, 0x09, 0x13, 0x03, 0x03, NULL, &gHoleTransitionParallaxes[16] },
+ { 0x01, 0x58, 0x1c, 0x01, 0xfff0, 0x0000, 0x08, 0x05, 0x03, 0x03, &gHoleTransitionPersistances[3], NULL },
+ { 0x01, 0x58, 0x20, 0x01, 0xfff0, 0x0000, 0x00, 0x00, 0x00, 0x00, &gHoleTransitionPersistances[4], NULL },
+ { 0x01, 0x58, 0x22, 0x01, 0xffe0, 0x0000, 0x00, 0x00, 0x00, 0x00, &gHoleTransitionPersistances[5], NULL },
+ { 0x00, 0x62, 0x11, 0x01, 0x00c8, 0x0038, 0x00, 0x00, 0x00, 0x00, NULL, NULL },
+ { 0x01, 0x60, 0x20, 0x01, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxes[0] },
+ { 0x01, 0x60, 0x21, 0x01, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxes[1] },
+ { 0x01, 0x60, 0x2e, 0x01, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxes[2] },
+ { 0x01, 0x60, 0x11, 0x01, 0xffc0, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxes[3] },
+ { 0x00, 0x60, 0x31, 0x01, 0x0078, 0x00a8, 0x00, 0x00, 0x00, 0x00, NULL, NULL },
+ { 0x00, 0x51, 0x00, 0x02, 0x00c0, 0x00f8, 0x00, 0x00, 0x00, 0x00, &gHoleTransitionPersistances[1], NULL },
+ { 0x01, 0x08, 0x01, 0x01, 0x0000, 0x0000, 0x1d, 0x1d, 0x03, 0x03, NULL, NULL },
+ { 0x01, 0x08, 0x02, 0x01, 0x0000, 0x0000, 0x1d, 0x1d, 0x03, 0x03, NULL, NULL },
+ { 0x01, 0x08, 0x02, 0x01, 0x0000, 0x0000, 0x23, 0x03, 0x03, 0x03, NULL, NULL },
+ { 0x01, 0x08, 0x02, 0x01, 0x0000, 0x0000, 0x32, 0x03, 0x03, 0x03, NULL, NULL },
+ { 0x01, 0x08, 0x02, 0x01, 0x0000, 0x0000, 0x03, 0x13, 0x03, 0x03, NULL, NULL },
+ { 0x01, 0x08, 0x02, 0x01, 0x0000, 0x0000, 0x37, 0x10, 0x03, 0x03, NULL, NULL },
+ { 0x01, 0x08, 0x02, 0x01, 0x0000, 0x0000, 0x2f, 0x18, 0x03, 0x03, NULL, NULL },
+ { 0x01, 0x08, 0x02, 0x01, 0x0000, 0x0000, 0x16, 0x2b, 0x03, 0x03, NULL, NULL },
+ { 0x01, 0x08, 0x02, 0x01, 0x0000, 0x0000, 0x25, 0x2c, 0x03, 0x03, NULL, NULL },
+ { 0x01, 0x08, 0x02, 0x01, 0x0000, 0x0000, 0x32, 0x2d, 0x03, 0x03, NULL, NULL },
+ { 0x01, 0x08, 0x02, 0x01, 0x0000, 0x0000, 0x0d, 0x35, 0x03, 0x03, NULL, NULL },
+ { 0x01, 0x08, 0x02, 0x01, 0x0000, 0x0000, 0x17, 0x37, 0x03, 0x03, NULL, NULL },
+ { 0x01, 0x08, 0x02, 0x01, 0x0000, 0x0000, 0x1d, 0x38, 0x03, 0x03, NULL, NULL },
+ { 0x01, 0x08, 0x02, 0x01, 0x0000, 0x0000, 0x36, 0x38, 0x03, 0x03, NULL, NULL },
+ { 0x01, 0x08, 0x02, 0x01, 0x0000, 0x0000, 0x38, 0x19, 0x03, 0x03, NULL, NULL },
+ { 0x01, 0x08, 0x02, 0x01, 0x0000, 0x0000, 0x3a, 0x2e, 0x01, 0x01, NULL, NULL },
+ { 0x01, 0x08, 0x02, 0x01, 0x0000, 0x0000, 0x30, 0x39, 0x01, 0x01, NULL, NULL },
+ { 0x00, 0x1a, 0x00, 0x01, 0x0058, 0x0048, 0x18, 0x1b, 0x03, 0x03, NULL, NULL },
+ { 0x01, 0x70, 0x0f, 0x01, 0x01e0, 0x0070, 0x08, 0x03, 0x04, 0x04, NULL, NULL },
+ { 0x01, 0x70, 0x10, 0x01, 0x0000, 0x0090, 0x14, 0x05, 0x05, 0x03, NULL, NULL },
+ { 0x01, 0x70, 0x10, 0x01, 0x0000, 0x0090, 0x21, 0x05, 0x04, 0x03, NULL, NULL },
+ { 0x00, 0x70, 0x0c, 0x01, 0x0078, 0x00a0, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxes[4] },
+ { 0x01, 0x70, 0x15, 0x01, 0x01e0, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxes[5] },
+ { 0x01, 0x70, 0x19, 0x01, 0x00f0, 0x0000, 0x05, 0x08, 0x04, 0x04, NULL, NULL },
+ { 0x01, 0x70, 0x1b, 0x01, 0x0000, 0x0000, 0x08, 0x02, 0x02, 0x04, NULL, &gHoleTransitionParallaxes[6] },
+ { 0x01, 0x70, 0x1d, 0x01, 0xfe30, 0x0000, 0x23, 0x02, 0x02, 0x04, NULL, &gHoleTransitionParallaxes[7] },
+ { 0x01, 0x70, 0x1f, 0x01, 0xff10, 0xff60, 0x13, 0x0e, 0x07, 0x04, NULL, &gHoleTransitionParallaxes[8] },
+ { 0x01, 0x70, 0x21, 0x01, 0x0000, 0x0090, 0x06, 0x03, 0x04, 0x04, NULL, NULL },
+ { 0x01, 0x70, 0x26, 0x01, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxes[9] },
+ { 0x01, 0x70, 0x29, 0x01, 0x0000, 0x0000, 0x06, 0x06, 0x03, 0x02, NULL, &gHoleTransitionParallaxes[10] },
+ { 0x01, 0x70, 0x2c, 0x01, 0x0000, 0x0000, 0x12, 0x0c, 0x04, 0x04, NULL, NULL },
+ { 0x01, 0x70, 0x32, 0x01, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxes[11] },
+ { 0x01, 0x70, 0x32, 0x02, 0x00f0, 0x0000, 0x07, 0x04, 0x02, 0x02, NULL, NULL },
+ { 0x01, 0x70, 0x32, 0x01, 0x00f0, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxes[12] },
+ { 0x01, 0x70, 0x32, 0x01, 0x01e0, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxes[13] },
+ { 0x01, 0x70, 0x32, 0x01, 0x0000, 0x00a0, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxes[14] },
+ { 0x00, 0x31, 0x00, 0x01, 0x0078, 0x0068, 0x25, 0x04, 0x03, 0x03, NULL, &gHoleTransitionParallaxes[15] },
+ { 0x00, 0x70, 0x00, 0x02, 0x01d8, 0x00d8, 0x00, 0x00, 0x00, 0x00, NULL, NULL },
+ { 0x01, 0x88, 0x1e, 0x01, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, &gHoleTransitionPersistances[6], NULL },
+ { 0x01, 0x88, 0x2c, 0x01, 0x0000, 0xff30, 0x00, 0x00, 0x00, 0x00, &gHoleTransitionPersistances[7], NULL },
+ { 0x01, 0x88, 0x3a, 0x01, 0x0000, 0xffe0, 0x00, 0x00, 0x00, 0x00, &gHoleTransitionPersistances[8], NULL },
+ { 0x00, 0x88, 0x06, 0x01, 0x00a8, 0x0088, 0x00, 0x00, 0x00, 0x00, NULL, NULL },
+ { 0x02, 0x23, 0x01, 0x01, 0x0078, 0x0078, 0x00, 0x00, 0x00, 0x00, NULL, NULL },
+ { 0x02, 0x23, 0x00, 0x01, 0x00a8, 0x0060, 0x00, 0x00, 0x00, 0x00, NULL, NULL },
+ { 0x02, 0x22, 0x04, 0x01, 0x00a8, 0x0058, 0x00, 0x00, 0x00, 0x00, NULL, NULL },
+ { 0x02, 0x23, 0x03, 0x01, 0x0078, 0x0078, 0x00, 0x00, 0x00, 0x00, NULL, NULL },
+ { 0x00, 0x41, 0x01, 0x01, 0x0078, 0x0050, 0x2f, 0x27, 0x03, 0x03, NULL, NULL },
+};
void HoleManager_Main(HoleManager* this) {
HoleManager_Actions[super->action](this);
}
-typedef struct struct_08108764 {
- u8 unk_00;
- u8 unk_01; // area ID?
- u8 unk_02; // room ID?
- u8 unk_03; // layer?
- u16 unk_04;
- u16 unk_06;
- u8 unk_08;
- u8 unk_09;
- u8 unk_0a;
- u8 unk_0b;
- struct {
- u32 unk_00;
- u16 unk_04;
- u16 unk_06;
- u16 unk_08;
- u16 unk_0a;
- } * unk_0c;
- struct {
- u8 unk_00;
- u8 unk_01;
- u8 unk_02[2];
- u16 unk_04;
- u16 unk_06;
- } * unk_10;
-} struct_08108764;
-
-extern struct_08108764 gUnk_08108764[];
-
-u32 sub_0805B1CC(HoleManager*);
-void sub_0805B210(HoleManager*);
-void sub_0805B2B0(HoleManager*);
-void sub_0805B328(HoleManager*);
-
-void sub_0805B048(HoleManager* this) {
- struct_08108764* tmp;
+bool32 IsPlayerOnHole(HoleManager*);
+void DoHoleTransition(HoleManager*);
+void HoleManager_ConfigureBG3Offset(HoleManager*);
+void HoleManager_ConfigureBG3(HoleManager*);
+
+void HoleManager_Init(HoleManager* this) {
+ const HoleTransition* transition;
Entity* obj;
SetEntityPriority((Entity*)super, PRIO_PLAYER_EVENT);
- MemClear(&this->unk_20, 0x20);
+ MemClear(&this->x, 0x20);
super->action = 1;
this->unk_3f = gRoomControls.room;
- tmp = &gUnk_08108764[super->type];
- if (!tmp->unk_0a) {
- this->unk_20 = gRoomControls.origin_x;
- this->unk_22 = gRoomControls.origin_y;
- this->unk_24 = gRoomControls.width;
- this->unk_26 = gRoomControls.height;
+ transition = &gHoleTransitions[super->type];
+ if (transition->hole_width == 0) {
+ this->x = gRoomControls.origin_x;
+ this->y = gRoomControls.origin_y;
+ this->width = gRoomControls.width;
+ this->height = gRoomControls.height;
} else {
- this->unk_20 = (tmp->unk_08 << 4) + gRoomControls.origin_x;
- this->unk_22 = (tmp->unk_09 << 4) + gRoomControls.origin_y;
- this->unk_24 = (tmp->unk_0a << 4);
- this->unk_26 = (tmp->unk_0b << 4);
+ this->x = (transition->hole_x << 4) + gRoomControls.origin_x;
+ this->y = (transition->hole_y << 4) + gRoomControls.origin_y;
+ this->width = (transition->hole_width << 4);
+ this->height = (transition->hole_height << 4);
}
- super->type2 = tmp->unk_0c != 0;
+ super->type2 = transition->persistance != NULL;
if (super->type2) {
super->flags |= ENT_PERSIST;
- this->unk_34 = tmp->unk_0c->unk_04;
- this->unk_36 = tmp->unk_0c->unk_06;
- this->unk_30 = tmp->unk_0c->unk_08;
- this->unk_32 = tmp->unk_0c->unk_0a;
- sub_0805BC4C();
- sub_0805B2B0(this);
- sub_0805B328(this);
- RegisterTransitionManager(this, sub_0805B328, 0);
+ this->persistance_offset_x = transition->persistance->offset_x;
+ this->persistance_offset_y = transition->persistance->offset_y;
+ this->persistance_x = transition->persistance->x;
+ this->persistance_y = transition->persistance->y;
+ UnDarkRoom();
+ HoleManager_ConfigureBG3Offset(this);
+ HoleManager_ConfigureBG3(this);
+ RegisterTransitionManager(this, HoleManager_ConfigureBG3, NULL);
}
- if (!tmp->unk_10)
+ if (!transition->parallax)
return;
- obj = CreateObject(PARALLAX_ROOM_VIEW, tmp->unk_10->unk_00, tmp->unk_10->unk_01);
+ obj = CreateObject(PARALLAX_ROOM_VIEW, transition->parallax->type, transition->parallax->subtype);
if (obj) {
- obj->x.HALF.HI = tmp->unk_10->unk_04 + gRoomControls.origin_x;
- obj->y.HALF.HI = tmp->unk_10->unk_06 + gRoomControls.origin_y;
+ obj->x.HALF.HI = transition->parallax->x + gRoomControls.origin_x;
+ obj->y.HALF.HI = transition->parallax->y + gRoomControls.origin_y;
}
if (super->type != 0xa || CheckLocalFlag(0x4B))
return;
obj = CreateObject(PARALLAX_ROOM_VIEW, 3, 3);
if (obj) {
- obj->x.HALF.HI = tmp->unk_10->unk_04 + gRoomControls.origin_x;
- obj->y.HALF.HI = tmp->unk_10->unk_06 + gRoomControls.origin_y;
+ obj->x.HALF.HI = transition->parallax->x + gRoomControls.origin_x;
+ obj->y.HALF.HI = transition->parallax->y + gRoomControls.origin_y;
}
}
-void sub_0805B168(HoleManager* this) {
- if (sub_0805B1CC(this)) {
- sub_0805B210(this);
+void HoleManager_Update(HoleManager* this) {
+ if (IsPlayerOnHole(this)) {
+ DoHoleTransition(this);
DeleteThisEntity();
return;
}
- sub_0805B2B0(this);
+ HoleManager_ConfigureBG3Offset(this);
if (gRoomControls.reload_flags == 1) {
super->subAction = 1;
return;
@@ -121,82 +226,83 @@ void sub_0805B168(HoleManager* this) {
DeleteThisEntity();
}
-u32 sub_0805B1CC(HoleManager* this) {
- u32 re = 0;
- if (CheckPlayerProximity(this->unk_20, this->unk_22, this->unk_24, this->unk_26)) {
+bool32 IsPlayerOnHole(HoleManager* this) {
+ bool32 re = FALSE;
+ if (CheckPlayerProximity(this->x, this->y, this->width, this->height)) {
if ((gPlayerState.flags & PL_DROWNING) && (gPlayerState.flags & PL_BUSY)) {
gPlayerState.flags |= PL_PIT_IS_EXIT;
} else if (gPlayerState.flags & PL_PIT_IS_EXIT) {
- re = 1;
+ re = TRUE;
}
}
return re;
}
-void sub_0805B210(HoleManager* this) {
- struct_08108764* tmp;
+void DoHoleTransition(HoleManager* this) {
+ const HoleTransition* transition;
gRoomTransition.transitioningOut = 1;
gRoomTransition.type = TRANSITION_CUT;
gRoomTransition.player_status.start_anim = 4;
- tmp = &gUnk_08108764[super->type];
- gRoomTransition.player_status.area_next = tmp->unk_01;
- gRoomTransition.player_status.room_next = tmp->unk_02;
- gRoomTransition.player_status.layer = tmp->unk_03;
+ transition = &gHoleTransitions[super->type];
+ gRoomTransition.player_status.area_next = transition->area;
+ gRoomTransition.player_status.room_next = transition->room;
+ gRoomTransition.player_status.layer = transition->layer;
if (gPlayerState.flags & PL_MINISH) {
gRoomTransition.player_status.spawn_type = PL_SPAWN_DROP_MINISH;
} else {
gRoomTransition.player_status.spawn_type = PL_SPAWN_DROP;
}
- switch (tmp->unk_00) {
- case 0:
- gRoomTransition.player_status.start_pos_x = tmp->unk_04;
- gRoomTransition.player_status.start_pos_y = tmp->unk_06;
+ switch (transition->type) {
+ case HOLE_TRANSITION_ABSOLUTE:
+ gRoomTransition.player_status.start_pos_x = transition->x;
+ gRoomTransition.player_status.start_pos_y = transition->y;
break;
- case 1:
+ case HOLE_TRANSITION_RELATIVE:
gRoomTransition.player_status.start_pos_x =
- gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x + tmp->unk_04;
+ gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x + transition->x;
gRoomTransition.player_status.start_pos_y =
- gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y + tmp->unk_06;
+ gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y + transition->y;
break;
- case 2:
- gRoomTransition.player_status.start_pos_x = tmp->unk_04;
- gRoomTransition.player_status.start_pos_y = tmp->unk_06;
+ case HOLE_TRANSITION_ABSOLUTE_MINISH:
+ gRoomTransition.player_status.start_pos_x = transition->x;
+ gRoomTransition.player_status.start_pos_y = transition->y;
gRoomTransition.player_status.spawn_type = PL_SPAWN_DROP_MINISH;
break;
+ default:
+ break;
}
}
-void sub_0805B2B0(HoleManager* this) {
- s32 tmp, tmp2;
+void HoleManager_ConfigureBG3Offset(HoleManager* this) {
+ s32 x, y;
if (!super->type2)
return;
- tmp = (this->unk_30 - gRoomControls.scroll_x) / 4;
- tmp2 = (this->unk_32 - gRoomControls.scroll_y) / 4;
- if (tmp < -12) {
- tmp = -12;
+ x = (this->persistance_x - gRoomControls.scroll_x) / 4;
+ y = (this->persistance_y - gRoomControls.scroll_y) / 4;
+ if (x < -12) {
+ x = -12;
}
- if (tmp > 12) {
- tmp = 12;
+ if (x > 12) {
+ x = 12;
}
- if (tmp2 < -12) {
- tmp2 = -12;
+ if (y < -12) {
+ y = -12;
}
- if (tmp2 > 12) {
- tmp2 = 12;
+ if (y > 12) {
+ y = 12;
}
gScreen.lcd.displayControl |= DISPCNT_BG3_ON;
- gRoomControls.bg3OffsetX.HALF.HI = gRoomControls.scroll_x + this->unk_34 + tmp;
- gScreen.bg3.xOffset = gRoomControls.scroll_x + this->unk_34 + tmp;
- gRoomControls.bg3OffsetY.HALF.HI = gRoomControls.scroll_y + this->unk_36 + tmp2;
- gScreen.bg3.yOffset = gRoomControls.scroll_y + this->unk_36 + tmp2;
+
+ gScreen.bg3.xOffset = gRoomControls.bg3OffsetX.HALF.HI = gRoomControls.scroll_x + this->persistance_offset_x + x;
+ gScreen.bg3.yOffset = gRoomControls.bg3OffsetY.HALF.HI = gRoomControls.scroll_y + this->persistance_offset_y + y;
}
-void sub_0805B328(HoleManager* this) {
- struct_08108764* tmp;
+void HoleManager_ConfigureBG3(HoleManager* this) {
+ const HoleTransition* transition;
if (!super->type2)
return;
- tmp = &gUnk_08108764[super->type];
- LoadResourceAsync(&gGlobalGfxAndPalettes[tmp->unk_0c->unk_00], 0x0600F000, 0x800);
+ transition = &gHoleTransitions[super->type];
+ LoadResourceAsync(&gGlobalGfxAndPalettes[transition->persistance->gfx], 0x0600F000, 0x800);
gScreen.bg3.control = 0x1E07;
gScreen.lcd.displayControl |= DISPCNT_BG3_ON;
gScreen.bg3.xOffset = gRoomControls.bg3OffsetX.HALF.HI;
diff --git a/src/manager/lightManager.c b/src/manager/lightManager.c
index 7a0cca5f..cb96636d 100644
--- a/src/manager/lightManager.c
+++ b/src/manager/lightManager.c
@@ -186,7 +186,7 @@ s32 sub_0805BC04(void) {
return iVar1;
}
-void sub_0805BC4C() {
+void UnDarkRoom() {
if (gArea.lightType != 0) {
gArea.lightType = 0;
gScreen.lcd.displayControl &= ~(DISPCNT_BG3_ON | DISPCNT_WIN0_ON);
diff --git a/src/object/chestSpawner.c b/src/object/chestSpawner.c
index 702b87c1..d6f3256f 100644
--- a/src/object/chestSpawner.c
+++ b/src/object/chestSpawner.c
@@ -4,12 +4,13 @@
*
* @brief Chest Spawner object
*/
-#include "functions.h"
#include "item.h"
#include "object.h"
#include "screen.h"
-#include "structures.h"
#include "tiles.h"
+#include "manager/lightManager.h"
+#include "structures.h"
+#include "functions.h"
typedef struct {
/*0x00*/ Entity base;
@@ -104,7 +105,7 @@ void ChestSpawner_Type2Action1(ChestSpawnerEntity* this) {
super->spriteSettings.draw = 1;
super->spriteRendering.alphaBlend = 1;
RequestPriorityDuration(super, 30);
- sub_0805BC4C();
+ UnDarkRoom();
}
}
diff --git a/src/object/fourElements.c b/src/object/fourElements.c
index e364d7cb..a8514ec8 100644
--- a/src/object/fourElements.c
+++ b/src/object/fourElements.c
@@ -5,11 +5,12 @@
* @brief Four Elements object
*/
#include "collision.h"
-#include "functions.h"
#include "hitbox.h"
#include "message.h"
#include "object.h"
#include "screen.h"
+#include "manager/lightManager.h"
+#include "functions.h"
typedef struct {
/*0x00*/ Entity base;
@@ -63,7 +64,7 @@ void FourElements_Init(FourElementsEntity* this) {
StartPlayerScript(script_PlayerGetElement);
gScreen.controls.layerFXControl = 0x640;
gScreen.controls.alphaBlend = 0x1000;
- sub_0805BC4C();
+ UnDarkRoom();
elementsBackground = CreateObjectWithParent(super, ELEMENTS_BACKGROUND, super->type - 0x40, 0);
if (elementsBackground != NULL) {
elementsBackground->parent = super;
diff --git a/src/object/minishPortalStone.c b/src/object/minishPortalStone.c
index cb3ca717..e4d92872 100644
--- a/src/object/minishPortalStone.c
+++ b/src/object/minishPortalStone.c
@@ -4,9 +4,10 @@
*
* @brief Minish Portal Stone object
*/
-#include "functions.h"
#include "object.h"
#include "screen.h"
+#include "manager/lightManager.h"
+#include "functions.h"
typedef struct {
/*0x00*/ Entity base;
@@ -42,7 +43,7 @@ void MinishPortalStone_Init(MinishPortalStoneEntity* this) {
super->action = 4;
sub_08097CFC(this);
} else {
- sub_0805BC4C();
+ UnDarkRoom();
}
}
diff --git a/src/roomInit.c b/src/roomInit.c
index e5afa576..f070575f 100644
--- a/src/roomInit.c
+++ b/src/roomInit.c
@@ -2,12 +2,10 @@
#include "common.h"
#include "effects.h"
#include "flags.h"
-#include "functions.h"
#include "game.h"
#include "item.h"
#include "kinstone.h"
#include "main.h"
-#include "npc.h"
#include "object.h"
#include "save.h"
#include "screen.h"
@@ -15,6 +13,8 @@
#include "sound.h"
#include "tiles.h"
#include "windcrest.h"
+#include "manager/lightManager.h"
+#include "functions.h"
extern u32 sub_08060354(void);
extern void sub_08057E64(void);
@@ -861,7 +861,7 @@ void sub_StateChange_Dojos_Grimblade(void) {
if (!CheckLocalFlag(3)) {
LoadRoomEntityList(&gUnk_080D827C);
} else {
- sub_0805BC4C();
+ UnDarkRoom();
SetTileType(TILE_TYPE_118, TILE_POS(2, 2), LAYER_TOP);
SetTileType(TILE_TYPE_118, TILE_POS(12, 2), LAYER_TOP);
}
diff --git a/tools/src/asset_processor/offsets.cpp b/tools/src/asset_processor/offsets.cpp
index f865a85a..631bb05e 100644
--- a/tools/src/asset_processor/offsets.cpp
+++ b/tools/src/asset_processor/offsets.cpp
@@ -5,6 +5,6 @@ OffsetCalculator::OffsetCalculator(const std::filesystem::path& asmOutputFile, c
}
void OffsetCalculator::addAsset(int start, const std::string& symbol) {
- asmOutput << "\t.equiv offset_" << symbol << ", " << start - baseOffset << std::endl;
- cOutput << "#define offset_" << symbol << " " << start - baseOffset << std::endl;
+ asmOutput << "\t.equiv offset_" << symbol << ", 0x" << std::hex << start - baseOffset << std::endl;
+ cOutput << "#define offset_" << symbol << " 0x" << std::hex << start - baseOffset << std::endl;
} \ No newline at end of file