diff options
| author | Henny022p <73211432+Henny022p@users.noreply.github.com> | 2026-02-08 18:32:38 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-08 18:32:38 +0100 |
| commit | 5ab63f00e522ff69c5bc987e379f0163943f2833 (patch) | |
| tree | 53622222ac729c6ab6dc75ef7f9bafa8031daf18 /src/manager | |
| parent | 73901a0a012d55ebb66a4627dcb246d19737fcb5 (diff) | |
| parent | 5b2cafdc894823d57beee8f3947a391d881d91de (diff) | |
Various code cleanup changes
Diffstat (limited to 'src/manager')
45 files changed, 683 insertions, 474 deletions
diff --git a/src/manager/angryStatueManager.c b/src/manager/angryStatueManager.c index c24d026e..6d7cc127 100644 --- a/src/manager/angryStatueManager.c +++ b/src/manager/angryStatueManager.c @@ -6,10 +6,14 @@ */ #include "manager/angryStatueManager.h" #include "flags.h" -#include "functions.h" #include "object.h" +#include "script.h" + +#include "sound.h" #include "room.h" +#include "player.h" + void sub_0805D11C(AngryStatueManager*); void AngryStatueManager_Init(AngryStatueManager*); void AngryStatueManager_Action1(AngryStatueManager*); diff --git a/src/manager/armosInteriorManager.c b/src/manager/armosInteriorManager.c index 98587f46..0c190d36 100644 --- a/src/manager/armosInteriorManager.c +++ b/src/manager/armosInteriorManager.c @@ -6,10 +6,9 @@ */ #include "manager/armosInteriorManager.h" #include "common.h" -#include "entity.h" #include "flags.h" -#include "functions.h" #include "sound.h" +#include "room.h" bool32 sub_0805C920(ArmosInteriorManager*); void ArmosInteriorManager_Init(ArmosInteriorManager*); diff --git a/src/manager/bombableWallManager.c b/src/manager/bombableWallManager.c index e0343063..18347fa1 100644 --- a/src/manager/bombableWallManager.c +++ b/src/manager/bombableWallManager.c @@ -7,10 +7,11 @@ #include "manager/bombableWallManager.h" #include "entity.h" #include "flags.h" -#include "functions.h" #include "game.h" #include "object.h" +#include "asm.h" #include "sound.h" +#include "room.h" #include "tiles.h" u32 BombableWallManager_GetBombableType(u32 tilePos, u32 layer); diff --git a/src/manager/bridgeManager.c b/src/manager/bridgeManager.c index 17e91f91..0070ed04 100644 --- a/src/manager/bridgeManager.c +++ b/src/manager/bridgeManager.c @@ -6,8 +6,8 @@ */ #include "manager/bridgeManager.h" #include "flags.h" -#include "functions.h" #include "sound.h" +#include "player.h" void BridgeManager_Init(BridgeManager*); void BridgeManager_Action1(BridgeManager*); diff --git a/src/manager/cloudOverlayManager.c b/src/manager/cloudOverlayManager.c index b9563b46..021da0f3 100644 --- a/src/manager/cloudOverlayManager.c +++ b/src/manager/cloudOverlayManager.c @@ -6,19 +6,20 @@ */ #include "manager/cloudOverlayManager.h" #include "area.h" -#include "functions.h" #include "screen.h" +#include "game.h" +#include "room.h" -void sub_0805AEDC(CloudOverlayManager*); -void sub_0805AF3C(CloudOverlayManager*); +void CloudOverlayManager_OnEnterRoom(CloudOverlayManager*); +void CloudOverlayManager_OnExitRoom(CloudOverlayManager*); void CloudOverlayManager_Main(CloudOverlayManager* this) { static const u16 gUnk_0810865C[] = { 0xf01, 0xe02, 0xe03, 0xe04, 0, 0, }; if (this == NULL) { - if (gArea.onEnter != sub_0805AEDC) { - sub_0805AEDC(NULL); + if (gArea.onEnter != CloudOverlayManager_OnEnterRoom) { + CloudOverlayManager_OnEnterRoom(NULL); } } else { if (super->action == 0) { @@ -29,7 +30,7 @@ void CloudOverlayManager_Main(CloudOverlayManager* this) { this->field_0x20 = gUnk_0810865C[0]; SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); if (gArea.onEnter == NULL) { - RegisterTransitionManager(this, sub_0805AEDC, sub_0805AF3C); + RegisterTransitionHandler(this, CloudOverlayManager_OnEnterRoom, CloudOverlayManager_OnExitRoom); } else { DeleteThisEntity(); } @@ -49,7 +50,7 @@ void CloudOverlayManager_Main(CloudOverlayManager* this) { } } -void sub_0805AEDC(CloudOverlayManager* this) { +void CloudOverlayManager_OnEnterRoom(CloudOverlayManager* this) { gScreen.bg3.control = BGCNT_SCREENBASE(30) | BGCNT_PRIORITY(1) | BGCNT_CHARBASE(1); gScreen.lcd.displayControl |= DISPCNT_BG3_ON; gScreen.controls.layerFXControl = @@ -62,7 +63,7 @@ void sub_0805AEDC(CloudOverlayManager* this) { } } -void sub_0805AF3C(CloudOverlayManager* this) { +void CloudOverlayManager_OnExitRoom(CloudOverlayManager* this) { super->flags &= ~ENT_PERSIST; gScreen.lcd.displayControl &= ~DISPCNT_BG3_ON; gScreen.controls.layerFXControl = 0; diff --git a/src/manager/cloudStaircaseTransitionManager.c b/src/manager/cloudStaircaseTransitionManager.c index d8a47d63..3926f1ed 100644 --- a/src/manager/cloudStaircaseTransitionManager.c +++ b/src/manager/cloudStaircaseTransitionManager.c @@ -7,7 +7,8 @@ #include "manager/cloudStaircaseTransitionManager.h" #include "asm.h" #include "common.h" -#include "functions.h" +#include "room.h" +#include "player.h" void CloudStaircaseTransitionManager_Main(CloudStaircaseTransitionManager* this) { if (super->action == 0) { diff --git a/src/manager/delayedEntityLoadManager.c b/src/manager/delayedEntityLoadManager.c index 0a13bf40..1509c95b 100644 --- a/src/manager/delayedEntityLoadManager.c +++ b/src/manager/delayedEntityLoadManager.c @@ -8,7 +8,11 @@ #include "room.h" #include "npc.h" #include "area.h" +#include "flags.h" +#include "script.h" +#include "save.h" #include "asm.h" +#include "object.h" typedef struct { Manager base; diff --git a/src/manager/diggingCaveEntranceManager.c b/src/manager/diggingCaveEntranceManager.c index ce428a2b..49104baf 100644 --- a/src/manager/diggingCaveEntranceManager.c +++ b/src/manager/diggingCaveEntranceManager.c @@ -7,11 +7,12 @@ #include "manager/diggingCaveEntranceManager.h" #include "area.h" #include "asm.h" -#include "functions.h" #include "player.h" #include "room.h" #include "scroll.h" #include "tiles.h" +#ifndef EU +#endif void DiggingCaveEntranceManager_Main(DiggingCaveEntranceManager*); void DiggingCaveEntranceManager_Init(DiggingCaveEntranceManager*); diff --git a/src/manager/enterRoomTextboxManager.c b/src/manager/enterRoomTextboxManager.c index 61276437..6e1f012c 100644 --- a/src/manager/enterRoomTextboxManager.c +++ b/src/manager/enterRoomTextboxManager.c @@ -8,10 +8,11 @@ #include "area.h" #include "common.h" #include "fileselect.h" -#include "functions.h" #include "game.h" #include "message.h" #include "screen.h" +#include "vram.h" +#include "fade.h" const u16 gUnk_08108DE8[] = { 0, 0x70b, 0x70c, 0x70d, 0x70e, 0x70f, 0x710, 0x711, 0x712, 0x713, 0x714, 0x715, 0x716, 0x717, 0x718, 0x719, 0x71a, 0x71b, 0x71c, 0x71d, 0x71e, 0x71f, diff --git a/src/manager/entitySpawnManager.c b/src/manager/entitySpawnManager.c index 6303d998..f9868310 100644 --- a/src/manager/entitySpawnManager.c +++ b/src/manager/entitySpawnManager.c @@ -9,9 +9,9 @@ #include "manager/entitySpawnManager.h" #include "entity.h" #include "flags.h" -#include "functions.h" #include "room.h" #include "sound.h" +#include "player.h" void EntitySpawnManager_Main(EntitySpawnManager* this) { if (super->action == 0) { diff --git a/src/manager/ezloHintManager.c b/src/manager/ezloHintManager.c index eb2a666a..f5b93933 100644 --- a/src/manager/ezloHintManager.c +++ b/src/manager/ezloHintManager.c @@ -9,7 +9,7 @@ #include "asm.h" #include "entity.h" #include "flags.h" -#include "functions.h" +#include "player.h" static void EzloHintManager_Init(EzloHintManager*); static void EzloHintManager_Action1(EzloHintManager*); diff --git a/src/manager/fallingItemManager.c b/src/manager/fallingItemManager.c index 740c91a3..951cf83c 100644 --- a/src/manager/fallingItemManager.c +++ b/src/manager/fallingItemManager.c @@ -40,7 +40,7 @@ void FallingItemManager_Action1(FallingItemManager* this) { object->base.collisionLayer = this->field_0x36; object->base.x.HALF.HI = this->field_0x38 + gRoomControls.origin_x; object->base.y.HALF.HI = this->field_0x3a + gRoomControls.origin_y; - object->unk_86 = this->field_0x3c; + object->flag = this->field_0x3c; } DeleteThisEntity(); } diff --git a/src/manager/flagAndOperatorManager.c b/src/manager/flagAndOperatorManager.c index 7439830a..6236ef91 100644 --- a/src/manager/flagAndOperatorManager.c +++ b/src/manager/flagAndOperatorManager.c @@ -10,12 +10,12 @@ void FlagAndOperatorManager_Main(FlagAndOperatorManager* this) { if (super->action == 0) { super->action = 1; - if (CheckFlags(this->unk_3c)) { + if (CheckFlags(this->setFlag)) { DeleteThisEntity(); } } else { - if (CheckFlags(this->unk_3e)) { - SetFlag(this->unk_3c); + if (CheckFlags(this->checkFlags)) { + SetFlag(this->setFlag); DeleteThisEntity(); } } diff --git a/src/manager/flameManager.c b/src/manager/flameManager.c index a363ebe0..e7535e63 100644 --- a/src/manager/flameManager.c +++ b/src/manager/flameManager.c @@ -8,9 +8,10 @@ */ #include "manager/flameManager.h" #include "asm.h" -#include "functions.h" #include "room.h" #include "tiles.h" +#include "player.h" +#include "map.h" void FlameManager_Main(FlameManager* this) { if (super->action == 0) { diff --git a/src/manager/goronMerchantShopManager.c b/src/manager/goronMerchantShopManager.c index ff1d1b56..f4004c8e 100644 --- a/src/manager/goronMerchantShopManager.c +++ b/src/manager/goronMerchantShopManager.c @@ -10,6 +10,7 @@ #include "flags.h" #include "item.h" #include "object.h" +#include "room.h" #include "object/itemForSale.h" typedef struct { diff --git a/src/manager/holeManager.c b/src/manager/holeManager.c index c83ed3ea..cc3a3191 100644 --- a/src/manager/holeManager.c +++ b/src/manager/holeManager.c @@ -7,105 +7,213 @@ #include "manager/holeManager.h" #include "common.h" #include "flags.h" -#include "functions.h" #include "object.h" +#include "asm.h" +#include "player.h" #include "room.h" #include "screen.h" +#include "game.h" +#include "manager/lightManager.h" +#include "assets/gfx_offsets.h" +#include "gfx.h" -extern void (*const HoleManager_Actions[])(HoleManager*); +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; +} HoleTransitionParallaxBackground; + +typedef struct { + u8 type; + u8 subtype; + u8 unk_2; + u8 unk_3; + u16 x; + u16 y; +} HoleTransitionParallaxEntity; + +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 HoleTransitionParallaxBackground* parallax_background; + const HoleTransitionParallaxEntity* parallax_entity; +} HoleTransition; + +void HoleManager_Init(HoleManager*); +void HoleManager_Update(HoleManager*); + +void (*const HoleManager_Actions[])(HoleManager*) = { + HoleManager_Init, + HoleManager_Update, +}; + +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 }, + { 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 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 }, + { 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, &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, &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, &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 }, + { 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, &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, &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, &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, &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, &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, &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 }, + { 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_UpdateParallaxBackground(HoleManager*); +void HoleManager_OnEnterRoom(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->parallax_background != 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->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_UpdateParallaxBackground(this); + HoleManager_OnEnterRoom(this); + RegisterTransitionHandler(this, HoleManager_OnEnterRoom, NULL); } - if (!tmp->unk_10) + if (!transition->parallax_entity) return; - obj = CreateObject(PARALLAX_ROOM_VIEW, tmp->unk_10->unk_00, tmp->unk_10->unk_01); + obj = CreateObject(PARALLAX_ROOM_VIEW, transition->parallax_entity->type, transition->parallax_entity->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_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 = 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_entity->x + gRoomControls.origin_x; + obj->y.HALF.HI = transition->parallax_entity->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_UpdateParallaxBackground(this); if (gRoomControls.reload_flags == 1) { super->subAction = 1; return; @@ -121,82 +229,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_UpdateParallaxBackground(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_OnEnterRoom(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->parallax_background->gfx], BG_SCREEN_ADDR(30), BG_SCREEN_SIZE); gScreen.bg3.control = 0x1E07; gScreen.lcd.displayControl |= DISPCNT_BG3_ON; gScreen.bg3.xOffset = gRoomControls.bg3OffsetX.HALF.HI; diff --git a/src/manager/horizontalMinishPathBackgroundManager.c b/src/manager/horizontalMinishPathBackgroundManager.c index 5d5d1ae7..6c0a96fd 100644 --- a/src/manager/horizontalMinishPathBackgroundManager.c +++ b/src/manager/horizontalMinishPathBackgroundManager.c @@ -6,11 +6,13 @@ */ #include "manager/horizontalMinishPathBackgroundManager.h" #include "common.h" -#include "functions.h" #include "screen.h" +#include "game.h" +#include "vram.h" +#include "room.h" void sub_08057F20(HorizontalMinishPathBackgroundManager*); -void sub_08057EFC(void*); +void HorizontalMinishPathBackgroundManager_OnEnterRoom(HorizontalMinishPathBackgroundManager*); void sub_08058034(void); void sub_08058084(u16*, u16*); void sub_08058004(u32, void*, void*); @@ -24,38 +26,38 @@ void HorizontalMinishPathBackgroundManager_Main(HorizontalMinishPathBackgroundMa super->action = 1; gScreen.bg1.updated = 0; gScreen.bg3.updated = 0; - RegisterTransitionManager(this, sub_08057EFC, NULL); + RegisterTransitionHandler(this, HorizontalMinishPathBackgroundManager_OnEnterRoom, NULL); } } -void sub_08057EFC(void* this) { - LoadGfxGroup((u32)gRoomVars.graphicsGroups[0]); +void HorizontalMinishPathBackgroundManager_OnEnterRoom(HorizontalMinishPathBackgroundManager* this) { + LoadGfxGroup(gRoomVars.graphicsGroups[0]); sub_08058034(); - ((HorizontalMinishPathBackgroundManager*)this)->unk_3c = 0; - ((HorizontalMinishPathBackgroundManager*)this)->unk_38 = 0; - sub_08057F20(((HorizontalMinishPathBackgroundManager*)this)); + this->unk_3c = 0; + this->unk_38 = 0; + sub_08057F20(this); } void sub_08057F20(HorizontalMinishPathBackgroundManager* this) { u32 tmp; tmp = gRoomControls.scroll_x - gRoomControls.origin_x; - tmp = tmp + (tmp >> 3) + ((0x400 - gRoomControls.width) / 2); + tmp = tmp + (tmp >> 3) + (0x400 - gRoomControls.width) / 2; gScreen.bg3.xOffset = tmp & 0xF; gScreen.bg3.yOffset = 0x30 - ((0x30 - (gRoomControls.scroll_y - gRoomControls.origin_y)) >> 2); gScreen.bg3.subTileMap = gBG3Buffer; sub_08058004(tmp, gUnk_02006F00, gBG3Buffer); - tmp = ((tmp >> 4) << 1); + tmp = (tmp >> 4) << 1; if (this->unk_38 != tmp) { this->unk_38 = tmp; gScreen.bg3.updated = 1; } - tmp = (gRoomControls.scroll_x - gRoomControls.origin_x); - tmp = tmp + (tmp >> 2) + ((0x400 - gRoomControls.width) / 2); + tmp = gRoomControls.scroll_x - gRoomControls.origin_x; + tmp = tmp + (tmp >> 2) + (0x400 - gRoomControls.width) / 2; gScreen.bg1.xOffset = tmp & 0xF; gScreen.bg1.yOffset = 0x30 - ((0x30 - (gRoomControls.scroll_y - gRoomControls.origin_y)) >> 1); gScreen.bg1.subTileMap = gBG3Buffer + 0x400; sub_08058004(tmp, gUnk_02006F00 + 0x2000, gBG3Buffer + 0x400); - tmp = ((tmp >> 4) << 1); + tmp = (tmp >> 4) << 1; if (this->unk_3c != tmp) { this->unk_3c = tmp; gScreen.bg1.updated = 1; diff --git a/src/manager/hyruleTownTileSetManager.c b/src/manager/hyruleTownTileSetManager.c index 118d2f14..8fa8b77b 100644 --- a/src/manager/hyruleTownTileSetManager.c +++ b/src/manager/hyruleTownTileSetManager.c @@ -8,106 +8,131 @@ #include "area.h" #include "asm.h" #include "flags.h" -#include "functions.h" #include "main.h" #include "room.h" #include "tiles.h" +#include "game.h" +#include "assets/gfx_offsets.h" +#include "player.h" + +void HyruleTownTileSetManager_UpdateLoadGfxGroups(HyruleTownTileSetManager*); +void HyruleTownTileSetManager_OnEnterRoom(HyruleTownTileSetManager*); + +// clang-format off +static const u16 gHyruleTownTileSetManager_regions0[] = { + 0, 0x000, 0x000, 0x3f0, 0x200, + 1, 0x000, 0x280, 0x3f0, 0x140, + 0xff +}; +static const u16 gHyruleTownTileSetManager_regions1[] = { + 2, 0x000, 0x000, 0x180, 0x3c0, + 3, 0x280, 0x000, 0x170, 0x3c0, + 0xff +}; +static const u16 gHyruleTownTileSetManager_regions2[] = { + 5, 0x130, 0x1b0, 0x190, 0x140, + 4, 0x000, 0x000, 0x3f0, 0x3c0, + 0xff +}; +static const u16 gHyruleTownTileSetManager_festivalRegions0[] = { + 0, 0x000, 0x000, 0x190, 0x1d0, + 1, 0x000, 0x2a0, 0x190, 0x120, + 0xff +}; +static const u16 gHyruleTownTileSetManager_festivalRegions1[] = { + 0xff +}; +static const u16 gHyruleTownTileSetManager_festivalRegions2[] = { + 5, 0x000, 0x1b0, 0x190, 0x140, + 4, 0x000, 0x000, 0x190, 0x3c0, + 0xff +}; +// clang-format on -void sub_08059A58(HyruleTownTileSetManager*); -void sub_08059A2C(HyruleTownTileSetManager*); - -static const u16 gUnk_08108398[] = { 0x0, 0x0, 0x0, 0x3f0, 0x200, 0x1, 0x0, 0x280, 0x3f0, 0x140, 0xff }; -static const u16 gUnk_081083AE[] = { 0x2, 0x0, 0x0, 0x180, 0x3c0, 0x3, 0x280, 0x0, 0x170, 0x3c0, 0xff }; -static const u16 gUnk_081083C4[] = { 0x5, 0x130, 0x1b0, 0x190, 0x140, 0x4, 0x0, 0x0, 0x3f0, 0x3c0, 0xff }; -static const u16 gUnk_081083DA[] = { 0x0, 0x0, 0x0, 0x190, 0x1d0, 0x1, 0x0, 0x2a0, 0x190, 0x120, 0xff, 0xff }; -static const u16 gUnk_081083F2[] = { 0x5, 0x0, 0x1b0, 0x190, 0x140, 0x4, 0x0, 0x0, 0x190, 0x3c0, 0xff }; - -void sub_08059CC0(u32, u32); -void sub_08059B18(void); +void HyruleTownTileSetManager_LoadGfxGroup(u32, u32); +void HyruleTownTileSetManager_BuildSecondOracleHouse(void); -bool32 sub_08059C8C(HyruleTownTileSetManager*, u32, u8*, const u16*); +bool32 HyruleTownTileSetManager_UpdateRoomGfxGroup(HyruleTownTileSetManager*, u32, u8*, const u16*); extern u32 gUnk_086E8460; typedef struct { - u32 field_0x0; - u32 field_0x4; - u32 field_0x8; - u32 field_0xc; -} Unknown; - -static const Unknown gUnk_08108408[] = { -#ifdef EU - { 0x139860, 0x6000000, 0x13f860, 0x6008000 }, { 0x13c860, 0x6000000, 0x142860, 0x6008000 }, - { 0x13a860, 0x6001000, 0x140860, 0x6009000 }, { 0x13d860, 0x6001000, 0x143860, 0x6009000 }, - { 0x13b860, 0x6002000, 0x141860, 0x600a000 }, { 0x13e860, 0x6002000, 0x144860, 0x600a000 } -#else - { 0x1395e0, 0x6000000, 0x13f5e0, 0x6008000 }, { 0x13c5e0, 0x6000000, 0x1425e0, 0x6008000 }, - { 0x13a5e0, 0x6001000, 0x1405e0, 0x6009000 }, { 0x13d5e0, 0x6001000, 0x1435e0, 0x6009000 }, - { 0x13b5e0, 0x6002000, 0x1415e0, 0x600a000 }, { 0x13e5e0, 0x6002000, 0x1445e0, 0x600a000 } -#endif + u32 gfx1; + void* dest1; + u32 gfx2; + void* dest2; +} HyruleTownTileSetManagerGfxInfo; + +static const HyruleTownTileSetManagerGfxInfo gHyruleTownTileSetManagerGfxInfos[] = { + { offset_gUnk_086D4460 + 0x8000, BG_SCREEN_ADDR(0), offset_gUnk_086D4460 + 0xE000, BG_SCREEN_ADDR(16) }, + { offset_gUnk_086D4460 + 0xB000, BG_SCREEN_ADDR(0), offset_gUnk_086D4460 + 0x11000, BG_SCREEN_ADDR(16) }, + { offset_gUnk_086D4460 + 0x9000, BG_SCREEN_ADDR(2), offset_gUnk_086D4460 + 0xF000, BG_SCREEN_ADDR(18) }, + { offset_gUnk_086D4460 + 0xC000, BG_SCREEN_ADDR(2), offset_gUnk_086D4460 + 0x12000, BG_SCREEN_ADDR(18) }, + { offset_gUnk_086D4460 + 0xA000, BG_SCREEN_ADDR(4), offset_gUnk_086D4460 + 0x10000, BG_SCREEN_ADDR(20) }, + { offset_gUnk_086D4460 + 0xD000, BG_SCREEN_ADDR(4), offset_gUnk_086D4460 + 0x13000, BG_SCREEN_ADDR(20) } }; -static const Unknown gUnk_08108468[] = { -#ifdef EU - { 0x146060, 0x6000000, 0x14c060, 0x6008000 }, { 0x149060, 0x6000000, 0x14f060, 0x6008000 }, - { 0x147060, 0x6001000, 0x14d060, 0x6009000 }, { 0x14a060, 0x6001000, 0x150060, 0x6009000 }, - { 0x148060, 0x6002000, 0x14e060, 0x600a000 }, { 0x14b060, 0x6002000, 0x151060, 0x600a000 }, -#else - { 0x145de0, 0x6000000, 0x14bde0, 0x6008000 }, { 0x148de0, 0x6000000, 0x14ede0, 0x6008000 }, - { 0x146de0, 0x6001000, 0x14cde0, 0x6009000 }, { 0x149de0, 0x6001000, 0x14fde0, 0x6009000 }, - { 0x147de0, 0x6002000, 0x14dde0, 0x600a000 }, { 0x14ade0, 0x6002000, 0x150de0, 0x600a000 }, -#endif +static const HyruleTownTileSetManagerGfxInfo gHyruleTownTileSetManagerGfxInfosFestival[] = { + { offset_gUnk_086E8460 + 0x800, BG_SCREEN_ADDR(0), offset_gUnk_086E8460 + 0x6800, BG_SCREEN_ADDR(16) }, + { offset_gUnk_086E8460 + 0x3800, BG_SCREEN_ADDR(0), offset_gUnk_086E8460 + 0x9800, BG_SCREEN_ADDR(16) }, + { offset_gUnk_086E8460 + 0x1800, BG_SCREEN_ADDR(2), offset_gUnk_086E8460 + 0x7800, BG_SCREEN_ADDR(18) }, + { offset_gUnk_086E8460 + 0x4800, BG_SCREEN_ADDR(2), offset_gUnk_086E8460 + 0xA800, BG_SCREEN_ADDR(18) }, + { offset_gUnk_086E8460 + 0x2800, BG_SCREEN_ADDR(4), offset_gUnk_086E8460 + 0x8800, BG_SCREEN_ADDR(20) }, + { offset_gUnk_086E8460 + 0x5800, BG_SCREEN_ADDR(4), offset_gUnk_086E8460 + 0xB800, BG_SCREEN_ADDR(20) }, }; extern const u8 gGlobalGfxAndPalettes[]; void HyruleTownTileSetManager_Main(HyruleTownTileSetManager* this) { if (super->action == 0) { super->action = 1; - this->field_0x22 = 0xff; - this->field_0x21 = 0xff; - this->field_0x20 = 0xff; - RegisterTransitionManager(this, sub_08059A2C, NULL); + this->gfxGroup2 = 0xff; + this->gfxGroup1 = 0xff; + this->gfxGroup0 = 0xff; + RegisterTransitionHandler(this, HyruleTownTileSetManager_OnEnterRoom, NULL); SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); } - sub_08059A58(this); + HyruleTownTileSetManager_UpdateLoadGfxGroups(this); } -void sub_08059A2C(HyruleTownTileSetManager* this) { +void HyruleTownTileSetManager_OnEnterRoom(HyruleTownTileSetManager* this) { gRoomVars.graphicsGroups[2] = 0xff; gRoomVars.graphicsGroups[1] = 0xff; gRoomVars.graphicsGroups[0] = 0xff; - this->field_0x22 = 0xff; - this->field_0x21 = 0xff; - this->field_0x20 = 0xff; - sub_08059A58(this); + this->gfxGroup2 = 0xff; + this->gfxGroup1 = 0xff; + this->gfxGroup0 = 0xff; + HyruleTownTileSetManager_UpdateLoadGfxGroups(this); } -void sub_08059A58(HyruleTownTileSetManager* this) { +void HyruleTownTileSetManager_UpdateLoadGfxGroups(HyruleTownTileSetManager* this) { if (gRoomControls.area != AREA_FESTIVAL_TOWN) { - if (sub_08059C8C(this, 0, &this->field_0x20, gUnk_08108398) != 0) { - sub_08059CC0(0, (u32)this->field_0x20); + if (HyruleTownTileSetManager_UpdateRoomGfxGroup(this, 0, &this->gfxGroup0, + gHyruleTownTileSetManager_regions0) != 0) { + HyruleTownTileSetManager_LoadGfxGroup(0, this->gfxGroup0); } - if (sub_08059C8C(this, 1, &this->field_0x21, gUnk_081083AE) != 0) { - sub_08059CC0(1, this->field_0x21); - if (this->field_0x21 == 2) { - sub_08059B18(); + if (HyruleTownTileSetManager_UpdateRoomGfxGroup(this, 1, &this->gfxGroup1, + gHyruleTownTileSetManager_regions1) != 0) { + HyruleTownTileSetManager_LoadGfxGroup(1, this->gfxGroup1); + if (this->gfxGroup1 == 2) { + HyruleTownTileSetManager_BuildSecondOracleHouse(); } } - if (sub_08059C8C(this, 2, &this->field_0x22, gUnk_081083C4) != 0) { - sub_08059CC0(2, (u32)this->field_0x22); + if (HyruleTownTileSetManager_UpdateRoomGfxGroup(this, 2, &this->gfxGroup2, + gHyruleTownTileSetManager_regions2) != 0) { + HyruleTownTileSetManager_LoadGfxGroup(2, this->gfxGroup2); } } else { - if (sub_08059C8C(this, 0, &this->field_0x20, gUnk_081083DA) != 0) { - sub_08059CC0(0, (u32)this->field_0x20); + if (HyruleTownTileSetManager_UpdateRoomGfxGroup(this, 0, &this->gfxGroup0, + gHyruleTownTileSetManager_festivalRegions0) != 0) { + HyruleTownTileSetManager_LoadGfxGroup(0, this->gfxGroup0); } - if (sub_08059C8C(this, 2, &this->field_0x22, gUnk_081083F2) != 0) { - sub_08059CC0(2, (u32)this->field_0x22); + if (HyruleTownTileSetManager_UpdateRoomGfxGroup(this, 2, &this->gfxGroup2, + gHyruleTownTileSetManager_festivalRegions2) != 0) { + HyruleTownTileSetManager_LoadGfxGroup(2, this->gfxGroup2); } } } -#define COMMON(tmp2, tmp1) (((tmp2) >> 4 & 0x3f) | (((tmp1) + 0x188U) >> 4 & 0x3f) << 6) -void sub_08059B18(void) { +void HyruleTownTileSetManager_BuildSecondOracleHouse(void) { u32 loopVar; u32 innerLoopVar; @@ -115,25 +140,25 @@ void sub_08059B18(void) { for (loopVar = 0; loopVar < 4; ++loopVar) { for (innerLoopVar = 0; innerLoopVar < 4; ++innerLoopVar) { SetTileByIndex(loopVar * 0x10 + TILE_TYPE_1195 + innerLoopVar, - COMMON(0x28 + 0x10 * innerLoopVar, loopVar * 0x10), 1); + TILE_LOCAL(0x28 + innerLoopVar * 0x10, 0x188 + loopVar * 0x10), 1); } } for (loopVar = 0; loopVar < 3; ++loopVar) { for (innerLoopVar = 0; innerLoopVar < 4; ++innerLoopVar) { SetTileByIndex(loopVar * 0x10 + TILE_TYPE_1088 + innerLoopVar, - COMMON(0x28 + 0x10 * innerLoopVar, loopVar * 0x10), 2); + TILE_LOCAL(0x28 + innerLoopVar * 0x10, 0x188 + loopVar * 0x10), 2); } } SetTileByIndex(TILE_TYPE_214, TILE_POS(2, 23), LAYER_TOP); SetTileByIndex(TILE_TYPE_215, TILE_POS(3, 23), LAYER_TOP); - LoadResourceAsync(&gUnk_086E8460, 0x6001800, 0x800); + LoadResourceAsync(&gUnk_086E8460, BG_SCREEN_ADDR(3), BG_SCREEN_SIZE); } else { if (CheckGlobalFlag(TATEKAKE_TOCHU) != 0) { for (loopVar = 0; loopVar < 5; ++loopVar) { for (innerLoopVar = 0; innerLoopVar < 4; ++innerLoopVar) { SetTileByIndex(loopVar * 0x10 + TILE_TYPE_1190 + innerLoopVar, - COMMON(0x28 + 0x10 * innerLoopVar, loopVar * 0x10), 1); + TILE_LOCAL(0x28 + innerLoopVar * 0x10, 0x188 + loopVar * 0x10), 1); } } SetTileByIndex(TILE_TYPE_1092, TILE_POS(2, 24), LAYER_TOP); @@ -144,55 +169,56 @@ void sub_08059B18(void) { } } -bool32 sub_08059C8C(HyruleTownTileSetManager* this, u32 param_2, u8* param_3, const u16* param_4) { - bool32 bVar2; - - *param_3 = CheckRegionsOnScreen(param_4); - if ((*param_3 != 0xff) && (gRoomVars.graphicsGroups[param_2] != *param_3)) { - gRoomVars.graphicsGroups[param_2] = *param_3; +bool32 HyruleTownTileSetManager_UpdateRoomGfxGroup(HyruleTownTileSetManager* this, u32 gfxIndex, u8* pGfxGroup, + const u16* regions) { + *pGfxGroup = CheckRegionsOnScreen(regions); + if ((*pGfxGroup != 0xff) && (gRoomVars.graphicsGroups[gfxIndex] != *pGfxGroup)) { + gRoomVars.graphicsGroups[gfxIndex] = *pGfxGroup; return TRUE; - } else { - return FALSE; } + return FALSE; } -void sub_08059CC0(u32 param_1, u32 param_2) { - const Unknown* unknown; +void HyruleTownTileSetManager_LoadGfxGroup(u32 gfxIndex, u32 gfxGroup) { + const HyruleTownTileSetManagerGfxInfo* gfxInfo; - gRoomVars.graphicsGroups[param_1] = param_2; + gRoomVars.graphicsGroups[gfxIndex] = gfxGroup; if (gRoomControls.area != AREA_FESTIVAL_TOWN) { - unknown = &gUnk_08108408[param_2]; + gfxInfo = &gHyruleTownTileSetManagerGfxInfos[gfxGroup]; } else { - unknown = &gUnk_08108468[param_2]; + gfxInfo = &gHyruleTownTileSetManagerGfxInfosFestival[gfxGroup]; } - LoadResourceAsync((void*)&gGlobalGfxAndPalettes + unknown->field_0x0, unknown->field_0x4, 0x1000); - LoadResourceAsync((void*)&gGlobalGfxAndPalettes + unknown->field_0x8, unknown->field_0xc, 0x1000); + LoadResourceAsync(&gGlobalGfxAndPalettes[gfxInfo->gfx1], gfxInfo->dest1, BG_SCREEN_SIZE * 2); + LoadResourceAsync(&gGlobalGfxAndPalettes[gfxInfo->gfx2], gfxInfo->dest2, BG_SCREEN_SIZE * 2); } void TryLoadPrologueHyruleTown(void) { - u32 tmp; + u32 gfxGroup; if (gRoomControls.area != AREA_FESTIVAL_TOWN) { - tmp = CheckRegionsOnScreen(gUnk_08108398); - if (tmp != 0xff) { - sub_08059CC0(0, tmp); + gfxGroup = CheckRegionsOnScreen(gHyruleTownTileSetManager_regions0); + if (gfxGroup != 0xff) { + HyruleTownTileSetManager_LoadGfxGroup(0, gfxGroup); } - tmp = CheckRegionsOnScreen(gUnk_081083AE); - if ((tmp != 0xff) && (sub_08059CC0(1, tmp), tmp == 2)) { - sub_08059B18(); + gfxGroup = CheckRegionsOnScreen(gHyruleTownTileSetManager_regions1); + if (gfxGroup != 0xff) { + HyruleTownTileSetManager_LoadGfxGroup(1, gfxGroup); + if (gfxGroup == 2) { + HyruleTownTileSetManager_BuildSecondOracleHouse(); + } } - tmp = CheckRegionsOnScreen(gUnk_081083C4); - if (tmp != 0xff) { - sub_08059CC0(2, tmp); + gfxGroup = CheckRegionsOnScreen(gHyruleTownTileSetManager_regions2); + if (gfxGroup != 0xff) { + HyruleTownTileSetManager_LoadGfxGroup(2, gfxGroup); } } else { - tmp = CheckRegionsOnScreen(gUnk_081083DA); - if (tmp != 0xff) { - sub_08059CC0(0, tmp); + gfxGroup = CheckRegionsOnScreen(gHyruleTownTileSetManager_festivalRegions0); + if (gfxGroup != 0xff) { + HyruleTownTileSetManager_LoadGfxGroup(0, gfxGroup); } - tmp = CheckRegionsOnScreen(gUnk_081083F2); - if (tmp != 0xff) { - sub_08059CC0(2, tmp); + gfxGroup = CheckRegionsOnScreen(gHyruleTownTileSetManager_festivalRegions2); + if (gfxGroup != 0xff) { + HyruleTownTileSetManager_LoadGfxGroup(2, gfxGroup); } } } diff --git a/src/manager/lightLevelSetManager.c b/src/manager/lightLevelSetManager.c index 26350020..7aad3428 100644 --- a/src/manager/lightLevelSetManager.c +++ b/src/manager/lightLevelSetManager.c @@ -6,9 +6,11 @@ */ #include "manager/lightLevelSetManager.h" #include "flags.h" -#include "functions.h" #include "game.h" #include "object.h" +#include "asm.h" +#include "effects.h" +#include "player.h" #include "room.h" #include "tiles.h" @@ -115,7 +117,7 @@ void LightLevelSetManager_Type3(LightLevelSetManager* this) { default: if (--this->field_0x22 == 0) { - CreateDustAt(*(s16*)&this->field_0x38, *(s16*)&this->field_0x3a, super->type2); + CreateDeathFxAt(*(s16*)&this->field_0x38, *(s16*)&this->field_0x3a, super->type2); ClearFlag(this->field_0x3e); RestorePrevTileEntity(this->field_0x20, super->type2); ChangeLightLevel(-super->timer); diff --git a/src/manager/lightManager.c b/src/manager/lightManager.c index 7a0cca5f..a27d3b5a 100644 --- a/src/manager/lightManager.c +++ b/src/manager/lightManager.c @@ -7,7 +7,6 @@ #include "manager/lightManager.h" #include "area.h" #include "common.h" -#include "functions.h" #include "game.h" #include "main.h" #include "physics.h" @@ -186,7 +185,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/manager/lightRayManager.c b/src/manager/lightRayManager.c index 4a6c4227..1a75f63b 100644 --- a/src/manager/lightRayManager.c +++ b/src/manager/lightRayManager.c @@ -9,9 +9,11 @@ */ #include "manager/lightRayManager.h" #include "common.h" -#include "functions.h" #include "main.h" #include "screen.h" +#include "game.h" +#include "player.h" +#include "physics.h" extern void DisableVBlankDMA(void); @@ -47,7 +49,7 @@ void LightRayManager_Main(LightRayManager* this) { } } -static void LightRayManager_EnterRoom(LightRayManager* this) { +static void LightRayManager_OnEnterRoom(LightRayManager* this) { u8* pbVar1; LoadGfxGroup(this->gfxGroup); @@ -60,7 +62,7 @@ static void LightRayManager_EnterRoom(LightRayManager* this) { } } -static void LightRayManager_ExitRoom(void) { +static void LightRayManager_OnExitRoom(void) { gScreen.lcd.displayControl &= ~DISPCNT_BG3_ON; gScreen.controls.layerFXControl = 0; DisableVBlankDMA(); @@ -76,7 +78,7 @@ void LightRayManager_Init(LightRayManager* this) { gScreen.lcd.displayControl |= DISPCNT_BG3_ON; gScreen.controls.layerFXControl = 0x3648; gScreen.controls.alphaBlend = 0x1000; - RegisterTransitionManager(this, LightRayManager_EnterRoom, LightRayManager_ExitRoom); + RegisterTransitionHandler(this, LightRayManager_OnEnterRoom, LightRayManager_OnExitRoom); } void LightRayManager_Action1(LightRayManager* this) { diff --git a/src/manager/manager29.c b/src/manager/manager29.c index 133d3944..29daf9e7 100644 --- a/src/manager/manager29.c +++ b/src/manager/manager29.c @@ -7,7 +7,9 @@ #include "manager/manager29.h" #include "asm.h" #include "flags.h" -#include "functions.h" +#include "room.h" +#include "player.h" +#include "map.h" bool32 sub_0805CF80(Manager29* this); void sub_0805CBD0(Manager29* this); @@ -16,12 +18,12 @@ void sub_0805CC3C(Manager29* this); void Manager29_Main(Manager29* this) { if (super->action == 0) { sub_0805CBD0(this); - if (CheckFlags(this->unk_3e)) { + if (CheckFlags(this->flag)) { sub_0805CC3C(this); DeleteManager(this); } } else if (sub_0805CF80(this)) { - SetFlag(this->unk_3e); + SetFlag(this->flag); DeleteManager(this); } } diff --git a/src/manager/minishPortalManager.c b/src/manager/minishPortalManager.c index 2d13eb1e..66171581 100644 --- a/src/manager/minishPortalManager.c +++ b/src/manager/minishPortalManager.c @@ -8,8 +8,9 @@ #include "area.h" #include "asm.h" #include "flags.h" -#include "functions.h" #include "object.h" +#include "common.h" +#include "effects.h" #include "player.h" #include "room.h" #include "sound.h" @@ -43,8 +44,8 @@ void MinishPortalManager_Main(MinishPortalManager* this) { } } if (GetActTileAtRoomCoords(this->unk_38, this->unk_3a, super->timer) == ACT_TILE_61) { - CreateMagicSparkles(this->unk_38 + gRoomControls.origin_x, this->unk_3a + gRoomControls.origin_y, - super->timer); + CreateMagicSparklesFxAt(this->unk_38 + gRoomControls.origin_x, this->unk_3a + gRoomControls.origin_y, + super->timer); if (super->subtimer == 0) { super->subtimer = 1; SoundReq(SFX_NEAR_PORTAL); @@ -57,7 +58,7 @@ void MinishPortalManager_Main(MinishPortalManager* this) { } } -void CreateMagicSparkles(u32 baseX, u32 baseY, u32 layer) { +void CreateMagicSparklesFxAt(u32 baseX, u32 baseY, u32 layer) { u32 r; int offsetX, offsetY; Entity* spark; diff --git a/src/manager/minishRaftersBackgroundManager.c b/src/manager/minishRaftersBackgroundManager.c index f92470d6..da5680e3 100644 --- a/src/manager/minishRaftersBackgroundManager.c +++ b/src/manager/minishRaftersBackgroundManager.c @@ -6,10 +6,11 @@ */ #include "manager/minishRaftersBackgroundManager.h" #include "common.h" -#include "functions.h" #include "room.h" +#include "game.h" +#include "vram.h" -void sub_08058204(MinishRaftersBackgroundManager*); +void MinishRaftersBackgroundManager_OnEnterRoom(MinishRaftersBackgroundManager*); void sub_08058210(MinishRaftersBackgroundManager*); u32 sub_08058244(int); void sub_080582A0(u32, u32*, u16*); @@ -23,11 +24,11 @@ void MinishRaftersBackgroundManager_Main(MinishRaftersBackgroundManager* this) { if (super->action == 0) { super->action = 1; gScreen.bg1.updated = 0; - RegisterTransitionManager(this, sub_08058204, NULL); + RegisterTransitionHandler(this, MinishRaftersBackgroundManager_OnEnterRoom, NULL); } } -void sub_08058204(MinishRaftersBackgroundManager* this) { +void MinishRaftersBackgroundManager_OnEnterRoom(MinishRaftersBackgroundManager* this) { sub_08058324(super->type); } diff --git a/src/manager/minishSizedEntranceManager.c b/src/manager/minishSizedEntranceManager.c index 3cac2f1f..9c06a928 100644 --- a/src/manager/minishSizedEntranceManager.c +++ b/src/manager/minishSizedEntranceManager.c @@ -6,9 +6,10 @@ * screen. */ #include "manager/minishSizedEntranceManager.h" -#include "functions.h" #include "object.h" +#include "flags.h" #include "room.h" +#include "script.h" #include "asm.h" typedef struct { diff --git a/src/manager/minishVillageTileSetManager.c b/src/manager/minishVillageTileSetManager.c index 88671417..7799ba83 100644 --- a/src/manager/minishVillageTileSetManager.c +++ b/src/manager/minishVillageTileSetManager.c @@ -7,85 +7,150 @@ #include "manager/minishVillageTileSetManager.h" #include "asm.h" #include "common.h" -#include "functions.h" #include "main.h" - -void sub_08057E30(void*); -bool32 sub_08057E40(MinishVillageTileSetManager*); -void sub_08057E7C(u32); - -extern const u8 gGlobalGfxAndPalettes[]; - -const u16 gUnk_08108050[0x2A] = { +#include "game.h" +#include "assets/gfx_offsets.h" +#include "pauseMenu.h" +#include "gfx.h" + +void MinishVillageTileSetManager_OnEnterRoom(void*); +bool32 MinishVillageTileSetManager_UpdateRoomGfxGroup(MinishVillageTileSetManager*); +void MinishVillageTileSetManager_LoadGfxGroup(u32); + +// clang-format off +const u16 gMinishVillageTileSetManagerRegions[] = { + 0, 0x000, 0x020, 0x0E0, 0x0E0, #ifdef EU - 0, 0, 0x20, 0xE0, 0xE0, 1, 0x28, 0x1C8, 0x60, 0x80, 2, - 0x188, 0x278, 0xE0, 0xA0, 3, 0x310, 0x178, 0xC0, 0x150, 3, 0x340, + 1, 0x028, 0x1C8, 0x060, 0x080, + 2, 0x188, 0x278, 0x0E0, 0x0A0, #else - 0, 0, 0x20, 0xE0, 0xE0, 1, 0, 0x1D0, 0x80, 0x60, 2, - 0x170, 0x278, 0xF8, 0xA0, 3, 0x310, 0x178, 0xC0, 0x150, 3, 0x340, + 1, 0x000, 0x1D0, 0x080, 0x060, + 2, 0x170, 0x278, 0x0F8, 0x0A0, #endif - 0x2C8, 0x60, 0x90, 4, 0x1D0, 0, 0x200, 0xE0, 1, 0x108, 0x188, - 0xD0, 0x80, 2, 0x1E8, 0x338, 0x50, 0xC0, 0xFF, 0 + 3, 0x310, 0x178, 0x0C0, 0x150, + 3, 0x340, 0x2C8, 0x060, 0x090, + 4, 0x1D0, 0x000, 0x200, 0x0E0, + 1, 0x108, 0x188, 0x0D0, 0x080, + 2, 0x1E8, 0x338, 0x050, 0x0C0, + 0xFF, }; - -const u32 gUnk_081080A4[0x50] = { -#ifdef EU - 0x109860, 0x6000000, 0x10a860, 0x6001000, 0x10b860, 0x6002000, 0x10c860, 0x6003000, 0x10d860, 0x6008000, - 0x10e860, 0x6009000, 0x10f860, 0x600a000, 0x110860, 0x600b000, 0x111860, 0x6000000, 0x112860, 0x6001000, - 0x113860, 0x6002000, 0x114860, 0x6003000, 0x115860, 0x6008000, 0x116860, 0x6009000, 0x117860, 0x600a000, - 0x118860, 0x600b000, 0x119860, 0x6000000, 0x11a860, 0x6001000, 0x11b860, 0x6002000, 0x11c860, 0x6003000, - 0x11d860, 0x6008000, 0x11e860, 0x6009000, 0x11f860, 0x600a000, 0x120860, 0x600b000, 0x121860, 0x6000000, - 0x122860, 0x6001000, 0x123860, 0x6002000, 0x124860, 0x6003000, 0x125860, 0x6008000, 0x126860, 0x6009000, - 0x127860, 0x600a000, 0x128860, 0x600b000, 0x129860, 0x6000000, 0x12a860, 0x6001000, 0x12b860, 0x6002000, - 0x12c860, 0x6003000, 0x12d860, 0x6008000, 0x12e860, 0x6009000, 0x12f860, 0x600a000, 0x130860, 0x600b000 -#else - 0x001095E0, 0x06000000, 0x0010A5E0, 0x06001000, 0x0010B5E0, 0x06002000, 0x0010C5E0, 0x06003000, 0x0010D5E0, - 0x06008000, 0x0010E5E0, 0x06009000, 0x0010F5E0, 0x0600A000, 0x001105E0, 0x0600B000, 0x001115E0, 0x06000000, - 0x001125E0, 0x06001000, 0x001135E0, 0x06002000, 0x001145E0, 0x06003000, 0x001155E0, 0x06008000, 0x001165E0, - 0x06009000, 0x001175E0, 0x0600A000, 0x001185E0, 0x0600B000, 0x001195E0, 0x06000000, 0x0011A5E0, 0x06001000, - 0x0011B5E0, 0x06002000, 0x0011C5E0, 0x06003000, 0x0011D5E0, 0x06008000, 0x0011E5E0, 0x06009000, 0x0011F5E0, - 0x0600A000, 0x001205E0, 0x0600B000, 0x001215E0, 0x06000000, 0x001225E0, 0x06001000, 0x001235E0, 0x06002000, - 0x001245E0, 0x06003000, 0x001255E0, 0x06008000, 0x001265E0, 0x06009000, 0x001275E0, 0x0600A000, 0x001285E0, - 0x0600B000, 0x001295E0, 0x06000000, 0x0012A5E0, 0x06001000, 0x0012B5E0, 0x06002000, 0x0012C5E0, 0x06003000, - 0x0012D5E0, 0x06008000, 0x0012E5E0, 0x06009000, 0x0012F5E0, 0x0600A000, 0x001305E0, 0x0600B000 -#endif +// clang-format on + +typedef struct { + u32 gfx; + void* dest; +} MinishVillageTileSetManagerGfxInfo; + +const MinishVillageTileSetManagerGfxInfo gMinishVillageTileSetManagerGfxInfos[][8] = { + { + { offset_gUnk_086AAEE0 + 0x1580, BG_SCREEN_ADDR(0) }, + { offset_gUnk_086AAEE0 + 0x2580, BG_SCREEN_ADDR(2) }, + { offset_gUnk_086AAEE0 + 0x3580, BG_SCREEN_ADDR(4) }, + { offset_gUnk_086AAEE0 + 0x4580, BG_SCREEN_ADDR(6) }, + { offset_gUnk_086AAEE0 + 0x5580, BG_SCREEN_ADDR(16) }, + { offset_gUnk_086AAEE0 + 0x6580, BG_SCREEN_ADDR(18) }, + { offset_gUnk_086AAEE0 + 0x7580, BG_SCREEN_ADDR(20) }, + { offset_gUnk_086AAEE0 + 0x8580, BG_SCREEN_ADDR(22) }, + }, + { + { offset_gUnk_086AAEE0 + 0x9580, BG_SCREEN_ADDR(0) }, + { offset_gUnk_086AAEE0 + 0xA580, BG_SCREEN_ADDR(2) }, + { offset_gUnk_086AAEE0 + 0xB580, BG_SCREEN_ADDR(4) }, + { offset_gUnk_086AAEE0 + 0xC580, BG_SCREEN_ADDR(6) }, + { offset_gUnk_086AAEE0 + 0xD580, BG_SCREEN_ADDR(16) }, + { offset_gUnk_086AAEE0 + 0xE580, BG_SCREEN_ADDR(18) }, + { offset_gUnk_086AAEE0 + 0xF580, BG_SCREEN_ADDR(20) }, + { offset_gUnk_086AAEE0 + 0x10580, BG_SCREEN_ADDR(22) }, + }, + { + { offset_gUnk_086AAEE0 + 0x11580, BG_SCREEN_ADDR(0) }, + { offset_gUnk_086AAEE0 + 0x12580, BG_SCREEN_ADDR(2) }, + { offset_gUnk_086AAEE0 + 0x13580, BG_SCREEN_ADDR(4) }, + { offset_gUnk_086AAEE0 + 0x14580, BG_SCREEN_ADDR(6) }, + { offset_gUnk_086AAEE0 + 0x15580, BG_SCREEN_ADDR(16) }, + { offset_gUnk_086AAEE0 + 0x16580, BG_SCREEN_ADDR(18) }, + { offset_gUnk_086AAEE0 + 0x17580, BG_SCREEN_ADDR(20) }, + { offset_gUnk_086AAEE0 + 0x18580, BG_SCREEN_ADDR(22) }, + }, + { + { offset_gUnk_086AAEE0 + 0x19580, BG_SCREEN_ADDR(0) }, + { offset_gUnk_086AAEE0 + 0x1A580, BG_SCREEN_ADDR(2) }, + { offset_gUnk_086AAEE0 + 0x1B580, BG_SCREEN_ADDR(4) }, + { offset_gUnk_086AAEE0 + 0x1C580, BG_SCREEN_ADDR(6) }, + { offset_gUnk_086AAEE0 + 0x1D580, BG_SCREEN_ADDR(16) }, + { offset_gUnk_086AAEE0 + 0x1E580, BG_SCREEN_ADDR(18) }, + { offset_gUnk_086AAEE0 + 0x1F580, BG_SCREEN_ADDR(20) }, + { offset_gUnk_086AAEE0 + 0x20580, BG_SCREEN_ADDR(22) }, + }, + { + { offset_gUnk_086AAEE0 + 0x21580, BG_SCREEN_ADDR(0) }, + { offset_gUnk_086AAEE0 + 0x22580, BG_SCREEN_ADDR(2) }, + { offset_gUnk_086AAEE0 + 0x23580, BG_SCREEN_ADDR(4) }, + { offset_gUnk_086AAEE0 + 0x24580, BG_SCREEN_ADDR(6) }, + { offset_gUnk_086AAEE0 + 0x25580, BG_SCREEN_ADDR(16) }, + { offset_gUnk_086AAEE0 + 0x26580, BG_SCREEN_ADDR(18) }, + { offset_gUnk_086AAEE0 + 0x27580, BG_SCREEN_ADDR(20) }, + { offset_gUnk_086AAEE0 + 0x28580, BG_SCREEN_ADDR(22) }, + }, }; -const u8 gUnk_081081E4[] = { 0x16, 0x17, 0x17, 0x18, 0x18 }; +const u8 gMinishVillateTileSetManagerPaletteGroups[] = { 0x16, 0x17, 0x17, 0x18, 0x18 }; -#ifdef EU void MinishVillageTileSetManager_Main(MinishVillageTileSetManager* this) { - u32 tmp; - const u32* tmp2; - s32 tmp3; + u32 gfxGroup; + const MinishVillageTileSetManagerGfxInfo* gfxInfo; + s32 super_timer; if (super->action == 0) { super->action = 1; super->timer = 8; this->unk_20 = 0xFF; - RegisterTransitionManager(this, sub_08057E30, 0); +#ifndef EU + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); +#endif + RegisterTransitionHandler(this, MinishVillageTileSetManager_OnEnterRoom, NULL); } +#ifdef EU if (gRoomControls.reload_flags) return; +#endif - if (sub_08057E40(this)) { - tmp = (u32)gRoomVars.graphicsGroups[0]; - if (this->unk_20 != tmp) { - this->unk_20 = tmp; + if (MinishVillageTileSetManager_UpdateRoomGfxGroup(this)) { + gfxGroup = (u32)gRoomVars.graphicsGroups[0]; + if (this->unk_20 != gfxGroup) { + this->unk_20 = gfxGroup; super->timer = 0; } } +#ifndef EU + if (gRoomControls.reload_flags) + return; +#endif +#ifndef JP +#ifndef EU + gfxGroup = this->unk_20; +#endif +#endif - tmp2 = &gUnk_081080A4[tmp << 4]; - tmp3 = super->timer; - if (tmp3 == 0) { + gfxInfo = gMinishVillageTileSetManagerGfxInfos[gfxGroup]; +#ifdef EU + super_timer = super->timer; + if (super_timer == 0) { +#else + switch (super->timer) { + case 0: +#endif gPauseMenuOptions.disabled = 1; - LoadResourceAsync(&gGlobalGfxAndPalettes[tmp2[0]], tmp2[1], 0x1000); - LoadPaletteGroup(gUnk_081081E4[tmp]); + LoadResourceAsync(&gGlobalGfxAndPalettes[gfxInfo->gfx], gfxInfo->dest, BG_SCREEN_SIZE * 2); + LoadPaletteGroup(gMinishVillateTileSetManagerPaletteGroups[gfxGroup]); super->timer++; +#ifdef EU } else { - switch (tmp3) { + switch (super_timer) { case 0: +#else + break; +#endif case 1: case 2: case 3: @@ -93,99 +158,58 @@ void MinishVillageTileSetManager_Main(MinishVillageTileSetManager* this) { case 5: case 6: case 7: - LoadResourceAsync(&gGlobalGfxAndPalettes[tmp2[(super->timer << 1)]], tmp2[(super->timer << 1) + 1], - 0x1000); + LoadResourceAsync(&gGlobalGfxAndPalettes[gfxInfo[super->timer].gfx], gfxInfo[super->timer].dest, + BG_SCREEN_SIZE * 2); super->timer++; +#ifdef EU gPauseMenuOptions.disabled = 0; +#endif + break; case 8: +#ifndef EU + gPauseMenuOptions.disabled = 0; + super->timer++; +#endif break; } +#ifdef EU } -} -#else -void MinishVillageTileSetManager_Main(MinishVillageTileSetManager* this) { - u32 tmp; - const u32* tmp2; - if (super->action == 0) { - super->action = 1; - super->timer = 8; - this->unk_20 = 0xFF; - - SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); - RegisterTransitionManager(this, sub_08057E30, 0); - } - if (sub_08057E40(this)) { - tmp = (u32)gRoomVars.graphicsGroups[0]; - if (this->unk_20 != tmp) { - this->unk_20 = tmp; - super->timer = 0; - } - } - if (gRoomControls.reload_flags) - return; -#ifndef JP - tmp = this->unk_20; #endif - tmp2 = &gUnk_081080A4[tmp << 4]; - switch (super->timer) { - case 0: - gPauseMenuOptions.disabled = 1; - LoadResourceAsync(&gGlobalGfxAndPalettes[tmp2[0]], tmp2[1], 0x1000); - LoadPaletteGroup(gUnk_081081E4[tmp]); - super->timer++; - break; - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - LoadResourceAsync(&gGlobalGfxAndPalettes[tmp2[(super->timer << 1)]], tmp2[(super->timer << 1) + 1], 0x1000); - super->timer++; - break; - case 8: - gPauseMenuOptions.disabled = 0; - super->timer++; - break; - } } -#endif -void sub_08057E30(void* this) { - sub_08057E7C(gRoomVars.graphicsGroups[0]); +void MinishVillageTileSetManager_OnEnterRoom(void* this) { + MinishVillageTileSetManager_LoadGfxGroup(gRoomVars.graphicsGroups[0]); } -bool32 sub_08057E40(MinishVillageTileSetManager* this) { - u32 tmp = CheckRegionsOnScreen(gUnk_08108050); - if (tmp != 0xFF) { - gRoomVars.graphicsGroups[0] = tmp; +bool32 MinishVillageTileSetManager_UpdateRoomGfxGroup(MinishVillageTileSetManager* this) { + u32 gfxGroup = CheckRegionsOnScreen(gMinishVillageTileSetManagerRegions); + if (gfxGroup != 0xFF) { + gRoomVars.graphicsGroups[0] = gfxGroup; return TRUE; - } else { - return FALSE; } + return FALSE; } -void sub_08057E64(void) { - u32 tmp = CheckRegionsOnScreen(gUnk_08108050); - if (tmp != 0xFF) { - sub_08057E7C(tmp); +void MinishVillageTileSetManger_LoadInitialGfxGroup(void) { + u32 gfxGroup = CheckRegionsOnScreen(gMinishVillageTileSetManagerRegions); + if (gfxGroup != 0xFF) { + MinishVillageTileSetManager_LoadGfxGroup(gfxGroup); } } -void sub_08057E7C(u32 unk1) { - u32 tmp; - const u32* tmp2; +void MinishVillageTileSetManager_LoadGfxGroup(u32 gfxGroup) { + u32 i; + const MinishVillageTileSetManagerGfxInfo* gfxInfo; #ifndef EU - if (unk1 > 4) + if (gfxGroup >= ARRAY_COUNT(gMinishVillageTileSetManagerGfxInfos)) return; #endif - LoadPaletteGroup(gUnk_081081E4[unk1]); - tmp2 = &gUnk_081080A4[unk1 << 4]; - for (tmp = 0; tmp < 8; tmp++, tmp2 += 2) { - DmaCopy32(3, &gGlobalGfxAndPalettes[tmp2[0]], tmp2[1], 0x400 * 4); + LoadPaletteGroup(gMinishVillateTileSetManagerPaletteGroups[gfxGroup]); + gfxInfo = gMinishVillageTileSetManagerGfxInfos[gfxGroup]; + for (i = 0; i < ARRAY_COUNT(gMinishVillageTileSetManagerGfxInfos[0]); i++, gfxInfo++) { + DmaCopy32(3, &gGlobalGfxAndPalettes[gfxInfo->gfx], gfxInfo->dest, BG_SCREEN_SIZE * 2); } - gRoomVars.graphicsGroups[0] = unk1; + gRoomVars.graphicsGroups[0] = gfxGroup; } diff --git a/src/manager/miscManager.c b/src/manager/miscManager.c index 1adf595d..0008dc51 100644 --- a/src/manager/miscManager.c +++ b/src/manager/miscManager.c @@ -6,16 +6,23 @@ */ #include "manager/miscManager.h" #include "area.h" -#include "common.h" #include "flags.h" -#include "functions.h" #include "item.h" #include "message.h" #include "object.h" +#include "asm.h" +#include "effects.h" +#include "physics.h" #include "player.h" #include "room.h" +#include "script.h" #include "sound.h" #include "tiles.h" +#include "scroll.h" +#include "subtask.h" +#if defined(USA) || defined(DEMO_USA) || defined(DEMO_JP) +#include "common.h" +#endif void MiscManager_Type0(MiscManager*); void MiscManager_Type1(MiscManager*); @@ -68,7 +75,7 @@ typedef struct { u16 width; u16 height; u16 unk_08; -} PACKED __attribute__((aligned(2))) MiscManager_HelperStruct; +} PACKED ALIGNED(2) MiscManager_HelperStruct; const MiscManager_HelperStruct gUnk_08108354[] = { { 0xF0, 0xB0, 0xF0, 0xB0, 0x100 }, @@ -146,12 +153,12 @@ void MiscManager_Type1(MiscManager* this) { super->subAction = 8; super->subtimer = 2; } - if (CheckFlags(this->flags)) { + if (CheckFlags(this->flag2)) { DeleteManager(super); } break; case 1: - if (CheckFlags(this->flags)) { + if (CheckFlags(this->flag2)) { super->action = 2; super->timer = 120; RequestPriorityDuration((Entity*)this, 240); @@ -172,7 +179,7 @@ void MiscManager_Type1(MiscManager* this) { } break; default: - SetFlag(this->flags); + SetFlag(this->flag2); SetPlayerControl(1); DeleteThisEntity(); } @@ -229,21 +236,21 @@ void MiscManager_Type5(MiscManager* this) { switch (super->action) { default: if (!--super->timer) { - CreateDustAt(this->x, this->y, super->type2); + CreateDeathFxAt(this->x, this->y, super->type2); RestorePrevTileEntity(TILE_LOCAL(this->x, this->y), super->type2); SoundReq(SFX_TASK_COMPLETE); DeleteThisEntity(); } break; case 0: - if (CheckFlags(this->flags)) { + if (CheckFlags(this->flag2)) { DeleteThisEntity(); } super->action = 1; SetTileType(TILE_TYPE_869, TILE_LOCAL(this->x, this->y), super->type2); break; case 1: - if (CheckFlags(this->flags)) { + if (CheckFlags(this->flag2)) { RequestPriorityDuration((Entity*)this, 75); super->timer = 45; super->action++; @@ -254,14 +261,14 @@ void MiscManager_Type5(MiscManager* this) { void MiscManager_Type6(MiscManager* this) { if (super->action == 0) { super->action = 1; - super->type2 = CheckFlags(this->flags); + super->type2 = CheckFlags(this->flag2); if (super->type2) { gRoomVars.lightLevel = this->y; } else { gRoomVars.lightLevel = this->x; } } else { - u32 tmp = CheckFlags(this->flags); + u32 tmp = CheckFlags(this->flag2); if (super->type2 != tmp) { super->type2 = tmp; if (tmp) { @@ -304,12 +311,12 @@ void MiscManager_Type8(MiscManager* this) { void MiscManager_Type9(MiscManager* this) { if (super->action == 0) { super->action = 1; - if (CheckFlags(this->flags)) { + if (CheckFlags(this->flag2)) { sub_080592EC(this); DeleteThisEntity(); } } else { - if (CheckFlags(this->flags)) { + if (CheckFlags(this->flag2)) { sub_080592EC(this); sub_0805930C(this); #ifndef EU @@ -346,8 +353,8 @@ void SetDirtTile(u32 tilePos) { void MiscManager_TypeA(MiscManager* this) { super->action = 1; - if (this->unk_3c == gTextRender.curToken.textIndex) { - SetFlag(this->flags); + if (this->flag1 == gTextRender.curToken.textIndex) { + SetFlag(this->flag2); DeleteThisEntity(); } } @@ -355,7 +362,7 @@ void MiscManager_TypeA(MiscManager* this) { void MiscManager_TypeB(MiscManager* this) { if (sub_080593CC(this)) { if (++super->timer >= 8) { - sub_080806BC(this->x - gRoomControls.origin_x, this->y - gRoomControls.origin_y, 0xFF, 0xA); + DoApplicableTransition(this->x - gRoomControls.origin_x, this->y - gRoomControls.origin_y, 0xFF, 0xA); } } else { super->timer = 0; @@ -372,10 +379,10 @@ bool32 sub_080593CC(MiscManager* this) { void MiscManager_TypeC(MiscManager* this) { Entity* tmp; - if (CheckFlags(this->flags)) { + if (CheckFlags(this->flag2)) { DeleteThisEntity(); } - if (!CheckFlags(this->unk_3c)) + if (!CheckFlags(this->flag1)) return; tmp = CreateObject(SPECIAL_FX, FX_BIG_EXPLOSION, 0); if (!tmp) @@ -388,7 +395,7 @@ void MiscManager_TypeC(MiscManager* this) { } void MiscManager_TypeD(MiscManager* this) { - if (!CheckFlags(this->flags)) { + if (!CheckFlags(this->flag2)) { SetPlayerControl(3); if (gRoomControls.reload_flags) return; diff --git a/src/manager/moveableObjectManager.c b/src/manager/moveableObjectManager.c index 21756299..5cf898fa 100644 --- a/src/manager/moveableObjectManager.c +++ b/src/manager/moveableObjectManager.c @@ -9,6 +9,7 @@ #include "manager/moveableObjectManager.h" #include "flags.h" #include "room.h" +#include "object.h" void MoveableObjectManager_Main(MoveableObjectManager* this) { Entity* object = CreateObject(super->timer, super->type, super->type2); diff --git a/src/manager/powBackgroundManager.c b/src/manager/powBackgroundManager.c index d7a24f25..bbb29c7d 100644 --- a/src/manager/powBackgroundManager.c +++ b/src/manager/powBackgroundManager.c @@ -8,13 +8,14 @@ #include "area.h" #include "room.h" #include "screen.h" +#include "game.h" -void sub_0805AFFC(PowBackgroundManager*); +void PowBackgroundManager_OnEnterRoom(PowBackgroundManager*); void PowBackgroundManager_Main(PowBackgroundManager* this) { if (this == NULL) { - if ((void*)gArea.onEnter != sub_0805AFFC) { - sub_0805AFFC(this); + if ((void*)gArea.onEnter != PowBackgroundManager_OnEnterRoom) { + PowBackgroundManager_OnEnterRoom(this); } } else { if (super->action == 0) { @@ -22,7 +23,7 @@ void PowBackgroundManager_Main(PowBackgroundManager* this) { super->flags |= ENT_PERSIST; SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); if (gArea.onEnter == NULL) { - RegisterTransitionManager(this, sub_0805AFFC, NULL); + RegisterTransitionHandler(this, PowBackgroundManager_OnEnterRoom, NULL); } else { DeleteThisEntity(); } @@ -34,7 +35,7 @@ void PowBackgroundManager_Main(PowBackgroundManager* this) { } } -void sub_0805AFFC(PowBackgroundManager* this) { +void PowBackgroundManager_OnEnterRoom(PowBackgroundManager* this) { gScreen.bg3.control = BGCNT_PRIORITY(3) | BGCNT_SCREENBASE(30); gScreen.lcd.displayControl |= DISPCNT_BG3_ON; gScreen.bg3.xOffset = gRoomControls.scroll_x + gRoomControls.bg3OffsetX.HALF.HI; diff --git a/src/manager/pushableFurnitureManager.c b/src/manager/pushableFurnitureManager.c index f701bc42..260c0348 100644 --- a/src/manager/pushableFurnitureManager.c +++ b/src/manager/pushableFurnitureManager.c @@ -8,6 +8,7 @@ #include "flags.h" #include "object.h" +#include "player.h" #include "object/pushableFurniture.h" #include "room.h" diff --git a/src/manager/rollingBarrelManager.c b/src/manager/rollingBarrelManager.c index 7f44557b..11320d40 100644 --- a/src/manager/rollingBarrelManager.c +++ b/src/manager/rollingBarrelManager.c @@ -8,21 +8,22 @@ #include "area.h" #include "common.h" #include "flags.h" -#include "functions.h" #include "main.h" #include "physics.h" #include "room.h" #include "save.h" #include "screen.h" #include "sound.h" -#include "structures.h" +#include "game.h" +#include "asm.h" +#include "fade.h" extern struct BgAffineDstData gUnk_02017AA0[]; extern struct BgAffineDstData gUnk_02017BA0[]; extern u8 gUpdateVisibleTiles; extern u32 gUsedPalettes; -void sub_08058D34(void); +void RollingBarrelManager_OnEnterRoom(void); void sub_08058BC8(RollingBarrelManager*); void sub_08058CB0(RollingBarrelManager*); void sub_08058CFC(void); @@ -52,7 +53,7 @@ void RollingBarrelManager_Init(RollingBarrelManager* this) { this->unk_28 = 0x1234; super->timer = CheckLocalFlags(0x15, 0x2) != 0; sub_08058CB0(this); - RegisterTransitionManager(this, sub_08058D34, 0); + RegisterTransitionHandler(this, RollingBarrelManager_OnEnterRoom, NULL); } void RollingBarrelManager_Action1(RollingBarrelManager* this) { @@ -256,12 +257,12 @@ void sub_08058CFC(void) { } } -void sub_08058D34(void) { +void RollingBarrelManager_OnEnterRoom(void) { u16 tmp; u32 tmp2; LoadPaletteGroup(0x28); MemCopy(gPaletteBuffer + 3 * 16, gPaletteBuffer + 21 * 16, 16 * 2); - gUsedPalettes |= 1 << 21; + USE_PALETTE(21); LoadGfxGroup(0x16); tmp = gScreen.lcd.displayControl; tmp2 = 0; diff --git a/src/manager/secretManager.c b/src/manager/secretManager.c index ca2ec125..69739493 100644 --- a/src/manager/secretManager.c +++ b/src/manager/secretManager.c @@ -9,7 +9,6 @@ #include "manager/secretManager.h" #include "entity.h" #include "flags.h" -#include "functions.h" #include "sound.h" void SecretManager_Type0_Action2(SecretManager*); diff --git a/src/manager/specialWarpManager.c b/src/manager/specialWarpManager.c index f62ac451..cba10388 100644 --- a/src/manager/specialWarpManager.c +++ b/src/manager/specialWarpManager.c @@ -6,7 +6,8 @@ */ #include "manager/specialWarpManager.h" #include "asm.h" -#include "functions.h" +#include "room.h" +#include "player.h" void SpecialWarpManager_Main(SpecialWarpManager* this) { u32 collisionLayer; diff --git a/src/manager/staticBackgroundManager.c b/src/manager/staticBackgroundManager.c index 2163b280..1ee959fe 100644 --- a/src/manager/staticBackgroundManager.c +++ b/src/manager/staticBackgroundManager.c @@ -6,10 +6,11 @@ */ #include "manager/staticBackgroundManager.h" #include "common.h" -#include "functions.h" #include "screen.h" +#include "game.h" +#include "room.h" -void sub_0805B4B4(StaticBackgroundManager*); +void StaticBackgroundManager_OnEnterRoom(StaticBackgroundManager*); void sub_0805B448(StaticBackgroundManager*); void sub_0805B474(StaticBackgroundManager*); @@ -37,7 +38,7 @@ void StaticBackgroundManager_Main(StaticBackgroundManager* this) { super->flags |= ENT_PERSIST; SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); if (super->type != 0) { - RegisterTransitionManager(this, sub_0805B4B4, NULL); + RegisterTransitionHandler(this, StaticBackgroundManager_OnEnterRoom, NULL); } iVar3 = 0x100 - (u32)gRoomControls.height; if (iVar3 < 0) { @@ -62,7 +63,7 @@ void sub_0805B474(StaticBackgroundManager* this) { gScreen.bg3.xOffset = gRoomControls.scroll_x - ((gRoomControls.width - 0x100) / 2); } -void sub_0805B4B4(StaticBackgroundManager* this) { +void StaticBackgroundManager_OnEnterRoom(StaticBackgroundManager* this) { LoadStaticBackground(super->type); if (super->type == 2) { sub_0806D0F8(); diff --git a/src/manager/steamOverlayManager.c b/src/manager/steamOverlayManager.c index 0052f5e1..358f70f7 100644 --- a/src/manager/steamOverlayManager.c +++ b/src/manager/steamOverlayManager.c @@ -10,6 +10,7 @@ #include "physics.h" #include "room.h" #include "screen.h" +#include "game.h" const u16 gUnk_08108588[] = { 0x1000, 0xF01, 0xE02, 0xD03, 0xC04, 0xB05, 0xA06, 0x907, 0x808 }; @@ -26,8 +27,8 @@ void sub_0805A098(SteamOverlayManager*); void SteamOverlayManager_Action3(SteamOverlayManager*); void sub_0805A114(u32, u32); void sub_0805A1D8(SteamOverlayManager*); -void nullsub_495(void*); -void sub_0805A25C(void*); +void SteamOverlayManager_OnEnterRoom(void*); +void SteamOverlayManager_OnExitRoom(void*); void SteamOverlayManager_Main(SteamOverlayManager* this) { static void (*const SteamOverlayManager_Actions[])(SteamOverlayManager*) = { @@ -55,7 +56,7 @@ void SteamOverlayManager_Init(SteamOverlayManager* this) { gScreen.controls.alphaBlend = 0x1000; gScreen.bg3.xOffset = 0x80; gScreen.bg3.yOffset = 0; - RegisterTransitionManager(this, nullsub_495, sub_0805A25C); + RegisterTransitionHandler(this, SteamOverlayManager_OnEnterRoom, SteamOverlayManager_OnExitRoom); } void SteamOverlayManager_Action4(SteamOverlayManager* this) { @@ -85,11 +86,11 @@ u32 sub_08059F9C(SteamOverlayManager* this) { if (CheckLocalFlag(0x16)) { return 0; } - sub_0805A25C(this); + SteamOverlayManager_OnExitRoom(this); DeleteThisEntity(); break; case 7: - sub_0805A25C(this); + SteamOverlayManager_OnExitRoom(this); DeleteThisEntity(); break; case 0: @@ -185,10 +186,10 @@ void sub_0805A1D8(SteamOverlayManager* this) { } } -void nullsub_495(void* this) { +void SteamOverlayManager_OnEnterRoom(void* this) { } -void sub_0805A25C(void* this) { +void SteamOverlayManager_OnExitRoom(void* this) { gScreen.controls.layerFXControl = 0; gScreen.lcd.displayControl &= ~DISPCNT_BG3_ON; DisableVBlankDMA(); diff --git a/src/manager/templeOfDropletsManager.c b/src/manager/templeOfDropletsManager.c index 19d8f07a..fc8309df 100644 --- a/src/manager/templeOfDropletsManager.c +++ b/src/manager/templeOfDropletsManager.c @@ -7,11 +7,16 @@ #include "manager/templeOfDropletsManager.h" #include "enemy.h" #include "flags.h" -#include "functions.h" +#include "common.h" #include "object.h" +#include "room.h" +#include "player.h" #include "screen.h" #include "sound.h" -#include "structures.h" +#include "game.h" +#include "vram.h" +#include "pauseMenu.h" +#include "asm.h" static const u16 gUnk_081085B8[] = { 0x1008, 0x1007, 0x1006, 0x1005, 0x1006, 0x1007, 0x1008, 0x1009, 0x1008, 0x1007, 0x1006, 0x1005, 0x1006, 0x1007, 0x1008, 0x1009 }; @@ -60,7 +65,7 @@ void TempleOfDropletsManager_Main(TempleOfDropletsManager* this) { void TempleOfDropletsManager_Type0(TempleOfDropletsManager* this) { if (super->action == 0) { sub_0805A89C(this); - if (!CheckLocalFlag(this->unk_3e)) { + if (!CheckLocalFlag(this->localFlag)) { this->unk_23 = 1; } else { this->unk_23 = 2; @@ -83,7 +88,7 @@ void TempleOfDropletsManager_Type1(TempleOfDropletsManager* this) { sub_0805A89C(this); this->unk_23 = 1; sub_0805AAF0(1); - if (!CheckLocalFlag(this->unk_3e)) { + if (!CheckLocalFlag(this->localFlag)) { super->action = 1; gScreen.lcd.displayControl &= 0xB7FF; } else { @@ -144,12 +149,12 @@ void TempleOfDropletsManager_Type2(TempleOfDropletsManager* this) { this->unk_23 = 1; } sub_0805AAF0(this->unk_23); - if (!CheckLocalFlag(this->unk_3e)) { - ClearFlag(this->unk_3c); + if (!CheckLocalFlag(this->localFlag)) { + ClearFlag(this->flag); super->action = 1; gScreen.lcd.displayControl &= ~(DISPCNT_WIN1_ON | DISPCNT_BG3_ON); } else { - SetFlag(this->unk_3c); + SetFlag(this->flag); super->action = 3; gScreen.lcd.displayControl |= DISPCNT_WIN1_ON | DISPCNT_BG3_ON; } @@ -162,7 +167,7 @@ void TempleOfDropletsManager_Type2(TempleOfDropletsManager* this) { void sub_0805A4CC(TempleOfDropletsManager*, u32); void TempleOfDropletsManager_Type1_Action1(TempleOfDropletsManager* this) { - if (CheckLocalFlag(this->unk_3e)) { + if (CheckLocalFlag(this->localFlag)) { super->action = 2; sub_0805A4CC(this, 0); } @@ -171,12 +176,12 @@ void TempleOfDropletsManager_Type1_Action1(TempleOfDropletsManager* this) { void TempleOfDropletsManager_Type2_Action2(TempleOfDropletsManager* this) { if (super->subAction != 0) { super->action = 3; - SetFlag(this->unk_3c); + SetFlag(this->flag); } } void TempleOfDropletsManager_Type2_Action3(TempleOfDropletsManager* this) { - if (!CheckLocalFlag(this->unk_3e)) { + if (!CheckLocalFlag(this->localFlag)) { super->action = 4; sub_0805A4CC(this, 1); } @@ -185,7 +190,7 @@ void TempleOfDropletsManager_Type2_Action3(TempleOfDropletsManager* this) { void TempleOfDropletsManager_Type2_Action4(TempleOfDropletsManager* this) { if (super->subAction != 0) { super->action = 1; - ClearFlag(this->unk_3c); + ClearFlag(this->flag); } } @@ -363,7 +368,7 @@ void TempleOfDropletsManager_Type6_Action3(TempleOfDropletsManager* this) { void TempleOfDropletsManager_Type7(TempleOfDropletsManager* this) { switch (super->action) { case 0: - if (CheckLocalFlag(this->unk_3e)) { + if (CheckLocalFlag(this->localFlag)) { super->action = 1; } else { super->action = 2; @@ -373,7 +378,7 @@ void TempleOfDropletsManager_Type7(TempleOfDropletsManager* this) { SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); break; case 1: - if (CheckLocalFlag(this->unk_3e)) + if (CheckLocalFlag(this->localFlag)) break; super->action = 2; sub_0805A4CC(this, 4); @@ -384,7 +389,7 @@ void TempleOfDropletsManager_Type7(TempleOfDropletsManager* this) { } break; case 3: - if (!CheckLocalFlag(this->unk_3e)) + if (!CheckLocalFlag(this->localFlag)) break; super->action = 4; sub_0805A4CC(this, 4); @@ -399,7 +404,7 @@ void TempleOfDropletsManager_Type7(TempleOfDropletsManager* this) { } } -void sub_0805AAC8(TempleOfDropletsManager*); +void TempleOfDropletsManager_OnEnterRoom(TempleOfDropletsManager*); void sub_0805A89C(TempleOfDropletsManager* this) { SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); @@ -412,7 +417,7 @@ void sub_0805A89C(TempleOfDropletsManager* this) { this->unk_20 = gRoomControls.room; this->unk_24 = gRoomControls.origin_x; this->unk_26 = gRoomControls.origin_y; - RegisterTransitionManager(this, sub_0805AAC8, 0); + RegisterTransitionHandler(this, TempleOfDropletsManager_OnEnterRoom, NULL); } void sub_0805A94C(TempleOfDropletsManager* this); @@ -505,7 +510,7 @@ void sub_0805AA58(TempleOfDropletsManager* this) { } } -void sub_0805AAC8(TempleOfDropletsManager* this) { +void TempleOfDropletsManager_OnEnterRoom(TempleOfDropletsManager* this) { sub_0805AAF0(this->unk_23); TempleOfDropletsManager_Main(this); } diff --git a/src/manager/tileChangeObserveManager.c b/src/manager/tileChangeObserveManager.c index 7a05a853..e24a8787 100644 --- a/src/manager/tileChangeObserveManager.c +++ b/src/manager/tileChangeObserveManager.c @@ -9,8 +9,8 @@ */ #include "manager/tileChangeObserveManager.h" #include "flags.h" -#include "functions.h" #include "room.h" +#include "map.h" void TileChangeObserveManager_Init(TileChangeObserveManager*); void TileChangeObserveManager_Action1(TileChangeObserveManager*); diff --git a/src/manager/tilePuzzleManager.c b/src/manager/tilePuzzleManager.c index 766e2c6d..2da91901 100644 --- a/src/manager/tilePuzzleManager.c +++ b/src/manager/tilePuzzleManager.c @@ -10,9 +10,10 @@ #include "manager/tilePuzzleManager.h" #include "asm.h" #include "flags.h" -#include "functions.h" #include "sound.h" #include "tiles.h" +#include "room.h" +#include "player.h" enum { INIT, IN_PROGRESS, FAILED, SUCCEEDED }; diff --git a/src/manager/vaati3BackgroundManager.c b/src/manager/vaati3BackgroundManager.c index bc8847cf..2b2e838b 100644 --- a/src/manager/vaati3BackgroundManager.c +++ b/src/manager/vaati3BackgroundManager.c @@ -7,16 +7,16 @@ #include "manager/vaati3BackgroundManager.h" #include "area.h" #include "common.h" -#include "functions.h" #include "room.h" #include "screen.h" +#include "game.h" -void sub_0805D470(Vaati3BackgroundManager*); +void Vaati3BackgroundManager_OnEnterRoom(Vaati3BackgroundManager*); void Vaati3BackgroundManager_Main(Vaati3BackgroundManager* this) { if (this == NULL) { - if (gArea.onEnter != sub_0805D470) { - sub_0805D470(NULL); + if (gArea.onEnter != Vaati3BackgroundManager_OnEnterRoom) { + Vaati3BackgroundManager_OnEnterRoom(NULL); } } else { if (super->action == 0) { @@ -24,7 +24,7 @@ void Vaati3BackgroundManager_Main(Vaati3BackgroundManager* this) { super->flags |= ENT_PERSIST; SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); if (gArea.onEnter == NULL) { - RegisterTransitionManager(this, sub_0805D470, NULL); + RegisterTransitionHandler(this, Vaati3BackgroundManager_OnEnterRoom, NULL); } else { DeleteThisEntity(); } @@ -37,7 +37,7 @@ void Vaati3BackgroundManager_Main(Vaati3BackgroundManager* this) { } } -void sub_0805D470(Vaati3BackgroundManager* this) { +void Vaati3BackgroundManager_OnEnterRoom(Vaati3BackgroundManager* this) { LoadGfxGroup(0x4c); gScreen.bg3.control = 0x1e07; gScreen.lcd.displayControl |= DISPCNT_BG3_ON; diff --git a/src/manager/vaati3InsideArmManager.c b/src/manager/vaati3InsideArmManager.c index 579ce58b..a5f1eaed 100644 --- a/src/manager/vaati3InsideArmManager.c +++ b/src/manager/vaati3InsideArmManager.c @@ -5,10 +5,9 @@ * @brief Manages the inside of the arms of Vaati3. */ #include "manager/vaati3InsideArmManager.h" -#include "functions.h" #include "screenTransitions.h" +#include "room.h" #include "sound.h" -#include "structures.h" void sub_0805DBF0(Vaati3InsideArmManager*); void Vaati3InsideArmManager_Init(Vaati3InsideArmManager*); diff --git a/src/manager/vaati3StartManager.c b/src/manager/vaati3StartManager.c index 1fa0c618..27fc8b9b 100644 --- a/src/manager/vaati3StartManager.c +++ b/src/manager/vaati3StartManager.c @@ -8,14 +8,17 @@ #include "area.h" #include "enemy.h" #include "flags.h" -#include "functions.h" #include "message.h" #include "object.h" -#include "save.h" -#include "screen.h" +#include "room.h" +#include "player.h" #include "screenTransitions.h" #include "sound.h" -#include "structures.h" +#include "scroll.h" +#include "fade.h" +#if !defined(EU) && !defined(JP) +#include "save.h" +#endif void sub_0805E094(void); void Vaati3StartManager_Type0(Vaati3StartManager*); @@ -154,5 +157,5 @@ void Vaati3StartManager_Type1_Action1(Vaati3StartManager* this) { void sub_0805E094(void) { SetInitializationPriority(); - sub_0808091C(&gUnk_0813AC34, TRANSITION_7); + DoExitTransitionWithType(&gUnk_0813AC34, TRANSITION_7); } diff --git a/src/manager/vaatiAppearingManager.c b/src/manager/vaatiAppearingManager.c index 6eabadd8..930c0bd5 100644 --- a/src/manager/vaatiAppearingManager.c +++ b/src/manager/vaatiAppearingManager.c @@ -7,11 +7,11 @@ #include "manager/vaatiAppearingManager.h" #include "area.h" #include "common.h" -#include "functions.h" #include "game.h" #include "main.h" #include "room.h" #include "screen.h" +#include "physics.h" void sub_0805D9D8(VaatiAppearingManager*); void VaatiAppearingManager_Action3(VaatiAppearingManager*); diff --git a/src/manager/verticalMinishPathBackgroundManager.c b/src/manager/verticalMinishPathBackgroundManager.c index 645118fc..a5d18429 100644 --- a/src/manager/verticalMinishPathBackgroundManager.c +++ b/src/manager/verticalMinishPathBackgroundManager.c @@ -6,10 +6,11 @@ */ #include "manager/verticalMinishPathBackgroundManager.h" #include "common.h" -#include "functions.h" #include "game.h" #include "screen.h" -extern void sub_080576A0(void*); +#include "room.h" + +extern void VerticalMinishPathBackgroundManager_OnEnterRoom(void*); extern void sub_0805754C(VerticalMinishPathBackgroundManager*); extern u8 gMapDataTopSpecial[]; @@ -19,7 +20,7 @@ void VerticalMinishPathBackgroundManager_Main(VerticalMinishPathBackgroundManage super->action = 1; gScreen.bg3.updated = 0; gScreen.bg1.updated = 0; - RegisterTransitionManager(this, sub_080576A0, NULL); + RegisterTransitionHandler(this, VerticalMinishPathBackgroundManager_OnEnterRoom, NULL); } sub_0805754C(this); } @@ -79,7 +80,7 @@ void sub_08057688(void) { gScreen.bg1.control = BGCNT_SCREENBASE(30) | BGCNT_CHARBASE(2) | BGCNT_MOSAIC; } -void sub_080576A0(void* this) { +void VerticalMinishPathBackgroundManager_OnEnterRoom(void* this) { LoadGfxGroup(gRoomVars.graphicsGroups[0]); ((VerticalMinishPathBackgroundManager*)this)->field_0x38 = NULL; ((VerticalMinishPathBackgroundManager*)this)->field_0x3c = NULL; diff --git a/src/manager/waterfallBottomManager.c b/src/manager/waterfallBottomManager.c index a9e7196e..9fb68714 100644 --- a/src/manager/waterfallBottomManager.c +++ b/src/manager/waterfallBottomManager.c @@ -7,8 +7,10 @@ #include "manager/waterfallBottomManager.h" #include "asm.h" #include "entity.h" -#include "functions.h" +#include "player.h" #include "tiles.h" +#include "room.h" +#include "map.h" void WaterfallBottomManager_Main(WaterfallBottomManager* this) { SetTile(SPECIAL_TILE_20, TILE_POS(3, 23), LAYER_BOTTOM); diff --git a/src/manager/weatherChangeManager.c b/src/manager/weatherChangeManager.c index 995716a0..92b1edb5 100644 --- a/src/manager/weatherChangeManager.c +++ b/src/manager/weatherChangeManager.c @@ -8,14 +8,16 @@ #include "area.h" #include "asm.h" #include "common.h" -#include "fileselect.h" -#include "functions.h" #include "main.h" #include "room.h" #include "screen.h" #include "sound.h" +#include "game.h" +#include "manager/staticBackgroundManager.h" +#include "player.h" +#include "fade.h" -void sub_080595E4(WeatherChangeManager*); +void WeatherChangeManager_OnEnterRoom(WeatherChangeManager*); void sub_08059608(WeatherChangeManager*); void sub_08059690(WeatherChangeManager*); void sub_080596E0(WeatherChangeManager*); @@ -45,14 +47,14 @@ void WeatherChangeManager_Main(WeatherChangeManager* this) { this->unk_22 = 5; } gRoomVars.graphicsGroups[0] = 0xFF; - RegisterTransitionManager(this, sub_080595E4, 0); + RegisterTransitionHandler(this, WeatherChangeManager_OnEnterRoom, NULL); } sub_08059608(this); sub_08059690(this); sub_080596E0(this); } -void sub_080595E4(WeatherChangeManager* this) { +void WeatherChangeManager_OnEnterRoom(WeatherChangeManager* this) { gRoomVars.graphicsGroups[0] = 0xFF; sub_08059690(this); sub_080596E0(this); @@ -140,7 +142,7 @@ void sub_080596E0(WeatherChangeManager* this) { break; case 4: MemClear(gBG3Buffer, 0x800); - LoadResourceAsync(gBG3Buffer, 0x600e800, 0x800); + LoadResourceAsync(gBG3Buffer, BG_SCREEN_ADDR(29), BG_SCREEN_SIZE); break; case 5: gMapTop.bgSettings = &gScreen.bg1; |
