diff options
| author | octorock <79596758+octorock@users.noreply.github.com> | 2023-06-24 00:19:33 +0200 |
|---|---|---|
| committer | octorock <79596758+octorock@users.noreply.github.com> | 2023-06-24 00:19:33 +0200 |
| commit | f89bb66911372a067041b66d50ac8462b7e0bd97 (patch) | |
| tree | 5c7516fcf3e30a3aaf4e63c4a28a42e7c66f4471 /src/object | |
| parent | f9da6344273ac86d6fd9219fac2710c968eeab37 (diff) | |
Create enums for Vvvs and MetaTiles
Diffstat (limited to 'src/object')
68 files changed, 611 insertions, 607 deletions
diff --git a/src/object/angryStatue.c b/src/object/angryStatue.c index 0204c90e..99d42b58 100644 --- a/src/object/angryStatue.c +++ b/src/object/angryStatue.c @@ -29,7 +29,7 @@ void AngryStatue(Entity* this) { void AngryStatue_Init(Entity* this) { this->action = 1; this->hitbox = (Hitbox*)&gUnk_080FD178; - SetTile(0x4022, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile(0x4022, COORD_TO_TILE(this), this->collisionLayer); InitializeAnimation(this, this->type); } diff --git a/src/object/bakerOven.c b/src/object/bakerOven.c index f1689675..e0ce4ba2 100644 --- a/src/object/bakerOven.c +++ b/src/object/bakerOven.c @@ -101,12 +101,12 @@ void sub_0809CDF0(Entity* this) { (((this->y.HALF.HI - gRoomControls.origin_y) >> 4 & 0x3f) << 6); y = this->field_0x80.HWORD; - SetTile(0x402e, y - 0x01, this->collisionLayer); - SetTile(0x4022, y - 0x00, this->collisionLayer); - SetTile(0x4022, y + 0x01, this->collisionLayer); - SetTile(0x4026, y - 0x41, this->collisionLayer); - SetTile(0x4026, y - 0x40, this->collisionLayer); - SetTile(0x4024, y - 0x3f, this->collisionLayer); - SetTile(0x4026, y - 0x81, this->collisionLayer); - SetTile(0x4026, y - 0x80, this->collisionLayer); + SetMetaTile(0x402e, y - 0x01, this->collisionLayer); + SetMetaTile(0x4022, y - 0x00, this->collisionLayer); + SetMetaTile(0x4022, y + 0x01, this->collisionLayer); + SetMetaTile(0x4026, y - 0x41, this->collisionLayer); + SetMetaTile(0x4026, y - 0x40, this->collisionLayer); + SetMetaTile(0x4024, y - 0x3f, this->collisionLayer); + SetMetaTile(0x4026, y - 0x81, this->collisionLayer); + SetMetaTile(0x4026, y - 0x80, this->collisionLayer); } diff --git a/src/object/beanstalk.c b/src/object/beanstalk.c index 801c89d2..4661d43e 100644 --- a/src/object/beanstalk.c +++ b/src/object/beanstalk.c @@ -259,8 +259,8 @@ void Beanstalk_Action1Type7(BeanstalkEntity* this) { this->unk_70 = TILE(super->x.HALF.HI, this->unk_6c); while (TRUE) { this->unk_70 = TILE(super->x.HALF.HI, this->unk_6c); - SetTile(0x4017, this->unk_70, 2); - SetTile(0x4017, this->unk_70, 1); + SetMetaTile(0x4017, this->unk_70, 2); + SetMetaTile(0x4017, this->unk_70, 1); this->unk_6c += 0x10; if (this->unk_6c >= gRoomControls.origin_y + gRoomControls.height) break; @@ -309,7 +309,7 @@ void Beanstalk_Action1Type8SubAction0(BeanstalkEntity* this) { super->spriteOrientation.flipY = 2; this->unk_70 = COORD_TO_TILE(super); - SetTile(0x4017, this->unk_70, 1); + SetMetaTile(0x4017, this->unk_70, 1); super->subAction = 1; obj = CreateObjectWithParent(super, CHUCHU_BOSS_PARTICLE, 0, 0); if (obj != NULL) { @@ -341,12 +341,12 @@ void Beanstalk_Action1Type9(BeanstalkEntity* this) { if (gPlayerState.floor_type == SURFACE_LADDER) { super->spritePriority.b0 = 0; if (sub_080B1A0C(super, 0, -0x18) != 0x4014) { - SetTile(0x4014, COORD_TO_TILE_OFFSET(super, 0, 0x18), 1); + SetMetaTile(0x4014, COORD_TO_TILE_OFFSET(super, 0, 0x18), 1); } } else { super->spritePriority.b0 = 5; if (this->unk_72 != sub_080B1A0C(super, 0, -0x18)) { - SetTile(this->unk_72, COORD_TO_TILE_OFFSET(super, 0, 0x18), 1); + SetMetaTile(this->unk_72, COORD_TO_TILE_OFFSET(super, 0, 0x18), 1); } } } diff --git a/src/object/bigBarrel.c b/src/object/bigBarrel.c index f40c90a3..c08cba6a 100644 --- a/src/object/bigBarrel.c +++ b/src/object/bigBarrel.c @@ -293,7 +293,7 @@ void sub_08088F20(BigBarrelEntity* this) { pEVar3->collisionLayer = 2; pEVar3->spritePriority.b0 = 2; } - SetTileType(0x76, COORD_TO_TILE(super), 2); + SetMetaTileType(0x76, COORD_TO_TILE(super), 2); break; case 2: if (--super->timer) { diff --git a/src/object/bigIceBlock.c b/src/object/bigIceBlock.c index 0d865546..fb208a90 100644 --- a/src/object/bigIceBlock.c +++ b/src/object/bigIceBlock.c @@ -7,10 +7,10 @@ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "hitbox.h" #include "item.h" #include "object.h" +#include "tiles.h" typedef struct { /*0x00*/ Entity base; @@ -131,127 +131,127 @@ void sub_08099910(BigIceBlockEntity* this) { u32 uVar2; s32 vvv; u32 tileIndex; - u32 position; + u32 metaTilePos; - position = COORD_TO_TILE(super); - this->unk_6e = position; + metaTilePos = COORD_TO_TILE(super); + this->unk_6e = metaTilePos; uVar2 = (((super->x.HALF.HI & 8)) >> 0x3) + ((super->y.HALF.HI & 8) >> 2); this->unk_6c = uVar2; switch (uVar2) { default: - SetTile(0x4022, position - 0x41, super->collisionLayer); - SetTile(0x4022, position - 0x40, super->collisionLayer); - SetTile(0x4022, position - 1, super->collisionLayer); - SetTile(0x4022, position, super->collisionLayer); + SetMetaTile(0x4022, metaTilePos - 0x41, super->collisionLayer); + SetMetaTile(0x4022, metaTilePos - 0x40, super->collisionLayer); + SetMetaTile(0x4022, metaTilePos - 1, super->collisionLayer); + SetMetaTile(0x4022, metaTilePos, super->collisionLayer); break; case 1: - vvv = GetVvvAtMetaTilePos(position - 0x41, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(metaTilePos - 0x41, super->collisionLayer); tileIndex = 0x4024; - if (vvv == 0x12) { + if (vvv == VVV_18) { tileIndex = 0x4079; } - SetTile(tileIndex, position - 0x41, super->collisionLayer); - SetTile(0x4022, position - 0x40, super->collisionLayer); - vvv = GetVvvAtMetaTilePos(position - 0x3f, super->collisionLayer); + SetMetaTile(tileIndex, metaTilePos - 0x41, super->collisionLayer); + SetMetaTile(0x4022, metaTilePos - 0x40, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(metaTilePos - 0x3f, super->collisionLayer); tileIndex = 0x4025; - if (vvv == 0x12) { + if (vvv == VVV_18) { tileIndex = 0x407b; } - SetTile(tileIndex, position - 0x3f, super->collisionLayer); - vvv = GetVvvAtMetaTilePos(position - 1, super->collisionLayer); + SetMetaTile(tileIndex, metaTilePos - 0x3f, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(metaTilePos - 1, super->collisionLayer); tileIndex = 0x4024; - if (vvv == 0x12) { + if (vvv == VVV_18) { tileIndex = 0x4079; } - SetTile(tileIndex, position - 1, super->collisionLayer); - SetTile(0x4022, position, super->collisionLayer); - vvv = GetVvvAtMetaTilePos(position + 1, super->collisionLayer); + SetMetaTile(tileIndex, metaTilePos - 1, super->collisionLayer); + SetMetaTile(0x4022, metaTilePos, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(metaTilePos + 1, super->collisionLayer); tileIndex = 0x4025; - if (vvv == 0x12) { + if (vvv == VVV_18) { tileIndex = 0x407b; } - SetTile(tileIndex, position + 1, super->collisionLayer); + SetMetaTile(tileIndex, metaTilePos + 1, super->collisionLayer); return; break; case 2: - vvv = GetVvvAtMetaTilePos(position - 0x41, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(metaTilePos - 0x41, super->collisionLayer); tileIndex = 0x4023; - if (vvv == 0x12) { + if (vvv == VVV_18) { tileIndex = 0x4077; } - SetTile(tileIndex, position - 0x41, super->collisionLayer); - vvv = GetVvvAtMetaTilePos(position - 0x40, super->collisionLayer); + SetMetaTile(tileIndex, metaTilePos - 0x41, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(metaTilePos - 0x40, super->collisionLayer); tileIndex = 0x4023; - if (vvv == 0x12) { + if (vvv == VVV_18) { tileIndex = 0x4077; } - SetTile(tileIndex, position - 0x40, super->collisionLayer); - SetTile(0x4022, position - 1, super->collisionLayer); - SetTile(0x4022, position, super->collisionLayer); - vvv = GetVvvAtMetaTilePos(position + 0x3f, super->collisionLayer); + SetMetaTile(tileIndex, metaTilePos - 0x40, super->collisionLayer); + SetMetaTile(0x4022, metaTilePos - 1, super->collisionLayer); + SetMetaTile(0x4022, metaTilePos, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(metaTilePos + 0x3f, super->collisionLayer); tileIndex = 0x4026; - if (vvv == 0x12) { + if (vvv == VVV_18) { tileIndex = 0x407c; } - SetTile(tileIndex, position + 0x3f, super->collisionLayer); - vvv = GetVvvAtMetaTilePos(position + 0x40, super->collisionLayer); + SetMetaTile(tileIndex, metaTilePos + 0x3f, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(metaTilePos + 0x40, super->collisionLayer); tileIndex = 0x4026; - if (vvv == 0x12) { + if (vvv == VVV_18) { tileIndex = 0x407c; } - SetTile(tileIndex, position + 0x40, super->collisionLayer); + SetMetaTile(tileIndex, metaTilePos + 0x40, super->collisionLayer); break; case 3: - vvv = GetVvvAtMetaTilePos(position - 0x41, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(metaTilePos - 0x41, super->collisionLayer); tileIndex = 0x4027; - if (vvv == 0x12) { + if (vvv == VVV_18) { tileIndex = 0x4075; } - SetTile(tileIndex, position - 0x41, super->collisionLayer); - vvv = GetVvvAtMetaTilePos(position - 0x40, super->collisionLayer); + SetMetaTile(tileIndex, metaTilePos - 0x41, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(metaTilePos - 0x40, super->collisionLayer); tileIndex = 0x4023; - if (vvv == 0x12) { + if (vvv == VVV_18) { tileIndex = 0x4077; } - SetTile(tileIndex, position - 0x40, super->collisionLayer); - vvv = GetVvvAtMetaTilePos(position - 0x3f, super->collisionLayer); + SetMetaTile(tileIndex, metaTilePos - 0x40, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(metaTilePos - 0x3f, super->collisionLayer); tileIndex = 0x4028; - if (vvv == 0x12) { + if (vvv == VVV_18) { tileIndex = 0x4076; } - SetTile(tileIndex, position - 0x3f, super->collisionLayer); - vvv = GetVvvAtMetaTilePos(position - 1, super->collisionLayer); + SetMetaTile(tileIndex, metaTilePos - 0x3f, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(metaTilePos - 1, super->collisionLayer); tileIndex = 0x4024; - if (vvv == 0x12) { + if (vvv == VVV_18) { tileIndex = 0x4079; } - SetTile(tileIndex, position - 1, super->collisionLayer); - SetTile(0x4022, position, super->collisionLayer); - vvv = GetVvvAtMetaTilePos(position + 1, super->collisionLayer); + SetMetaTile(tileIndex, metaTilePos - 1, super->collisionLayer); + SetMetaTile(0x4022, metaTilePos, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(metaTilePos + 1, super->collisionLayer); tileIndex = 0x4025; - if (vvv == 0x12) { + if (vvv == VVV_18) { tileIndex = 0x407b; } - SetTile(tileIndex, position + 1, super->collisionLayer); - vvv = GetVvvAtMetaTilePos(position + 0x3f, super->collisionLayer); + SetMetaTile(tileIndex, metaTilePos + 1, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(metaTilePos + 0x3f, super->collisionLayer); tileIndex = 0x4029; - if (vvv == 0x12) { + if (vvv == VVV_18) { tileIndex = 0x4078; } - SetTile(tileIndex, position + 0x3f, super->collisionLayer); - vvv = GetVvvAtMetaTilePos(position + 0x40, super->collisionLayer); + SetMetaTile(tileIndex, metaTilePos + 0x3f, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(metaTilePos + 0x40, super->collisionLayer); tileIndex = 0x4026; - if (vvv == 0x12) { + if (vvv == VVV_18) { tileIndex = 0x407c; } - SetTile(tileIndex, position + 0x40, super->collisionLayer); - vvv = GetVvvAtMetaTilePos(position + 0x41, super->collisionLayer); + SetMetaTile(tileIndex, metaTilePos + 0x40, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(metaTilePos + 0x41, super->collisionLayer); tileIndex = 0x402a; - if (vvv == 0x12) { + if (vvv == VVV_18) { tileIndex = 0x407a; } - SetTile(tileIndex, position + 0x41, super->collisionLayer); + SetMetaTile(tileIndex, metaTilePos + 0x41, super->collisionLayer); break; } } diff --git a/src/object/bigPushableLever.c b/src/object/bigPushableLever.c index 1f62e640..8ea37a28 100644 --- a/src/object/bigPushableLever.c +++ b/src/object/bigPushableLever.c @@ -35,7 +35,7 @@ extern const u8 BigPushableLever_PushedOffsets[]; void BigPushableLever_SetIdle(BigPushableLeverEntity*); bool32 BigPushableLever_ShouldStartPushing(BigPushableLeverEntity*); -void BigPushableLever_SetTiles(BigPushableLeverEntity*); +void BigPushableLever_SetMetaTiles(BigPushableLeverEntity*); void BigPushableLever_CalculateSpriteOffsets(BigPushableLeverEntity*); #define TILE_INITIAL 0x4058 @@ -53,8 +53,8 @@ void BigPushableLever_Init(BigPushableLeverEntity* this) { void BigPushableLever_Idle(BigPushableLeverEntity* this) { if (BigPushableLever_ShouldStartPushing(this)) { super->action = PUSHING; - SetTile(this->tileIndexUpper, this->tilePositionUpper, super->collisionLayer); - SetTile(this->tileIndexLower, this->tilePositionLower, super->collisionLayer); + SetMetaTile(this->tileIndexUpper, this->tilePositionUpper, super->collisionLayer); + SetMetaTile(this->tileIndexLower, this->tilePositionLower, super->collisionLayer); EnqueueSFX(SFX_132); RequestPriorityDuration(super, 30); if (PlayerCanBeMoved()) { @@ -83,38 +83,38 @@ void BigPushableLever_Pushing(BigPushableLeverEntity* this) { void BigPushableLever_SetIdle(BigPushableLeverEntity* this) { super->action = IDLE; this->timer = 60; - BigPushableLever_SetTiles(this); + BigPushableLever_SetMetaTiles(this); } -void BigPushableLever_SetTiles(BigPushableLeverEntity* this) { +void BigPushableLever_SetMetaTiles(BigPushableLeverEntity* this) { if (!CheckFlags(this->pushedFlag)) { super->type2 = 0; this->tilePositionUpper = COORD_TO_TILE_OFFSET(super, 0, 0x10); this->tilePositionLower = this->tilePositionUpper - 0x40; - this->tileIndexUpper = GetTileIndex(this->tilePositionUpper, super->collisionLayer); - this->tileIndexLower = GetTileIndex(this->tilePositionLower, super->collisionLayer); - SetTile(0x4057, this->tilePositionUpper, super->collisionLayer); - SetTile(0x4058, this->tilePositionLower, super->collisionLayer); + this->tileIndexUpper = GetMetaTileIndex(this->tilePositionUpper, super->collisionLayer); + this->tileIndexLower = GetMetaTileIndex(this->tilePositionLower, super->collisionLayer); + SetMetaTile(0x4057, this->tilePositionUpper, super->collisionLayer); + SetMetaTile(0x4058, this->tilePositionLower, super->collisionLayer); InitializeAnimation(super, 1); } else { super->type2 = 1; this->tilePositionUpper = COORD_TO_TILE_OFFSET(super, 0x10, 0); this->tilePositionLower = this->tilePositionUpper - 1; - this->tileIndexUpper = GetTileIndex(this->tilePositionUpper, super->collisionLayer); - this->tileIndexLower = GetTileIndex(this->tilePositionLower, super->collisionLayer); - SetTile(0x4055, this->tilePositionUpper, super->collisionLayer); - SetTile(0x4056, this->tilePositionLower, super->collisionLayer); + this->tileIndexUpper = GetMetaTileIndex(this->tilePositionUpper, super->collisionLayer); + this->tileIndexLower = GetMetaTileIndex(this->tilePositionLower, super->collisionLayer); + SetMetaTile(0x4055, this->tilePositionUpper, super->collisionLayer); + SetMetaTile(0x4056, this->tilePositionLower, super->collisionLayer); InitializeAnimation(super, 0); } } bool32 BigPushableLever_ShouldStartPushing(BigPushableLeverEntity* this) { - if (GetTileIndex(this->tilePositionLower, super->collisionLayer) == 0x4059) { + if (GetMetaTileIndex(this->tilePositionLower, super->collisionLayer) == 0x4059) { if (--this->timer == 0) { return TRUE; } BigPushableLever_CalculateSpriteOffsets(this); - SetTile(gUnk_081236E8[super->type2], this->tilePositionLower, super->collisionLayer); + SetMetaTile(gUnk_081236E8[super->type2], this->tilePositionLower, super->collisionLayer); } else { this->timer = 60; super->spriteOffsetX = 0; diff --git a/src/object/blockPushed.c b/src/object/blockPushed.c index eb19a284..a1201014 100644 --- a/src/object/blockPushed.c +++ b/src/object/blockPushed.c @@ -46,7 +46,7 @@ void BlockPushed_Init(BlockPushedEntity* this) { super->x.HALF.HI += tmp; super->y.HALF.HI += tmp; super->hitbox = (Hitbox*)gUnk_0811F64C[super->type]; - this->unk_68 = GetTileType(pos, (u32)super->collisionLayer); + this->unk_68 = GetMetaTileType(pos, (u32)super->collisionLayer); switch (super->type) { case 0: sub_080832D8(pos, this); diff --git a/src/object/board.c b/src/object/board.c index 6bb75f1c..4aea1824 100644 --- a/src/object/board.c +++ b/src/object/board.c @@ -54,7 +54,7 @@ void Board_Init(BoardEntity* this) { UpdateSpriteForCollisionLayer(super); super->spritePriority.b0 = 6; if (super->type == 0) { - SetTile(0x4074, this->tile - 0x40, super->collisionLayer); + SetMetaTile(0x4074, this->tile - 0x40, super->collisionLayer); } sub_08098BE8(this); } diff --git a/src/object/bollard.c b/src/object/bollard.c index 20994ca3..f604ee82 100644 --- a/src/object/bollard.c +++ b/src/object/bollard.c @@ -59,7 +59,7 @@ void Bollard_Action1(BollardEntity* this) { } super->action = 2; InitializeAnimation(super, 3); - SetTile(this->tileIndex, this->tile, super->collisionLayer); + SetMetaTile(this->tileIndex, this->tile, super->collisionLayer); EnqueueSFX(SFX_1A5); } @@ -94,9 +94,9 @@ void Bollard_Action4(BollardEntity* this) { void sub_0808B3AC(BollardEntity* this) { super->spritePriority.b0 = 4; this->tile = COORD_TO_TILE(super); - this->tileIndex = GetTileIndex(this->tile, super->collisionLayer); + this->tileIndex = GetMetaTileIndex(this->tile, super->collisionLayer); this->unk74 = GetCollisionDataAtMetaTilePos(this->tile, super->collisionLayer); - SetTile(0x400b, this->tile, super->collisionLayer); + SetMetaTile(0x400b, this->tile, super->collisionLayer); } void sub_0808B41C(BollardEntity* this) { diff --git a/src/object/bossDoor.c b/src/object/bossDoor.c index c1b3bcff..8a73de50 100644 --- a/src/object/bossDoor.c +++ b/src/object/bossDoor.c @@ -177,31 +177,31 @@ void sub_0808C4BC(BossDoorEntity* this) { void sub_0808C500(BossDoorEntity* this) { if ((this->unk_76 == 0) || (this->unk_76 == 2)) { - this->unk_78 = GetTileIndex(this->unk_74 - 1, super->collisionLayer); - this->unk_7a = GetTileIndex(this->unk_74, super->collisionLayer); - this->unk_7c = GetTileIndex(this->unk_74 + 1, super->collisionLayer); - SetTile(0x4022, this->unk_74 - 1, super->collisionLayer); - SetTile(0x4022, this->unk_74, super->collisionLayer); - SetTile(0x4022, this->unk_74 + 1, super->collisionLayer); + this->unk_78 = GetMetaTileIndex(this->unk_74 - 1, super->collisionLayer); + this->unk_7a = GetMetaTileIndex(this->unk_74, super->collisionLayer); + this->unk_7c = GetMetaTileIndex(this->unk_74 + 1, super->collisionLayer); + SetMetaTile(0x4022, this->unk_74 - 1, super->collisionLayer); + SetMetaTile(0x4022, this->unk_74, super->collisionLayer); + SetMetaTile(0x4022, this->unk_74 + 1, super->collisionLayer); } else { - this->unk_78 = GetTileIndex(this->unk_74 - 0x40, super->collisionLayer); - this->unk_7a = GetTileIndex(this->unk_74, super->collisionLayer); - this->unk_7c = GetTileIndex(this->unk_74 + 0x40, super->collisionLayer); - SetTile(0x4022, this->unk_74 - 0x40, super->collisionLayer); - SetTile(0x4022, this->unk_74, super->collisionLayer); - SetTile(0x4022, this->unk_74 + 0x40, super->collisionLayer); + this->unk_78 = GetMetaTileIndex(this->unk_74 - 0x40, super->collisionLayer); + this->unk_7a = GetMetaTileIndex(this->unk_74, super->collisionLayer); + this->unk_7c = GetMetaTileIndex(this->unk_74 + 0x40, super->collisionLayer); + SetMetaTile(0x4022, this->unk_74 - 0x40, super->collisionLayer); + SetMetaTile(0x4022, this->unk_74, super->collisionLayer); + SetMetaTile(0x4022, this->unk_74 + 0x40, super->collisionLayer); } } void sub_0808C5D0(BossDoorEntity* this) { if ((this->unk_76 == 0) || (this->unk_76 == 2)) { - SetTile(this->unk_78, this->unk_74 - 1, super->collisionLayer); - SetTile(this->unk_7a, this->unk_74, super->collisionLayer); - SetTile(this->unk_7c, this->unk_74 + 1, super->collisionLayer); + SetMetaTile(this->unk_78, this->unk_74 - 1, super->collisionLayer); + SetMetaTile(this->unk_7a, this->unk_74, super->collisionLayer); + SetMetaTile(this->unk_7c, this->unk_74 + 1, super->collisionLayer); } else { - SetTile(this->unk_78, this->unk_74 - 0x40, super->collisionLayer); - SetTile(this->unk_7a, this->unk_74, super->collisionLayer); - SetTile(this->unk_7c, this->unk_74 + 0x40, super->collisionLayer); + SetMetaTile(this->unk_78, this->unk_74 - 0x40, super->collisionLayer); + SetMetaTile(this->unk_7a, this->unk_74, super->collisionLayer); + SetMetaTile(this->unk_7c, this->unk_74 + 0x40, super->collisionLayer); } } diff --git a/src/object/bush.c b/src/object/bush.c index 449b332e..9d83d3e4 100644 --- a/src/object/bush.c +++ b/src/object/bush.c @@ -69,8 +69,8 @@ void Bush_Init(BushEntity* this) { super->flags2 = 4; super->hitbox = (Hitbox*)&gUnk_081205B4; this->unk_72 = 0; - this->unk_70 = GetTileIndex(COORD_TO_TILE(super), super->collisionLayer); - SetTile(0x4022, COORD_TO_TILE(super), super->collisionLayer); + this->unk_70 = GetMetaTileIndex(COORD_TO_TILE(super), super->collisionLayer); + SetMetaTile(0x4022, COORD_TO_TILE(super), super->collisionLayer); InitializeAnimation(super, gUnk_08120588[super->type].unk_0); } diff --git a/src/object/button.c b/src/object/button.c index ff68caba..4f17877e 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -32,10 +32,10 @@ void Button_Init(Entity* this) { } this->field_0x74.HWORD = (((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3F) | ((((this->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3F) << 6); - this->field_0x70.HALF.HI = GetTileType(this->field_0x74.HWORD, this->collisionLayer); + this->field_0x70.HALF.HI = GetMetaTileType(this->field_0x74.HWORD, this->collisionLayer); if (this->type == 0 && CheckFlags(this->field_0x86.HWORD)) { this->action = 5; - SetTileType(0x7A, this->field_0x74.HWORD, this->collisionLayer); + SetMetaTileType(0x7A, this->field_0x74.HWORD, this->collisionLayer); } else { if (sub_08081E3C(this)) { this->action = 2; @@ -48,7 +48,7 @@ void Button_Init(Entity* this) { void Button_Action1(Entity* this) { if (sub_08081E3C(this)) { this->action = 2; - this->field_0x70.HALF.HI = GetTileType(this->field_0x74.HWORD, this->collisionLayer); + this->field_0x70.HALF.HI = GetMetaTileType(this->field_0x74.HWORD, this->collisionLayer); } } @@ -94,7 +94,7 @@ void Button_Action4(Entity* this) { this->timer--; if (this->subtimer != 0) { this->subtimer = 0; - SetTile(0x4035, this->field_0x74.HWORD, this->collisionLayer); + SetMetaTile(0x4035, this->field_0x74.HWORD, this->collisionLayer); } if (sub_08081CB0(this)) { this->action = 3; @@ -103,7 +103,7 @@ void Button_Action4(Entity* this) { } else { this->action = 2; ClearFlag(this->field_0x86.HWORD); - SetTileType(0x77, this->field_0x74.HWORD, this->collisionLayer); + SetMetaTileType(0x77, this->field_0x74.HWORD, this->collisionLayer); SoundReq(SFX_BUTTON_PRESS); } } @@ -120,14 +120,14 @@ u32 sub_08081CB0(Entity* this) { u16 tmp; if (sub_08081D74(this)) { this->field_0x70.HALF.LO = -1; - if (GetTileType(this->field_0x74.HWORD, this->collisionLayer) == 0x4035) { + if (GetMetaTileType(this->field_0x74.HWORD, this->collisionLayer) == 0x4035) { sub_0807B7D8(0x78, this->field_0x74.HWORD, this->collisionLayer); } return 1; } else { - tmp = GetTileType(this->field_0x74.HWORD, this->collisionLayer); + tmp = GetMetaTileType(this->field_0x74.HWORD, this->collisionLayer); if (tmp != 0x77 && tmp != 0x79 && tmp != 0x4035) { - this->field_0x70.HALF.LO = GetTileIndex(this->field_0x74.HWORD, this->collisionLayer); + this->field_0x70.HALF.LO = GetMetaTileIndex(this->field_0x74.HWORD, this->collisionLayer); return 1; } } @@ -142,7 +142,7 @@ u32 sub_08081D28(Entity* this) { if (this->field_0x70.HALF_U.LO == 0xFFFF) { return 0; } - if (GetTileIndex(this->field_0x74.HWORD, this->collisionLayer) != this->field_0x70.HALF_U.LO) { + if (GetMetaTileIndex(this->field_0x74.HWORD, this->collisionLayer) != this->field_0x70.HALF_U.LO) { return 0; } } @@ -192,7 +192,7 @@ u32 sub_08081E3C(Entity* this) { }; const u16* tmp1; s32 tmp2; - tmp2 = GetTileType(this->field_0x74.HWORD, this->collisionLayer); + tmp2 = GetMetaTileType(this->field_0x74.HWORD, this->collisionLayer); tmp1 = gUnk_0811EE50; do { if (*tmp1 == tmp2) @@ -209,26 +209,26 @@ extern u16 gMapDataBottomSpecial[]; void sub_08081E6C(Entity* this) { u32 tileType; - LayerStruct* r1; + MapLayer* mapLayer; u16* tmp2; u16* tmp; u16* tmp3; u32 tilePosition = this->field_0x74.HWORD; u32 layer = this->collisionLayer; - u32 tile = GetTileType(tilePosition, layer); + u32 tile = GetMetaTileType(tilePosition, layer); if (tile < 0x4000) return; - r1 = GetLayerByIndex(layer); + mapLayer = GetLayerByIndex(layer); tileType = (this->type == 0 ? 0x7a : 0x78); - tmp = r1->metatiles; - tmp = tmp + (r1->unkData2[tileType] << 2); + tmp = mapLayer->metatiles; + tmp = tmp + (mapLayer->unkData2[tileType] << 2); tmp2 = (layer == 2 ? gMapDataTopSpecial : gMapDataBottomSpecial); tmp2 += (((0x3f & tilePosition) << 1) + ((0xfc0 & tilePosition) << 2)); if (sub_08081F00((u32*)tmp2, (u32*)tmp)) return; - SetTileType(tileType, tilePosition, layer); - SetTile(tile, tilePosition, layer); + SetMetaTileType(tileType, tilePosition, layer); + SetMetaTile(tile, tilePosition, layer); } // Are the two tiles already set to the correct one @@ -265,11 +265,11 @@ u32 sub_08081F7C(Entity* this, u32 r7) { } else { if (this->timer == 6) { SetFlag(this->field_0x86.HWORD); - SetTileType(r7, this->field_0x74.HWORD, this->collisionLayer); + SetMetaTileType(r7, this->field_0x74.HWORD, this->collisionLayer); sub_08081F24(this); SoundReq(SFX_BUTTON_PRESS); if (this->field_0x70.HALF_U.LO != 0xFFFF) - SetTile(this->field_0x70.HALF_U.LO, this->field_0x74.HWORD, this->collisionLayer); + SetMetaTile(this->field_0x70.HALF_U.LO, this->field_0x74.HWORD, this->collisionLayer); return 0; } } diff --git a/src/object/cabinFurniture.c b/src/object/cabinFurniture.c index c2704dcd..cb1c7f15 100644 --- a/src/object/cabinFurniture.c +++ b/src/object/cabinFurniture.c @@ -44,38 +44,38 @@ void CabinFurniture_Init(CabinFurnitureEntity* this) { super->spritePriority.b0 = 6; uVar7 = this->tile; uVar6 = uVar7 - 1; - SetTile(0x4022, uVar6, uVar1); - SetTile(0x4022, uVar7, uVar1); - SetTile(0x4022, uVar7 + 1, uVar1); - SetTile(0x4022, uVar7 + 0x3f, uVar1); - SetTile(0x4022, uVar7 + 0x40, uVar1); - SetTile(0x4022, uVar7 + 0x41, uVar1); - SetTile(0x403d, uVar7 - 0x41, uVar1); - SetTile(0x403d, uVar7 - 0x40, uVar1); - SetTile(0x4026, uVar7 - 0x3f, uVar1); - SetTile(0x4026, uVar7 - 0x81, uVar1); - SetTile(0x4026, uVar7 - 0x80, uVar1); + SetMetaTile(0x4022, uVar6, uVar1); + SetMetaTile(0x4022, uVar7, uVar1); + SetMetaTile(0x4022, uVar7 + 1, uVar1); + SetMetaTile(0x4022, uVar7 + 0x3f, uVar1); + SetMetaTile(0x4022, uVar7 + 0x40, uVar1); + SetMetaTile(0x4022, uVar7 + 0x41, uVar1); + SetMetaTile(0x403d, uVar7 - 0x41, uVar1); + SetMetaTile(0x403d, uVar7 - 0x40, uVar1); + SetMetaTile(0x4026, uVar7 - 0x3f, uVar1); + SetMetaTile(0x4026, uVar7 - 0x81, uVar1); + SetMetaTile(0x4026, uVar7 - 0x80, uVar1); break; case 1: super->action = 1; uVar6 = this->tile; - SetTile(0x4022, uVar6, uVar1); - SetTile(0x4022, uVar6 + 0x40, uVar1); - SetTile(0x4025, uVar6 + 0x41, uVar1); + SetMetaTile(0x4022, uVar6, uVar1); + SetMetaTile(0x4022, uVar6 + 0x40, uVar1); + SetMetaTile(0x4025, uVar6 + 0x41, uVar1); if (CheckLocalFlag(0x4f) == 0) { - SetTile(0x402f, uVar6 + 1, uVar1); + SetMetaTile(0x402f, uVar6 + 1, uVar1); } else { - SetTile(0x402d, uVar6 + 1, uVar1); + SetMetaTile(0x402d, uVar6 + 1, uVar1); } break; case 2: super->action = 1; uVar7 = this->tile; uVar6 = uVar7 - 0x41; - SetTile(0x4022, uVar6, uVar1); - SetTile(0x4022, uVar7 - 0x40, uVar1); - SetTile(0x4022, uVar7 - 1, uVar1); - SetTile(0x4022, uVar7, uVar1); + SetMetaTile(0x4022, uVar6, uVar1); + SetMetaTile(0x4022, uVar7 - 0x40, uVar1); + SetMetaTile(0x4022, uVar7 - 1, uVar1); + SetMetaTile(0x4022, uVar7, uVar1); break; } } diff --git a/src/object/carlovObject.c b/src/object/carlovObject.c index f4ffa8a9..27a2da2a 100644 --- a/src/object/carlovObject.c +++ b/src/object/carlovObject.c @@ -95,11 +95,11 @@ void CarlovObject_Type1Init(CarlovObjectEntity* this) { this->unk_72 = super->y.HALF.HI; super->spritePriority.b0 = 5; this->unk_76 = COORD_TO_TILE(super); - this->unk_74 = GetTileIndex(this->unk_76, super->collisionLayer); + this->unk_74 = GetMetaTileIndex(this->unk_76, super->collisionLayer); if (super->timer == 0) { super->action = 1; super->subtimer = 120; - SetTile(0x4022, this->unk_76, super->collisionLayer); + SetMetaTile(0x4022, this->unk_76, super->collisionLayer); } else { super->action = 3; super->spriteSettings.draw = 0; @@ -113,7 +113,7 @@ void CarlovObject_Type1Action1(CarlovObjectEntity* this) { super->action = 2; super->timer = 7; super->direction = 0; - SetTile(this->unk_74, this->unk_76, super->collisionLayer); + SetMetaTile(this->unk_74, this->unk_76, super->collisionLayer); EnqueueSFX(SFX_10B); } } @@ -142,7 +142,7 @@ void CarlovObject_Type1Action4(CarlovObjectEntity* this) { super->action = 5; sub_08083814(super, 2); EnqueueSFX(SFX_10B); - SetTile(0x4022, this->unk_76, super->collisionLayer); + SetMetaTile(0x4022, this->unk_76, super->collisionLayer); } } diff --git a/src/object/chestSpawner.c b/src/object/chestSpawner.c index 8a721a58..a3bfe455 100644 --- a/src/object/chestSpawner.c +++ b/src/object/chestSpawner.c @@ -232,7 +232,7 @@ void ChestSpawner_Type0Init(ChestSpawnerEntity* this) { super->action++; this->tilePosition = COORD_TO_TILE(super); super->hitbox = (Hitbox*)&gUnk_0811F8A8; - if (GetTileTypeByEntity(super) == 0x74) { + if (GetMetaTileTypeByEntity(super) == 0x74) { DeleteThisEntity(); } if (CheckFlags(this->unk_86)) { @@ -271,7 +271,7 @@ void ChestSpawner_Type0Action2(ChestSpawnerEntity* this) { void ChestSpawner_Type0Action3(ChestSpawnerEntity* this) { if ((super->type == 1) || (super->type == 7)) { - if (GetTileTypeByEntity(super) == 0x74) { + if (GetMetaTileTypeByEntity(super) == 0x74) { DeleteEntity(super); } else { if (!CheckFlags(this->unk_86)) { diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c index e9af7e85..e2c75700 100644 --- a/src/object/crenelBeanSprout.c +++ b/src/object/crenelBeanSprout.c @@ -10,6 +10,7 @@ #include "functions.h" #include "hitbox.h" #include "object.h" +#include "tiles.h" typedef struct { /*0x00*/ Entity base; @@ -55,13 +56,13 @@ void CrenelBeanSprout_Init(CrenelBeanSproutEntity* this) { if (CheckGlobalFlag(WATERBEAN_OUT)) { if (CheckGlobalFlag(WATERBEAN_PUT) == 0) { PositionRelative(&gPlayerEntity, super, 0, 0x10000); - SetTile(0x4022, 0xdc, super->collisionLayer); + SetMetaTile(0x4022, 0xdc, super->collisionLayer); } else { if (CheckLocalFlag(super->type2) == 0) { InitializeAnimation(super, 10); super->y.HALF.HI += 4; super->action = 4; - SetTile(0x403b, COORD_TO_TILE(super), super->collisionLayer); + SetMetaTile(0x403b, COORD_TO_TILE(super), super->collisionLayer); return; } super->type2 = 0; @@ -108,7 +109,7 @@ void CrenelBeanSprout_Init(CrenelBeanSproutEntity* this) { InitializeAnimation(super, 0xb); super->y.HALF.HI += 4; super->action = 4; - SetTile(0x4032, COORD_TO_TILE(super), super->collisionLayer); + SetMetaTile(0x4032, COORD_TO_TILE(super), super->collisionLayer); return; } else { super->type2 = 0; @@ -169,13 +170,13 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) { tmp = gPlayerEntity.animationState & 6; this->unk_70 = ((super->x.HALF.HI + (s8)gUnk_08123184[tmp]) & -0x10) | 8; this->unk_72 = ((super->y.HALF.HI + (s8)gUnk_08123184[(tmp) + 1]) & -0x10) | 8; - if (GetVvvAtWorldCoords(this->unk_70, this->unk_72, super->collisionLayer) == 0x19) { + if (GetVvvAtWorldCoords(this->unk_70, this->unk_72, super->collisionLayer) == VVV_25) { gHUD.rActionPlayerState = R_ACTION_THROW; } else { gHUD.rActionPlayerState = R_ACTION_NONE; } PositionRelative(&gPlayerEntity, super, 0, 0x10000); - if (GetVvvAtEntity(super) == 0x19) { + if (GetVvvAtEntity(super) == VVV_25) { RestorePrevTileEntity(0xdc, super->collisionLayer); sub_08096A78(this); } @@ -234,7 +235,7 @@ void CrenelBeanSprout_Action3(CrenelBeanSproutEntity* this) { void CrenelBeanSprout_Action4(CrenelBeanSproutEntity* this) { static const u16 gUnk_0812319C[] = { 0x403c, 0x4033 }; - if (gUnk_0812319C[super->type >> 1] == GetTileTypeByEntity(super)) { + if (gUnk_0812319C[super->type >> 1] == GetMetaTileTypeByEntity(super)) { GetNextFrame(super); gPlayerState.keepFacing |= 0x80; gPlayerState.field_0xa |= 0x80; @@ -330,5 +331,5 @@ void sub_08096A78(CrenelBeanSproutEntity* this) { sub_08004168(super); super->y.HALF.HI += 4; super->action = 3; - SetTile(0x403b, COORD_TO_TILE(super), super->collisionLayer); + SetMetaTile(0x403b, COORD_TO_TILE(super), super->collisionLayer); } diff --git a/src/object/cuccoMinigame.c b/src/object/cuccoMinigame.c index f6b02dd1..3e04e6ae 100644 --- a/src/object/cuccoMinigame.c +++ b/src/object/cuccoMinigame.c @@ -363,11 +363,11 @@ void CuccoMinigame_TellObjective(void) { } void sub_080A1648(void) { - SetTileType(0x407f, 0xd36, 1); - SetTileType(0x407f, 0xd37, 1); - SetTileType(0x407f, 0xd38, 1); - SetTileType(0x407e, 0xd75, 1); - SetTileType(0x407e, 0xe75, 1); + SetMetaTileType(0x407f, 0xd36, 1); + SetMetaTileType(0x407f, 0xd37, 1); + SetMetaTileType(0x407f, 0xd38, 1); + SetMetaTileType(0x407e, 0xd75, 1); + SetMetaTileType(0x407e, 0xe75, 1); } void sub_080A169C(void) { diff --git a/src/object/doubleBookshelf.c b/src/object/doubleBookshelf.c index 877c3014..ef7c3484 100644 --- a/src/object/doubleBookshelf.c +++ b/src/object/doubleBookshelf.c @@ -74,7 +74,7 @@ void DoubleBookshelf_Init(DoubleBookshelfEntity* this) { } void DoubleBookshelf_Action1(DoubleBookshelfEntity* this) { - GetTileType(this->unk_82, super->collisionLayer); + GetMetaTileType(this->unk_82, super->collisionLayer); sub_0809B234(this); } @@ -100,39 +100,39 @@ void sub_0809B0B0(DoubleBookshelfEntity* this) { case 0: this->unk_84 = 0; this->unk_82 = position + 2; - SetTile(0x4082, position - 1, layer); - SetTile(0x4022, position, layer); - SetTile(0x4022, position + 1, layer); - SetTile(0x4022, position + 2, layer); + SetMetaTile(0x4082, position - 1, layer); + SetMetaTile(0x4022, position, layer); + SetMetaTile(0x4022, position + 1, layer); + SetMetaTile(0x4022, position + 2, layer); break; case 1: this->unk_84 = 1; this->unk_82 = position; - SetTile(0x405f, position, layer); - SetTile(0x4022, position + 1, layer); - SetTile(0x4022, position + 2, layer); - SetTile(0x4082, position + 3, layer); + SetMetaTile(0x405f, position, layer); + SetMetaTile(0x4022, position + 1, layer); + SetMetaTile(0x4022, position + 2, layer); + SetMetaTile(0x4082, position + 3, layer); break; case 2: this->unk_84 = 1; this->unk_82 = position; - SetTile(0x4082, position + 3, layer); - SetTile(0x4022, position + 2, layer); - SetTile(0x405f, position, layer); + SetMetaTile(0x4082, position + 3, layer); + SetMetaTile(0x4022, position + 2, layer); + SetMetaTile(0x405f, position, layer); SetFlag(((DoubleBookshelfEntity*)super->parent)->unk_86); break; case 3: this->unk_84 = 0; this->unk_82 = position + 2; - SetTile(0x4082, position - 1, layer); - SetTile(0x4022, position, layer); - SetTile(0x405f, position + 2, layer); + SetMetaTile(0x4082, position - 1, layer); + SetMetaTile(0x4022, position, layer); + SetMetaTile(0x405f, position + 2, layer); ClearFlag(((DoubleBookshelfEntity*)super->parent)->unk_86); break; case 4: - SetTile(0x4022, position, layer); - SetTile(0x4022, position + 1, layer); - SetTile(0x4022, position + 2, layer); + SetMetaTile(0x4022, position, layer); + SetMetaTile(0x4022, position + 1, layer); + SetMetaTile(0x4022, position + 2, layer); break; } } @@ -159,7 +159,7 @@ void sub_0809B274(DoubleBookshelfEntity* this) { case 1: if (player->x.HALF.HI + 0x1c > super->x.HALF.HI) { this->unk_84 = 2; - SetTile(0x4022, this->unk_80 + 2, 1); + SetMetaTile(0x4022, this->unk_80 + 2, 1); sub_0809B358((DoubleBookshelfEntity*)super->child); return; } @@ -184,7 +184,7 @@ void sub_0809B334(DoubleBookshelfEntity* this) { s32 index; u32 position = this->unk_80 - 0x81; for (index = 2; index >= 0; index--, position++) { - SetTile(0x4026, position, 1); + SetMetaTile(0x4026, position, 1); } } @@ -196,7 +196,7 @@ void sub_0809B358(DoubleBookshelfEntity* this) { const u16* array = &gUnk_08123D68[this->unk_84]; u32 position = this->unk_80 - 0x82; for (index = 4; index >= 0;) { - SetTile(*array, position, 1); + SetMetaTile(*array, position, 1); index--; position++; array += 2; diff --git a/src/object/figurineDevice.c b/src/object/figurineDevice.c index bf406be3..abaa443a 100644 --- a/src/object/figurineDevice.c +++ b/src/object/figurineDevice.c @@ -307,9 +307,9 @@ void sub_08087F58(FigurineDeviceEntity* this) { switch (super->type) { case 0: case 1: - SetTile(0x4022, this->unk_78 - 1, 1); - SetTile(0x4022, this->unk_78, 1); - SetTile(0x4022, this->unk_78 + 1, 1); + SetMetaTile(0x4022, this->unk_78 - 1, 1); + SetMetaTile(0x4022, this->unk_78, 1); + SetMetaTile(0x4022, this->unk_78 + 1, 1); break; } } diff --git a/src/object/fireplace.c b/src/object/fireplace.c index 57a7cef9..830cf0b8 100644 --- a/src/object/fireplace.c +++ b/src/object/fireplace.c @@ -29,7 +29,7 @@ void Fireplace_Init(Entity* this) { DeleteThisEntity(); } else { sub_0807B7D8(0x30b, TILE(this->x.HALF.HI, this->y.HALF.HI), 2); - SetTile(0x4061, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); + SetMetaTile(0x4061, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); } Fireplace_Action1(this); } @@ -43,7 +43,7 @@ void Fireplace_Action1(Entity* this) { } void sub_0809B7C0(Entity* this) { - u32 tileType = GetTileTypeByEntity(this); + u32 tileType = GetMetaTileTypeByEntity(this); if (tileType != 0x4061 && tileType != 0x4062) { sub_0809B7DC(this); } @@ -51,6 +51,6 @@ void sub_0809B7C0(Entity* this) { void sub_0809B7DC(Entity* this) { sub_0807B7D8(0xc3 << 2, TILE(this->x.HALF.HI, this->y.HALF.HI), 2); - SetTile(0x4062, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); + SetMetaTile(0x4062, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); this->timer = 1; } diff --git a/src/object/frozenWaterElement.c b/src/object/frozenWaterElement.c index 377dd87c..52a1f814 100644 --- a/src/object/frozenWaterElement.c +++ b/src/object/frozenWaterElement.c @@ -115,33 +115,33 @@ void FrozenWaterElement_Action2(FrozenWaterElementEntity* this) { void sub_0809C0A8(FrozenWaterElementEntity* this) { u32 position = COORD_TO_TILE(super); - SetTile(0x4022, position - 0x41, super->collisionLayer); - SetTile(0x4022, position - 0x40, super->collisionLayer); - SetTile(0x4022, position - 0x3f, super->collisionLayer); - SetTile(0x4022, position - 2, super->collisionLayer); - SetTile(0x4022, position - 1, super->collisionLayer); - SetTile(0x4022, position, super->collisionLayer); - SetTile(0x4022, position + 1, super->collisionLayer); - SetTile(0x4022, position + 2, super->collisionLayer); - SetTile(0x4022, position + 0x3e, super->collisionLayer); - SetTile(0x4022, position + 0x3f, super->collisionLayer); - SetTile(0x4022, position + 0x40, super->collisionLayer); - SetTile(0x4022, position + 0x41, super->collisionLayer); - SetTile(0x4022, position + 0x42, super->collisionLayer); - SetTile(0x4022, position + 0x7f, super->collisionLayer); - SetTile(0x4022, position + 0x80, super->collisionLayer); - SetTile(0x4022, position + 0x81, super->collisionLayer); - SetTile(0x4022, position + 0x13f, super->collisionLayer); - SetTile(0x4022, position + 0x140, super->collisionLayer); - SetTile(0x4022, position + 0x141, super->collisionLayer); - SetTile(0x4022, position + 0x17f, super->collisionLayer); - SetTile(0x4022, position + 0x181, super->collisionLayer); - SetTile(0x4022, position + 0x1bd, super->collisionLayer); - SetTile(0x4022, position + 0x1be, super->collisionLayer); - SetTile(0x4022, position + 0x1bf, super->collisionLayer); - SetTile(0x4022, position + 0x1c1, super->collisionLayer); - SetTile(0x4022, position + 0x1c2, super->collisionLayer); - SetTile(0x4022, position + 0x1c3, super->collisionLayer); + SetMetaTile(0x4022, position - 0x41, super->collisionLayer); + SetMetaTile(0x4022, position - 0x40, super->collisionLayer); + SetMetaTile(0x4022, position - 0x3f, super->collisionLayer); + SetMetaTile(0x4022, position - 2, super->collisionLayer); + SetMetaTile(0x4022, position - 1, super->collisionLayer); + SetMetaTile(0x4022, position, super->collisionLayer); + SetMetaTile(0x4022, position + 1, super->collisionLayer); + SetMetaTile(0x4022, position + 2, super->collisionLayer); + SetMetaTile(0x4022, position + 0x3e, super->collisionLayer); + SetMetaTile(0x4022, position + 0x3f, super->collisionLayer); + SetMetaTile(0x4022, position + 0x40, super->collisionLayer); + SetMetaTile(0x4022, position + 0x41, super->collisionLayer); + SetMetaTile(0x4022, position + 0x42, super->collisionLayer); + SetMetaTile(0x4022, position + 0x7f, super->collisionLayer); + SetMetaTile(0x4022, position + 0x80, super->collisionLayer); + SetMetaTile(0x4022, position + 0x81, super->collisionLayer); + SetMetaTile(0x4022, position + 0x13f, super->collisionLayer); + SetMetaTile(0x4022, position + 0x140, super->collisionLayer); + SetMetaTile(0x4022, position + 0x141, super->collisionLayer); + SetMetaTile(0x4022, position + 0x17f, super->collisionLayer); + SetMetaTile(0x4022, position + 0x181, super->collisionLayer); + SetMetaTile(0x4022, position + 0x1bd, super->collisionLayer); + SetMetaTile(0x4022, position + 0x1be, super->collisionLayer); + SetMetaTile(0x4022, position + 0x1bf, super->collisionLayer); + SetMetaTile(0x4022, position + 0x1c1, super->collisionLayer); + SetMetaTile(0x4022, position + 0x1c2, super->collisionLayer); + SetMetaTile(0x4022, position + 0x1c3, super->collisionLayer); } void sub_0809C23C(FrozenWaterElementEntity* this) { diff --git a/src/object/furniture.c b/src/object/furniture.c index b274a37f..eb5a496f 100644 --- a/src/object/furniture.c +++ b/src/object/furniture.c @@ -9,6 +9,7 @@ #include "functions.h" #include "object.h" #include "room.h" +#include "tiles.h" enum { FURNITURE_INIT, @@ -216,14 +217,14 @@ static void FurnitureInit(FurnitureEntity* this) { break; case 0x40: super->y.HALF.HI = (super->y.HALF.HI & ~0xF) | 4; - SetTile(0x4017, this->tile - 128, 1); - SetTile(0x4017, this->tile - 64, 1); + SetMetaTile(0x4017, this->tile - 128, 1); + SetMetaTile(0x4017, this->tile - 64, 1); break; case 0x80: super->frameIndex = 0; super->y.HALF.HI = (super->y.HALF.HI & ~0xF) | 6; this->tile = COORD_TO_TILE(super); - SetTile(0x4026, this->tile, super->collisionLayer); + SetMetaTile(0x4026, this->tile, super->collisionLayer); break; case 0x200: break; @@ -259,9 +260,9 @@ static void FurnitureInit(FurnitureEntity* this) { tile = this->tile - 129; cnt = super->type != 26 ? 3 : 2; for (i = 0; i < cnt; ++i, ++tile) { - SetTile(0x4026, tile, 2); - SetTile(0x4026, tile, 1); - SetVvvAtMetaTilePos(0, tile + 64, 1); + SetMetaTile(0x4026, tile, 2); + SetMetaTile(0x4026, tile, 1); + SetVvvAtMetaTilePos(VVV_0, tile + 64, 1); } break; } @@ -286,22 +287,22 @@ static void FurnitureInit(FurnitureEntity* this) { case STAIRCASE: super->collisionLayer = 1; super->spriteOrientation.flipY = 2; - SetTile(0x4074, this->tile - 64, super->collisionLayer); - SetVvvAtMetaTilePos(63, this->tile - 64, super->collisionLayer); - SetTile(0x4017, this->tile, super->collisionLayer); - SetTile(0x4017, this->tile + 64, super->collisionLayer); + SetMetaTile(0x4074, this->tile - 64, super->collisionLayer); + SetVvvAtMetaTilePos(VVV_63, this->tile - 64, super->collisionLayer); + SetMetaTile(0x4017, this->tile, super->collisionLayer); + SetMetaTile(0x4017, this->tile + 64, super->collisionLayer); break; case MINISH_CHEESE: if (super->type2 != 0) super->spriteOffsetX = -4; break; case WOODEN_TABLE: - SetTile(0x4023, this->tile - 65, super->collisionLayer); - SetTile(0x4023, this->tile - 64, super->collisionLayer); - SetTile(0x4023, this->tile - 63, super->collisionLayer); + SetMetaTile(0x4023, this->tile - 65, super->collisionLayer); + SetMetaTile(0x4023, this->tile - 64, super->collisionLayer); + SetMetaTile(0x4023, this->tile - 63, super->collisionLayer); break; case LOW_BOOKSHELF: - SetTile(0x4022, this->tile + 65, super->collisionLayer); + SetMetaTile(0x4022, this->tile + 65, super->collisionLayer); } } @@ -337,20 +338,20 @@ static void FurnitureUpdate(FurnitureEntity* this) { break; case 0x80: if (gPlayerEntity.y.HALF.HI < super->y.HALF.HI + 8) { - if (gPlayerState.floor_type != SURFACE_LADDER && GetTileTypeByEntity(super) == 0x4017) { - SetTile(0x4026, this->tile, super->collisionLayer); - SetTile(0x403D, this->tile - 64, super->collisionLayer); - SetTile(0x403D, this->tile - 128, super->collisionLayer); + if (gPlayerState.floor_type != SURFACE_LADDER && GetMetaTileTypeByEntity(super) == 0x4017) { + SetMetaTile(0x4026, this->tile, super->collisionLayer); + SetMetaTile(0x403D, this->tile - 64, super->collisionLayer); + SetMetaTile(0x403D, this->tile - 128, super->collisionLayer); } } else { if (gPlayerEntity.collisionLayer & 2) { gPlayerEntity.collisionLayer = 1; UpdateSpriteForCollisionLayer(&gPlayerEntity); } - if (GetTileTypeByEntity(super) != 0x4017) { - SetTile(0x4017, this->tile, super->collisionLayer); - SetTile(0x4017, this->tile - 64, super->collisionLayer); - SetTile(0x4014, this->tile - 128, super->collisionLayer); + if (GetMetaTileTypeByEntity(super) != 0x4017) { + SetMetaTile(0x4017, this->tile, super->collisionLayer); + SetMetaTile(0x4017, this->tile - 64, super->collisionLayer); + SetMetaTile(0x4014, this->tile - 128, super->collisionLayer); } } break; @@ -375,28 +376,28 @@ static void sub_08090B6C(FurnitureEntity* this) { num = 2; } for (i = -num; i <= num; ++i) { - SetTile(0x4022, tile + i, cl); + SetMetaTile(0x4022, tile + i, cl); } if (px & 8) { sub_08090CDC(0x4024, tile - i, cl); sub_08090CDC(0x4025, tile + i, cl); } else { - SetTile(0x4022, tile - i, cl); + SetMetaTile(0x4022, tile - i, cl); } break; case 1: num = w2 / 8; for (i = -num; i <= num; i++) { - SetTile(0x4022, tile + i, cl); + SetMetaTile(0x4022, tile + i, cl); } if (px & 8) { sub_08090CDC(0x4024, tile - i, cl); if (i != 0) { - SetTile(0x4022, tile + i, cl); + SetMetaTile(0x4022, tile + i, cl); } } else { if (i != 0) { - SetTile(0x4022, tile - i, cl); + SetMetaTile(0x4022, tile - i, cl); } sub_08090CDC(0x4025, tile + i, cl); } @@ -404,10 +405,10 @@ static void sub_08090B6C(FurnitureEntity* this) { case 2: num = w2 / 4; for (i = -num; i < num; ++i) { - SetTile(0x4022, tile + i, cl); + SetMetaTile(0x4022, tile + i, cl); } if (px & 8) { - SetTile(0x4022, tile + i, cl); + SetMetaTile(0x4022, tile + i, cl); } else { sub_08090CDC(0x4024, tile - i - 1, cl); sub_08090CDC(0x4025, tile + i, cl); @@ -416,7 +417,7 @@ static void sub_08090B6C(FurnitureEntity* this) { case 3: num = w2 / 4; for (i = -num; i <= num; ++i) { - SetTile(0x4022, tile + i, cl); + SetMetaTile(0x4022, tile + i, cl); } if (px & 8) { sub_08090CDC(0x4025, tile + i, cl); @@ -429,12 +430,12 @@ static void sub_08090B6C(FurnitureEntity* this) { } static void sub_08090CDC(u32 id, u32 pos, u32 layer) { - u16 cur = GetTileIndex(pos, layer); + u16 cur = GetMetaTileIndex(pos, layer); u32 next = cur; u32 id2; if ((cur & 0x4000) == 0) { - SetTile(id, pos, layer); + SetMetaTile(id, pos, layer); } else { switch (cur) { case 0x4025: @@ -472,7 +473,7 @@ static void sub_08090CDC(u32 id, u32 pos, u32 layer) { default: return; } - SetTile(next, pos, layer); + SetMetaTile(next, pos, layer); } } diff --git a/src/object/gentariCurtain.c b/src/object/gentariCurtain.c index 14a25cea..dd9f70d6 100644 --- a/src/object/gentariCurtain.c +++ b/src/object/gentariCurtain.c @@ -58,10 +58,10 @@ void GentariCurtain_Init(GentariCurtainEntity* this) { UpdateSpriteForCollisionLayer(super); this->tile = COORD_TO_TILE_OFFSET(super, 0, 8); this->tile2 = COORD_TO_TILE_OFFSET(super, 0, -8); - this->tileIndex = GetTileIndex(this->tile, 1); - this->tileIndex2 = GetTileIndex(this->tile2, 1); - SetTile(0x4022, this->tile, 1); - SetTile(0x4022, this->tile2, 1); + this->tileIndex = GetMetaTileIndex(this->tile, 1); + this->tileIndex2 = GetMetaTileIndex(this->tile2, 1); + SetMetaTile(0x4022, this->tile, 1); + SetMetaTile(0x4022, this->tile2, 1); InitAnimationForceUpdate(super, 0); } else { super->action = 1; @@ -81,8 +81,8 @@ void GentariCurtain_Action2(GentariCurtainEntity* this) { UpdateAnimationSingleFrame(super); if ((super->frame & ANIM_DONE) != 0) { super->action = 3; - SetTile(this->tileIndex, this->tile, 1); - SetTile(this->tileIndex2, this->tile2, 1); + SetMetaTile(this->tileIndex, this->tile, 1); + SetMetaTile(this->tileIndex2, this->tile2, 1); sub_08092214(this); sub_0809223C(this); InitAnimationForceUpdate(super, 1); diff --git a/src/object/giantBookLadder.c b/src/object/giantBookLadder.c index fd1e2a25..6789ecfa 100644 --- a/src/object/giantBookLadder.c +++ b/src/object/giantBookLadder.c @@ -51,36 +51,36 @@ void sub_0808E55C(GiantBookLadderEntity* this) { case 2: position = this->unk74; unaff_r9 = position - 0x101; - SetTile(0x408f, unaff_r9, super->collisionLayer); - SetTile(0x408f, position - 0x100, super->collisionLayer); - SetTile(0x406c, position - 0x102, super->collisionLayer); - SetTile(0x406d, position - 0xff, super->collisionLayer); + SetMetaTile(0x408f, unaff_r9, super->collisionLayer); + SetMetaTile(0x408f, position - 0x100, super->collisionLayer); + SetMetaTile(0x406c, position - 0x102, super->collisionLayer); + SetMetaTile(0x406d, position - 0xff, super->collisionLayer); type = super->type; uVar5 = 6; if (type != 0) { uVar5 = 4; - SetTile(0x4072, position + 0x3f, super->collisionLayer); - SetTile(0x4072, position + 0x40, super->collisionLayer); - SetTile(0x4072, position + 0x7f, super->collisionLayer); - SetTile(0x4072, position + 0x80, super->collisionLayer); + SetMetaTile(0x4072, position + 0x3f, super->collisionLayer); + SetMetaTile(0x4072, position + 0x40, super->collisionLayer); + SetMetaTile(0x4072, position + 0x7f, super->collisionLayer); + SetMetaTile(0x4072, position + 0x80, super->collisionLayer); } break; case 1: position = this->unk74; unaff_r9 = position - 1; - SetTile(0x408e, unaff_r9, super->collisionLayer); - SetTile(0x408e, position, super->collisionLayer); + SetMetaTile(0x408e, unaff_r9, super->collisionLayer); + SetMetaTile(0x408e, position, super->collisionLayer); uVar5 = 2; break; } for (uVar4 = 0; uVar4 < uVar5; uVar4++) { unaff_r9 += 0x40; - SetTile(0x408e, unaff_r9, super->collisionLayer); - SetTile(0x408e, unaff_r9 + 1, super->collisionLayer); + SetMetaTile(0x408e, unaff_r9, super->collisionLayer); + SetMetaTile(0x408e, unaff_r9 + 1, super->collisionLayer); } } u32 sub_0808E670(GiantBookLadderEntity* this) { - return GetTileType(this->unk74 - 0x101, 1); + return GetMetaTileType(this->unk74 - 0x101, 1); } diff --git a/src/object/giantLeaf.c b/src/object/giantLeaf.c index caab128c..b3a0a475 100644 --- a/src/object/giantLeaf.c +++ b/src/object/giantLeaf.c @@ -35,6 +35,6 @@ void sub_0808D618(Entity* ent) { ((((ent->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3F) * 64); for (i = 0; i < 13; i++) { - SetTile(16500, tilePos + arr[i], 1); + SetMetaTile(16500, tilePos + arr[i], 1); } } diff --git a/src/object/giantRock2.c b/src/object/giantRock2.c index 923a4dbe..92ac876c 100644 --- a/src/object/giantRock2.c +++ b/src/object/giantRock2.c @@ -39,10 +39,10 @@ void GiantRock2_Init(GiantRock2Entity* this) { position = (this->tile - 0x80); tileIndex = 0x4022; for (index = 4; index > -1; index--) { - SetTile(tileIndex, position - 2, collisionLayer); - SetTile(tileIndex, position - 1, collisionLayer); - SetTile(tileIndex, position, collisionLayer); - SetTile(tileIndex, position + 1, collisionLayer); + SetMetaTile(tileIndex, position - 2, collisionLayer); + SetMetaTile(tileIndex, position - 1, collisionLayer); + SetMetaTile(tileIndex, position, collisionLayer); + SetMetaTile(tileIndex, position + 1, collisionLayer); position += 0x40; } } diff --git a/src/object/giantTwig.c b/src/object/giantTwig.c index 7927c32c..0ed9a81d 100644 --- a/src/object/giantTwig.c +++ b/src/object/giantTwig.c @@ -158,7 +158,7 @@ void sub_08093984(GiantTwigEntity* this) { } for (index = 0; index < 0x13; index++) { - SetTile(0x4074, array[index] + this->tilePosition, 1); + SetMetaTile(0x4074, array[index] + this->tilePosition, 1); } } @@ -177,47 +177,47 @@ void GiantTwig_Type3Idle(GiantTwigEntity* this) { void sub_08093A1C(GiantTwigEntity* this) { switch (super->type) { case 0: - SetTile(0x4024, this->tilePosition + 0x3c, super->collisionLayer); - SetTile(0x4022, this->tilePosition + 0x3d, super->collisionLayer); - SetTile(0x4022, this->tilePosition + 0x3e, super->collisionLayer); - SetTile(0x4029, this->tilePosition + 0x7c, super->collisionLayer); - SetTile(0x4026, this->tilePosition + 0x7d, super->collisionLayer); - SetTile(0x4026, this->tilePosition + 0x7e, super->collisionLayer); - SetTile(0x403d, this->tilePosition + 0x40, super->collisionLayer); - SetTile(0x403d, this->tilePosition + 0x80, super->collisionLayer); - SetTile(0x4027, this->tilePosition + 0x41, super->collisionLayer); - SetTile(0x4023, this->tilePosition + 0x42, super->collisionLayer); - SetTile(0x406d, this->tilePosition + 0x43, super->collisionLayer); - SetTile(0x4029, this->tilePosition + 0x81, super->collisionLayer); - SetTile(0x4026, this->tilePosition + 0x82, super->collisionLayer); - SetTile(0x4026, this->tilePosition + 0x83, super->collisionLayer); + SetMetaTile(0x4024, this->tilePosition + 0x3c, super->collisionLayer); + SetMetaTile(0x4022, this->tilePosition + 0x3d, super->collisionLayer); + SetMetaTile(0x4022, this->tilePosition + 0x3e, super->collisionLayer); + SetMetaTile(0x4029, this->tilePosition + 0x7c, super->collisionLayer); + SetMetaTile(0x4026, this->tilePosition + 0x7d, super->collisionLayer); + SetMetaTile(0x4026, this->tilePosition + 0x7e, super->collisionLayer); + SetMetaTile(0x403d, this->tilePosition + 0x40, super->collisionLayer); + SetMetaTile(0x403d, this->tilePosition + 0x80, super->collisionLayer); + SetMetaTile(0x4027, this->tilePosition + 0x41, super->collisionLayer); + SetMetaTile(0x4023, this->tilePosition + 0x42, super->collisionLayer); + SetMetaTile(0x406d, this->tilePosition + 0x43, super->collisionLayer); + SetMetaTile(0x4029, this->tilePosition + 0x81, super->collisionLayer); + SetMetaTile(0x4026, this->tilePosition + 0x82, super->collisionLayer); + SetMetaTile(0x4026, this->tilePosition + 0x83, super->collisionLayer); break; case 1: if ((super->type2 & 1) != 0) { - SetTile(0x406d, this->tilePosition - 0x81, super->collisionLayer); - SetTile(0x4022, this->tilePosition - 0x41, super->collisionLayer); - SetTile(0x4029, this->tilePosition - 2, super->collisionLayer); - SetTile(0x4026, this->tilePosition - 1, super->collisionLayer); - SetTile(0x4022, this->tilePosition, super->collisionLayer); - SetTile(0x406d, this->tilePosition + 1, super->collisionLayer); - SetTile(0x406e, this->tilePosition + 0x40, super->collisionLayer); - SetTile(0x4022, this->tilePosition + 0x41, super->collisionLayer); - SetTile(0x406d, this->tilePosition + 0x42, super->collisionLayer); + SetMetaTile(0x406d, this->tilePosition - 0x81, super->collisionLayer); + SetMetaTile(0x4022, this->tilePosition - 0x41, super->collisionLayer); + SetMetaTile(0x4029, this->tilePosition - 2, super->collisionLayer); + SetMetaTile(0x4026, this->tilePosition - 1, super->collisionLayer); + SetMetaTile(0x4022, this->tilePosition, super->collisionLayer); + SetMetaTile(0x406d, this->tilePosition + 1, super->collisionLayer); + SetMetaTile(0x406e, this->tilePosition + 0x40, super->collisionLayer); + SetMetaTile(0x4022, this->tilePosition + 0x41, super->collisionLayer); + SetMetaTile(0x406d, this->tilePosition + 0x42, super->collisionLayer); } else { - SetTile(0x406c, this->tilePosition - 0x7f, super->collisionLayer); - SetTile(0x4022, this->tilePosition - 0x3f, super->collisionLayer); - SetTile(0x406c, this->tilePosition - 1, super->collisionLayer); - SetTile(0x4022, this->tilePosition, super->collisionLayer); - SetTile(0x4026, this->tilePosition + 1, super->collisionLayer); - SetTile(0x402a, this->tilePosition + 2, super->collisionLayer); - SetTile(0x406c, this->tilePosition + 0x3e, super->collisionLayer); - SetTile(0x4022, this->tilePosition + 0x3f, super->collisionLayer); - SetTile(0x406f, this->tilePosition + 0x40, super->collisionLayer); + SetMetaTile(0x406c, this->tilePosition - 0x7f, super->collisionLayer); + SetMetaTile(0x4022, this->tilePosition - 0x3f, super->collisionLayer); + SetMetaTile(0x406c, this->tilePosition - 1, super->collisionLayer); + SetMetaTile(0x4022, this->tilePosition, super->collisionLayer); + SetMetaTile(0x4026, this->tilePosition + 1, super->collisionLayer); + SetMetaTile(0x402a, this->tilePosition + 2, super->collisionLayer); + SetMetaTile(0x406c, this->tilePosition + 0x3e, super->collisionLayer); + SetMetaTile(0x4022, this->tilePosition + 0x3f, super->collisionLayer); + SetMetaTile(0x406f, this->tilePosition + 0x40, super->collisionLayer); return; } break; case 3: - SetTile(0x4022, this->tilePosition, super->collisionLayer); + SetMetaTile(0x4022, this->tilePosition, super->collisionLayer); break; } } @@ -226,12 +226,12 @@ void sub_08093C70(GiantTwigEntity* this) { if (this->unk_78 != 0) { if (gPlayerState.heldObject != 0) { this->unk_78 = 0; - SetTile(0x4022, this->tilePosition + 0x3f, super->collisionLayer); - SetTile(0x4022, this->tilePosition + 0x40, super->collisionLayer); - SetTile(0x4022, this->tilePosition + 0x41, super->collisionLayer); - SetTile(0x4026, this->tilePosition + 0x7f, super->collisionLayer); - SetTile(0x4026, this->tilePosition + 0x80, super->collisionLayer); - SetTile(0x4026, this->tilePosition + 0x81, super->collisionLayer); + SetMetaTile(0x4022, this->tilePosition + 0x3f, super->collisionLayer); + SetMetaTile(0x4022, this->tilePosition + 0x40, super->collisionLayer); + SetMetaTile(0x4022, this->tilePosition + 0x41, super->collisionLayer); + SetMetaTile(0x4026, this->tilePosition + 0x7f, super->collisionLayer); + SetMetaTile(0x4026, this->tilePosition + 0x80, super->collisionLayer); + SetMetaTile(0x4026, this->tilePosition + 0x81, super->collisionLayer); } } else { @@ -239,12 +239,12 @@ void sub_08093C70(GiantTwigEntity* this) { if (--this->unk_7a == 0) { this->unk_78++; this->unk_7a = 0x3c; - SetTile(0x403d, this->tilePosition + 0x3f, super->collisionLayer); - SetTile(0x403d, this->tilePosition + 0x40, super->collisionLayer); - SetTile(0x4027, this->tilePosition + 0x41, super->collisionLayer); - SetTile(0x403d, this->tilePosition + 0x7f, super->collisionLayer); - SetTile(0x403d, this->tilePosition + 0x80, super->collisionLayer); - SetTile(0x4029, this->tilePosition + 0x81, super->collisionLayer); + SetMetaTile(0x403d, this->tilePosition + 0x3f, super->collisionLayer); + SetMetaTile(0x403d, this->tilePosition + 0x40, super->collisionLayer); + SetMetaTile(0x4027, this->tilePosition + 0x41, super->collisionLayer); + SetMetaTile(0x403d, this->tilePosition + 0x7f, super->collisionLayer); + SetMetaTile(0x403d, this->tilePosition + 0x80, super->collisionLayer); + SetMetaTile(0x4029, this->tilePosition + 0x81, super->collisionLayer); } } } diff --git a/src/object/hiddenLadderDown.c b/src/object/hiddenLadderDown.c index d2369721..c519bac2 100644 --- a/src/object/hiddenLadderDown.c +++ b/src/object/hiddenLadderDown.c @@ -34,20 +34,20 @@ void HiddenLadderDown_Init(Entity* this) { if (CheckFlags(this->field_0x86.HWORD) != 0) { this->action = 2; this->spriteSettings.draw = TRUE; - SetTileType(0x1a2, *puVar3 - 0x41, this->collisionLayer); - SetTileType(0x1a3, *puVar3 - 0x40, this->collisionLayer); - SetTileType(0x1a4, *puVar3 - 0x3f, this->collisionLayer); - SetTileType(0x1a5, *puVar3 - 1, this->collisionLayer); - SetTileType(0x1a6, *puVar3, this->collisionLayer); - SetTileType(0x1a7, *puVar3 + 1, this->collisionLayer); - SetTileType(0x1a8, *puVar3 + 0x3f, this->collisionLayer); - SetTileType(0x1a9, *puVar3 + 0x40, this->collisionLayer); - SetTileType(0x1aa, *puVar3 + 0x41, this->collisionLayer); + SetMetaTileType(0x1a2, *puVar3 - 0x41, this->collisionLayer); + SetMetaTileType(0x1a3, *puVar3 - 0x40, this->collisionLayer); + SetMetaTileType(0x1a4, *puVar3 - 0x3f, this->collisionLayer); + SetMetaTileType(0x1a5, *puVar3 - 1, this->collisionLayer); + SetMetaTileType(0x1a6, *puVar3, this->collisionLayer); + SetMetaTileType(0x1a7, *puVar3 + 1, this->collisionLayer); + SetMetaTileType(0x1a8, *puVar3 + 0x3f, this->collisionLayer); + SetMetaTileType(0x1a9, *puVar3 + 0x40, this->collisionLayer); + SetMetaTileType(0x1aa, *puVar3 + 0x41, this->collisionLayer); } } void HiddenLadderDown_Action1(Entity* this) { - if (GetTileType(*(u16*)&this->field_0x70.HALF.LO, this->collisionLayer) == 0x1a6) { + if (GetMetaTileType(*(u16*)&this->field_0x70.HALF.LO, this->collisionLayer) == 0x1a6) { this->action = 2; this->spriteSettings.draw = TRUE; SetFlag(this->field_0x86.HWORD); diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c index 3ec5a6e2..7603bcee 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -216,7 +216,7 @@ void sub_08081188(Entity* this) { void sub_080811AC(Entity* this) { this->action = 2; this->spriteSettings.draw = 0; - this->field_0x6e.HWORD = GetTileTypeByEntity(this); + this->field_0x6e.HWORD = GetMetaTileTypeByEntity(this); } void sub_080811C8(Entity* this) { @@ -282,7 +282,7 @@ void sub_080812A0(Entity* this) { } void sub_080812A8(Entity* this) { - if (GetCollisionDataAtEntity(this) != 0xF && this->field_0x6e.HWORD != GetTileTypeByEntity(this)) { + if (GetCollisionDataAtEntity(this) != 0xF && this->field_0x6e.HWORD != GetMetaTileTypeByEntity(this)) { this->direction = 0; this->speed = 0; this->spriteSettings.draw = 1; diff --git a/src/object/jarPortal.c b/src/object/jarPortal.c index 94000d86..938cdbf0 100644 --- a/src/object/jarPortal.c +++ b/src/object/jarPortal.c @@ -176,10 +176,10 @@ void sub_0808C148(Entity* this, u32 a2) { pos = COORD_TO_TILE(this); if (!a2) { - SetTile(0x4092, pos - 1, this->collisionLayer); - SetTile(0x4093, pos, this->collisionLayer); - SetTile(0x4094, pos + 63, this->collisionLayer); - SetTile(0x4095, pos + 64, this->collisionLayer); + SetMetaTile(0x4092, pos - 1, this->collisionLayer); + SetMetaTile(0x4093, pos, this->collisionLayer); + SetMetaTile(0x4094, pos + 63, this->collisionLayer); + SetMetaTile(0x4095, pos + 64, this->collisionLayer); } else { RestorePrevTileEntity(pos - 1, this->collisionLayer); RestorePrevTileEntity(pos, this->collisionLayer); diff --git a/src/object/ladderUp.c b/src/object/ladderUp.c index 8743fadc..aacbc330 100644 --- a/src/object/ladderUp.c +++ b/src/object/ladderUp.c @@ -37,7 +37,7 @@ void LadderUp(Entity* this) { return; } this->y.HALF.HI = (this->y.HALF.HI & 0xfff0) + 0xc; - SetTile(0x4023, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile(0x4023, COORD_TO_TILE(this), this->collisionLayer); break; case 1: if (GravityUpdate(this, Q_8_8(16.0)) == 0) { @@ -65,17 +65,17 @@ void LadderUp(Entity* this) { default: if (this->type2 == 0) { if (gPlayerEntity.y.HALF.HI < this->y.HALF.HI) { - if (gPlayerState.floor_type != SURFACE_LADDER && (GetTileTypeByEntity(this) == 0x4017)) { - SetTile(0x4023, COORD_TO_TILE(this), this->collisionLayer); + if (gPlayerState.floor_type != SURFACE_LADDER && (GetMetaTileTypeByEntity(this) == 0x4017)) { + SetMetaTile(0x4023, COORD_TO_TILE(this), this->collisionLayer); RestorePrevTileEntity(COORD_TO_TILE_OFFSET(this, 0, 0x10), this->collisionLayer); } } else { - if (GetTileTypeByEntity(this) != 0x4017) { - SetTile(0x4017, COORD_TO_TILE(this), this->collisionLayer); + if (GetMetaTileTypeByEntity(this) != 0x4017) { + SetMetaTile(0x4017, COORD_TO_TILE(this), this->collisionLayer); if (this->type == 0) { - SetTile(0x4017, COORD_TO_TILE_OFFSET(this, 0, 0x10), this->collisionLayer); + SetMetaTile(0x4017, COORD_TO_TILE_OFFSET(this, 0, 0x10), this->collisionLayer); } else { - SetTile(0x4014, COORD_TO_TILE_OFFSET(this, 0, 0x10), this->collisionLayer); + SetMetaTile(0x4014, COORD_TO_TILE_OFFSET(this, 0, 0x10), this->collisionLayer); } } } diff --git a/src/object/lightDoor.c b/src/object/lightDoor.c index 5a90de45..aefc3a57 100644 --- a/src/object/lightDoor.c +++ b/src/object/lightDoor.c @@ -90,13 +90,13 @@ void LightDoor_Action4(LightDoorEntity* this) { void sub_080850FC(LightDoorEntity* this) { u32 position = COORD_TO_TILE(super); u32 layer = super->collisionLayer; - SetTile(0x403d, position - 0x41, layer); - SetTile(0x403d, position - 0x40, layer); - SetTile(0x403d, position - 0x3f, layer); - SetTile(0x403d, position - 1, layer); - SetTile(0x403d, position, layer); - SetTile(0x403d, position + 1, layer); - SetTile(0x403d, position + 0x3f, layer); - SetTile(0x403d, position + 0x40, layer); - SetTile(0x403d, position + 0x41, layer); + SetMetaTile(0x403d, position - 0x41, layer); + SetMetaTile(0x403d, position - 0x40, layer); + SetMetaTile(0x403d, position - 0x3f, layer); + SetMetaTile(0x403d, position - 1, layer); + SetMetaTile(0x403d, position, layer); + SetMetaTile(0x403d, position + 1, layer); + SetMetaTile(0x403d, position + 0x3f, layer); + SetMetaTile(0x403d, position + 0x40, layer); + SetMetaTile(0x403d, position + 0x41, layer); } diff --git a/src/object/lightableSwitch.c b/src/object/lightableSwitch.c index ba0ba466..e53e313b 100644 --- a/src/object/lightableSwitch.c +++ b/src/object/lightableSwitch.c @@ -91,7 +91,7 @@ static void sub_0809EAD8(Entity* this) { UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD); } else { - SetTile(0x4050, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile(0x4050, COORD_TO_TILE(this), this->collisionLayer); } } diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c index a9bbe2e1..840f7beb 100644 --- a/src/object/lilypadLarge.c +++ b/src/object/lilypadLarge.c @@ -5,11 +5,12 @@ * * @brief Large Lilypad object */ -#include "global.h" #include "area.h" #include "functions.h" #include "item.h" #include "object.h" +#include "map.h" +#include "tiles.h" typedef struct { Entity base; @@ -344,10 +345,10 @@ void sub_08085A1C(LilypadLargeEntity* this) { void sub_08085A44(LilypadLargeEntity* this) { super->speed = 0x200; - if (GetVvvRelativeToEntity(super, 0x10, 0x18) != 0x11) { + if (GetVvvRelativeToEntity(super, 0x10, 0x18) != VVV_17) { super->direction = 0x18; } else { - if (GetVvvRelativeToEntity(super, -0x10, 0x18) != 0x11) { + if (GetVvvRelativeToEntity(super, -0x10, 0x18) != VVV_17) { super->direction = 8; } else { super->direction = 0x10; @@ -368,7 +369,7 @@ void sub_08085A98(LilypadLargeEntity* this) { this->unk_78.WORD -= 0x20000; SetAffineInfo(super, this->unk_78.HALF_U.HI, this->unk_78.HALF_U.HI, this->unk_7c.HALF_U.HI); } - if (GetVvvRelativeToEntity(super, 0, 0x18) != 0x11) { + if (GetVvvRelativeToEntity(super, 0, 0x18) != VVV_17) { super->subAction = 2; if (gArea.locationIndex == 0x1b) { super->y.HALF.HI += 0xd0; @@ -401,7 +402,7 @@ void sub_08085B40(LilypadLargeEntity* this) { } } else { ResetCollisionLayer(super); - if (GetVvvAtEntity(super) == 0xd) { + if (GetVvvAtEntity(super) == VVV_13) { ResetCollisionLayer(&gPlayerEntity); sub_08085CDC(this); super->direction = GetFacingDirection(&gPlayerEntity, super); @@ -423,7 +424,7 @@ void sub_08085B40(LilypadLargeEntity* this) { super->timer |= 0x80; this->unk_70 = 0; this->unk_6c = 0; - if (GetVvvAtEntity(super) == 0xd) { + if (GetVvvAtEntity(super) == VVV_13) { super->action = 4; } } @@ -471,7 +472,7 @@ void sub_08085D10(LilypadLargeEntity* this) { void sub_08085D28(LilypadLargeEntity* this) { if (((gPlayerState.framestate != PL_STATE_TALKEZLO) && ((gPlayerState.flags & PL_FLAGS2) != 0)) && - (GetVvvRelativeToEntity(super, 0, 0x18) == 0x11)) { + (GetVvvRelativeToEntity(super, 0, 0x18) == VVV_17)) { super->action = 2; super->subAction = 0; sub_08078B48(); diff --git a/src/object/linkEmptyingBottle.c b/src/object/linkEmptyingBottle.c index 8c8b4ac7..99e7f27e 100644 --- a/src/object/linkEmptyingBottle.c +++ b/src/object/linkEmptyingBottle.c @@ -119,7 +119,7 @@ void sub_08094980(LinkEmptyingBottleEntity* this, u32 searchTileIndex, u32 repla xOffset = gUnk_08122A28[index]; yOffset = gUnk_08122A28[index + 1]; if (searchTileIndex == sub_080B1A0C(super, xOffset, yOffset)) { - SetTile(replaceTileIndex, TILE(super->x.HALF.HI + xOffset, super->y.HALF.HI + yOffset), + SetMetaTile(replaceTileIndex, TILE(super->x.HALF.HI + xOffset, super->y.HALF.HI + yOffset), super->collisionLayer); } index += 2; diff --git a/src/object/lockedDoor.c b/src/object/lockedDoor.c index 6cc6c1a6..b1247bca 100644 --- a/src/object/lockedDoor.c +++ b/src/object/lockedDoor.c @@ -104,7 +104,7 @@ void LockedDoor_Init(Entity* this) { this->spritePriority.b0 = 5; this->frame = this->type & 0xF; this->field_0x76.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI); - this->field_0x74.HWORD = GetTileIndex(this->field_0x76.HWORD, this->collisionLayer); + this->field_0x74.HWORD = GetMetaTileIndex(this->field_0x76.HWORD, this->collisionLayer); switch (this->type2) { case 0: if (!CheckFlags(this->field_0x86.HWORD)) { @@ -151,7 +151,7 @@ void LockedDoor_Action1(Entity* this) { if (--this->timer == 0) { this->action = 2; this->timer = 7; - SetTile(this->field_0x74.HWORD, this->field_0x76.HWORD, this->collisionLayer); + SetMetaTile(this->field_0x74.HWORD, this->field_0x76.HWORD, this->collisionLayer); EnqueueSFX(SFX_10B); } } @@ -251,12 +251,12 @@ void sub_080836A0(Entity* this) { this->spriteSettings.draw = 1; this->x.HALF.HI = this->field_0x70.HALF.LO; this->y.HALF.HI = this->field_0x70.HALF.HI; - SetTile(0x4022, this->field_0x76.HWORD, this->collisionLayer); + SetMetaTile(0x4022, this->field_0x76.HWORD, this->collisionLayer); } void sub_080836DC(Entity* this, u32 unk_0, u32 unk_1) { const struct_0811F680* tmp; - SetTile(0x4022, unk_1, this->collisionLayer); + SetMetaTile(0x4022, unk_1, this->collisionLayer); this->timer = 7; this->spriteSettings.draw = 1; this->direction = (unk_0 << 3) ^ 0x10; diff --git a/src/object/macroAcorn.c b/src/object/macroAcorn.c index c52f503d..690e36ea 100644 --- a/src/object/macroAcorn.c +++ b/src/object/macroAcorn.c @@ -68,38 +68,38 @@ void sub_0809E5F0(Entity* this) { this->field_0x80.HWORD = position; switch (this->type) { case 2: - SetTile(0x4022, position - 0x3d, 1); - SetTile(0x406d, position - 0x3c, 1); + SetMetaTile(0x4022, position - 0x3d, 1); + SetMetaTile(0x406d, position - 0x3c, 1); case 0: - SetTile(0x406c, position - 0x42, 1); - SetTile(0x4022, position - 0x41, 1); - SetTile(0x4022, position - 0x40, 1); - SetTile(0x4022, position - 0x3f, 1); - SetTile(0x4022, position - 2, 1); - SetTile(0x4022, position - 1, 1); - SetTile(0x4022, position, 1); - SetTile(0x4022, position + 1, 1); - SetTile(0x406e, position + 0x3e, 1); - SetTile(0x4022, position + 0x3f, 1); - SetTile(0x4022, position + 0x40, 1); - SetTile(0x406f, position + 0x41, 1); + SetMetaTile(0x406c, position - 0x42, 1); + SetMetaTile(0x4022, position - 0x41, 1); + SetMetaTile(0x4022, position - 0x40, 1); + SetMetaTile(0x4022, position - 0x3f, 1); + SetMetaTile(0x4022, position - 2, 1); + SetMetaTile(0x4022, position - 1, 1); + SetMetaTile(0x4022, position, 1); + SetMetaTile(0x4022, position + 1, 1); + SetMetaTile(0x406e, position + 0x3e, 1); + SetMetaTile(0x4022, position + 0x3f, 1); + SetMetaTile(0x4022, position + 0x40, 1); + SetMetaTile(0x406f, position + 0x41, 1); break; case 3: - SetTile(0x4022, position - 0x44, 1); - SetTile(0x406c, position - 0x45, 1); + SetMetaTile(0x4022, position - 0x44, 1); + SetMetaTile(0x406c, position - 0x45, 1); case 1: - SetTile(0x4022, position - 0x42, 1); - SetTile(0x4022, position - 0x41, 1); - SetTile(0x4022, position - 0x40, 1); - SetTile(0x406d, position - 0x3f, 1); - SetTile(0x4022, position - 2, 1); - SetTile(0x4022, position - 1, 1); - SetTile(0x4022, position, 1); - SetTile(0x4022, position + 1, 1); - SetTile(0x406e, position + 0x3e, 1); - SetTile(0x4022, position + 0x3f, 1); - SetTile(0x4022, position + 0x40, 1); - SetTile(0x406f, position + 0x41, 1); + SetMetaTile(0x4022, position - 0x42, 1); + SetMetaTile(0x4022, position - 0x41, 1); + SetMetaTile(0x4022, position - 0x40, 1); + SetMetaTile(0x406d, position - 0x3f, 1); + SetMetaTile(0x4022, position - 2, 1); + SetMetaTile(0x4022, position - 1, 1); + SetMetaTile(0x4022, position, 1); + SetMetaTile(0x4022, position + 1, 1); + SetMetaTile(0x406e, position + 0x3e, 1); + SetMetaTile(0x4022, position + 0x3f, 1); + SetMetaTile(0x4022, position + 0x40, 1); + SetMetaTile(0x406f, position + 0x41, 1); break; } } diff --git a/src/object/macroBook.c b/src/object/macroBook.c index 59f025a4..ecc7de8f 100644 --- a/src/object/macroBook.c +++ b/src/object/macroBook.c @@ -151,7 +151,7 @@ void sub_0809A958(MacroBookEntity* this) { for (index = 0; index < 5; index++, tilePos += 0x40) { for (index2 = 0; index2 < 4; index2++, tileIndexPtr++) { if ((*tileIndexPtr & 0x4000) != 0) { - SetTile(*tileIndexPtr, tilePos + index2, 1); + SetMetaTile(*tileIndexPtr, tilePos + index2, 1); } } } diff --git a/src/object/macroDecorations.c b/src/object/macroDecorations.c index f68ce765..db2883f3 100644 --- a/src/object/macroDecorations.c +++ b/src/object/macroDecorations.c @@ -89,7 +89,7 @@ void sub_08097EB8(MacroDecorationEntity* this) { const s16* tilePosPtr; u16 tile = COORD_TO_TILE(super); for (tilePosPtr = tilePosArray; *tilePosPtr != 0x7fff; tilePosPtr += 2) { - SetTile((u16)tilePosPtr[1], tile + tilePosPtr[0], 1); + SetMetaTile((u16)tilePosPtr[1], tile + tilePosPtr[0], 1); } } diff --git a/src/object/macroShoe.c b/src/object/macroShoe.c index 2d4b5ac2..fc9e2d00 100644 --- a/src/object/macroShoe.c +++ b/src/object/macroShoe.c @@ -39,9 +39,9 @@ void MacroShoe_Init(Entity* this) { this->action = 1; this->hitbox = (Hitbox*)MacroShoe_TypeHitboxes[this->type]; if (this->type2 == 1) { - SetTile(0x4024, 0x410, 1); - SetTile(0x4026, 0x411, 1); - SetTile(0x4025, 0x412, 1); + SetMetaTile(0x4024, 0x410, 1); + SetMetaTile(0x4026, 0x411, 1); + SetMetaTile(0x4025, 0x412, 1); } } diff --git a/src/object/mask.c b/src/object/mask.c index 566e6ea1..07dd9ee4 100644 --- a/src/object/mask.c +++ b/src/object/mask.c @@ -59,11 +59,11 @@ void Mask_Init(Entity* this) { this->frameIndex = this->type2 & 0x3f; this->field_0x7c.HALF_U.HI = COORD_TO_TILE(this); - this->field_0x7c.HALF_U.LO = GetTileIndex(this->field_0x7c.HALF_U.HI, 1); + this->field_0x7c.HALF_U.LO = GetMetaTileIndex(this->field_0x7c.HALF_U.HI, 1); this->field_0x7a.HWORD = GetCollisionDataAtMetaTilePos((u16)this->field_0x7c.HALF.HI, 1); - SetTile(0x4022, this->field_0x7c.HALF_U.HI, 1); + SetMetaTile(0x4022, this->field_0x7c.HALF_U.HI, 1); } // Probably related to knocking it down @@ -88,7 +88,7 @@ void Mask_Action1(Entity* this) { } // Presumably, make the mask fall - SetTile(this->field_0x7c.HALF_U.LO, this->field_0x7c.HALF_U.HI, 1); + SetMetaTile(this->field_0x7c.HALF_U.LO, this->field_0x7c.HALF_U.HI, 1); SetCollisionData(this->field_0x7a.HWORD, (u16)this->field_0x7c.HALF.HI, 1); diff --git a/src/object/metalDoor.c b/src/object/metalDoor.c index f7236beb..758dd18d 100644 --- a/src/object/metalDoor.c +++ b/src/object/metalDoor.c @@ -103,16 +103,16 @@ void MetalDoor_Action4(Entity* this) { } void sub_080A080C(Entity* this) { - this->field_0x76.HWORD = GetTileIndex(this->field_0x74.HWORD - 1, this->collisionLayer); - this->field_0x78.HWORD = GetTileIndex(this->field_0x74.HWORD, this->collisionLayer); - this->field_0x7a.HWORD = GetTileIndex(this->field_0x74.HWORD + 1, this->collisionLayer); - SetTile(0x4022, this->field_0x74.HWORD - 1, this->collisionLayer); - SetTile(0x4022, this->field_0x74.HWORD, this->collisionLayer); - SetTile(0x4022, this->field_0x74.HWORD + 1, this->collisionLayer); + this->field_0x76.HWORD = GetMetaTileIndex(this->field_0x74.HWORD - 1, this->collisionLayer); + this->field_0x78.HWORD = GetMetaTileIndex(this->field_0x74.HWORD, this->collisionLayer); + this->field_0x7a.HWORD = GetMetaTileIndex(this->field_0x74.HWORD + 1, this->collisionLayer); + SetMetaTile(0x4022, this->field_0x74.HWORD - 1, this->collisionLayer); + SetMetaTile(0x4022, this->field_0x74.HWORD, this->collisionLayer); + SetMetaTile(0x4022, this->field_0x74.HWORD + 1, this->collisionLayer); } void sub_080A0870(Entity* this) { - SetTile(this->field_0x76.HWORD, this->field_0x74.HWORD - 1, this->collisionLayer); - SetTile(this->field_0x78.HWORD, this->field_0x74.HWORD, this->collisionLayer); - SetTile(this->field_0x7a.HWORD, this->field_0x74.HWORD + 1, this->collisionLayer); + SetMetaTile(this->field_0x76.HWORD, this->field_0x74.HWORD - 1, this->collisionLayer); + SetMetaTile(this->field_0x78.HWORD, this->field_0x74.HWORD, this->collisionLayer); + SetMetaTile(this->field_0x7a.HWORD, this->field_0x74.HWORD + 1, this->collisionLayer); } diff --git a/src/object/minecart.c b/src/object/minecart.c index 77a027f1..24043868 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -8,6 +8,7 @@ #include "functions.h" #include "hitbox.h" #include "object.h" +#include "tiles.h" typedef struct { Entity base; @@ -60,7 +61,7 @@ void Minecart_Init(MinecartEntity* this) { super->speed = 0x700; super->spritePriority.b1 = 3; InitAnimationForceUpdate(super, super->type2 + 4 + super->animationState); - SetTile(0x4022, COORD_TO_TILE(super), super->collisionLayer); + SetMetaTile(0x4022, COORD_TO_TILE(super), super->collisionLayer); } void Minecart_Action1(MinecartEntity* this) { @@ -106,7 +107,7 @@ void Minecart_Action2(MinecartEntity* this) { if (gPlayerEntity.zVelocity >= 0) { return; } - gPlayerEntity.animationState = super->animationState << 1; + gPlayerEntity.animationState = super->animationState * 2; gPlayerState.flags = (gPlayerState.flags ^ PL_ENTER_MINECART) | PL_IN_MINECART; super->action++; super->subtimer = 1; @@ -170,7 +171,7 @@ void Minecart_Action3(MinecartEntity* this) { super->animationState = AnimationStateFlip90(super->animationState); } else { switch (vvv) { - case 0x64: + case VVV_100: super->flags &= ~ENT_PERSIST; super->hitType = 1; super->collisionFlags = 0x47; @@ -182,7 +183,7 @@ void Minecart_Action3(MinecartEntity* this) { gPlayerState.flags = (gPlayerState.flags ^ PL_IN_MINECART) | PL_ENTER_MINECART; gPlayerEntity.zVelocity = Q_16_16(2.0); gPlayerEntity.speed = 0x200; - gPlayerEntity.animationState = super->animationState << 1; + gPlayerEntity.animationState = super->animationState * 2; gPlayerEntity.direction = super->direction; gPlayerEntity.flags |= PL_MINISH; sub_08004168(super); @@ -190,14 +191,14 @@ void Minecart_Action3(MinecartEntity* this) { SoundReq(SFX_PLY_VO4); SoundReq(SFX_139); return; - case 0x67: - case 0x68: - case 0x69: - case 0x6a: - case 0x6c: - case 0x6d: - case 0x6e: - case 0x6f: + case VVV_103: + case VVV_104: + case VVV_105: + case VVV_106: + case VVV_108: + case VVV_109: + case VVV_110: + case VVV_111: if (vvv == GetVvvAtEntity(super)) { Minecart_Action4(this); gPlayerEntity.animationState = super->animationState << 1; @@ -221,7 +222,7 @@ void Minecart_Action4(MinecartEntity* this) { sub_08004168(super); CopyPosition(super, &gPlayerEntity); switch (GetVvvAtEntity(super)) { - case 0x67: + case VVV_103: if (super->direction == DirectionWest) { super->direction = DirectionNorth; super->animationState = 0; @@ -230,7 +231,7 @@ void Minecart_Action4(MinecartEntity* this) { super->animationState = 1; } break; - case 0x68: + case VVV_104: if (super->direction == DirectionEast) { super->direction = DirectionSouth; super->animationState = 2; @@ -239,7 +240,7 @@ void Minecart_Action4(MinecartEntity* this) { super->animationState = 3; } break; - case 0x69: + case VVV_105: if (super->direction == DirectionEast) { super->direction = DirectionNorth; super->animationState = 0; @@ -248,7 +249,7 @@ void Minecart_Action4(MinecartEntity* this) { super->animationState = 3; } break; - case 0x6a: + case VVV_106: if (super->direction == DirectionWest) { super->direction = DirectionSouth; super->animationState = 2; @@ -263,7 +264,7 @@ void Minecart_Action4(MinecartEntity* this) { } super->action = 3; - gPlayerEntity.animationState = super->animationState << 1; + gPlayerEntity.animationState = super->animationState * 2; } void Minecart_Action5(MinecartEntity* this) { @@ -289,7 +290,7 @@ void Minecart_Action6(MinecartEntity* this) { minecartData->room = gRoomControls.room; minecartData->animationState = super->animationState; InitAnimationForceUpdate(super, super->animationState + 0x10); - SetTile(0x4022, COORD_TO_TILE(super), super->collisionLayer); + SetMetaTile(0x4022, COORD_TO_TILE(super), super->collisionLayer); } else { UpdateAnimationSingleFrame(super); gPlayerEntity.spritePriority.b0 = super->spritePriority.b0 - 1; @@ -343,18 +344,18 @@ const KeyValuePair* const gUnk_081223D8[] = { gUnk_08122436, }; const KeyValuePair gUnk_081223E8[] = { - { 242, 1 }, { 101, 1 }, { 104, 1 }, { 106, 1 }, { 100, 1 }, { 41, 1 }, + { VVV_242, 1 }, { VVV_101, 1 }, { VVV_104, 1 }, { VVV_106, 1 }, { VVV_100, 1 }, { VVV_41, 1 }, }; const u16 gUnk_081223E8End = 0; const KeyValuePair gUnk_08122402[] = { - { 243, 1 }, { 102, 1 }, { 104, 1 }, { 105, 1 }, { 100, 1 }, { 41, 1 }, + { VVV_243, 1 }, { VVV_102, 1 }, { VVV_104, 1 }, { VVV_105, 1 }, { VVV_100, 1 }, { VVV_41, 1 }, }; const u16 gUnk_08122402End = 0; const KeyValuePair gUnk_0812241C[] = { - { 242, 1 }, { 101, 1 }, { 103, 1 }, { 105, 1 }, { 100, 1 }, { 41, 1 }, + { VVV_242, 1 }, { VVV_101, 1 }, { VVV_103, 1 }, { VVV_105, 1 }, { VVV_100, 1 }, { VVV_41, 1 }, }; const u16 gUnk_0812241CEnd = 0; const KeyValuePair gUnk_08122436[] = { - { 243, 1 }, { 102, 1 }, { 106, 1 }, { 103, 1 }, { 100, 1 }, { 41, 1 }, + { VVV_243, 1 }, { VVV_102, 1 }, { VVV_106, 1 }, { VVV_103, 1 }, { VVV_100, 1 }, { VVV_41, 1 }, }; const u16 gUnk_08122436End = 0; diff --git a/src/object/minecartDoor.c b/src/object/minecartDoor.c index edb60f48..7b99b7b8 100644 --- a/src/object/minecartDoor.c +++ b/src/object/minecartDoor.c @@ -55,7 +55,7 @@ void MinecartDoor_Init(MinecartDoorEntity* this) { this->unk_72 = super->y.HALF.HI; super->spritePriority.b0 = 5; this->unk_76 = COORD_TO_TILE(super); - this->unk_74 = GetTileIndex(this->unk_76, super->collisionLayer); + this->unk_74 = GetMetaTileIndex(this->unk_76, super->collisionLayer); super->frameIndex = super->type; if (sub_08096CEC(this)) { if (this->unk_7e != 0) { @@ -66,7 +66,7 @@ void MinecartDoor_Init(MinecartDoorEntity* this) { } else { super->action = 1; super->spriteSettings.draw = 1; - SetTile(0x4022, this->unk_76, super->collisionLayer); + SetMetaTile(0x4022, this->unk_76, super->collisionLayer); } } } @@ -76,7 +76,7 @@ void MinecartDoor_Action1(MinecartDoorEntity* this) { super->action = 2; super->timer = 7; super->direction = super->type << 3; - SetTile(this->unk_74, this->unk_76, super->collisionLayer); + SetMetaTile(this->unk_74, this->unk_76, super->collisionLayer); EnqueueSFX(SFX_10B); } } diff --git a/src/object/minishVillageObject.c b/src/object/minishVillageObject.c index 417c3f99..e67fc613 100644 --- a/src/object/minishVillageObject.c +++ b/src/object/minishVillageObject.c @@ -90,7 +90,7 @@ void MinishVillageObject_Type1(MinishVillageObjectEntity* this) { super->subtimer = 0; super->frameIndex = 0; super->spritePriority.b0 = 7; - SetTile(0x4069, COORD_TO_TILE(super) - 0x40, 1); + SetMetaTile(0x4069, COORD_TO_TILE(super) - 0x40, 1); break; case 2: if ((gRoomTransition.frameCount & 3U) == 0) { @@ -224,7 +224,7 @@ void MinishVillageObject_Type8_Init(MinishVillageObjectEntity* this) { if (super->type2 != 0) { tilePosition -= 0x40; } - SetTile(0x4069, tilePosition, super->collisionLayer); + SetMetaTile(0x4069, tilePosition, super->collisionLayer); } } @@ -237,7 +237,7 @@ void MinishVillageObject_Type8_Action1(MinishVillageObjectEntity* this) { super->timer = 8; super->spriteRendering.alphaBlend = 0; gScreen.controls.layerFXControl = 0; - SetTile(0x4069, COORD_TO_TILE(super), super->collisionLayer); + SetMetaTile(0x4069, COORD_TO_TILE(super), super->collisionLayer); } } } diff --git a/src/object/object30.c b/src/object/object30.c index 196a3bc4..12bd96a4 100644 --- a/src/object/object30.c +++ b/src/object/object30.c @@ -39,12 +39,12 @@ void Object30(Object30Entity* this) { } void Object30_Init(Object30Entity* this) { - LayerStruct* data; + MapLayer* mapLayer; const u16* ptr; switch (super->type) { case 0: - data = GetLayerByIndex(super->collisionLayer); - ptr = &data->mapData[sub_0806F798(super)]; + mapLayer = GetLayerByIndex(super->collisionLayer); + ptr = &mapLayer->mapData[sub_0806F798(super)]; this->unk_6c = (u16*)ptr; this->unk_68 = ptr[0]; super->action = 1; diff --git a/src/object/objectA.c b/src/object/objectA.c index 77622f1f..7419a898 100644 --- a/src/object/objectA.c +++ b/src/object/objectA.c @@ -28,7 +28,7 @@ void ObjectA(Entity* this) { } this->field_0x70.HALF.LO = uVar2; if (CheckFlags(this->field_0x86.HWORD) != 0) { - SetTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); if ((gRoomControls.reload_flags & 1) != 0) { gUpdateVisibleTiles = 0; } @@ -37,7 +37,7 @@ void ObjectA(Entity* this) { AddInteractableSmallKeyLock(this); } } else if (this->interactType != 0) { - SetTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); SetFlag(this->field_0x86.HWORD); CreateDust(this); ModDungeonKeys(-1); diff --git a/src/object/objectBlockingStairs.c b/src/object/objectBlockingStairs.c index 5473531d..f69da586 100644 --- a/src/object/objectBlockingStairs.c +++ b/src/object/objectBlockingStairs.c @@ -109,9 +109,9 @@ void ObjectBlockingStairs_Action1(ObjectBlockingStairsEntity* this) { } if (this->unk7b & 0x40) { - tileType = (u32)GetTileType(this->tilePos - 1, super->collisionLayer); + tileType = (u32)GetMetaTileType(this->tilePos - 1, super->collisionLayer); } else { - tileType = (u32)GetTileType(this->tilePos + 1, super->collisionLayer); + tileType = (u32)GetMetaTileType(this->tilePos + 1, super->collisionLayer); } switch (tileType) { @@ -135,23 +135,23 @@ void ObjectBlockingStairs_Action1(ObjectBlockingStairsEntity* this) { if (this->unk7b & 0x80) { this->unk7b &= ~0x80; if ((this->unk7b & 0x40) != 0) { - SetTile(0x402c, this->tilePos - 1, super->collisionLayer); - SetTile(0x403d, this->tilePos + 1, super->collisionLayer); + SetMetaTile(0x402c, this->tilePos - 1, super->collisionLayer); + SetMetaTile(0x403d, this->tilePos + 1, super->collisionLayer); } else { - SetTile(0x403d, this->tilePos - 1, super->collisionLayer); - SetTile(0x402d, this->tilePos + 1, super->collisionLayer); + SetMetaTile(0x403d, this->tilePos - 1, super->collisionLayer); + SetMetaTile(0x402d, this->tilePos + 1, super->collisionLayer); } } else if (this->unk7b & 0x40) { if (xDist >= 5) { this->unk7b &= ~(0x40 | 0x80); - SetTile(0x403d, this->tilePos - 1, super->collisionLayer); - SetTile(0x402d, this->tilePos + 1, super->collisionLayer); + SetMetaTile(0x403d, this->tilePos - 1, super->collisionLayer); + SetMetaTile(0x402d, this->tilePos + 1, super->collisionLayer); } } else { if (-xDist > 4) { this->unk7b |= 0x40; - SetTile(0x402c, this->tilePos - 1, super->collisionLayer); - SetTile(0x403d, this->tilePos + 1, super->collisionLayer); + SetMetaTile(0x402c, this->tilePos - 1, super->collisionLayer); + SetMetaTile(0x403d, this->tilePos + 1, super->collisionLayer); } } } @@ -225,7 +225,7 @@ void sub_080931A4(ObjectBlockingStairsEntity* this, u32 param_2) { for (index = 0, iVar5 = 0; index < 9; index++) { u32 pos = tilePos + iVar5 + index - 1; - SetTile(pTileTypes[index], pos, collisionLayer); + SetMetaTile(pTileTypes[index], pos, collisionLayer); switch (index) { case 2: iVar5 = 0x3d; diff --git a/src/object/objectOnPillar.c b/src/object/objectOnPillar.c index ae4baa1d..daffbf1e 100644 --- a/src/object/objectOnPillar.c +++ b/src/object/objectOnPillar.c @@ -7,9 +7,9 @@ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "hitbox.h" #include "object.h" +#include "tiles.h" typedef struct { /*0x00*/ Entity base; @@ -150,7 +150,7 @@ void ObjectOnPillar_Action4(ObjectOnPillarEntity* this) { bool32 sub_08097008(ObjectOnPillarEntity* this) { Entity* effect; - u32 tileType = GetTileType(this->tilePosition, super->collisionLayer); + u32 tileType = GetMetaTileType(this->tilePosition, super->collisionLayer); if (tileType != 0x4036) { switch (sub_08097074(tileType)) { case 1: @@ -191,8 +191,8 @@ void sub_08097098(ObjectOnPillarEntity* this) { u16 tileType; this->unk_76 = 0x20; EnqueueSFX(SFX_10F); - SetTile(this->tileIndex, this->tilePosition, super->collisionLayer); - tileType = GetTileType(gUnk_080B4488[super->direction >> 3] + this->tilePosition, super->collisionLayer); + SetMetaTile(this->tileIndex, this->tilePosition, super->collisionLayer); + tileType = GetMetaTileType(gUnk_080B4488[super->direction >> 3] + this->tilePosition, super->collisionLayer); if ((tileType == 0x79) || tileType == 0x77) { super->spriteOffsetY = 2; } @@ -200,14 +200,14 @@ void sub_08097098(ObjectOnPillarEntity* this) { void sub_080970F4(ObjectOnPillarEntity* this) { this->tilePosition = COORD_TO_TILE(super); - this->tileIndex = GetTileIndex(this->tilePosition, super->collisionLayer); - SetTile(0x4036, this->tilePosition, super->collisionLayer); + this->tileIndex = GetMetaTileIndex(this->tilePosition, super->collisionLayer); + SetMetaTile(0x4036, this->tilePosition, super->collisionLayer); } bool32 sub_08097144(ObjectOnPillarEntity* this) { LinearMoveUpdate(super); sub_0800445C(super); - if (GetVvvAtEntity(super) == 0x19) { + if (GetVvvAtEntity(super) == VVV_25) { super->spriteOffsetY = 2; } if ((--this->unk_76 == 0) && sub_08097194(this) == FALSE) { @@ -223,7 +223,7 @@ bool32 sub_08097194(ObjectOnPillarEntity* this) { if (sub_0800442E(super)) { return TRUE; } else { - u32 tileType = GetTileTypeByEntity(super); + u32 tileType = GetMetaTileTypeByEntity(super); if (tileType == 0x71 || tileType == 0x72 || (tileType == 0x4020)) { SetFlag(this->unk_86); EnqueueSFX(SFX_10B); @@ -254,13 +254,13 @@ void sub_080971E0(ObjectOnPillarEntity* this) { super->action = 4; super->frameIndex = 1; super->spritePriority.b0 = 7; - SetTile(0, COORD_TO_TILE(super), super->collisionLayer); + SetMetaTile(0, COORD_TO_TILE(super), super->collisionLayer); DeleteThisEntity(); break; case 1: tilePosition = COORD_TO_TILE(super); if (sub_08097348(tilePosition) == 0) { - SetTileType(0x73, tilePosition, super->collisionLayer); + SetMetaTileType(0x73, tilePosition, super->collisionLayer); } DeleteThisEntity(); break; diff --git a/src/object/palaceArchway.c b/src/object/palaceArchway.c index 4f545bef..56c59c9f 100644 --- a/src/object/palaceArchway.c +++ b/src/object/palaceArchway.c @@ -22,7 +22,7 @@ void PalaceArchway_Init(Entity* this) { this->frameIndex = this->type2; this->spriteRendering.b3 = 3; this->spritePriority.b0 = 7; - SetTile(0x4069, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile(0x4069, COORD_TO_TILE(this), this->collisionLayer); } void PalaceArchway_Action1(Entity* this) { diff --git a/src/object/paper.c b/src/object/paper.c index ce3b8806..b29a0cf1 100644 --- a/src/object/paper.c +++ b/src/object/paper.c @@ -43,7 +43,7 @@ void Paper_Type0(Entity* this) { } this->spriteSettings.draw = 0; } - SetTile(0x4051, COORD_TO_TILE(this), 1); + SetMetaTile(0x4051, COORD_TO_TILE(this), 1); } void Paper_Type1(Entity* this) { @@ -63,8 +63,8 @@ void Paper_Type2(Entity* this) { this->action = 1; this->y.HALF.HI++; this->spriteOffsetY = -1; - SetTile(0x4051, COORD_TO_TILE(this) - 1, 1); - SetTile(0x4051, COORD_TO_TILE(this), 1); + SetMetaTile(0x4051, COORD_TO_TILE(this) - 1, 1); + SetMetaTile(0x4051, COORD_TO_TILE(this), 1); } void Paper_Action1(Entity* this) { diff --git a/src/object/playerClone.c b/src/object/playerClone.c index 48618a99..47446919 100644 --- a/src/object/playerClone.c +++ b/src/object/playerClone.c @@ -52,7 +52,7 @@ void PlayerClone_Init(PlayerCloneEntity* this) { super->y.HALF.HI = (super->y.HALF.HI & 0xfff0) | 8; this->tilePos = COORD_TO_TILE(super); InitializeAnimation(super, 8); - SetTile(0x4016, this->tilePos, super->collisionLayer); + SetMetaTile(0x4016, this->tilePos, super->collisionLayer); SoundReq(SFX_112); } @@ -191,7 +191,7 @@ void sub_08084CAC(PlayerCloneEntity* this) { if (((PlayerCloneEntity*)gPlayerClones[super->type])->unk70 == 0) { ptr = &gUnk_080B4468[super->animationState & 6]; - if (sub_080B1B54(GetTileType(COORD_TO_TILE_OFFSET(super, -ptr[0], -ptr[1]), super->collisionLayer)) == 0x72) { + if (sub_080B1B54(GetMetaTileType(COORD_TO_TILE_OFFSET(super, -ptr[0], -ptr[1]), super->collisionLayer)) == 0x72) { ((PlayerCloneEntity*)gPlayerClones[0])->unk6c |= (1 << super->type); } else { ((PlayerCloneEntity*)gPlayerClones[0])->unk6c &= ~(1 << super->type); diff --git a/src/object/pot.c b/src/object/pot.c index 2d635253..b3f134fa 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -7,12 +7,12 @@ #include "entity.h" #include "flags.h" #include "functions.h" -#include "global.h" #include "hitbox.h" #include "object.h" #include "player.h" #include "room.h" #include "sound.h" +#include "tiles.h" void Pot_Action5(Entity*); static void sub_08082850(Entity*, Entity*); @@ -68,12 +68,12 @@ void Pot_Init(Entity* this) { ResolveCollisionLayer(this); } - this->field_0x70.HALF.LO = GetTileIndex(COORD_TO_TILE(this), this->collisionLayer); + this->field_0x70.HALF.LO = GetMetaTileIndex(COORD_TO_TILE(this), this->collisionLayer); if ((u16)this->field_0x70.HALF.LO == 0x4000) { DeleteThisEntity(); } - SetTile(0x4000, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile(0x4000, COORD_TO_TILE(this), this->collisionLayer); InitializeAnimation(this, 5); } @@ -86,7 +86,7 @@ void Pot_Action1(Entity* this) { this->subAction = 0; break; case 0x1D: - SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); this->action = 5; this->zVelocity = Q_16_16(2.625); this->spriteOffsetY = 0; @@ -96,7 +96,7 @@ void Pot_Action1(Entity* this) { Pot_Action5(this); break; default: - tileType = GetTileTypeByEntity(this); + tileType = GetMetaTileTypeByEntity(this); if (tileType != 0x4000) { switch (tileType) { case 0x4004: @@ -110,19 +110,19 @@ void Pot_Action1(Entity* this) { this->speed >>= 1; this->timer = 64; } - SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); EnqueueSFX(SFX_10F); break; case 0x4067: - SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); DeleteThisEntity(); break; default: - if (GetVvvAtEntity(this) == 13) { + if (GetVvvAtEntity(this) == VVV_13) { CreateFx(this, FX_FALL_DOWN, 0); } else if (tileType == 0x4005) { gPlayerState.lastSwordMove = SWORD_MOVE_BREAK_POT; - SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); } sub_08082850(this, NULL); break; @@ -148,7 +148,7 @@ void sub_08082510(Entity* this) { this->hitType = 1; this->flags2 = gPlayerEntity.flags2; this->spriteOffsetY = 0; - SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); this->subAction++; } @@ -212,15 +212,15 @@ void Pot_Action4(Entity* this) { this->speed <<= 1; } - this->field_0x70.HALF.LO = GetTileIndex(COORD_TO_TILE(this), this->collisionLayer); - tileType = GetTileTypeByEntity(this); + this->field_0x70.HALF.LO = GetMetaTileIndex(COORD_TO_TILE(this), this->collisionLayer); + tileType = GetMetaTileTypeByEntity(this); switch (tileType) { case 0x71: case 0x72: sub_08082850(this, NULL); break; default: - SetTile(0x4000, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile(0x4000, COORD_TO_TILE(this), this->collisionLayer); RegisterCarryEntity(this); break; } @@ -243,7 +243,7 @@ void sub_0808270C(Entity* this) { if ((gPlayerState.field_0x1c & 0xF) != 0x1 || (this->contactFlags & 0x7F) != 0x13) { this->spriteOffsetX = 0; this->action = 1; - SetTile(0x4000, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile(0x4000, COORD_TO_TILE(this), this->collisionLayer); } else { sub_0806F4E8(this); } @@ -254,7 +254,7 @@ void sub_08082778(Entity* this) { this->timer = 1; this->spriteOffsetX = 0; this->spriteOffsetY = -2; - SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); } if ((gPlayerState.field_0x1c & 0xF) != 0x1 || (this->contactFlags & 0x7F) != 0x13) { diff --git a/src/object/pullableMushroom.c b/src/object/pullableMushroom.c index 3200afbf..d884555a 100644 --- a/src/object/pullableMushroom.c +++ b/src/object/pullableMushroom.c @@ -62,7 +62,7 @@ void PullableMushroom_Init(PullableMushroomEntity* this) { super->spritePriority.b0 = 4; super->hitbox = (Hitbox*)&gUnk_080FD224; super->carryFlags = 1; - SetTile(0x4022, COORD_TO_TILE(super), super->collisionLayer); + SetMetaTile(0x4022, COORD_TO_TILE(super), super->collisionLayer); super->health = 1; super->collisionFlags = 7; super->hitType = 0x6e; diff --git a/src/object/pushableFurniture.c b/src/object/pushableFurniture.c index e7310174..c18a041a 100644 --- a/src/object/pushableFurniture.c +++ b/src/object/pushableFurniture.c @@ -169,7 +169,7 @@ void PushableFurniture_Action1(PushableFurnitureEntity* this) { } void sub_0808FB68(PushableFurnitureEntity* this) { - u32 tileIndex = GetTileIndex(this->unk_70, super->collisionLayer); + u32 tileIndex = GetMetaTileIndex(this->unk_70, super->collisionLayer); switch (tileIndex) { case 0x4030: case 0x4031: @@ -179,7 +179,7 @@ void sub_0808FB68(PushableFurnitureEntity* this) { sub_0808FD44(this, 0); break; default: - tileIndex = GetTileIndex(this->unk_72, super->collisionLayer); + tileIndex = GetMetaTileIndex(this->unk_72, super->collisionLayer); switch (tileIndex) { case 0x4030: case 0x4031: @@ -195,7 +195,7 @@ void sub_0808FB68(PushableFurnitureEntity* this) { } void sub_0808FBFC(PushableFurnitureEntity* this) { - u32 tileIndex = GetTileIndex(this->unk_7c, super->collisionLayer); + u32 tileIndex = GetMetaTileIndex(this->unk_7c, super->collisionLayer); if (tileIndex != 0x404a) { super->action = 2; super->direction = ((tileIndex - 0x4bU) & 3) << 3; @@ -303,7 +303,7 @@ void sub_0808FD44(PushableFurnitureEntity* this, u32 param_2) { } EnqueueSFX(SFX_10F); sub_08090254(this); - GetTileIndex(tmp + gUnk_080B4488[super->direction >> 3], super->collisionLayer); + GetMetaTileIndex(tmp + gUnk_080B4488[super->direction >> 3], super->collisionLayer); } void sub_0808FDE8(PushableFurnitureEntity* this) { @@ -313,28 +313,28 @@ void sub_0808FDE8(PushableFurnitureEntity* this) { uVar3 = (u32)this->unk_70; uVar1 = GetCollisionDataAtMetaTilePos(uVar3 - 1, 1); - iVar2 = GetTileIndex(uVar3, 1); + iVar2 = GetMetaTileIndex(uVar3, 1); if (iVar2 == 0x402e) { if ((((uVar1 & 0xf0) != 0) && ((uVar1 & 0xf0) != 0x50)) || ((uVar1 & 5) == 0)) { - SetTile(0x402c, uVar3, 1); + SetMetaTile(0x402c, uVar3, 1); } } else { iVar2 = GetCollisionDataAtMetaTilePos(uVar3, 1); if ((iVar2 == 5) && ((((uVar1 & 0xf0) == 0 || ((uVar1 & 0xf0) == 0x50)) && ((uVar1 & 5) != 0)))) { - SetTile(0x402e, uVar3, 1); + SetMetaTile(0x402e, uVar3, 1); } } uVar3 = (u32)this->unk_72; uVar1 = GetCollisionDataAtMetaTilePos(uVar3 + 1, 1); - iVar2 = GetTileIndex(uVar3, 1); + iVar2 = GetMetaTileIndex(uVar3, 1); if (iVar2 == 0x402f) { if ((((uVar1 & 0xf0) != 0) && ((uVar1 & 0xf0) != 0x50)) || ((uVar1 & 10) == 0)) { - SetTile(0x402d, uVar3, 1); + SetMetaTile(0x402d, uVar3, 1); } } else { iVar2 = GetCollisionDataAtMetaTilePos(uVar3, 1); if (((iVar2 == 10) && (((uVar1 & 0xf0) == 0 || ((uVar1 & 0xf0) == 0x50)))) && ((uVar1 & 10) != 0)) { - SetTile(0x402f, uVar3, 1); + SetMetaTile(0x402f, uVar3, 1); } } } @@ -380,24 +380,24 @@ void sub_0808FF50(PushableFurnitureEntity* this) { switch (this->unk_80) { case 0: this->unk_70 = tmp; - this->unk_74 = GetTileIndex(this->unk_70, 1); - SetTile(0x404a, tmp, 1); + this->unk_74 = GetMetaTileIndex(this->unk_70, 1); + SetMetaTile(0x404a, tmp, 1); break; case 1: if ((tmp2 & 8) != 0) { this->unk_70 = this->unk_7c; - this->unk_74 = GetTileIndex(this->unk_70, 1); - SetTile(gUnk_08121EE4[this->unk_81], position, 1); + this->unk_74 = GetMetaTileIndex(this->unk_70, 1); + SetMetaTile(gUnk_08121EE4[this->unk_81], position, 1); this->unk_72 = tmp + 1; - this->unk_76 = GetTileIndex(this->unk_72, 1); + this->unk_76 = GetMetaTileIndex(this->unk_72, 1); sub_08090094(this, gUnk_08121EE4[this->unk_81 + 4], this->unk_72); sub_0809028C(this, 1); } else { this->unk_72 = this->unk_7c; - this->unk_76 = GetTileIndex(this->unk_72, 1); - SetTile(gUnk_08121EE4[this->unk_81], position, 1); + this->unk_76 = GetMetaTileIndex(this->unk_72, 1); + SetMetaTile(gUnk_08121EE4[this->unk_81], position, 1); this->unk_70 = tmp - 1; - this->unk_74 = GetTileIndex(this->unk_70, 1); + this->unk_74 = GetMetaTileIndex(this->unk_70, 1); sub_08090094(this, gUnk_08121EE4[this->unk_81 + 2], this->unk_70); sub_0809028C(this, 0); } @@ -412,7 +412,7 @@ void sub_08090094(PushableFurnitureEntity* this, u32 param_2, u32 tilePos) { u32 tmp2; tmp1 = GetCollisionDataAtMetaTilePos(tilePos, 1); - index = GetTileIndex(tilePos, 1); + index = GetMetaTileIndex(tilePos, 1); if ((index & 0x4000) == 0) { index = param_2; switch (index) { @@ -420,14 +420,14 @@ void sub_08090094(PushableFurnitureEntity* this, u32 param_2, u32 tilePos) { if (tmp1 == 5) { index = 0x4022; } - SetTile(index, tilePos, 1); + SetMetaTile(index, tilePos, 1); return; case 0x402d: case 0x402f: if (tmp1 == 5) { index = 0x4022; } - SetTile(index, tilePos, 1); + SetMetaTile(index, tilePos, 1); return; case 0x4024: case 0x402c: @@ -435,10 +435,10 @@ void sub_08090094(PushableFurnitureEntity* this, u32 param_2, u32 tilePos) { if (tmp1 == 10) { index = 0x4022; } - SetTile(index, tilePos, 1); + SetMetaTile(index, tilePos, 1); return; default: - SetTile(index, tilePos, 1); + SetMetaTile(index, tilePos, 1); return; } } @@ -490,7 +490,7 @@ void sub_08090094(PushableFurnitureEntity* this, u32 param_2, u32 tilePos) { break; } - SetTile(index, tilePos, 1); + SetMetaTile(index, tilePos, 1); } void sub_08090254(PushableFurnitureEntity* this) { @@ -511,7 +511,7 @@ void sub_0809028C(PushableFurnitureEntity* this, u32 param_2) { if ((this->unk_83 & 0x20) != 0) { sub_08090480(0, uVar2 + 1); } else { - switch (GetTileType(uVar2, 2)) { + switch (GetMetaTileType(uVar2, 2)) { case 0x301: this->unk_83 |= 8; break; @@ -525,7 +525,7 @@ void sub_0809028C(PushableFurnitureEntity* this, u32 param_2) { sub_08090480(0, uVar2); } if ((this->unk_83 & 0x10) != 0) { - switch (GetTileType(pos - 1, 1)) { + switch (GetMetaTileType(pos - 1, 1)) { case 0x300: break; default: @@ -535,7 +535,7 @@ void sub_0809028C(PushableFurnitureEntity* this, u32 param_2) { } return; } - switch (GetTileType(pos - 1, 2)) { + switch (GetMetaTileType(pos - 1, 2)) { case 0x300: this->unk_83 |= 4; break; @@ -552,7 +552,7 @@ void sub_0809028C(PushableFurnitureEntity* this, u32 param_2) { if ((this->unk_83 & 0x10) != 0) { sub_08090480(0, pos - 1); } else { - switch (GetTileType(pos, 2)) { + switch (GetMetaTileType(pos, 2)) { case 0x302: this->unk_83 |= 4; break; @@ -566,7 +566,7 @@ void sub_0809028C(PushableFurnitureEntity* this, u32 param_2) { sub_08090480(0, uVar2); } if ((this->unk_83 & 0x20) != 0) { - switch (GetTileType(uVar2 + 1, 1)) { + switch (GetMetaTileType(uVar2 + 1, 1)) { case 0x300: break; default: @@ -576,7 +576,7 @@ void sub_0809028C(PushableFurnitureEntity* this, u32 param_2) { } return; } - switch (GetTileType(uVar2 + 1, 2)) { + switch (GetMetaTileType(uVar2 + 1, 2)) { case 0x300: this->unk_83 |= 8; break; @@ -592,18 +592,18 @@ void sub_0809028C(PushableFurnitureEntity* this, u32 param_2) { } void sub_08090480(u32 param_1, u32 param_2) { - SetTile(gUnk_08121EF0[param_1], param_2, 1); + SetMetaTile(gUnk_08121EF0[param_1], param_2, 1); } void sub_08090498(PushableFurnitureEntity* this) { u32 tmp = this->unk_70 - 0x80; RestorePrevTileEntity(tmp, 1); - if (((this->unk_83 & 1) != 0) && (GetTileType(tmp, 2) == 0x306)) { + if (((this->unk_83 & 1) != 0) && (GetMetaTileType(tmp, 2) == 0x306)) { SetCollisionData(0x62, tmp, 1); } tmp = this->unk_72 - 0x80; RestorePrevTileEntity(tmp, 1); - if (((this->unk_83 & 2) != 0) && (GetTileType(tmp, 2) == 0x308)) { + if (((this->unk_83 & 2) != 0) && (GetMetaTileType(tmp, 2) == 0x308)) { SetCollisionData(99, tmp, 1); } } diff --git a/src/object/pushableGrave.c b/src/object/pushableGrave.c index 6452d3db..04bf070c 100644 --- a/src/object/pushableGrave.c +++ b/src/object/pushableGrave.c @@ -47,15 +47,15 @@ void PushableGrave_Init(PushableGraveEntity* this) { super->frameIndex = super->type; super->updatePriority = 3; tilePosition = COORD_TO_TILE(super); - this->unk_6a = GetTileIndex(tilePosition - 0x41, super->collisionLayer); - this->unk_6c = GetTileIndex(tilePosition - 0x40, super->collisionLayer); - this->unk_6e = GetTileIndex(tilePosition - 0x3f, super->collisionLayer); - this->unk_70 = GetTileIndex(tilePosition - 1, super->collisionLayer); - this->unk_72 = GetTileIndex(tilePosition, super->collisionLayer); - this->unk_74 = GetTileIndex(tilePosition + 1, super->collisionLayer); - this->unk_76 = GetTileIndex(tilePosition + 0x3f, super->collisionLayer); - this->unk_78 = GetTileIndex(tilePosition + 0x40, super->collisionLayer); - this->unk_7a = GetTileIndex(tilePosition + 0x41, super->collisionLayer); + this->unk_6a = GetMetaTileIndex(tilePosition - 0x41, super->collisionLayer); + this->unk_6c = GetMetaTileIndex(tilePosition - 0x40, super->collisionLayer); + this->unk_6e = GetMetaTileIndex(tilePosition - 0x3f, super->collisionLayer); + this->unk_70 = GetMetaTileIndex(tilePosition - 1, super->collisionLayer); + this->unk_72 = GetMetaTileIndex(tilePosition, super->collisionLayer); + this->unk_74 = GetMetaTileIndex(tilePosition + 1, super->collisionLayer); + this->unk_76 = GetMetaTileIndex(tilePosition + 0x3f, super->collisionLayer); + this->unk_78 = GetMetaTileIndex(tilePosition + 0x40, super->collisionLayer); + this->unk_7a = GetMetaTileIndex(tilePosition + 0x41, super->collisionLayer); if (sub_0809798C(this)) { if (super->type == 0) { super->y.HALF.HI -= 0x16; @@ -71,12 +71,12 @@ void PushableGrave_Init(PushableGraveEntity* this) { tileIndex = PushableGrave_Tiles[super->type2]; if (super->type == 0) { super->hitbox = (Hitbox*)&gUnk_080FD578; - SetTile(tileIndex, tilePosition - 1, super->collisionLayer); - SetTile(tileIndex, tilePosition, super->collisionLayer); + SetMetaTile(tileIndex, tilePosition - 1, super->collisionLayer); + SetMetaTile(tileIndex, tilePosition, super->collisionLayer); super->y.HALF.HI += 2; } else { super->hitbox = (Hitbox*)&gUnk_080FD570; - SetTile(tileIndex, tilePosition, super->collisionLayer); + SetMetaTile(tileIndex, tilePosition, super->collisionLayer); if (super->type2 == 2) { SetMultipleTiles((TileData*)gUnk_081232C0, tilePosition, super->collisionLayer); } @@ -136,9 +136,9 @@ void sub_080977F4(PushableGraveEntity* this) { super->action = 4; super->spriteOffsetY = 0; tilePosition = COORD_TO_TILE(super); - SetTile(0x4022, tilePosition, super->collisionLayer); + SetMetaTile(0x4022, tilePosition, super->collisionLayer); if (super->type == 0) { - SetTile(0x4022, tilePosition - 1, super->collisionLayer); + SetMetaTile(0x4022, tilePosition - 1, super->collisionLayer); } if (this->pushedFlag != 0) { SetFlag(this->pushedFlag); @@ -150,7 +150,7 @@ bool32 sub_0809785C(PushableGraveEntity* this) { if (super->type != 0) { if (super->type2 != 0) { - if ((CheckFlags(this->pushedFlag) != 0) || GetTileType(this->unk_68, super->collisionLayer) == 0x403f) { + if ((CheckFlags(this->pushedFlag) != 0) || GetMetaTileType(this->unk_68, super->collisionLayer) == 0x403f) { super->action = 3; super->timer = 64; super->subtimer = 0; diff --git a/src/object/pushableLever.c b/src/object/pushableLever.c index dec3fcb7..9fdc0151 100644 --- a/src/object/pushableLever.c +++ b/src/object/pushableLever.c @@ -33,7 +33,7 @@ extern const u8 PushableLever_PushedOffsets[]; void PushableLever_SetIdle(PushableLeverEntity*); bool32 PushableLever_ShouldStartPushing(PushableLeverEntity* this); -void PushableLever_SetTiles(PushableLeverEntity*); +void PushableLever_SetMetaTiles(PushableLeverEntity*); void PushableLever_CalculateSpriteOffsets(PushableLeverEntity*); #define TILE_INITIAL 0x4053 @@ -53,7 +53,7 @@ void PushableLever_Idle(PushableLeverEntity* this) { super->action = PUSHING; super->spriteOffsetX = 0; super->spriteOffsetY = 0; - SetTile(this->tileIndex, this->tilePosition, super->collisionLayer); + SetMetaTile(this->tileIndex, this->tilePosition, super->collisionLayer); EnqueueSFX(SFX_16A); RequestPriorityDuration(super, 30); if (PlayerCanBeMoved()) { @@ -82,32 +82,32 @@ void PushableLever_Pushing(PushableLeverEntity* this) { void PushableLever_SetIdle(PushableLeverEntity* this) { super->action = IDLE; this->timer = 60; - PushableLever_SetTiles(this); + PushableLever_SetMetaTiles(this); } -void PushableLever_SetTiles(PushableLeverEntity* this) { +void PushableLever_SetMetaTiles(PushableLeverEntity* this) { if (CheckFlags(this->pushedFlag) == FALSE) { super->type2 = 0; this->tilePosition = COORD_TO_TILE_OFFSET(super, 0, 0x10); - this->tileIndex = GetTileIndex(this->tilePosition, super->collisionLayer); - SetTile(TILE_INITIAL, this->tilePosition, super->collisionLayer); + this->tileIndex = GetMetaTileIndex(this->tilePosition, super->collisionLayer); + SetMetaTile(TILE_INITIAL, this->tilePosition, super->collisionLayer); InitializeAnimation(super, 1); } else { super->type2 = 1; this->tilePosition = COORD_TO_TILE_OFFSET(super, 0x10, 0); - this->tileIndex = GetTileIndex(this->tilePosition, super->collisionLayer); - SetTile(TILE_PUSHED, this->tilePosition, super->collisionLayer); + this->tileIndex = GetMetaTileIndex(this->tilePosition, super->collisionLayer); + SetMetaTile(TILE_PUSHED, this->tilePosition, super->collisionLayer); InitializeAnimation(super, 0); } } bool32 PushableLever_ShouldStartPushing(PushableLeverEntity* this) { - if (GetTileIndex(this->tilePosition, super->collisionLayer) == 0x4054) { + if (GetMetaTileIndex(this->tilePosition, super->collisionLayer) == 0x4054) { if (--this->timer == 0) { return TRUE; } PushableLever_CalculateSpriteOffsets(this); - SetTile(PushableLever_Tiles[super->type2], this->tilePosition, super->collisionLayer); + SetMetaTile(PushableLever_Tiles[super->type2], this->tilePosition, super->collisionLayer); } else { this->timer = 60; super->spriteOffsetX = 0; diff --git a/src/object/pushableRock.c b/src/object/pushableRock.c index 464bb24a..8287b494 100644 --- a/src/object/pushableRock.c +++ b/src/object/pushableRock.c @@ -7,8 +7,8 @@ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" +#include "tiles.h" typedef struct { /*0x00*/ Entity base; @@ -43,7 +43,7 @@ void PushableRock_Action1(PushableRockEntity* this) { u32 tileType; u32 tmp; - tileType = GetTileType(this->tilePosition, super->collisionLayer); + tileType = GetMetaTileType(this->tilePosition, super->collisionLayer); switch (tileType) { case 0x401c: case 0x401d: @@ -57,7 +57,7 @@ void PushableRock_Action1(PushableRockEntity* this) { } else { super->spriteSettings.flipX = 0; } - SetTile(this->tileIndex, this->tilePosition, super->collisionLayer); + SetMetaTile(this->tileIndex, this->tilePosition, super->collisionLayer); super->action = 2; InitializeAnimation(super, (super->animationState >> 1) + 1); EnqueueSFX(SFX_10F); @@ -91,11 +91,11 @@ void PushableRock_Action3(PushableRockEntity* this) { void sub_0808A644(PushableRockEntity* this) { u32 vvv; this->tilePosition = COORD_TO_TILE(super); - this->tileIndex = GetTileIndex(this->tilePosition, super->collisionLayer); + this->tileIndex = GetMetaTileIndex(this->tilePosition, super->collisionLayer); this->unk_72 = GetCollisionDataAtMetaTilePos(this->tilePosition, super->collisionLayer); vvv = GetVvvAtMetaTilePos(this->tilePosition, super->collisionLayer); - if ((vvv == 0x19) || (vvv == 0xf0)) { - SetTile(0x4015, this->tilePosition, super->collisionLayer); + if ((vvv == VVV_25) || (vvv == VVV_240)) { + SetMetaTile(0x4015, this->tilePosition, super->collisionLayer); super->action = 3; if (!CheckFlags(this->pushedFlag)) { SetFlag(this->pushedFlag); @@ -105,7 +105,7 @@ void sub_0808A644(PushableRockEntity* this) { InitializeAnimation(super, 6); } } else { - SetTile(0x401b, this->tilePosition, super->collisionLayer); + SetMetaTile(0x401b, this->tilePosition, super->collisionLayer); } } diff --git a/src/object/pushableStatue.c b/src/object/pushableStatue.c index f6722b71..e24f56ee 100644 --- a/src/object/pushableStatue.c +++ b/src/object/pushableStatue.c @@ -5,10 +5,10 @@ * @brief Pushable Statue object */ #define NENT_DEPRECATED -#include "global.h" #include "object.h" #include "functions.h" #include "hitbox.h" +#include "tiles.h" typedef struct { /*0x00*/ Entity base; @@ -62,7 +62,7 @@ void PushableStatue_Action1(PushableStatueEntity* this) { Entity* obj; if (sub_0800442E(super) == 0) { - tileType = GetTileType(this->unk_84, super->collisionLayer); + tileType = GetMetaTileType(this->unk_84, super->collisionLayer); if (tileType != 0x400b) { switch (sub_0808968C(tileType)) { case 1: @@ -110,7 +110,7 @@ void PushableStatue_SubAction0(PushableStatueEntity* this) { ptr = &gUnk_08120CB4[index]; PositionRelative(super, &gPlayerEntity, *(ptr) << 0x10, *(ptr + 1) << 0x10); } - tileType = GetTileType(this->unk_84, super->collisionLayer); + tileType = GetMetaTileType(this->unk_84, super->collisionLayer); if (tileType != 0x400b) { switch (sub_0808968C(tileType)) { case 1: @@ -157,17 +157,17 @@ void PushableStatue_Action4(PushableStatueEntity* this) { } else { super->spriteSettings.draw = 1; super->action = 1; - SetTile(0x400b, this->unk_84, super->collisionLayer); + SetMetaTile(0x400b, this->unk_84, super->collisionLayer); sub_080894C8(this); } } void sub_08089454(PushableStatueEntity* this) { this->unk_84 = COORD_TO_TILE(super); - this->unk_80 = GetTileIndex(this->unk_84, super->collisionLayer); - SetTile(0x400b, this->unk_84, super->collisionLayer); - if (super->collisionLayer == 2 && GetTileType(this->unk_84, 1) == 0x310) { - SetTile(0x400b, this->unk_84, 1); + this->unk_80 = GetMetaTileIndex(this->unk_84, super->collisionLayer); + SetMetaTile(0x400b, this->unk_84, super->collisionLayer); + if (super->collisionLayer == 2 && GetMetaTileType(this->unk_84, 1) == 0x310) { + SetMetaTile(0x400b, this->unk_84, 1); } } @@ -196,11 +196,11 @@ void sub_08089538(PushableStatueEntity* this) { u16 tileType; this->unk_86 = 0x20; EnqueueSFX(SFX_10F); - SetTile(this->unk_80, this->unk_84, super->collisionLayer); - if ((super->collisionLayer == 2) && (GetTileType(this->unk_84, 1) == 0x400b)) { + SetMetaTile(this->unk_80, this->unk_84, super->collisionLayer); + if ((super->collisionLayer == 2) && (GetMetaTileType(this->unk_84, 1) == 0x400b)) { CloneTile(0x310, this->unk_84, 1); } - tileType = GetTileType(this->unk_84 + gUnk_080B4488[super->direction >> 3], super->collisionLayer); + tileType = GetMetaTileType(this->unk_84 + gUnk_080B4488[super->direction >> 3], super->collisionLayer); if ((tileType == 0x79) || (tileType == 0x77)) { super->spriteOffsetY = -2; } @@ -253,7 +253,7 @@ u32 sub_0808968C(u32 param_1) { bool32 sub_080896B0(void) { s16 uVar1; s16 iVar2; - LayerStruct* layer; + MapLayer* mapLayer; s32 uVar4; const s16* ptr; u32 tmp1; @@ -265,11 +265,11 @@ bool32 sub_080896B0(void) { uVar1 = gUnk_080B4488[gPlayerEntity.animationState >> 1]; uVar4 = COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], -ptr[1]) - uVar1; vvv = GetVvvAtMetaTilePos(uVar4, gPlayerEntity.collisionLayer); - if ((vvv - 0x26 > 1) && (vvv != 0x29)) { - layer = GetLayerByIndex(gPlayerEntity.collisionLayer); + if ((vvv - 0x26 > 1) && (vvv != VVV_41)) { + mapLayer = GetLayerByIndex(gPlayerEntity.collisionLayer); iVar2 = (uVar4 * 0x10000) >> 0x10; - tmp1 = layer->collisionData[iVar2]; - tmp2 = layer->collisionData[(iVar2 - uVar1)]; + tmp1 = mapLayer->collisionData[iVar2]; + tmp2 = mapLayer->collisionData[(iVar2 - uVar1)]; if ((tmp1 == 0) && (tmp2 == 0)) { return TRUE; } diff --git a/src/object/railtrack.c b/src/object/railtrack.c index 5a77c8db..3162ebf8 100644 --- a/src/object/railtrack.c +++ b/src/object/railtrack.c @@ -128,13 +128,13 @@ void sub_08085394(Entity* this) { tile = COORD_TO_TILE(this); this->field_0x74.HWORD = *(layerData - off); - SetTile(uVar1, tile - off, this->collisionLayer); + SetMetaTile(uVar1, tile - off, this->collisionLayer); this->field_0x76.HWORD = layerData[0x0]; - SetTile(uVar1, tile - 0x0, this->collisionLayer); + SetMetaTile(uVar1, tile - 0x0, this->collisionLayer); this->field_0x78.HWORD = layerData[off]; - SetTile(uVar1, tile + off, this->collisionLayer); + SetMetaTile(uVar1, tile + off, this->collisionLayer); } void sub_0808543C(Entity* this) { @@ -144,9 +144,9 @@ void sub_0808543C(Entity* this) { temp = gUnk_080B4488[this->animationState / 2][0]; uVar2 = COORD_TO_TILE(this); - SetTile(this->field_0x74.HWORD, uVar2 - temp, this->collisionLayer); - SetTile(this->field_0x76.HWORD, uVar2, this->collisionLayer); - SetTile(this->field_0x78.HWORD, uVar2 + temp, this->collisionLayer); + SetMetaTile(this->field_0x74.HWORD, uVar2 - temp, this->collisionLayer); + SetMetaTile(this->field_0x76.HWORD, uVar2, this->collisionLayer); + SetMetaTile(this->field_0x78.HWORD, uVar2 + temp, this->collisionLayer); } u32 sub_080854A8(Entity* this) { diff --git a/src/object/rotatingTrapdoor.c b/src/object/rotatingTrapdoor.c index 9aa0f947..df523b5d 100644 --- a/src/object/rotatingTrapdoor.c +++ b/src/object/rotatingTrapdoor.c @@ -32,7 +32,7 @@ void RotatingTrapdoor_Init(Entity* this) { this->action = 1; x = 0; y = 0; - switch (GetTileTypeByEntity(this)) { + switch (GetMetaTileTypeByEntity(this)) { case 0x343: x = 0x10; case 0x344: diff --git a/src/object/smallIceBlock.c b/src/object/smallIceBlock.c index 1c5e048a..bc1754d4 100644 --- a/src/object/smallIceBlock.c +++ b/src/object/smallIceBlock.c @@ -87,7 +87,7 @@ void SmallIceBlock_Action1(SmallIceBlockEntity* this) { } } else { if (!sub_0800442E(super)) { - tileType = GetTileType(this->unk_70, super->collisionLayer); + tileType = GetMetaTileType(this->unk_70, super->collisionLayer); if (tileType != 0x405a) { switch (sub_08099618(tileType)) { case 1: @@ -102,7 +102,7 @@ void SmallIceBlock_Action1(SmallIceBlockEntity* this) { if (obj != NULL) { CopyPosition(super, obj); } - SetTile(this->unk_6c, this->unk_70, super->collisionLayer); + SetMetaTile(this->unk_6c, this->unk_70, super->collisionLayer); DeleteEntity(super); break; @@ -161,7 +161,7 @@ void SmallIceBlock_Action4(SmallIceBlockEntity* this) { DeleteThisEntity(); } else { if (super->timer == 0x30) { - SetTile(this->unk_6c, this->unk_70, super->collisionLayer); + SetMetaTile(this->unk_6c, this->unk_70, super->collisionLayer); } SetAffineInfo(super, 0x100, (0x3c - super->timer) * 0x20 + 0x100, 0); if ((super->timer & 1) != 0) { @@ -179,19 +179,19 @@ void SmallIceBlock_Action4(SmallIceBlockEntity* this) { void sub_08099468(SmallIceBlockEntity* this) { this->unk_70 = COORD_TO_TILE(super); - this->unk_6c = GetTileIndex(this->unk_70, super->collisionLayer); - SetTile(0x405a, this->unk_70, super->collisionLayer); + this->unk_6c = GetMetaTileIndex(this->unk_70, super->collisionLayer); + SetMetaTile(0x405a, this->unk_70, super->collisionLayer); } void sub_080994B8(SmallIceBlockEntity* this) { u16 tileType; EnqueueSFX(SFX_ICE_BLOCK_SLIDE); - SetTile(this->unk_6c, this->unk_70, super->collisionLayer); - if ((super->collisionLayer == 2) && (GetTileType(this->unk_70, 1) == 0x405a)) { + SetMetaTile(this->unk_6c, this->unk_70, super->collisionLayer); + if ((super->collisionLayer == 2) && (GetMetaTileType(this->unk_70, 1) == 0x405a)) { CloneTile(0x310, this->unk_70, 1); } - tileType = GetTileType(this->unk_70 + gUnk_080B4488[super->direction >> 3], super->collisionLayer); + tileType = GetMetaTileType(this->unk_70 + gUnk_080B4488[super->direction >> 3], super->collisionLayer); if (tileType == 0x79 || tileType == 0x77) { super->spriteOffsetY = -2; } diff --git a/src/object/smokeParticle.c b/src/object/smokeParticle.c index dacd282f..774ded3d 100644 --- a/src/object/smokeParticle.c +++ b/src/object/smokeParticle.c @@ -6,8 +6,8 @@ */ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" +#include "tiles.h" void SmokeParticle_Init(Entity*); void SmokeParticle_Action1(Entity*); @@ -64,22 +64,22 @@ void sub_080878CC(Entity* this) { s32 itX; s32 itY; u32 layer; - u32 pos; + u32 metaTilePos; x = this->x.HALF.HI; y = this->y.HALF.HI; layer = this->collisionLayer; for (itX = -0x10; itX < 0x11; itX += 0x10) { for (itY = -0x10; itY < 0x11; itY += 0x10) { - pos = TILE((u32)x + itX, (u32)y + itY); - if (GetVvvAtMetaTilePos(pos, (u8)layer) == 0x2e) { - switch (GetTileType(pos, layer)) { + metaTilePos = TILE((u32)x + itX, (u32)y + itY); + if (GetVvvAtMetaTilePos(metaTilePos, (u8)layer) == VVV_46) { + switch (GetMetaTileType(metaTilePos, layer)) { case 0x368: case 0x367: sub_08008796(this, 3, x + itX, y + itY); break; default: - SetTile(0x4022, pos, layer); + SetMetaTile(0x4022, metaTilePos, layer); break; } } else { diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c index 8887c9db..333c5d70 100644 --- a/src/object/treeHidingPortal.c +++ b/src/object/treeHidingPortal.c @@ -8,11 +8,11 @@ #include "entity.h" #include "flags.h" #include "functions.h" -#include "global.h" #include "object.h" #include "player.h" #include "room.h" #include "sound.h" +#include "tiles.h" extern const s16 gUnk_080B4468[]; @@ -54,7 +54,7 @@ void TreeHidingPortal_Action1(Entity* this) { } } } - if (sub_0809E9A0() == 0x54) { + if (sub_0809E9A0() == VVV_84) { this->action = 2; this->timer = 15; SetPlayerControl(1); @@ -108,7 +108,7 @@ static u32 sub_0809E9A0(void) { const s16* ptr; if (gPlayerEntity.action != PLAYER_BOUNCE) { - vvv = 0; + vvv = VVV_0; } else { ptr = &gUnk_080B4468[gPlayerEntity.animationState & 6]; vvv = GetVvvAtMetaTilePos(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], -ptr[1]), 1); diff --git a/src/object/treeThorns.c b/src/object/treeThorns.c index e01a832d..30d40a11 100644 --- a/src/object/treeThorns.c +++ b/src/object/treeThorns.c @@ -30,8 +30,8 @@ void TreeThorns(Entity* this) { this->flags2 = 1; this->hitbox = (Hitbox*)&gHitbox_1; tilePos = COORD_TO_TILE(this); - SetTile(0x4066, tilePos - 1, *layer); - SetTile(0x4065, tilePos, *layer); + SetMetaTile(0x4066, tilePos - 1, *layer); + SetMetaTile(0x4065, tilePos, *layer); UpdateSpriteForCollisionLayer(this); ent = CreateObject(TREE_THORNS, 1, 0); if (ent != NULL) { diff --git a/src/object/unusedSkull.c b/src/object/unusedSkull.c index c6a2e1f5..739cbb8d 100644 --- a/src/object/unusedSkull.c +++ b/src/object/unusedSkull.c @@ -40,7 +40,7 @@ void UnusedSkull_Init(UnusedSkullEntity* this) { super->hurtType = 0x47; super->flags2 = 2; super->hitbox = (Hitbox*)&gHitbox_4; - SetTile(0x4050, COORD_TO_TILE(super), super->collisionLayer); + SetMetaTile(0x4050, COORD_TO_TILE(super), super->collisionLayer); if (super->type == 1 || CheckFlags(this->unk_86)) { super->action = 3; SetFlag(this->unk_86); diff --git a/src/object/waterfallOpening.c b/src/object/waterfallOpening.c index 72c724d1..92455ebb 100644 --- a/src/object/waterfallOpening.c +++ b/src/object/waterfallOpening.c @@ -77,7 +77,7 @@ void WaterfallOpening(Entity* this) { case 2: if ((this->subAction == 0)) { this->subAction = 1; - SetTileType(0x39, COORD_TO_TILE(this), 1); + SetMetaTileType(0x39, COORD_TO_TILE(this), 1); } } diff --git a/src/object/well.c b/src/object/well.c index 8f866a41..480a0821 100644 --- a/src/object/well.c +++ b/src/object/well.c @@ -28,13 +28,13 @@ void Well_Init(Entity* this) { this->action = 1; tilePos = COORD_TO_TILE(this); this->field_0x80.HWORD = tilePos; - SetTile(0x407d, this->field_0x80.HWORD, 1); + SetMetaTile(0x407d, this->field_0x80.HWORD, 1); } void Well_Action1(Entity* this) { s32 tileIndex; - tileIndex = GetTileType(this->field_0x80.HWORD, 1); + tileIndex = GetMetaTileType(this->field_0x80.HWORD, 1); if (tileIndex != 0x407d) { sub_08078B48(); gPlayerEntity.x.WORD = this->x.WORD; |
