diff options
| author | octorock <79596758+octorock@users.noreply.github.com> | 2023-06-17 00:10:00 +0200 |
|---|---|---|
| committer | octorock <79596758+octorock@users.noreply.github.com> | 2023-06-17 00:10:00 +0200 |
| commit | c317fe3f18325fec54c0d76df450f132945449f7 (patch) | |
| tree | 553de6f2d0b1a1ed2a988ffb8a306dd3a138e88a /src/object | |
| parent | 551cb7209393d06e302a5bda489c341f38efd1f3 (diff) | |
Extract KeyValuePairs
Diffstat (limited to 'src/object')
| -rw-r--r-- | src/object/bigIceBlock.c | 164 | ||||
| -rw-r--r-- | src/object/bollard.c | 2 | ||||
| -rw-r--r-- | src/object/button.c | 2 | ||||
| -rw-r--r-- | src/object/crenelBeanSprout.c | 8 | ||||
| -rw-r--r-- | src/object/cutsceneMiscObject.c | 2 | ||||
| -rw-r--r-- | src/object/furniture.c | 6 | ||||
| -rw-r--r-- | src/object/itemOnGround.c | 2 | ||||
| -rw-r--r-- | src/object/jarPortal.c | 8 | ||||
| -rw-r--r-- | src/object/lilypadLarge.c | 16 | ||||
| -rw-r--r-- | src/object/mask.c | 2 | ||||
| -rw-r--r-- | src/object/minecart.c | 52 | ||||
| -rw-r--r-- | src/object/object1F.c | 2 | ||||
| -rw-r--r-- | src/object/objectOnPillar.c | 10 | ||||
| -rw-r--r-- | src/object/playerClone.c | 2 | ||||
| -rw-r--r-- | src/object/pot.c | 2 | ||||
| -rw-r--r-- | src/object/pullableLever.c | 2 | ||||
| -rw-r--r-- | src/object/pushableFurniture.c | 12 | ||||
| -rw-r--r-- | src/object/pushableRock.c | 8 | ||||
| -rw-r--r-- | src/object/pushableStatue.c | 8 | ||||
| -rw-r--r-- | src/object/smokeParticle.c | 2 | ||||
| -rw-r--r-- | src/object/treeHidingPortal.c | 8 | ||||
| -rw-r--r-- | src/object/well.c | 4 |
22 files changed, 171 insertions, 153 deletions
diff --git a/src/object/bigIceBlock.c b/src/object/bigIceBlock.c index b52fe780..0d865546 100644 --- a/src/object/bigIceBlock.c +++ b/src/object/bigIceBlock.c @@ -129,8 +129,8 @@ void sub_08099880(BigIceBlockEntity* this) { void sub_08099910(BigIceBlockEntity* this) { u32 uVar2; - s32 iVar1; - u32 uVar3; + s32 vvv; + u32 tileIndex; u32 position; position = COORD_TO_TILE(super); @@ -146,112 +146,112 @@ void sub_08099910(BigIceBlockEntity* this) { SetTile(0x4022, position, super->collisionLayer); break; case 1: - iVar1 = sub_080B1AE0(position - 0x41, super->collisionLayer); - uVar3 = 0x4024; - if (iVar1 == 0x12) { - uVar3 = 0x4079; + vvv = GetVvvAtMetaTilePos(position - 0x41, super->collisionLayer); + tileIndex = 0x4024; + if (vvv == 0x12) { + tileIndex = 0x4079; } - SetTile(uVar3, position - 0x41, super->collisionLayer); + SetTile(tileIndex, position - 0x41, super->collisionLayer); SetTile(0x4022, position - 0x40, super->collisionLayer); - iVar1 = sub_080B1AE0(position - 0x3f, super->collisionLayer); - uVar3 = 0x4025; - if (iVar1 == 0x12) { - uVar3 = 0x407b; + vvv = GetVvvAtMetaTilePos(position - 0x3f, super->collisionLayer); + tileIndex = 0x4025; + if (vvv == 0x12) { + tileIndex = 0x407b; } - SetTile(uVar3, position - 0x3f, super->collisionLayer); - iVar1 = sub_080B1AE0(position - 1, super->collisionLayer); - uVar3 = 0x4024; - if (iVar1 == 0x12) { - uVar3 = 0x4079; + SetTile(tileIndex, position - 0x3f, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(position - 1, super->collisionLayer); + tileIndex = 0x4024; + if (vvv == 0x12) { + tileIndex = 0x4079; } - SetTile(uVar3, position - 1, super->collisionLayer); + SetTile(tileIndex, position - 1, super->collisionLayer); SetTile(0x4022, position, super->collisionLayer); - iVar1 = sub_080B1AE0(position + 1, super->collisionLayer); - uVar3 = 0x4025; - if (iVar1 == 0x12) { - uVar3 = 0x407b; + vvv = GetVvvAtMetaTilePos(position + 1, super->collisionLayer); + tileIndex = 0x4025; + if (vvv == 0x12) { + tileIndex = 0x407b; } - SetTile(uVar3, position + 1, super->collisionLayer); + SetTile(tileIndex, position + 1, super->collisionLayer); return; break; case 2: - iVar1 = sub_080B1AE0(position - 0x41, super->collisionLayer); - uVar3 = 0x4023; - if (iVar1 == 0x12) { - uVar3 = 0x4077; + vvv = GetVvvAtMetaTilePos(position - 0x41, super->collisionLayer); + tileIndex = 0x4023; + if (vvv == 0x12) { + tileIndex = 0x4077; } - SetTile(uVar3, position - 0x41, super->collisionLayer); - iVar1 = sub_080B1AE0(position - 0x40, super->collisionLayer); - uVar3 = 0x4023; - if (iVar1 == 0x12) { - uVar3 = 0x4077; + SetTile(tileIndex, position - 0x41, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(position - 0x40, super->collisionLayer); + tileIndex = 0x4023; + if (vvv == 0x12) { + tileIndex = 0x4077; } - SetTile(uVar3, position - 0x40, super->collisionLayer); + SetTile(tileIndex, position - 0x40, super->collisionLayer); SetTile(0x4022, position - 1, super->collisionLayer); SetTile(0x4022, position, super->collisionLayer); - iVar1 = sub_080B1AE0(position + 0x3f, super->collisionLayer); - uVar3 = 0x4026; - if (iVar1 == 0x12) { - uVar3 = 0x407c; + vvv = GetVvvAtMetaTilePos(position + 0x3f, super->collisionLayer); + tileIndex = 0x4026; + if (vvv == 0x12) { + tileIndex = 0x407c; } - SetTile(uVar3, position + 0x3f, super->collisionLayer); - iVar1 = sub_080B1AE0(position + 0x40, super->collisionLayer); - uVar3 = 0x4026; - if (iVar1 == 0x12) { - uVar3 = 0x407c; + SetTile(tileIndex, position + 0x3f, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(position + 0x40, super->collisionLayer); + tileIndex = 0x4026; + if (vvv == 0x12) { + tileIndex = 0x407c; } - SetTile(uVar3, position + 0x40, super->collisionLayer); + SetTile(tileIndex, position + 0x40, super->collisionLayer); break; case 3: - iVar1 = sub_080B1AE0(position - 0x41, super->collisionLayer); - uVar3 = 0x4027; - if (iVar1 == 0x12) { - uVar3 = 0x4075; + vvv = GetVvvAtMetaTilePos(position - 0x41, super->collisionLayer); + tileIndex = 0x4027; + if (vvv == 0x12) { + tileIndex = 0x4075; } - SetTile(uVar3, position - 0x41, super->collisionLayer); - iVar1 = sub_080B1AE0(position - 0x40, super->collisionLayer); - uVar3 = 0x4023; - if (iVar1 == 0x12) { - uVar3 = 0x4077; + SetTile(tileIndex, position - 0x41, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(position - 0x40, super->collisionLayer); + tileIndex = 0x4023; + if (vvv == 0x12) { + tileIndex = 0x4077; } - SetTile(uVar3, position - 0x40, super->collisionLayer); - iVar1 = sub_080B1AE0(position - 0x3f, super->collisionLayer); - uVar3 = 0x4028; - if (iVar1 == 0x12) { - uVar3 = 0x4076; + SetTile(tileIndex, position - 0x40, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(position - 0x3f, super->collisionLayer); + tileIndex = 0x4028; + if (vvv == 0x12) { + tileIndex = 0x4076; } - SetTile(uVar3, position - 0x3f, super->collisionLayer); - iVar1 = sub_080B1AE0(position - 1, super->collisionLayer); - uVar3 = 0x4024; - if (iVar1 == 0x12) { - uVar3 = 0x4079; + SetTile(tileIndex, position - 0x3f, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(position - 1, super->collisionLayer); + tileIndex = 0x4024; + if (vvv == 0x12) { + tileIndex = 0x4079; } - SetTile(uVar3, position - 1, super->collisionLayer); + SetTile(tileIndex, position - 1, super->collisionLayer); SetTile(0x4022, position, super->collisionLayer); - iVar1 = sub_080B1AE0(position + 1, super->collisionLayer); - uVar3 = 0x4025; - if (iVar1 == 0x12) { - uVar3 = 0x407b; + vvv = GetVvvAtMetaTilePos(position + 1, super->collisionLayer); + tileIndex = 0x4025; + if (vvv == 0x12) { + tileIndex = 0x407b; } - SetTile(uVar3, position + 1, super->collisionLayer); - iVar1 = sub_080B1AE0(position + 0x3f, super->collisionLayer); - uVar3 = 0x4029; - if (iVar1 == 0x12) { - uVar3 = 0x4078; + SetTile(tileIndex, position + 1, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(position + 0x3f, super->collisionLayer); + tileIndex = 0x4029; + if (vvv == 0x12) { + tileIndex = 0x4078; } - SetTile(uVar3, position + 0x3f, super->collisionLayer); - iVar1 = sub_080B1AE0(position + 0x40, super->collisionLayer); - uVar3 = 0x4026; - if (iVar1 == 0x12) { - uVar3 = 0x407c; + SetTile(tileIndex, position + 0x3f, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(position + 0x40, super->collisionLayer); + tileIndex = 0x4026; + if (vvv == 0x12) { + tileIndex = 0x407c; } - SetTile(uVar3, position + 0x40, super->collisionLayer); - iVar1 = sub_080B1AE0(position + 0x41, super->collisionLayer); - uVar3 = 0x402a; - if (iVar1 == 0x12) { - uVar3 = 0x407a; + SetTile(tileIndex, position + 0x40, super->collisionLayer); + vvv = GetVvvAtMetaTilePos(position + 0x41, super->collisionLayer); + tileIndex = 0x402a; + if (vvv == 0x12) { + tileIndex = 0x407a; } - SetTile(uVar3, position + 0x41, super->collisionLayer); + SetTile(tileIndex, position + 0x41, super->collisionLayer); break; } } diff --git a/src/object/bollard.c b/src/object/bollard.c index 304a9647..20994ca3 100644 --- a/src/object/bollard.c +++ b/src/object/bollard.c @@ -95,7 +95,7 @@ void sub_0808B3AC(BollardEntity* this) { super->spritePriority.b0 = 4; this->tile = COORD_TO_TILE(super); this->tileIndex = GetTileIndex(this->tile, super->collisionLayer); - this->unk74 = GetCollisionData(this->tile, super->collisionLayer); + this->unk74 = GetCollisionDataAtMetaTilePos(this->tile, super->collisionLayer); SetTile(0x400b, this->tile, super->collisionLayer); } diff --git a/src/object/button.c b/src/object/button.c index 42233657..ff68caba 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -154,7 +154,7 @@ u32 sub_08081E0C(Entity*); Entity* sub_08081D74(Entity* this) { Entity* ent; - if (GetCollisionData(this->field_0x74.HWORD, this->collisionLayer) == 0xF) { + if (GetCollisionDataAtMetaTilePos(this->field_0x74.HWORD, this->collisionLayer) == 0xF) { return 0; } ent = 0; diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c index 8bee94eb..e9af7e85 100644 --- a/src/object/crenelBeanSprout.c +++ b/src/object/crenelBeanSprout.c @@ -6,8 +6,8 @@ */ #define NENT_DEPRECATED +#include "asm.h" #include "functions.h" -#include "global.h" #include "hitbox.h" #include "object.h" @@ -18,8 +18,6 @@ typedef struct { /*0x72*/ u16 unk_72; } CrenelBeanSproutEntity; -extern u32 sub_080B1AB4(s32, s32, u32); - void sub_080969A4(CrenelBeanSproutEntity*); void sub_08096A78(CrenelBeanSproutEntity*); void CrenelBeanSprout_Init(CrenelBeanSproutEntity*); @@ -171,13 +169,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 (sub_080B1AB4(this->unk_70, this->unk_72, super->collisionLayer) == 0x19) { + if (GetVvvAtWorldCoords(this->unk_70, this->unk_72, super->collisionLayer) == 0x19) { gHUD.rActionPlayerState = R_ACTION_THROW; } else { gHUD.rActionPlayerState = R_ACTION_NONE; } PositionRelative(&gPlayerEntity, super, 0, 0x10000); - if (GetTileUnderEntity(super) == 0x19) { + if (GetVvvAtEntity(super) == 0x19) { RestorePrevTileEntity(0xdc, super->collisionLayer); sub_08096A78(this); } diff --git a/src/object/cutsceneMiscObject.c b/src/object/cutsceneMiscObject.c index 8105cb11..16994592 100644 --- a/src/object/cutsceneMiscObject.c +++ b/src/object/cutsceneMiscObject.c @@ -335,7 +335,7 @@ void sub_08094E30(CutsceneMiscObjectEntity* this) { super->zVelocity = 0; SetDefaultPriority(super, PRIO_PLAYER_EVENT); InitializeAnimation(super, 0); - if (GetTileUnderEntity(super) == 13) { + if (GetVvvAtEntity(super) == 13) { super->action = 3; } break; diff --git a/src/object/furniture.c b/src/object/furniture.c index 38a111d0..b274a37f 100644 --- a/src/object/furniture.c +++ b/src/object/furniture.c @@ -10,8 +10,6 @@ #include "object.h" #include "room.h" -extern void sub_080001D0(u32, u32, u32); - enum { FURNITURE_INIT, FURNITURE_UPDATE, @@ -263,7 +261,7 @@ static void FurnitureInit(FurnitureEntity* this) { for (i = 0; i < cnt; ++i, ++tile) { SetTile(0x4026, tile, 2); SetTile(0x4026, tile, 1); - sub_080001D0(0, tile + 64, 1); + SetVvvAtMetaTilePos(0, tile + 64, 1); } break; } @@ -289,7 +287,7 @@ static void FurnitureInit(FurnitureEntity* this) { super->collisionLayer = 1; super->spriteOrientation.flipY = 2; SetTile(0x4074, this->tile - 64, super->collisionLayer); - sub_080001D0(63, 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); break; diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c index eaf97830..3ec5a6e2 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -282,7 +282,7 @@ void sub_080812A0(Entity* this) { } void sub_080812A8(Entity* this) { - if (sub_080B1B0C(this) != 0xF && this->field_0x6e.HWORD != GetTileTypeByEntity(this)) { + if (GetCollisionDataAtEntity(this) != 0xF && this->field_0x6e.HWORD != GetTileTypeByEntity(this)) { this->direction = 0; this->speed = 0; this->spriteSettings.draw = 1; diff --git a/src/object/jarPortal.c b/src/object/jarPortal.c index 04720216..94000d86 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(16530, pos - 1, this->collisionLayer); - SetTile(16531, pos, this->collisionLayer); - SetTile(16532, pos + 63, this->collisionLayer); - SetTile(16533, pos + 64, this->collisionLayer); + SetTile(0x4092, pos - 1, this->collisionLayer); + SetTile(0x4093, pos, this->collisionLayer); + SetTile(0x4094, pos + 63, this->collisionLayer); + SetTile(0x4095, pos + 64, this->collisionLayer); } else { RestorePrevTileEntity(pos - 1, this->collisionLayer); RestorePrevTileEntity(pos, this->collisionLayer); diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c index 84b11274..a9bbe2e1 100644 --- a/src/object/lilypadLarge.c +++ b/src/object/lilypadLarge.c @@ -344,10 +344,10 @@ void sub_08085A1C(LilypadLargeEntity* this) { void sub_08085A44(LilypadLargeEntity* this) { super->speed = 0x200; - if (GetRelativeCollisionTile(super, 0x10, 0x18) != 0x11) { + if (GetVvvRelativeToEntity(super, 0x10, 0x18) != 0x11) { super->direction = 0x18; } else { - if (GetRelativeCollisionTile(super, -0x10, 0x18) != 0x11) { + if (GetVvvRelativeToEntity(super, -0x10, 0x18) != 0x11) { super->direction = 8; } else { super->direction = 0x10; @@ -368,7 +368,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 (GetRelativeCollisionTile(super, 0, 0x18) != 0x11) { + if (GetVvvRelativeToEntity(super, 0, 0x18) != 0x11) { super->subAction = 2; if (gArea.locationIndex == 0x1b) { super->y.HALF.HI += 0xd0; @@ -401,7 +401,7 @@ void sub_08085B40(LilypadLargeEntity* this) { } } else { ResetCollisionLayer(super); - if (GetTileUnderEntity(super) == 0xd) { + if (GetVvvAtEntity(super) == 0xd) { ResetCollisionLayer(&gPlayerEntity); sub_08085CDC(this); super->direction = GetFacingDirection(&gPlayerEntity, super); @@ -423,7 +423,7 @@ void sub_08085B40(LilypadLargeEntity* this) { super->timer |= 0x80; this->unk_70 = 0; this->unk_6c = 0; - if (GetTileUnderEntity(super) == 0xd) { + if (GetVvvAtEntity(super) == 0xd) { super->action = 4; } } @@ -471,7 +471,7 @@ void sub_08085D10(LilypadLargeEntity* this) { void sub_08085D28(LilypadLargeEntity* this) { if (((gPlayerState.framestate != PL_STATE_TALKEZLO) && ((gPlayerState.flags & PL_FLAGS2) != 0)) && - (GetRelativeCollisionTile(super, 0, 0x18) == 0x11)) { + (GetVvvRelativeToEntity(super, 0, 0x18) == 0x11)) { super->action = 2; super->subAction = 0; sub_08078B48(); @@ -509,7 +509,7 @@ void sub_08085D60(LilypadLargeEntity* this) { tmp = r4 >> 2; tmpX = gUnk_08120638[tmp]; tmpY = gUnk_08120638[tmp + 1]; - if (sub_080B1AF0(super, tmpX, tmpY) == 0xff) { + if (GetCollisionDataRelativeTo(super, tmpX, tmpY) == 0xff) { if (sub_080806BC((super->x.HALF.HI - gRoomControls.origin_x) + tmpX, (super->y.HALF.HI - gRoomControls.origin_y) + tmpY, r4, 5) == 0) { @@ -528,7 +528,7 @@ void sub_08085D60(LilypadLargeEntity* this) { tmp = r6 >> 2; tmpX2 = gUnk_08120638[tmp]; tmpY2 = gUnk_08120638[tmp + 1]; - if (sub_080B1AF0(super, tmpX2, tmpY2) == 0xff) { + if (GetCollisionDataRelativeTo(super, tmpX2, tmpY2) == 0xff) { if (sub_0807BD14(&gPlayerEntity, r6 >> 3) != 0) { super->direction = (u8)r6; sub_08085E74(this); diff --git a/src/object/mask.c b/src/object/mask.c index 969d98c2..566e6ea1 100644 --- a/src/object/mask.c +++ b/src/object/mask.c @@ -61,7 +61,7 @@ void Mask_Init(Entity* this) { 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_0x7a.HWORD = GetCollisionData((u16)this->field_0x7c.HALF.HI, 1); + this->field_0x7a.HWORD = GetCollisionDataAtMetaTilePos((u16)this->field_0x7c.HALF.HI, 1); SetTile(0x4022, this->field_0x7c.HALF_U.HI, 1); } diff --git a/src/object/minecart.c b/src/object/minecart.c index 3a4c434e..77a027f1 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -27,7 +27,7 @@ void Minecart_Action5(MinecartEntity*); void Minecart_Action6(MinecartEntity*); void Minecart_Action7(MinecartEntity*); -extern const u16* const gUnk_081223D8[]; +extern const KeyValuePair* const gUnk_081223D8[]; void Minecart(Entity* this) { static void (*const Minecart_Actions[])(MinecartEntity*) = { @@ -129,10 +129,9 @@ void Minecart_Action2(MinecartEntity* this) { } void Minecart_Action3(MinecartEntity* this) { - static const s8 gUnk_081223C8[] = { 0, -7, 7, 0, 0, 7, -7, 0 }; + static const s8 offsetCoords[] = { 0, -7, 7, 0, 0, 7, -7, 0 }; - u32 iVar2; - u32 uVar3; + u32 vvv; gRoomControls.scrollSpeed = 7; if ((gPlayerState.flags & PL_IN_MINECART) == 0) { @@ -164,14 +163,13 @@ void Minecart_Action3(MinecartEntity* this) { super->subtimer = 60; } - uVar3 = GetRelativeCollisionTile(super, gUnk_081223C8[super->animationState * 2], - gUnk_081223C8[super->animationState * 2 + 1]); - iVar2 = sub_08007DD6(uVar3, gUnk_081223D8[super->animationState]); - if (iVar2 == 0) { + vvv = GetVvvRelativeToEntity(super, offsetCoords[super->animationState * 2], + offsetCoords[super->animationState * 2 + 1]); + if (FindValueForKey(vvv, gUnk_081223D8[super->animationState]) == 0) { super->direction = DirectionTurnAround(super->direction); super->animationState = AnimationStateFlip90(super->animationState); } else { - switch (uVar3) { + switch (vvv) { case 0x64: super->flags &= ~ENT_PERSIST; super->hitType = 1; @@ -200,7 +198,7 @@ void Minecart_Action3(MinecartEntity* this) { case 0x6d: case 0x6e: case 0x6f: - if (uVar3 == GetTileUnderEntity(super)) { + if (vvv == GetVvvAtEntity(super)) { Minecart_Action4(this); gPlayerEntity.animationState = super->animationState << 1; return; @@ -222,7 +220,7 @@ void Minecart_Action3(MinecartEntity* this) { void Minecart_Action4(MinecartEntity* this) { sub_08004168(super); CopyPosition(super, &gPlayerEntity); - switch (GetTileUnderEntity(super)) { + switch (GetVvvAtEntity(super)) { case 0x67: if (super->direction == DirectionWest) { super->direction = DirectionNorth; @@ -312,8 +310,8 @@ void Minecart_Action7(MinecartEntity* this) { bool32 sub_08091DDC(MinecartEntity* this) { static const s8 gUnk_081223D0[] = { 0, -8, 8, 0, 0, 8, -8, 0 }; - if ((sub_080B1AF0(super, gUnk_081223D0[super->animationState * 2], gUnk_081223D0[super->animationState * 2 + 1]) == - 0xff) && + if ((GetCollisionDataRelativeTo(super, gUnk_081223D0[super->animationState * 2], + gUnk_081223D0[super->animationState * 2 + 1]) == 0xff) && (sub_0807BD14(&gPlayerEntity, super->animationState))) { super->updatePriority = 6; super->action = 5; @@ -332,3 +330,31 @@ bool32 sub_08091DDC(MinecartEntity* this) { return 0; } } + +extern const KeyValuePair gUnk_081223E8[]; +extern const KeyValuePair gUnk_08122402[]; +extern const KeyValuePair gUnk_0812241C[]; +extern const KeyValuePair gUnk_08122436[]; + +const KeyValuePair* const gUnk_081223D8[] = { + gUnk_081223E8, + gUnk_08122402, + gUnk_0812241C, + gUnk_08122436, +}; +const KeyValuePair gUnk_081223E8[] = { + { 242, 1 }, { 101, 1 }, { 104, 1 }, { 106, 1 }, { 100, 1 }, { 41, 1 }, +}; +const u16 gUnk_081223E8End = 0; +const KeyValuePair gUnk_08122402[] = { + { 243, 1 }, { 102, 1 }, { 104, 1 }, { 105, 1 }, { 100, 1 }, { 41, 1 }, +}; +const u16 gUnk_08122402End = 0; +const KeyValuePair gUnk_0812241C[] = { + { 242, 1 }, { 101, 1 }, { 103, 1 }, { 105, 1 }, { 100, 1 }, { 41, 1 }, +}; +const u16 gUnk_0812241CEnd = 0; +const KeyValuePair gUnk_08122436[] = { + { 243, 1 }, { 102, 1 }, { 106, 1 }, { 103, 1 }, { 100, 1 }, { 41, 1 }, +}; +const u16 gUnk_08122436End = 0; diff --git a/src/object/object1F.c b/src/object/object1F.c index bff26637..5ee4382f 100644 --- a/src/object/object1F.c +++ b/src/object/object1F.c @@ -83,7 +83,7 @@ void Object1F_Action1(Object1FEntity* this) { void Object1F_Action2(Object1FEntity* this) { u8 bVar1; - bVar1 = sub_080B1B0C(super); + bVar1 = GetCollisionDataAtEntity(super); switch (bVar1) { case 0x21: CreateFx(super, FX_FALL_DOWN, 0); diff --git a/src/object/objectOnPillar.c b/src/object/objectOnPillar.c index 5b617169..ae4baa1d 100644 --- a/src/object/objectOnPillar.c +++ b/src/object/objectOnPillar.c @@ -38,11 +38,6 @@ typedef struct { /*0x86*/ u16 hitFlag; } EntityWithHitFlag; -typedef struct { - u16 key; - u16 value; -} KeyValuePair; - void sub_080970F4(ObjectOnPillarEntity*); void sub_080971E0(ObjectOnPillarEntity*); bool32 sub_08097194(ObjectOnPillarEntity*); @@ -180,8 +175,9 @@ bool32 sub_08097008(ObjectOnPillarEntity* this) { u32 sub_08097074(u32 tileType) { static const KeyValuePair gUnk_0812327C[] = { - { 0x4037, 1 }, { 0x4038, 1 }, { 0x4039, 1 }, { 0x403a, 1 }, { 0x7a, 2 }, { 0x78, 2 }, { 0, 0 }, + { 0x4037, 1 }, { 0x4038, 1 }, { 0x4039, 1 }, { 0x403a, 1 }, { 0x7a, 2 }, { 0x78, 2 }, }; + static const u16 gUnk_0812327CEnd = 0; const KeyValuePair* entry = gUnk_0812327C; for (; entry->key != 0; entry++) { if (entry->key == tileType) { @@ -211,7 +207,7 @@ void sub_080970F4(ObjectOnPillarEntity* this) { bool32 sub_08097144(ObjectOnPillarEntity* this) { LinearMoveUpdate(super); sub_0800445C(super); - if (GetTileUnderEntity(super) == 0x19) { + if (GetVvvAtEntity(super) == 0x19) { super->spriteOffsetY = 2; } if ((--this->unk_76 == 0) && sub_08097194(this) == FALSE) { diff --git a/src/object/playerClone.c b/src/object/playerClone.c index e898dcfe..48618a99 100644 --- a/src/object/playerClone.c +++ b/src/object/playerClone.c @@ -110,7 +110,7 @@ void PlayerClone_Action2(PlayerCloneEntity* this) { if (gPlayerEntity.iframes >= 1) { gPlayerState.chargeState.action = 1; } else { - GetTileUnderEntity(super); + GetVvvAtEntity(super); // TODO why is the return value not used? sub_08084B1C(this); super->x.HALF.HI = gPlayerEntity.x.HALF.HI + this->unk78; super->y.HALF.HI = gPlayerEntity.y.HALF.HI + this->unk7a; diff --git a/src/object/pot.c b/src/object/pot.c index 0e024f6f..2d635253 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -118,7 +118,7 @@ void Pot_Action1(Entity* this) { DeleteThisEntity(); break; default: - if (GetTileUnderEntity(this) == 13) { + if (GetVvvAtEntity(this) == 13) { CreateFx(this, FX_FALL_DOWN, 0); } else if (tileType == 0x4005) { gPlayerState.lastSwordMove = SWORD_MOVE_BREAK_POT; diff --git a/src/object/pullableLever.c b/src/object/pullableLever.c index 7c2a738f..7c7186c6 100644 --- a/src/object/pullableLever.c +++ b/src/object/pullableLever.c @@ -114,7 +114,7 @@ void PullableLever_HandleSubAction0(PullableLeverEntity* this) { if (-player->animationState + super->type2 * 2 == 0) { x = gUnk_081222B8[super->type2 * 2] + super->x.HALF_U.HI; y = gUnk_081222B8[super->type2 * 2 + 1] + super->y.HALF_U.HI; - if (0x10 < sub_080B1B18(x, y, player->collisionLayer) - 0xf) { + if (0x10 < GetCollisionDataAtWorldCoords(x, y, player->collisionLayer) - 0xf) { player->x.HALF.HI = x; player->y.HALF.HI = y; } diff --git a/src/object/pushableFurniture.c b/src/object/pushableFurniture.c index 2d3b77da..e7310174 100644 --- a/src/object/pushableFurniture.c +++ b/src/object/pushableFurniture.c @@ -223,7 +223,7 @@ bool32 sub_0808FC5C(PushableFurnitureEntity* this) { } else { super->spriteOffsetY = 0; } - if (sub_080B1B0C(super)) { + if (GetCollisionDataAtEntity(super)) { return 0; } if (super->subtimer == 0) { @@ -312,27 +312,27 @@ void sub_0808FDE8(PushableFurnitureEntity* this) { u32 uVar3; uVar3 = (u32)this->unk_70; - uVar1 = GetCollisionData(uVar3 - 1, 1); + uVar1 = GetCollisionDataAtMetaTilePos(uVar3 - 1, 1); iVar2 = GetTileIndex(uVar3, 1); if (iVar2 == 0x402e) { if ((((uVar1 & 0xf0) != 0) && ((uVar1 & 0xf0) != 0x50)) || ((uVar1 & 5) == 0)) { SetTile(0x402c, uVar3, 1); } } else { - iVar2 = GetCollisionData(uVar3, 1); + iVar2 = GetCollisionDataAtMetaTilePos(uVar3, 1); if ((iVar2 == 5) && ((((uVar1 & 0xf0) == 0 || ((uVar1 & 0xf0) == 0x50)) && ((uVar1 & 5) != 0)))) { SetTile(0x402e, uVar3, 1); } } uVar3 = (u32)this->unk_72; - uVar1 = GetCollisionData(uVar3 + 1, 1); + uVar1 = GetCollisionDataAtMetaTilePos(uVar3 + 1, 1); iVar2 = GetTileIndex(uVar3, 1); if (iVar2 == 0x402f) { if ((((uVar1 & 0xf0) != 0) && ((uVar1 & 0xf0) != 0x50)) || ((uVar1 & 10) == 0)) { SetTile(0x402d, uVar3, 1); } } else { - iVar2 = GetCollisionData(uVar3, 1); + iVar2 = GetCollisionDataAtMetaTilePos(uVar3, 1); if (((iVar2 == 10) && (((uVar1 & 0xf0) == 0 || ((uVar1 & 0xf0) == 0x50)))) && ((uVar1 & 10) != 0)) { SetTile(0x402f, uVar3, 1); } @@ -411,7 +411,7 @@ void sub_08090094(PushableFurnitureEntity* this, u32 param_2, u32 tilePos) { u32 index; u32 tmp2; - tmp1 = GetCollisionData(tilePos, 1); + tmp1 = GetCollisionDataAtMetaTilePos(tilePos, 1); index = GetTileIndex(tilePos, 1); if ((index & 0x4000) == 0) { index = param_2; diff --git a/src/object/pushableRock.c b/src/object/pushableRock.c index f0a90128..464bb24a 100644 --- a/src/object/pushableRock.c +++ b/src/object/pushableRock.c @@ -89,12 +89,12 @@ void PushableRock_Action3(PushableRockEntity* this) { } void sub_0808A644(PushableRockEntity* this) { - u32 tmp; + u32 vvv; this->tilePosition = COORD_TO_TILE(super); this->tileIndex = GetTileIndex(this->tilePosition, super->collisionLayer); - this->unk_72 = GetCollisionData(this->tilePosition, super->collisionLayer); - tmp = sub_080B1AE0(this->tilePosition, super->collisionLayer); - if ((tmp == 0x19) || (tmp == 0xf0)) { + 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); super->action = 3; if (!CheckFlags(this->pushedFlag)) { diff --git a/src/object/pushableStatue.c b/src/object/pushableStatue.c index b29ca269..f6722b71 100644 --- a/src/object/pushableStatue.c +++ b/src/object/pushableStatue.c @@ -212,7 +212,7 @@ bool32 sub_080895C0(PushableStatueEntity* this) { LinearMoveUpdate(super); if ((--this->unk_86 == 0) && (sub_0800442E(super) == 0)) { super->spriteOffsetY = 0; - if (!sub_080B1B0C(super)) { + if (!GetCollisionDataAtEntity(super)) { sub_08089454(this); return TRUE; } @@ -258,14 +258,14 @@ bool32 sub_080896B0(void) { const s16* ptr; u32 tmp1; u32 tmp2; - u32 val; + u32 vvv; if (((gPlayerState.heldObject & 0x1f) == 0x12) && ((gPlayerEntity.frame & 1) != 0)) { ptr = &gUnk_080B4468[gPlayerEntity.animationState & 6]; uVar1 = gUnk_080B4488[gPlayerEntity.animationState >> 1]; uVar4 = COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], -ptr[1]) - uVar1; - val = sub_080B1AE0(uVar4, gPlayerEntity.collisionLayer); - if ((val - 0x26 > 1) && (val != 0x29)) { + vvv = GetVvvAtMetaTilePos(uVar4, gPlayerEntity.collisionLayer); + if ((vvv - 0x26 > 1) && (vvv != 0x29)) { layer = GetLayerByIndex(gPlayerEntity.collisionLayer); iVar2 = (uVar4 * 0x10000) >> 0x10; tmp1 = layer->collisionData[iVar2]; diff --git a/src/object/smokeParticle.c b/src/object/smokeParticle.c index de97206b..dacd282f 100644 --- a/src/object/smokeParticle.c +++ b/src/object/smokeParticle.c @@ -72,7 +72,7 @@ void sub_080878CC(Entity* this) { for (itX = -0x10; itX < 0x11; itX += 0x10) { for (itY = -0x10; itY < 0x11; itY += 0x10) { pos = TILE((u32)x + itX, (u32)y + itY); - if (sub_080B1AE0(pos, (u8)layer) == 0x2e) { + if (GetVvvAtMetaTilePos(pos, (u8)layer) == 0x2e) { switch (GetTileType(pos, layer)) { case 0x368: case 0x367: diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c index 9a5ac61e..8887c9db 100644 --- a/src/object/treeHidingPortal.c +++ b/src/object/treeHidingPortal.c @@ -104,15 +104,15 @@ static void sub_0809E96C(Entity* this) { } static u32 sub_0809E9A0(void) { - u32 rv; + u32 vvv; const s16* ptr; if (gPlayerEntity.action != PLAYER_BOUNCE) { - rv = 0; + vvv = 0; } else { ptr = &gUnk_080B4468[gPlayerEntity.animationState & 6]; - rv = sub_080B1AE0(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], -ptr[1]), 1); + vvv = GetVvvAtMetaTilePos(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], -ptr[1]), 1); } - return rv; + return vvv; } diff --git a/src/object/well.c b/src/object/well.c index 29a04181..8f866a41 100644 --- a/src/object/well.c +++ b/src/object/well.c @@ -28,14 +28,14 @@ void Well_Init(Entity* this) { this->action = 1; tilePos = COORD_TO_TILE(this); this->field_0x80.HWORD = tilePos; - SetTile(16509, this->field_0x80.HWORD, 1); + SetTile(0x407d, this->field_0x80.HWORD, 1); } void Well_Action1(Entity* this) { s32 tileIndex; tileIndex = GetTileType(this->field_0x80.HWORD, 1); - if (tileIndex != 0x407D) { + if (tileIndex != 0x407d) { sub_08078B48(); gPlayerEntity.x.WORD = this->x.WORD; gPlayerEntity.y.HALF.HI = this->y.HALF.HI + 4; |
