diff options
| author | octorock <79596758+octorock@users.noreply.github.com> | 2023-12-31 02:12:41 +0100 |
|---|---|---|
| committer | octorock <79596758+octorock@users.noreply.github.com> | 2023-12-31 02:12:41 +0100 |
| commit | 109b1020dcbfa17e80d28c522b5d792f7b3c6d46 (patch) | |
| tree | cf23c1134de2891d0eed3b55549e70b29eb1997f /src/manager | |
| parent | 957da774e4c34100e0bd352b1570af02bb7f7521 (diff) | |
| parent | 9c87bcca8ea4b52199ed908c0ea28ab08b1d0747 (diff) | |
Merge branch 'master' into tilemap-docs
Diffstat (limited to 'src/manager')
34 files changed, 186 insertions, 187 deletions
diff --git a/src/manager/cloudOverlayManager.c b/src/manager/cloudOverlayManager.c index 3cc20ca9..b9563b46 100644 --- a/src/manager/cloudOverlayManager.c +++ b/src/manager/cloudOverlayManager.c @@ -27,7 +27,7 @@ void CloudOverlayManager_Main(CloudOverlayManager* this) { super->timer = 0; super->subtimer = 8; this->field_0x20 = gUnk_0810865C[0]; - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); if (gArea.onEnter == NULL) { RegisterTransitionManager(this, sub_0805AEDC, sub_0805AF3C); } else { diff --git a/src/manager/cloudStaircaseTransitionManager.c b/src/manager/cloudStaircaseTransitionManager.c index 73dc764d..d8a47d63 100644 --- a/src/manager/cloudStaircaseTransitionManager.c +++ b/src/manager/cloudStaircaseTransitionManager.c @@ -15,7 +15,7 @@ void CloudStaircaseTransitionManager_Main(CloudStaircaseTransitionManager* this) this->y = 0; } if (((CheckPlayerInRegion(this->x, this->y, 0x14, 0x40) != 0) && - (((gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) + gPlayerEntity.z.HALF.HI) < 0)) && + (((gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y) + gPlayerEntity.base.z.HALF.HI) < 0)) && (gRoomControls.scroll_y == gRoomControls.origin_y)) { MemClear(&gRoomTransition.player_status, sizeof(PlayerRoomStatus)); gRoomTransition.transitioningOut = 1; diff --git a/src/manager/delayedEntityLoadManager.c b/src/manager/delayedEntityLoadManager.c index de9a8390..0a13bf40 100644 --- a/src/manager/delayedEntityLoadManager.c +++ b/src/manager/delayedEntityLoadManager.c @@ -37,7 +37,7 @@ void DelayedEntityLoadManager_Main(DelayedEntityLoadManager* this) { if (super->action == 0) { super->action++; this->unk_20 = gArea.filler[1]; - SetDefaultPriority((Entity*)this, 6); + SetEntityPriority((Entity*)this, 6); npcPtr = gNPCData; npcPtr += (super->type2 + this->unk_20); index1 = 0; diff --git a/src/manager/diggingCaveEntranceManager.c b/src/manager/diggingCaveEntranceManager.c index 762711ef..a98257c3 100644 --- a/src/manager/diggingCaveEntranceManager.c +++ b/src/manager/diggingCaveEntranceManager.c @@ -78,8 +78,8 @@ bool32 DiggingCaveEntranceManager_CheckEnterEntrance(DiggingCaveEntranceManager* u16 offsetX, offsetY, offsetX2, offsetY2; u32 tmp, tmp2; if (gDiggingCaveEntranceTransition.isDiggingCave) { - offsetX = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x; - offsetY = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y; + offsetX = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x; + offsetY = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y; offsetX2 = (entr->sourceTilePosition & TILE_POS_X_COMPONENT) * 16 + 8; offsetY2 = ((entr->sourceTilePosition & TILE_POS_Y_COMPONENT) >> 6) * 16 + 0x18; tmp = offsetX - offsetX2; @@ -90,10 +90,10 @@ bool32 DiggingCaveEntranceManager_CheckEnterEntrance(DiggingCaveEntranceManager* DiggingCaveEntranceManager_EnterEntrance(this, entr); return TRUE; } else { - if (COORD_TO_TILE(&gPlayerEntity) != entr->sourceTilePosition) + if (COORD_TO_TILE(&gPlayerEntity.base) != entr->sourceTilePosition) return FALSE; offsetY2 = gRoomControls.origin_y + ((entr->sourceTilePosition >> 6) << 4) + 6; - if (gPlayerEntity.y.HALF.HI >= offsetY2) + if (gPlayerEntity.base.y.HALF.HI >= offsetY2) return FALSE; DiggingCaveEntranceManager_EnterEntrance(this, entr); return TRUE; @@ -110,10 +110,10 @@ void DiggingCaveEntranceManager_EnterEntrance(DiggingCaveEntranceManager* this, gRoomControls.area = entr->targetArea; gRoomControls.room = entr->targetRoom; gDiggingCaveEntranceTransition.entrance = entr; - gDiggingCaveEntranceTransition.offsetX = - gPlayerEntity.x.HALF.HI - gRoomControls.origin_x - ((entr->sourceTilePosition & TILE_POS_X_COMPONENT) * 16); - gDiggingCaveEntranceTransition.offsetY = - gPlayerEntity.y.HALF.HI - gRoomControls.origin_y - ((entr->sourceTilePosition & TILE_POS_Y_COMPONENT) >> 2); + gDiggingCaveEntranceTransition.offsetX = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x - + ((entr->sourceTilePosition & TILE_POS_X_COMPONENT) * 16); + gDiggingCaveEntranceTransition.offsetY = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y - + ((entr->sourceTilePosition & TILE_POS_Y_COMPONENT) >> 2); #ifndef EU isDiggingCave = gDiggingCaveEntranceTransition.isDiggingCave; diff --git a/src/manager/enterRoomTextboxManager.c b/src/manager/enterRoomTextboxManager.c index 959e90f9..61276437 100644 --- a/src/manager/enterRoomTextboxManager.c +++ b/src/manager/enterRoomTextboxManager.c @@ -34,7 +34,7 @@ void sub_0805E1F8(u32, bool32); void EnterRoomTextboxManager_Main(EnterRoomTextboxManager* this) { EnterRoomTextboxManager_Actions[super->action](this); - if ((gRoomControls.room != this->unk_20) || (gMessage.doTextBox & 0x7F)) { + if ((gRoomControls.room != this->unk_20) || (gMessage.state & MESSAGE_ACTIVE)) { sub_0805E1D8(this); } } @@ -45,7 +45,7 @@ void sub_0805E140(EnterRoomTextboxManager* this) { this->unk_20 = gRoomControls.room; super->timer = 120; super->subtimer = 60; - SetDefaultPriority((Entity*)this, PRIO_HIGHEST); + SetEntityPriority((Entity*)this, PRIO_HIGHEST); sub_0805E1F8(gUnk_08108DE8[gArea.locationIndex], AreaIsDungeon()); } @@ -56,7 +56,7 @@ void sub_0805E18C(EnterRoomTextboxManager* this) { if (--super->subtimer == 0) { super->type2 = 0; gPlayerState.controlMode = CONTROL_1; - ResetSystemPriority(); + ClearEventPriority(); } } if (--super->timer == 0) { diff --git a/src/manager/entitySpawnManager.c b/src/manager/entitySpawnManager.c index 900b6480..6303d998 100644 --- a/src/manager/entitySpawnManager.c +++ b/src/manager/entitySpawnManager.c @@ -26,7 +26,7 @@ void EntitySpawnManager_Main(EntitySpawnManager* this) { if (super->type2 != 0) { super->type2 = 0; SetPlayerControl(0xff); - sub_08078B48(); + PausePlayer(); } if (this->spawnTimer == 0) { if (this->sound != 0) { diff --git a/src/manager/ezloHintManager.c b/src/manager/ezloHintManager.c index afe8394a..eb2a666a 100644 --- a/src/manager/ezloHintManager.c +++ b/src/manager/ezloHintManager.c @@ -35,7 +35,7 @@ static void EzloHintManager_Init(EzloHintManager* this) { this->ry = this->ry_raw << 3; this->x = this->rx + (this->x_raw << 4); this->y = this->ry + (this->y_raw << 4); - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); if (this->flag2 == 0) { super->action = 2; } else { @@ -69,7 +69,7 @@ static void EzloHintManager_Action2(EzloHintManager* this) { if (!PlayerStateValid(this)) return; SetPlayerControl(3); - sub_08078B48(); + PausePlayer(); SetPlayerEventPriority(); super->action = 3; super->subAction = 0; @@ -121,7 +121,7 @@ static void EzloHintManager_Action3(EzloHintManager* this) { if (gPlayerState.flags & (PL_BUSY | PL_DROWNING | PL_USE_PORTAL | PL_FALLING | PL_IN_MINECART | PL_CAPTURED)) return; - if (gPlayerEntity.z.HALF.HI != 0) + if (gPlayerEntity.base.z.HALF.HI != 0) return; gPlayerState.jump_status = 0; CreateEzloHint(this->msg_idx, this->msg_height); @@ -136,7 +136,7 @@ static void EzloHintManager_Action3(EzloHintManager* this) { return; case 3: /* wait for player to finish talking */ - if (gPlayerEntity.action == PLAYER_NORMAL || gPlayerEntity.action == PLAYER_MINISH) { + if (gPlayerEntity.base.action == PLAYER_NORMAL || gPlayerEntity.base.action == PLAYER_MINISH) { gPlayerState.controlMode = CONTROL_1; ResetPlayerEventPriority(); SetFlag(this->flag1); diff --git a/src/manager/fallingItemManager.c b/src/manager/fallingItemManager.c index 966a5702..740c91a3 100644 --- a/src/manager/fallingItemManager.c +++ b/src/manager/fallingItemManager.c @@ -7,8 +7,10 @@ * If you leave the room without picking the item up and enter again, the item falls from the sky again. */ #include "manager/fallingItemManager.h" + #include "flags.h" #include "object.h" +#include "object/itemOnGround.h" #include "room.h" void FallingItemManager_Init(FallingItemManager*); @@ -32,13 +34,13 @@ void FallingItemManager_Init(FallingItemManager* this) { void FallingItemManager_Action1(FallingItemManager* this) { if (CheckFlags(this->field_0x3e)) { - Entity* object = CreateObject(GROUND_ITEM, super->type, super->type2); + ItemOnGroundEntity* object = (ItemOnGroundEntity*)CreateObject(GROUND_ITEM, super->type, super->type2); if (object != NULL) { - object->timer = this->field_0x35; - object->collisionLayer = this->field_0x36; - object->x.HALF.HI = this->field_0x38 + gRoomControls.origin_x; - object->y.HALF.HI = this->field_0x3a + gRoomControls.origin_y; - object->field_0x86.HWORD = this->field_0x3c; + object->base.timer = this->field_0x35; + 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; } DeleteThisEntity(); } diff --git a/src/manager/fightManager.c b/src/manager/fightManager.c index 1f54b143..9d743f07 100644 --- a/src/manager/fightManager.c +++ b/src/manager/fightManager.c @@ -55,7 +55,7 @@ void FightManager_Init(FightManager* this) { if (!this->fightStartFlag) { FightManager_LoadFight(this); } - SetDefaultPriority((Entity*)this, PRIO_NO_BLOCK); + SetEntityPriority((Entity*)this, PRIO_NO_BLOCK); } else { DeleteThisEntity(); } @@ -112,7 +112,7 @@ void FightManager_LoadFight(FightManager* this) { while (prop->kind != 0xFF) { ent = LoadRoomEntity(prop++); if ((ent != NULL) && (ent->kind == ENEMY)) { - ent->field_0x6c.HALF.HI |= 0x40; + ((GenericEntity*)ent)->field_0x6c.HALF.HI |= 0x40; FightManagerHelper_Monitor(monitor, ent, counter++); } if (counter >= 7) { @@ -157,7 +157,7 @@ void FightManagerHelper_Main(FightManagerHelper* this) { if (super->action == 0) { super->action = 1; - SetDefaultPriority((Entity*)this, PRIO_NO_BLOCK); + SetEntityPriority((Entity*)this, PRIO_NO_BLOCK); } // go through and check all monitored enemies. anyRemaining = FALSE; diff --git a/src/manager/goronMerchantShopManager.c b/src/manager/goronMerchantShopManager.c index feb2f7c0..c2493c99 100644 --- a/src/manager/goronMerchantShopManager.c +++ b/src/manager/goronMerchantShopManager.c @@ -5,10 +5,12 @@ * @brief Spawns the shop items for the kinstones for the goron merchant. */ #include "manager/goronMerchantShopManager.h" + #include "asm.h" #include "flags.h" -#include "object.h" #include "item.h" +#include "object.h" +#include "object/itemForSale.h" typedef struct { u16 minType; @@ -59,17 +61,17 @@ void GoronMerchantShopManager_Main(GoronMerchantShopManager* this) { count = 0; for (count = 0; count < 3;) { if (CheckGlobalFlag(GORON_KAKERA_L + count) == 0) { - Entity* object = - CreateObject(SHOP_ITEM, ITEM_KINSTONE, ((s32)Random() % spawnData->numTypes) + spawnData->minType); + ItemForSaleEntity* object = (ItemForSaleEntity*)CreateObject( + SHOP_ITEM, ITEM_KINSTONE, ((s32)Random() % spawnData->numTypes) + spawnData->minType); if (object != NULL) { - object->timer = 1; - object->subtimer = count; - object->x.HALF.HI = spawnData->x + gRoomControls.origin_x; - object->y.HALF.HI = spawnData->y + gRoomControls.origin_y; - object->field_0x80.HWORD = spawnData->x; - object->field_0x82.HWORD = spawnData->y; - object->collisionLayer = 1; - object->parent = (Entity*)this; + object->base.timer = 1; + object->base.subtimer = count; + object->base.x.HALF.HI = spawnData->x + gRoomControls.origin_x; + object->base.y.HALF.HI = spawnData->y + gRoomControls.origin_y; + object->unk_80 = spawnData->x; + object->unk_82 = spawnData->y; + object->base.collisionLayer = 1; + object->base.parent = (Entity*)this; this->itemActive[count] = 1; } } diff --git a/src/manager/holeManager.c b/src/manager/holeManager.c index 9fb2e333..5807b909 100644 --- a/src/manager/holeManager.c +++ b/src/manager/holeManager.c @@ -55,7 +55,7 @@ void sub_0805B328(HoleManager*); void sub_0805B048(HoleManager* this) { struct_08108764* tmp; Entity* obj; - SetDefaultPriority((Entity*)super, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)super, PRIO_PLAYER_EVENT); MemClear(&this->unk_20, 0x20); super->action = 1; this->unk_3f = gRoomControls.room; @@ -153,8 +153,10 @@ void sub_0805B210(HoleManager* this) { gRoomTransition.player_status.start_pos_y = tmp->unk_06; break; case 1: - gRoomTransition.player_status.start_pos_x = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x + tmp->unk_04; - gRoomTransition.player_status.start_pos_y = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y + tmp->unk_06; + gRoomTransition.player_status.start_pos_x = + gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x + tmp->unk_04; + gRoomTransition.player_status.start_pos_y = + gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y + tmp->unk_06; break; case 2: gRoomTransition.player_status.start_pos_x = tmp->unk_04; diff --git a/src/manager/horizontalMinishPathBackgroundManager.c b/src/manager/horizontalMinishPathBackgroundManager.c index f2a8b1fb..a407e50e 100644 --- a/src/manager/horizontalMinishPathBackgroundManager.c +++ b/src/manager/horizontalMinishPathBackgroundManager.c @@ -29,7 +29,7 @@ void HorizontalMinishPathBackgroundManager_Main(HorizontalMinishPathBackgroundMa } void sub_08057EFC(void* this) { - LoadGfxGroup((u32)gRoomVars.unk_10[0]); + LoadGfxGroup((u32)gRoomVars.graphicsGroups[0]); sub_08058034(); ((HorizontalMinishPathBackgroundManager*)this)->unk_3c = 0; ((HorizontalMinishPathBackgroundManager*)this)->unk_38 = 0; @@ -103,7 +103,7 @@ void sub_080580B0(u32 unk1) { gMapTop.bgSettings = 0; REG_DISPCNT = 0; LoadGfxGroup(unk1); - gRoomVars.unk_10[0] = unk1; + gRoomVars.graphicsGroups[0] = unk1; sub_08058034(); tmp = gRoomControls.scroll_x - gRoomControls.origin_x; tmp = tmp + (tmp >> 3) + (0x400 - gRoomControls.width) / 2; diff --git a/src/manager/houseSignManager.c b/src/manager/houseSignManager.c index 8722de83..c33bd50a 100644 --- a/src/manager/houseSignManager.c +++ b/src/manager/houseSignManager.c @@ -8,10 +8,12 @@ * Creates the signs on the houses in hyrule town. */ #include "manager/houseSignManager.h" + #include "area.h" +#include "asm.h" #include "object.h" +#include "object/houseSign.h" #include "room.h" -#include "asm.h" typedef struct { u16 x; @@ -56,15 +58,15 @@ void HouseSignManager_Main(HouseSignManager* this) { u32 bitfieldFlag = 1 << type2; if ((((this->bitfield & bitfieldFlag) == 0) && (CheckRectOnScreen(spawnData->x, spawnData->y, 0x10, 0x10) != 0))) { - Entity* object = CreateObject(HOUSE_SIGN, spawnData->type, type2); + HouseSignEntity* object = (HouseSignEntity*)CreateObject(HOUSE_SIGN, spawnData->type, type2); if (object != NULL) { - object->frameIndex = spawnData->frameIndex; - object->x.HALF.HI = gRoomControls.origin_x + spawnData->x; - object->y.HALF.HI = gRoomControls.origin_y + spawnData->y; - object->parent = (Entity*)this; - object->field_0x80.HWORD = spawnData->x; - object->field_0x82.HWORD = spawnData->y; - object->collisionLayer = spawnData->collisionLayer; + object->base.frameIndex = spawnData->frameIndex; + object->base.x.HALF.HI = gRoomControls.origin_x + spawnData->x; + object->base.y.HALF.HI = gRoomControls.origin_y + spawnData->y; + object->base.parent = (Entity*)this; + object->unk_80 = spawnData->x; + object->unk_82 = spawnData->y; + object->base.collisionLayer = spawnData->collisionLayer; this->bitfield |= bitfieldFlag; } } diff --git a/src/manager/hyruleTownBellManager.c b/src/manager/hyruleTownBellManager.c index c22442dc..4dc2ebed 100644 --- a/src/manager/hyruleTownBellManager.c +++ b/src/manager/hyruleTownBellManager.c @@ -13,11 +13,11 @@ void HyruleTownBellManager_Main(HyruleTownBellManager* this) { RoomControls* roomControls = &gRoomControls; u32 a = roomControls->origin_x + 0x1f8; - u32 x = (a - gPlayerEntity.x.HALF.HI) + 0x10; + u32 x = (a - gPlayerEntity.base.x.HALF.HI) + 0x10; u32 b = roomControls->origin_y + 0x140; - u32 y = (b - gPlayerEntity.y.HALF.HI) + 0x10; + u32 y = (b - gPlayerEntity.base.y.HALF.HI) + 0x10; if (super->action == 0) { - if (x < 0x20 && y < 0x20 && gPlayerEntity.z.HALF.HI < -0x18 && gPlayerState.framestate == PL_STATE_CAPE) { + if (x < 0x20 && y < 0x20 && gPlayerEntity.base.z.HALF.HI < -0x18 && gPlayerState.framestate == PL_STATE_CAPE) { super->action++; super->timer = 90; SoundReq(SFX_10A); diff --git a/src/manager/hyruleTownTilesetManager.c b/src/manager/hyruleTownTilesetManager.c index ce30c9fb..3a9752cc 100644 --- a/src/manager/hyruleTownTilesetManager.c +++ b/src/manager/hyruleTownTilesetManager.c @@ -67,15 +67,15 @@ void HyruleTownTilesetManager_Main(HyruleTownTilesetManager* this) { this->field_0x21 = 0xff; this->field_0x20 = 0xff; RegisterTransitionManager(this, sub_08059A2C, NULL); - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); } sub_08059A58(this); } void sub_08059A2C(HyruleTownTilesetManager* this) { - gRoomVars.unk_10[2] = 0xff; - gRoomVars.unk_10[1] = 0xff; - gRoomVars.unk_10[0] = 0xff; + gRoomVars.graphicsGroups[2] = 0xff; + gRoomVars.graphicsGroups[1] = 0xff; + gRoomVars.graphicsGroups[0] = 0xff; this->field_0x22 = 0xff; this->field_0x21 = 0xff; this->field_0x20 = 0xff; @@ -148,8 +148,8 @@ bool32 sub_08059C8C(HyruleTownTilesetManager* this, u32 param_2, u8* param_3, co bool32 bVar2; *param_3 = CheckRegionsOnScreen(param_4); - if ((*param_3 != 0xff) && (gRoomVars.unk_10[param_2] != *param_3)) { - gRoomVars.unk_10[param_2] = *param_3; + if ((*param_3 != 0xff) && (gRoomVars.graphicsGroups[param_2] != *param_3)) { + gRoomVars.graphicsGroups[param_2] = *param_3; return TRUE; } else { return FALSE; @@ -159,7 +159,7 @@ bool32 sub_08059C8C(HyruleTownTilesetManager* this, u32 param_2, u8* param_3, co void sub_08059CC0(u32 param_1, u32 param_2) { const Unknown* unknown; - gRoomVars.unk_10[param_1] = param_2; + gRoomVars.graphicsGroups[param_1] = param_2; if (gRoomControls.area != AREA_FESTIVAL_TOWN) { unknown = &gUnk_08108408[param_2]; } else { diff --git a/src/manager/lightManager.c b/src/manager/lightManager.c index edad0b7d..7a0cca5f 100644 --- a/src/manager/lightManager.c +++ b/src/manager/lightManager.c @@ -20,8 +20,8 @@ extern void sub_0801E120(void); extern void sub_0801E154(u32); extern void sub_0801E160(u32, u32, u32); -bool32 sub_0805BA78(); -void sub_0805BAD4(); +bool32 LerpLightLevel(); +void UpdateLightAlpha(); void LightManager_Main(LightManager* this) { s32 sVar1; @@ -37,20 +37,20 @@ void LightManager_Main(LightManager* this) { super->flags |= ENT_PERSIST; super->timer = 17; this->unk20 = 0; - SetDefaultPriority((Entity*)this, 6); + SetEntityPriority((Entity*)this, 6); sub_0801E120(); sub_0801E154(super->timer); } if (gMain.substate == GAMEMAIN_UPDATE) { gScreen.lcd.displayControl |= DISPCNT_BG3_ON; - sub_0805BA78(); - sub_0805BAD4(); + LerpLightLevel(); + UpdateLightAlpha(); } if (gArea.lightType == 2) { gScreen.lcd.displayControl &= ~DISPCNT_WIN0_ON; } else { - if (CheckRectOnScreen(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x, - gPlayerEntity.y.HALF.HI - gRoomControls.origin_y, 0, 0)) { + if (CheckRectOnScreen(gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x, + gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y, 0, 0)) { gScreen.lcd.displayControl |= DISPCNT_WIN0_ON; } else { gScreen.lcd.displayControl &= ~DISPCNT_WIN0_ON; @@ -79,52 +79,41 @@ void LightManager_Main(LightManager* this) { } super->timer = uVar3; - sub_0801E160(gPlayerEntity.x.HALF.HI - gRoomControls.scroll_x, - gPlayerEntity.y.HALF.HI - gRoomControls.scroll_y - 9 + gPlayerEntity.z.HALF.HI, + sub_0801E160(gPlayerEntity.base.x.HALF.HI - gRoomControls.scroll_x, + gPlayerEntity.base.y.HALF.HI - gRoomControls.scroll_y - 9 + gPlayerEntity.base.z.HALF.HI, uVar3 + this->unk20); } } #define ABS(x) ((unsigned)(x < 0 ? -(x) : x)) -bool32 sub_0805BA78() { - u32 uVar1; - s32 iVar1; - s32 iVar2; - - iVar2 = (short)gArea.lightLevel; - iVar1 = gRoomVars.lightLevel; +bool32 LerpLightLevel() { + s32 tgt; + s32 cur; - if (iVar1 < 0) { - iVar1 = 0; - } + cur = (short)gArea.lightLevel; + tgt = gRoomVars.lightLevel; - if (0x100 < iVar1) { - iVar1 = 0x100; - } + tgt = max(tgt, 0); + tgt = min(tgt, 0x100); - if (iVar2 != iVar1) { - if (ABS(iVar1 - iVar2) <= 4) { - iVar2 = iVar1; - } else { - if (iVar1 < iVar2) { - iVar2 = iVar2 - 4; - } else { - if (iVar1 > iVar2) { - iVar2 = iVar2 + 4; - } - } + if (cur != tgt) { + if (ABS(tgt - cur) <= 4) { + cur = tgt; + } else if (tgt < cur) { + cur -= 4; + } else if (tgt > cur) { + cur += 4; } - gArea.lightLevel = iVar2; - } else { - return FALSE; + gArea.lightLevel = cur; + return TRUE; } - return TRUE; + return FALSE; } extern u16 gUnk_08108CA8[]; -void sub_0805BAD4() { +void UpdateLightAlpha() { static const u16 gUnk_08108CA8[] = { 0x10, 0x10f, 0x20e, 0x30d, 0x40c, 0x50b, 0x60a, 0x709, 0x808, 0x907, 0xa06, 0xb05, 0xc04, 0xd03, 0xe02, 0xf01, 0x1000, 0x00 }; if (gArea.lightType != 0) { @@ -164,8 +153,8 @@ void sub_0805BB74(s32 lightLevel) { if (manager) { LightManager_Main(manager); gScreen.lcd.displayControl |= DISPCNT_BG3_ON; - sub_0805BA78(); - sub_0805BAD4(); + LerpLightLevel(); + UpdateLightAlpha(); } } @@ -175,9 +164,9 @@ bool32 UpdateLightLevel() { iVar1 = FALSE; if (gArea.lightType && gRoomVars.lightLevel < (s16)gArea.lightLevel) { gScreen.lcd.displayControl |= DISPCNT_BG3_ON; - iVar1 = sub_0805BA78(); + iVar1 = LerpLightLevel(); if (iVar1) { - sub_0805BAD4(); + UpdateLightAlpha(); } } return iVar1; @@ -189,9 +178,9 @@ s32 sub_0805BC04(void) { iVar1 = 0; if (gArea.lightType && gRoomVars.lightLevel > (short)gArea.lightLevel) { gScreen.lcd.displayControl |= DISPCNT_BG3_ON; - iVar1 = sub_0805BA78(); + iVar1 = LerpLightLevel(); if (iVar1) { - sub_0805BAD4(); + UpdateLightAlpha(); } } return iVar1; diff --git a/src/manager/lightRayManager.c b/src/manager/lightRayManager.c index 48c48a6f..8a6a75b9 100644 --- a/src/manager/lightRayManager.c +++ b/src/manager/lightRayManager.c @@ -88,8 +88,8 @@ void LightRayManager_Action1(LightRayManager* this) { if (prop->unk0 == 0xff) return; - x = gPlayerEntity.x.HALF.HI / 16; - y = gPlayerEntity.y.HALF.HI / 16; + x = gPlayerEntity.base.x.HALF.HI / 16; + y = gPlayerEntity.base.y.HALF.HI / 16; for (; prop->unk0 != 0xff; prop++) { if (prop->unk0 != this->unk_21) { diff --git a/src/manager/minishVillageTilesetManager.c b/src/manager/minishVillageTilesetManager.c index f82b9153..055e78b0 100644 --- a/src/manager/minishVillageTilesetManager.c +++ b/src/manager/minishVillageTilesetManager.c @@ -69,7 +69,7 @@ void MinishVillageTilesetManager_Main(MinishVillageTilesetManager* this) { return; if (sub_08057E40(this)) { - tmp = (u32)gRoomVars.unk_10[0]; + tmp = (u32)gRoomVars.graphicsGroups[0]; if (this->unk_20 != tmp) { this->unk_20 = tmp; super->timer = 0; @@ -111,11 +111,11 @@ void MinishVillageTilesetManager_Main(MinishVillageTilesetManager* this) { super->timer = 8; this->unk_20 = 0xFF; - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); RegisterTransitionManager(this, sub_08057E30, 0); } if (sub_08057E40(this)) { - tmp = (u32)gRoomVars.unk_10[0]; + tmp = (u32)gRoomVars.graphicsGroups[0]; if (this->unk_20 != tmp) { this->unk_20 = tmp; super->timer = 0; @@ -153,13 +153,13 @@ void MinishVillageTilesetManager_Main(MinishVillageTilesetManager* this) { #endif void sub_08057E30(void* this) { - sub_08057E7C(gRoomVars.unk_10[0]); + sub_08057E7C(gRoomVars.graphicsGroups[0]); } bool32 sub_08057E40(MinishVillageTilesetManager* this) { u32 tmp = CheckRegionsOnScreen(gUnk_08108050); if (tmp != 0xFF) { - gRoomVars.unk_10[0] = tmp; + gRoomVars.graphicsGroups[0] = tmp; return TRUE; } else { return FALSE; @@ -187,5 +187,5 @@ void sub_08057E7C(u32 unk1) { for (tmp = 0; tmp < 8; tmp++, tmp2 += 2) { DmaCopy32(3, &gGlobalGfxAndPalettes[tmp2[0]], tmp2[1], 0x400 * 4); } - gRoomVars.unk_10[0] = unk1; + gRoomVars.graphicsGroups[0] = unk1; } diff --git a/src/manager/miscManager.c b/src/manager/miscManager.c index a25aa3e5..d8e28e97 100644 --- a/src/manager/miscManager.c +++ b/src/manager/miscManager.c @@ -164,7 +164,7 @@ void MiscManager_Type1(MiscManager* this) { PutAwayItems(); } if (super->timer == 60) { - gPlayerEntity.animationState = super->subtimer; + gPlayerEntity.base.animationState = super->subtimer; } if (!--super->timer) { super->action = 3; @@ -212,7 +212,7 @@ void MiscManager_Type3(MiscManager* this) { void MiscManager_Type4(MiscManager* this) { if (super->action == 0) { super->action = 1; - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); } if (CheckLocalFlag(0x6c)) { if (CheckLocalFlag(0x4b)) { @@ -298,7 +298,7 @@ void sub_08059278(void) { void MiscManager_Type8(MiscManager* this) { super->action = 1; - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; } void MiscManager_Type9(MiscManager* this) { @@ -363,9 +363,9 @@ void MiscManager_TypeB(MiscManager* this) { } bool32 sub_080593CC(MiscManager* this) { - if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.swim_state != 0 && gPlayerEntity.animationState == 0 && - (gPlayerState.playerInput.heldInput & PLAYER_INPUT_ANY_DIRECTION) == PLAYER_INPUT_UP) { - return EntityWithinDistance(&gPlayerEntity, this->x, this->y + 12, 6); + if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.swim_state != 0 && gPlayerEntity.base.animationState == 0 && + (gPlayerState.playerInput.heldInput & INPUT_ANY_DIRECTION) == INPUT_UP) { + return EntityWithinDistance(&gPlayerEntity.base, this->x, this->y + 12, 6); } return FALSE; } @@ -392,10 +392,10 @@ void MiscManager_TypeD(MiscManager* this) { SetPlayerControl(3); if (gRoomControls.reload_flags) return; - if (gRoomVars.field_0x0) { + if (gRoomVars.didEnterScrolling) { StartPlayerScript(gUnk_08108380[gRoomControls.scroll_direction]); } else { - StartPlayerScript(gUnk_08108380[gPlayerEntity.animationState >> 1]); + StartPlayerScript(gUnk_08108380[gPlayerEntity.base.animationState >> 1]); } } DeleteThisEntity(); @@ -430,8 +430,8 @@ void MiscManager_TypeE(MiscManager* this) { #if defined(USA) || defined(DEMO_USA) || defined(DEMO_JP) void MiscManager_TypeF(MiscManager* this) { - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); - if (gPlayerEntity.action == PLAYER_TALKEZLO) { + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); + if (gPlayerEntity.base.action == PLAYER_TALKEZLO) { DeleteThisEntity(); } gInput.heldKeys |= SELECT_BUTTON; diff --git a/src/manager/moveableObjectManager.c b/src/manager/moveableObjectManager.c index 6c697777..21756299 100644 --- a/src/manager/moveableObjectManager.c +++ b/src/manager/moveableObjectManager.c @@ -14,7 +14,7 @@ void MoveableObjectManager_Main(MoveableObjectManager* this) { Entity* object = CreateObject(super->timer, super->type, super->type2); if (!object) return; - object->field_0x86.HWORD = this->flags; + ((GenericEntity*)object)->field_0x86.HWORD = this->flags; if (CheckFlags(this->flags)) { object->x.HALF.HI = this->unk_36 | (this->unk_37 & 0xF) << 8; // r1 object->y.HALF.HI = this->unk_3c & 0xFFF; diff --git a/src/manager/powBackgroundManager.c b/src/manager/powBackgroundManager.c index 1aa2a0e1..d7a24f25 100644 --- a/src/manager/powBackgroundManager.c +++ b/src/manager/powBackgroundManager.c @@ -20,7 +20,7 @@ void PowBackgroundManager_Main(PowBackgroundManager* this) { if (super->action == 0) { super->action = 1; super->flags |= ENT_PERSIST; - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); if (gArea.onEnter == NULL) { RegisterTransitionManager(this, sub_0805AFFC, NULL); } else { diff --git a/src/manager/pushableFurnitureManager.c b/src/manager/pushableFurnitureManager.c index d8cb00d9..f701bc42 100644 --- a/src/manager/pushableFurnitureManager.c +++ b/src/manager/pushableFurnitureManager.c @@ -5,8 +5,10 @@ * @brief Creates pushable furniture based on a room property list. */ #include "manager/pushableFurnitureManager.h" + #include "flags.h" #include "object.h" +#include "object/pushableFurniture.h" #include "room.h" void PushableFurnitureManager_Init(PushableFurnitureManager*); @@ -35,16 +37,16 @@ void PushableFurnitureManager_Init(PushableFurnitureManager* this) { this->unk_28 = 0; this->unk_29 = 0; while (tmp->unk_00 != 0xFF && super->timer < 0x20) { - Entity* obj; - obj = CreateObject(PUSHABLE_FURNITURE, tmp->unk_01, tmp->unk_02); - if (obj) { - obj->timer = tmp->unk_03; - obj->x.HALF.HI = gRoomControls.origin_x + tmp->unk_04; - obj->y.HALF.HI = gRoomControls.origin_y + tmp->unk_06; - obj->parent = (Entity*)this; - obj->collisionLayer = 1; - obj->field_0x82.HALF.HI = super->timer; - obj->field_0x82.HALF.LO = tmp->unk_00; + PushableFurnitureEntity* furniture = + (PushableFurnitureEntity*)CreateObject(PUSHABLE_FURNITURE, tmp->unk_01, tmp->unk_02); + if (furniture) { + furniture->base.timer = tmp->unk_03; + furniture->base.x.HALF.HI = gRoomControls.origin_x + tmp->unk_04; + furniture->base.y.HALF.HI = gRoomControls.origin_y + tmp->unk_06; + furniture->base.parent = (Entity*)this; + furniture->base.collisionLayer = 1; + furniture->unk_83 = super->timer; + furniture->unk_82 = tmp->unk_00; this->unk_29 |= 1 << super->timer; } tmp++; @@ -75,13 +77,13 @@ void PushableFurnitureManager_Action2(PushableFurnitureManager* this) { void sub_0805C7CC(PushableFurnitureManager* this) { if (gPlayerState.flags & PL_MINISH) { - if (gPlayerEntity.y.HALF.HI < this->unk_2a + 0x10) { + if (gPlayerEntity.base.y.HALF.HI < this->unk_2a + 0x10) { super->subAction = 1; } else { super->subAction = 0; } } else { - if (gPlayerEntity.y.HALF.HI < this->unk_2a + 0x28) { + if (gPlayerEntity.base.y.HALF.HI < this->unk_2a + 0x28) { super->subAction = 3; } else { super->subAction = 2; diff --git a/src/manager/repeatedSoundManager.c b/src/manager/repeatedSoundManager.c index d55677d6..ff2c534b 100644 --- a/src/manager/repeatedSoundManager.c +++ b/src/manager/repeatedSoundManager.c @@ -37,7 +37,7 @@ void CreateRepeatedSoundManager(Entity* entity, ScriptExecutionContext* context) manager->id = REPEATED_SOUND_MANAGER; manager->type = context->intVariable; AppendEntityToList((Entity*)manager, 6); - SetDefaultPriority((Entity*)manager, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)manager, PRIO_PLAYER_EVENT); } } diff --git a/src/manager/rollingBarrelManager.c b/src/manager/rollingBarrelManager.c index ec215c34..7f44557b 100644 --- a/src/manager/rollingBarrelManager.c +++ b/src/manager/rollingBarrelManager.c @@ -92,7 +92,7 @@ void sub_080588F8(RollingBarrelManager* this) { } } if (super->timer) { - s32 tmp = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y; + s32 tmp = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y; u32 tmp2; tmp2 = (((unsigned)(tmp - 0x50 < 0 ? 0x50 - tmp : tmp - 0x50) >> 3) * 0x3000) + 0x4000; if (super->subtimer == 0) { @@ -133,14 +133,14 @@ void sub_08058A04(RollingBarrelManager* this) { { 0x9C, 0x78, 0x1A, 0x16 }, { 0x9A, 0x70, 0x1A, 0x18 }, { 0x98, 0x64, 0x1E, 0x1E }, { 0x98, 0x6A, 0x1C, 0x10 } }; - s32 tmp = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x; - s32 tmp2 = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y; + s32 tmp = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x; + s32 tmp2 = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y; if ((this->unk_20 - 0x118 < 0xDu) && CheckGlobalFlag(LV1TARU_OPEN) && (tmp - 0x6d < 0x17u) && - (tmp2 - 0x45 < 0x17u) && (gPlayerEntity.z.HALF.HI == 0)) { + (tmp2 - 0x45 < 0x17u) && (gPlayerEntity.base.z.HALF.HI == 0)) { gPlayerState.queued_action = PLAYER_FALL; gPlayerState.field_0x38 = 0; - gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + 0x78; - gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0x50; + gPlayerEntity.base.x.HALF.HI = gRoomControls.origin_x + 0x78; + gPlayerEntity.base.y.HALF.HI = gRoomControls.origin_y + 0x50; return; } if (tmp < 0x78) { @@ -175,8 +175,8 @@ u32 sub_08058B08(RollingBarrelManager* this, u32 unk1, u32 unk2, const struct_08 tmp -= unk1; tmp >>= 3; unk3 += tmp; - tmp2 = (gPlayerEntity.x.HALF.HI - gRoomControls.origin_x - unk3->unk_0); - tmp3 = (gPlayerEntity.y.HALF.HI - gRoomControls.origin_y - unk3->unk_2); + tmp2 = (gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x - unk3->unk_0); + tmp3 = (gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y - unk3->unk_2); return ((tmp2 < unk3->unk_4) && (tmp3 < unk3->unk_6)); } } @@ -229,8 +229,8 @@ void sub_08058BC8(RollingBarrelManager* this) { void sub_08058CB0(RollingBarrelManager* this) { static const u16 gUnk_08108300[4] = { 0xA4, 0x4C, 0xF4, 0x9C }; - u32 tmp = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x; - u32 tmp2 = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y; + u32 tmp = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x; + u32 tmp2 = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y; u32 tmp3; if (tmp < 0x78) { tmp3 = 1; @@ -247,12 +247,12 @@ void sub_08058CB0(RollingBarrelManager* this) { } void sub_08058CFC(void) { - u32 tmp = gPlayerEntity.y.HALF.HI - gRoomControls.scroll_y; + u32 tmp = gPlayerEntity.base.y.HALF.HI - gRoomControls.scroll_y; if (tmp < 0x4C) { - sub_080044AE(&gPlayerEntity, 0xC0, 0x10); + sub_080044AE(&gPlayerEntity.base, 0xC0, 0x10); } if (tmp > 0x54) { - sub_080044AE(&gPlayerEntity, 0xC0, 0); + sub_080044AE(&gPlayerEntity.base, 0xC0, 0); } } diff --git a/src/manager/secretManager.c b/src/manager/secretManager.c index 4a9ba020..ca2ec125 100644 --- a/src/manager/secretManager.c +++ b/src/manager/secretManager.c @@ -51,7 +51,7 @@ void SecretManager_Type0_Init(SecretManager* this) { if (super->timer == 0) { super->timer = 30; } - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); } void SecretManager_Type0_Action1(SecretManager* this) { @@ -94,7 +94,7 @@ void SecretManager_Type1_Init(SecretManager* this) { super->timer = 30; } super->subtimer = super->timer; - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); } void SecretManager_Type1_Action1(SecretManager* this) { diff --git a/src/manager/specialWarpManager.c b/src/manager/specialWarpManager.c index f387761e..f62ac451 100644 --- a/src/manager/specialWarpManager.c +++ b/src/manager/specialWarpManager.c @@ -22,10 +22,10 @@ void SpecialWarpManager_Main(SpecialWarpManager* this) { if (super->timer == 0 || gPlayerState.floor_type == SURFACE_LADDER) { for (data = this->warpList; data->posX != 0xffff; data++) { collisionLayer = (data->unk_07.all & 0x3); - if ((collisionLayer & gPlayerEntity.collisionLayer) != 0) { + if ((collisionLayer & gPlayerEntity.base.collisionLayer) != 0) { if ((gPlayerState.flags & PL_MINISH) != 0 || data->unk_07.b.unk2 != 0) { if (CheckPlayerInRegion(data->posX, data->posY, data->width, data->height) && - gPlayerEntity.z.HALF.HI == 0) { + gPlayerEntity.base.z.HALF.HI == 0) { DoExitTransition(GetCurrentRoomProperty(data->roomProperty)); } } diff --git a/src/manager/staticBackgroundManager.c b/src/manager/staticBackgroundManager.c index a8bd1810..2163b280 100644 --- a/src/manager/staticBackgroundManager.c +++ b/src/manager/staticBackgroundManager.c @@ -35,7 +35,7 @@ void StaticBackgroundManager_Main(StaticBackgroundManager* this) { if (super->action == 0) { super->action = 1; super->flags |= ENT_PERSIST; - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); if (super->type != 0) { RegisterTransitionManager(this, sub_0805B4B4, NULL); } diff --git a/src/manager/templeOfDropletsManager.c b/src/manager/templeOfDropletsManager.c index 16021808..14fc1d75 100644 --- a/src/manager/templeOfDropletsManager.c +++ b/src/manager/templeOfDropletsManager.c @@ -334,14 +334,14 @@ void TempleOfDropletsManager_Type6_Action1(TempleOfDropletsManager* this) { } void TempleOfDropletsManager_Type6_Action2(TempleOfDropletsManager* this) { - if ((gPlayerEntity.health != 0) && (gPlayerEntity.z.HALF.HI == 0) && (!gPlayerState.item)) { + if ((gPlayerEntity.base.health != 0) && (gPlayerEntity.base.z.HALF.HI == 0) && (!gPlayerState.item)) { switch (gPlayerState.framestate_last) { case PL_STATE_IDLE: case PL_STATE_WALK: if (sub_0805A73C(this)) { super->action++; - sub_08004168(&gPlayerEntity); - gPlayerEntity.animationState = 4; + sub_08004168(&gPlayerEntity.base); + gPlayerEntity.base.animationState = 4; RequestPriorityDuration((Entity*)this, 600); SetPlayerControl(0xFF); gPauseMenuOptions.disabled = 1; @@ -370,7 +370,7 @@ void TempleOfDropletsManager_Type7(TempleOfDropletsManager* this) { } super->subAction = 1; super->flags |= ENT_PERSIST; - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); break; case 1: if (CheckLocalFlag(this->unk_3e)) @@ -402,7 +402,7 @@ void TempleOfDropletsManager_Type7(TempleOfDropletsManager* this) { void sub_0805AAC8(TempleOfDropletsManager*); void sub_0805A89C(TempleOfDropletsManager* this) { - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); super->action = 1; super->flags |= ENT_PERSIST; super->timer = 8; diff --git a/src/manager/tilePuzzleManager.c b/src/manager/tilePuzzleManager.c index 367cf776..241cba49 100644 --- a/src/manager/tilePuzzleManager.c +++ b/src/manager/tilePuzzleManager.c @@ -25,10 +25,10 @@ void TilePuzzleManager_Main(TilePuzzleManager* this) { super->action = IN_PROGRESS; super->subtimer = super->timer; this->own_tile = (((this->x >> 4) & 0x3fU) | ((this->y >> 4) & 0x3fU) << 6); - this->player_previous_tile = this->player_current_tile = COORD_TO_TILE((&gPlayerEntity)); + this->player_previous_tile = this->player_current_tile = COORD_TO_TILE((&gPlayerEntity.base)); break; case 1: - this->player_current_tile = COORD_TO_TILE((&gPlayerEntity)); + this->player_current_tile = COORD_TO_TILE((&gPlayerEntity.base)); if (this->player_current_tile != this->player_previous_tile) { this->player_previous_tile = this->player_current_tile; switch (GetMetaTileType(this->player_current_tile, super->type2)) { diff --git a/src/manager/vaati3BackgroundManager.c b/src/manager/vaati3BackgroundManager.c index 5b3bcc18..bc8847cf 100644 --- a/src/manager/vaati3BackgroundManager.c +++ b/src/manager/vaati3BackgroundManager.c @@ -22,7 +22,7 @@ void Vaati3BackgroundManager_Main(Vaati3BackgroundManager* this) { if (super->action == 0) { super->action = 1; super->flags |= ENT_PERSIST; - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); if (gArea.onEnter == NULL) { RegisterTransitionManager(this, sub_0805D470, NULL); } else { diff --git a/src/manager/vaati3StartManager.c b/src/manager/vaati3StartManager.c index 6d1c666d..1fa0c618 100644 --- a/src/manager/vaati3StartManager.c +++ b/src/manager/vaati3StartManager.c @@ -63,20 +63,20 @@ void Vaati3StartManager_Type0_Action1(Vaati3StartManager* this) { s32 distY; Entity* object; - distX = gPlayerEntity.x.HALF.HI - (gRoomControls.origin_x + 0x88); - distY = gPlayerEntity.y.HALF.HI - (gRoomControls.origin_y + 0x40); + distX = gPlayerEntity.base.x.HALF.HI - (gRoomControls.origin_x + 0x88); + distY = gPlayerEntity.base.y.HALF.HI - (gRoomControls.origin_y + 0x40); if (distX * distX + distY * distY < 0x901) { super->action = 2; super->subAction = 0; super->timer = 120; SetPlayerControl(2); - sub_08078B48(); + PausePlayer(); object = CreateObject(THUNDERBOLT, 0, 0); if (object != NULL) { object->x.HALF.HI = gRoomControls.origin_x + 0x88; object->y.HALF.HI = gRoomControls.origin_y + 0x48; } - object = CreateSpeechBubbleExclamationMark(&gPlayerEntity, 8, 0xfffffff0); + object = CreateSpeechBubbleExclamationMark(&gPlayerEntity.base, 8, 0xfffffff0); if (object != NULL) { object->spritePriority.b0 = 3; } @@ -85,10 +85,10 @@ void Vaati3StartManager_Type0_Action1(Vaati3StartManager* this) { } void Vaati3StartManager_Type0_Action2(Vaati3StartManager* this) { - gPlayerEntity.animationState = 0; - if (gPlayerEntity.z.HALF.HI != 0) { - if (gPlayerEntity.y.HALF.HI < (gRoomControls.origin_y + 0x48)) { - gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0x48; + gPlayerEntity.base.animationState = 0; + if (gPlayerEntity.base.z.HALF.HI != 0) { + if (gPlayerEntity.base.y.HALF.HI < (gRoomControls.origin_y + 0x48)) { + gPlayerEntity.base.y.HALF.HI = gRoomControls.origin_y + 0x48; } } else { if (--super->timer == 0) { @@ -100,7 +100,7 @@ void Vaati3StartManager_Type0_Action2(Vaati3StartManager* this) { } void Vaati3StartManager_Type0_Action3(Vaati3StartManager* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { if (super->timer != 0) { super->timer--; } else { diff --git a/src/manager/verticalMinishPathBackgroundManager.c b/src/manager/verticalMinishPathBackgroundManager.c index d2978bb7..e67cde8d 100644 --- a/src/manager/verticalMinishPathBackgroundManager.c +++ b/src/manager/verticalMinishPathBackgroundManager.c @@ -51,7 +51,7 @@ void sub_080575C8(u32 param) { gMapTop.bgSettings = 0; REG_DISPCNT = 0; LoadGfxGroup(param); - gRoomVars.unk_10[0] = param; + gRoomVars.graphicsGroups[0] = param; bgOffset = (gRoomControls.scroll_y - gRoomControls.origin_y); bgOffset += bgOffset >> 3; @@ -80,7 +80,7 @@ void sub_08057688(void) { } void sub_080576A0(void* this) { - LoadGfxGroup(gRoomVars.unk_10[0]); + LoadGfxGroup(gRoomVars.graphicsGroups[0]); ((VerticalMinishPathBackgroundManager*)this)->field_0x38 = NULL; ((VerticalMinishPathBackgroundManager*)this)->field_0x3c = NULL; sub_0805754C((VerticalMinishPathBackgroundManager*)this); diff --git a/src/manager/waterfallBottomManager.c b/src/manager/waterfallBottomManager.c index 0d27d35b..c6bedd2f 100644 --- a/src/manager/waterfallBottomManager.c +++ b/src/manager/waterfallBottomManager.c @@ -12,10 +12,10 @@ void WaterfallBottomManager_Main(WaterfallBottomManager* this) { SetMetaTile(SPECIAL_META_TILE_20, TILE_POS(3, 23), LAYER_BOTTOM); - if ((gRoomControls.origin_y + 200 < gPlayerEntity.y.HALF.HI) && - ((u32)(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) - 0x30 < 0x11)) { - gPlayerEntity.collisionLayer = 3; - UpdateSpriteForCollisionLayer(&gPlayerEntity); + if ((gRoomControls.origin_y + 200 < gPlayerEntity.base.y.HALF.HI) && + ((u32)(gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x) - 0x30 < 0x11)) { + gPlayerEntity.base.collisionLayer = 3; + UpdateSpriteForCollisionLayer(&gPlayerEntity.base); } DeleteManager(super); } diff --git a/src/manager/weatherChangeManager.c b/src/manager/weatherChangeManager.c index baf2f940..995716a0 100644 --- a/src/manager/weatherChangeManager.c +++ b/src/manager/weatherChangeManager.c @@ -44,7 +44,7 @@ void WeatherChangeManager_Main(WeatherChangeManager* this) { this->unk_20 = 0x1F; this->unk_22 = 5; } - gRoomVars.unk_10[0] = 0xFF; + gRoomVars.graphicsGroups[0] = 0xFF; RegisterTransitionManager(this, sub_080595E4, 0); } sub_08059608(this); @@ -53,7 +53,7 @@ void WeatherChangeManager_Main(WeatherChangeManager* this) { } void sub_080595E4(WeatherChangeManager* this) { - gRoomVars.unk_10[0] = 0xFF; + gRoomVars.graphicsGroups[0] = 0xFF; sub_08059690(this); sub_080596E0(this); LoadStaticBackground(0); @@ -132,8 +132,8 @@ void sub_080596E0(WeatherChangeManager* this) { } break; } - if (gRoomVars.unk_10[0] != this->unk_22) { - gRoomVars.unk_10[0] = this->unk_22; + if (gRoomVars.graphicsGroups[0] != this->unk_22) { + gRoomVars.graphicsGroups[0] = this->unk_22; switch (this->unk_22) { case 0 ... 3: LoadGfxGroup(this->unk_22 + 0x2B); @@ -151,11 +151,11 @@ void sub_080596E0(WeatherChangeManager* this) { } u32 sub_08059844(void) { - return gPlayerEntity.x.HALF.HI - gRoomControls.origin_x > gRoomControls.width >> 1; + return gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x > gRoomControls.width >> 1; } u32 sub_0805986C(void) { - return gPlayerEntity.x.HALF.HI - gRoomControls.origin_x > 0x200; + return gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x > 0x200; } void sub_08059894(const u16* palette1, const u16* palette2, u32 factor) { |
