diff --git a/src/manager/holeManager.c b/src/manager/holeManager.c index 4517f41d..e177c4a3 100644 --- a/src/manager/holeManager.c +++ b/src/manager/holeManager.c @@ -26,7 +26,7 @@ typedef struct { u16 offset_y; u16 x; u16 y; -} HoleTransitionPersistance; +} HoleTransitionParallaxBackground; typedef struct { u8 type; @@ -35,7 +35,7 @@ typedef struct { u8 unk_3; u16 x; u16 y; -} HoleTransitionParallax; +} HoleTransitionParallaxEntity; typedef struct HoleTransition { u8 type; @@ -48,8 +48,8 @@ typedef struct HoleTransition { u8 hole_y; u8 hole_width; u8 hole_height; - const HoleTransitionPersistance* persistance; - const HoleTransitionParallax* parallax; + const HoleTransitionParallaxBackground* parallax_background; + const HoleTransitionParallaxEntity* parallax_entity; } HoleTransition; void HoleManager_Init(HoleManager*); @@ -60,7 +60,7 @@ void (*const HoleManager_Actions[])(HoleManager*) = { HoleManager_Update, }; -const HoleTransitionPersistance gHoleTransitionPersistances[] = { +const HoleTransitionParallaxBackground gHoleTransitionParallaxBackgrounds[] = { { 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 }, @@ -72,7 +72,7 @@ const HoleTransitionPersistance gHoleTransitionPersistances[] = { { offset_gfx_unknown_7 + 0x800 * 2, 0x005c, 0x00a4, 0x0290, 0x1b48 }, }; -const HoleTransitionParallax gHoleTransitionParallaxes[] = { +const HoleTransitionParallaxEntity gHoleTransitionParallaxEntities[] = { { 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 }, @@ -86,19 +86,19 @@ const HoleTransitionParallax gHoleTransitionParallaxes[] = { 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, 0x51, 0x00, 0x02, 0x00c0, 0x00f8, 0x00, 0x00, 0x00, 0x00, &gHoleTransitionParallaxBackgrounds[0], NULL }, + { 0x01, 0x58, 0x1b, 0x02, 0xfeb0, 0x0000, 0x1d, 0x06, 0x05, 0x02, &gHoleTransitionParallaxBackgrounds[2], NULL }, + { 0x01, 0x58, 0x1d, 0x01, 0xffe0, 0xff20, 0x09, 0x13, 0x03, 0x03, NULL, &gHoleTransitionParallaxEntities[16] }, + { 0x01, 0x58, 0x1c, 0x01, 0xfff0, 0x0000, 0x08, 0x05, 0x03, 0x03, &gHoleTransitionParallaxBackgrounds[3], NULL }, + { 0x01, 0x58, 0x20, 0x01, 0xfff0, 0x0000, 0x00, 0x00, 0x00, 0x00, &gHoleTransitionParallaxBackgrounds[4], NULL }, + { 0x01, 0x58, 0x22, 0x01, 0xffe0, 0x0000, 0x00, 0x00, 0x00, 0x00, &gHoleTransitionParallaxBackgrounds[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] }, + { 0x01, 0x60, 0x20, 0x01, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxEntities[0] }, + { 0x01, 0x60, 0x21, 0x01, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxEntities[1] }, + { 0x01, 0x60, 0x2e, 0x01, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxEntities[2] }, + { 0x01, 0x60, 0x11, 0x01, 0xffc0, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxEntities[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 }, + { 0x00, 0x51, 0x00, 0x02, 0x00c0, 0x00f8, 0x00, 0x00, 0x00, 0x00, &gHoleTransitionParallaxBackgrounds[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 }, @@ -120,26 +120,26 @@ const HoleTransition gHoleTransitions[] = { { 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] }, + { 0x00, 0x70, 0x0c, 0x01, 0x0078, 0x00a0, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxEntities[4] }, + { 0x01, 0x70, 0x15, 0x01, 0x01e0, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxEntities[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, 0x1b, 0x01, 0x0000, 0x0000, 0x08, 0x02, 0x02, 0x04, NULL, &gHoleTransitionParallaxEntities[6] }, + { 0x01, 0x70, 0x1d, 0x01, 0xfe30, 0x0000, 0x23, 0x02, 0x02, 0x04, NULL, &gHoleTransitionParallaxEntities[7] }, + { 0x01, 0x70, 0x1f, 0x01, 0xff10, 0xff60, 0x13, 0x0e, 0x07, 0x04, NULL, &gHoleTransitionParallaxEntities[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, 0x26, 0x01, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxEntities[9] }, + { 0x01, 0x70, 0x29, 0x01, 0x0000, 0x0000, 0x06, 0x06, 0x03, 0x02, NULL, &gHoleTransitionParallaxEntities[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, 0x01, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxEntities[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] }, + { 0x01, 0x70, 0x32, 0x01, 0x00f0, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxEntities[12] }, + { 0x01, 0x70, 0x32, 0x01, 0x01e0, 0x0000, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxEntities[13] }, + { 0x01, 0x70, 0x32, 0x01, 0x0000, 0x00a0, 0x00, 0x00, 0x00, 0x00, NULL, &gHoleTransitionParallaxEntities[14] }, + { 0x00, 0x31, 0x00, 0x01, 0x0078, 0x0068, 0x25, 0x04, 0x03, 0x03, NULL, &gHoleTransitionParallaxEntities[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 }, + { 0x01, 0x88, 0x1e, 0x01, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, &gHoleTransitionParallaxBackgrounds[6], NULL }, + { 0x01, 0x88, 0x2c, 0x01, 0x0000, 0xff30, 0x00, 0x00, 0x00, 0x00, &gHoleTransitionParallaxBackgrounds[7], NULL }, + { 0x01, 0x88, 0x3a, 0x01, 0x0000, 0xffe0, 0x00, 0x00, 0x00, 0x00, &gHoleTransitionParallaxBackgrounds[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 }, @@ -154,8 +154,8 @@ void HoleManager_Main(HoleManager* this) { bool32 IsPlayerOnHole(HoleManager*); void DoHoleTransition(HoleManager*); -void HoleManager_ConfigureBG3Offset(HoleManager*); -void HoleManager_ConfigureBG3(HoleManager*); +void HoleManager_UpdateParallaxBackground(HoleManager*); +void HoleManager_InitParallaxBackground(HoleManager*); void HoleManager_Init(HoleManager* this) { const HoleTransition* transition; @@ -176,31 +176,31 @@ void HoleManager_Init(HoleManager* this) { this->width = (transition->hole_width << 4); this->height = (transition->hole_height << 4); } - super->type2 = transition->persistance != NULL; + super->type2 = transition->parallax_background != NULL; if (super->type2) { super->flags |= ENT_PERSIST; - 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; + this->persistance_offset_x = transition->parallax_background->offset_x; + this->persistance_offset_y = transition->parallax_background->offset_y; + this->persistance_x = transition->parallax_background->x; + this->persistance_y = transition->parallax_background->y; UnDarkRoom(); - HoleManager_ConfigureBG3Offset(this); - HoleManager_ConfigureBG3(this); - RegisterTransitionManager(this, HoleManager_ConfigureBG3, NULL); + HoleManager_UpdateParallaxBackground(this); + HoleManager_InitParallaxBackground(this); + RegisterTransitionManager(this, HoleManager_InitParallaxBackground, NULL); } - if (!transition->parallax) + if (!transition->parallax_entity) return; - obj = CreateObject(PARALLAX_ROOM_VIEW, transition->parallax->type, transition->parallax->subtype); + obj = CreateObject(PARALLAX_ROOM_VIEW, transition->parallax_entity->type, transition->parallax_entity->subtype); if (obj) { - obj->x.HALF.HI = transition->parallax->x + gRoomControls.origin_x; - obj->y.HALF.HI = transition->parallax->y + gRoomControls.origin_y; + obj->x.HALF.HI = transition->parallax_entity->x + gRoomControls.origin_x; + obj->y.HALF.HI = transition->parallax_entity->y + gRoomControls.origin_y; } if (super->type != 0xa || CheckLocalFlag(0x4B)) return; obj = CreateObject(PARALLAX_ROOM_VIEW, 3, 3); if (obj) { - obj->x.HALF.HI = transition->parallax->x + gRoomControls.origin_x; - obj->y.HALF.HI = transition->parallax->y + gRoomControls.origin_y; + obj->x.HALF.HI = transition->parallax_entity->x + gRoomControls.origin_x; + obj->y.HALF.HI = transition->parallax_entity->y + gRoomControls.origin_y; } } @@ -210,7 +210,7 @@ void HoleManager_Update(HoleManager* this) { DeleteThisEntity(); return; } - HoleManager_ConfigureBG3Offset(this); + HoleManager_UpdateParallaxBackground(this); if (gRoomControls.reload_flags == 1) { super->subAction = 1; return; @@ -273,7 +273,7 @@ void DoHoleTransition(HoleManager* this) { } } -void HoleManager_ConfigureBG3Offset(HoleManager* this) { +void HoleManager_UpdateParallaxBackground(HoleManager* this) { s32 x, y; if (!super->type2) return; @@ -297,12 +297,12 @@ void HoleManager_ConfigureBG3Offset(HoleManager* this) { gScreen.bg3.yOffset = gRoomControls.bg3OffsetY.HALF.HI = gRoomControls.scroll_y + this->persistance_offset_y + y; } -void HoleManager_ConfigureBG3(HoleManager* this) { +void HoleManager_InitParallaxBackground(HoleManager* this) { const HoleTransition* transition; if (!super->type2) return; transition = &gHoleTransitions[super->type]; - LoadResourceAsync(&gGlobalGfxAndPalettes[transition->persistance->gfx], 0x0600F000, 0x800); + LoadResourceAsync(&gGlobalGfxAndPalettes[transition->parallax_background->gfx], 0x0600F000, 0x800); gScreen.bg3.control = 0x1E07; gScreen.lcd.displayControl |= DISPCNT_BG3_ON; gScreen.bg3.xOffset = gRoomControls.bg3OffsetX.HALF.HI;