summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroctorock <79596758+octorock@users.noreply.github.com>2023-06-17 00:10:00 +0200
committeroctorock <79596758+octorock@users.noreply.github.com>2023-06-17 00:10:00 +0200
commitc317fe3f18325fec54c0d76df450f132945449f7 (patch)
tree553de6f2d0b1a1ed2a988ffb8a306dd3a138e88a /src
parent551cb7209393d06e302a5bda489c341f38efd1f3 (diff)
Extract KeyValuePairs
Diffstat (limited to 'src')
-rw-r--r--src/beanstalkSubtask.c9
-rw-r--r--src/collision.c2
-rw-r--r--src/data/data_080046A4.c34
-rw-r--r--src/data/mapVvvToSurfaceType.c74
-rw-r--r--src/enemy/acroBandits.c2
-rw-r--r--src/enemy/bombPeahat.c2
-rw-r--r--src/enemy/chuchu.c8
-rw-r--r--src/enemy/cloudPiranha.c4
-rw-r--r--src/enemy/gyorgFemale.c2
-rw-r--r--src/enemy/leever.c20
-rw-r--r--src/enemy/madderpillar.c2
-rw-r--r--src/enemy/pesto.c2
-rw-r--r--src/enemy/puffstool.c12
-rw-r--r--src/enemy/rope.c2
-rw-r--r--src/enemy/slime.c2
-rw-r--r--src/enemy/spinyBeetle.c2
-rw-r--r--src/enemy/tektite.c2
-rw-r--r--src/enemy/tektiteGolden.c2
-rw-r--r--src/enemy/vaatiEyesMacro.c2
-rw-r--r--src/enemy/vaatiProjectile.c2
-rw-r--r--src/enemy/wizzrobeWind.c2
-rw-r--r--src/item/itemGustJar.c2
-rw-r--r--src/item/itemMoleMitts.c4
-rw-r--r--src/manager/bombableWallManager.c4
-rw-r--r--src/manager/minishPortalManager.c4
-rw-r--r--src/npc/npc5.c6
-rw-r--r--src/npc/townMinish.c10
-rw-r--r--src/object/bigIceBlock.c164
-rw-r--r--src/object/bollard.c2
-rw-r--r--src/object/button.c2
-rw-r--r--src/object/crenelBeanSprout.c8
-rw-r--r--src/object/cutsceneMiscObject.c2
-rw-r--r--src/object/furniture.c6
-rw-r--r--src/object/itemOnGround.c2
-rw-r--r--src/object/jarPortal.c8
-rw-r--r--src/object/lilypadLarge.c16
-rw-r--r--src/object/mask.c2
-rw-r--r--src/object/minecart.c52
-rw-r--r--src/object/object1F.c2
-rw-r--r--src/object/objectOnPillar.c10
-rw-r--r--src/object/playerClone.c2
-rw-r--r--src/object/pot.c2
-rw-r--r--src/object/pullableLever.c2
-rw-r--r--src/object/pushableFurniture.c12
-rw-r--r--src/object/pushableRock.c8
-rw-r--r--src/object/pushableStatue.c8
-rw-r--r--src/object/smokeParticle.c2
-rw-r--r--src/object/treeHidingPortal.c8
-rw-r--r--src/object/well.c4
-rw-r--r--src/physics.c6
-rw-r--r--src/player.c42
-rw-r--r--src/playerItem/playerItemBottle.c2
-rw-r--r--src/playerItem/playerItemCellOverwriteSet.c34
-rw-r--r--src/playerItem/playerItemGustBig.c17
-rw-r--r--src/playerItem/playerItemHeldObject.c8
-rw-r--r--src/playerItem/playerItemPacciCaneProjectile.c2
-rw-r--r--src/playerItem/playerItemSword.c26
-rw-r--r--src/playerUtils.c185
-rw-r--r--src/projectile/projectile5.c5
-rw-r--r--src/projectile/removableDust.c8
-rw-r--r--src/projectile/spiderWeb.c4
-rw-r--r--src/scroll.c35
62 files changed, 540 insertions, 377 deletions
diff --git a/src/beanstalkSubtask.c b/src/beanstalkSubtask.c
index ee774646..f95786e1 100644
--- a/src/beanstalkSubtask.c
+++ b/src/beanstalkSubtask.c
@@ -74,7 +74,6 @@ u32 sub_0801A570(Entity*, u32);
bool32 sub_0801A458(LayerStruct* layer, u32 position, u32 collisionType);
bool32 sub_0801A370(LayerStruct* layer, u32 position);
u32 sub_0801A8D0(Entity* this, u32 param_2);
-extern void sub_080001D0(u32, u32, u32);
void sub_0801967C(void) {
gUnk_080B4458[gMenu.overlayType]();
@@ -202,8 +201,8 @@ u32 UpdatePlayerCollision(void) {
index = sub_0807BDB8(&gPlayerEntity, direction >> 2);
if (index != 0xff && (gRoomControls.scroll_flags & 4) == 0) {
ptr1 = &gUnk_080B4490[index * 2];
- if (GetCollisionData(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr1[0], -ptr1[1]),
- gPlayerEntity.collisionLayer) == 0xff) {
+ if (GetCollisionDataAtMetaTilePos(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr1[0], -ptr1[1]),
+ gPlayerEntity.collisionLayer) == 0xff) {
if ((((gPlayerState.flags & (PL_FLAGS10000 | PL_FLAGS2)) != 0) ||
((gPlayerState.sword_state & 0x10) != 0)) ||
((sub_080806BC(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x,
@@ -260,7 +259,7 @@ u32 UpdatePlayerCollision(void) {
if ((gPlayerEntity.direction & 0x80) != 0) {
return 0;
}
- if (GetCollisionData(position, gPlayerEntity.collisionLayer) != 0xf) {
+ if (GetCollisionDataAtMetaTilePos(position, gPlayerEntity.collisionLayer) != 0xf) {
return 0;
}
if (sub_08079778() == 0) {
@@ -581,7 +580,7 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
SetTile(0x4074, position, gPlayerEntity.collisionLayer);
- sub_080001D0(0xd, position, gPlayerEntity.collisionLayer);
+ SetVvvAtMetaTilePos(0xd, position, gPlayerEntity.collisionLayer);
return 1;
default:
return 0;
diff --git a/src/collision.c b/src/collision.c
index 402c9bfa..b514159b 100644
--- a/src/collision.c
+++ b/src/collision.c
@@ -788,7 +788,7 @@ CollisionResult CollisionDefault(Entity* org, Entity* tgt, u32 direction, ColSet
return RESULT_COLLISION;
}
-// unkData3 for tileType?
+// vvv for tileType?
#ifdef EU
const u8 gUnk_080B37A0[] = {
diff --git a/src/data/data_080046A4.c b/src/data/data_080046A4.c
new file mode 100644
index 00000000..0f0d8a65
--- /dev/null
+++ b/src/data/data_080046A4.c
@@ -0,0 +1,34 @@
+#include "asm.h"
+
+const KeyValuePair gUnk_080046A4[] = {
+ { 63, 1 }, { 80, 2 }, { 69, 8 }, { 70, 9 }, { 71, 10 }, { 72, 11 }, { 73, 12 }, { 74, 13 },
+ { 75, 14 }, { 76, 15 }, { 77, 16 }, { 65, 1 }, { 82, 2 }, { 68, 17 }, { 79, 18 }, { 372, 19 },
+ { 117, 23 }, { 67, 3 }, { 66, 4 }, { 64, 5 }, { 81, 6 }, { 85, 20 }, { 92, 21 }, { 87, 20 },
+ { 94, 21 }, { 86, 28 }, { 93, 29 }, { 88, 30 }, { 89, 31 }, { 90, 32 }, { 91, 22 }, { 9, 36 },
+ { 12, 37 }, { 13, 36 }, { 15, 38 }, { 14, 39 }, { 16, 36 }, { 17, 36 }, { 18, 36 }, { 20, 37 },
+ { 21, 36 }, { 23, 38 }, { 22, 39 }, { 24, 36 }, { 25, 36 }, { 10, 40 }, { 39, 40 }, { 28, 36 },
+ { 42, 36 }, { 29, 36 }, { 43, 36 }, { 97, 44 }, { 101, 45 }, { 353, 47 }, { 355, 48 }, { 16384, 25 },
+ { 16480, 26 }, { 374, 49 }, { 843, 33 }, { 844, 34 }, { 375, 50 }, { 871, 51 }, { 872, 52 }, { 16490, 24 },
+ { 105, 41 }, { 106, 42 }, { 111, 43 }, { 109, 53 }, { 110, 54 }, { 78, 7 }, { 389, 36 }, { 390, 36 },
+ { 391, 36 }, { 392, 36 }, { 393, 36 }, { 394, 36 }, { 398, 36 }, { 399, 36 }, { 403, 36 }, { 404, 36 },
+ { 405, 36 }, { 406, 36 }, { 407, 36 }, { 408, 36 },
+};
+const u16 gUnk_080046A4End = 0;
+
+const u16 gUnk_080047F6[] = {
+ 0, 255, 65280, 0, 65247, 783, 0, 28, 65247, 783, 0, 42, 65247, 783, 0, 121,
+ 65247, 783, 0, 119, 65247, 783, 0, 53, 65247, 783, 0, 53, 64735, 783, 0, 39,
+ 65247, 783, 0, 418, 65247, 783, 0, 419, 65247, 783, 0, 420, 65247, 783, 0, 421,
+ 65247, 783, 0, 422, 65247, 783, 0, 423, 65247, 783, 0, 424, 65247, 783, 0, 425,
+ 65247, 783, 0, 426, 65247, 783, 0, 360, 65247, 783, 0, 40, 39563, 15119, 65280, 31,
+ 59074, 1039, 256, 29, 59074, 1039, 256, 43, 59074, 1039, 256, 789, 34816, 298, 65280, 118,
+ 34816, 298, 65280, 16491, 33666, 255, 65280, 16389, 33666, 255, 65280, 16499, 33439, 4879, 65280, 53,
+ 59074, 1039, 256, 53, 59074, 1039, 256, 53, 59074, 1039, 256, 119, 59074, 1039, 256, 121,
+ 59074, 1039, 256, 360, 49323, 5647, 1024, 38, 49323, 5647, 1024, 52, 32768, 255, 65280, 804,
+ 40960, 255, 65280, 26, 40960, 255, 65280, 53, 40960, 255, 65280, 119, 40960, 255, 65280, 121,
+ 40960, 255, 65280, 27, 49192, 801, 768, 38, 49192, 801, 768, 789, 49192, 801, 768, 29,
+ 49192, 33, 768, 38, 49192, 33, 768, 121, 32832, 783, 0, 113, 43019, 5903, 65280, 29,
+ 43019, 5903, 65280, 53, 33859, 11535, 512, 30, 32776, 1039, 65280, 29, 32776, 1039, 65280, 38,
+ 32776, 1039, 65280, 52, 32779, 21263, 65280, 19, 32779, 21263, 65280, 789, 0, 30, 2, 18,
+ 64, 8, 0, 1, 128, 10, 0, 1, 128, 8, 384, 10, 128, 30, 1, 49152
+};
diff --git a/src/data/mapVvvToSurfaceType.c b/src/data/mapVvvToSurfaceType.c
new file mode 100644
index 00000000..50abb84e
--- /dev/null
+++ b/src/data/mapVvvToSurfaceType.c
@@ -0,0 +1,74 @@
+#include "asm.h"
+#include "player.h"
+
+const KeyValuePair gMapVvvToSurfaceType[] = {
+ { 13, SURFACE_PIT },
+ { 38, SURFACE_SLOPE_GNDGND_V },
+ { 39, SURFACE_SLOPE_GNDGND_H },
+ { 82, SURFACE_26 },
+ { 99, SURFACE_24 },
+ { 116, SURFACE_EDGE },
+ { 8, SURFACE_7 },
+ { 31, SURFACE_MINISH_DOOR_FRONT },
+ { 32, SURFACE_MINISH_DOOR_BACK },
+ { 33, SURFACE_A },
+ { 34, SURFACE_B },
+ { 24, SURFACE_16 },
+ { 18, SURFACE_ICE },
+ { 15, SURFACE_SHALLOW_WATER },
+ { 14, SURFACE_SLOPE_GNDWATER },
+ { 16, SURFACE_WATER },
+ { 27, SURFACE_BUTTON },
+ { 29, SURFACE_BUTTON },
+ { 97, SURFACE_1B },
+ { 90, SURFACE_1C },
+ { 17, SURFACE_14 },
+ { 98, SURFACE_21 },
+ { 101, SURFACE_6 },
+ { 102, SURFACE_6 },
+ { 103, SURFACE_6 },
+ { 104, SURFACE_6 },
+ { 105, SURFACE_6 },
+ { 106, SURFACE_6 },
+ { 108, SURFACE_6 },
+ { 109, SURFACE_6 },
+ { 110, SURFACE_6 },
+ { 111, SURFACE_6 },
+ { 107, SURFACE_6 },
+ { 48, SURFACE_22 },
+ { 49, SURFACE_22 },
+ { 50, SURFACE_22 },
+ { 51, SURFACE_22 },
+ { 22, SURFACE_DUST },
+ { 25, SURFACE_HOLE },
+ { 240, SURFACE_HOLE },
+ { 87, SURFACE_CLONE_TILE },
+ { 83, SURFACE_LADDER },
+ { 241, SURFACE_LADDER },
+ { 63, SURFACE_AUTO_LADDER },
+ { 80, SURFACE_CLIMB_WALL },
+ { 81, SURFACE_2C },
+ { 52, SURFACE_LIGHT_GRADE },
+ { 53, SURFACE_29 },
+ { 42, SURFACE_E },
+ { 43, SURFACE_D },
+ { 44, SURFACE_10 },
+ { 45, SURFACE_F },
+ { 64, SURFACE_E },
+ { 65, SURFACE_D },
+ { 66, SURFACE_10 },
+ { 67, SURFACE_F },
+ { 72, SURFACE_10 },
+ { 74, SURFACE_E },
+ { 69, SURFACE_E },
+ { 71, SURFACE_E },
+ { 70, SURFACE_D },
+ { 73, SURFACE_D },
+ { 68, SURFACE_D },
+ { 75, SURFACE_D },
+ { 19, SURFACE_SWAMP },
+ { 41, SURFACE_DOOR },
+ { 23, SURFACE_2D },
+ { 40, SURFACE_DOOR_13 },
+};
+// const u16 gMapVvvToSurfaceTypeEnd = 0;
diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c
index 59ed095d..072ca4e0 100644
--- a/src/enemy/acroBandits.c
+++ b/src/enemy/acroBandits.c
@@ -175,7 +175,7 @@ void AcroBandit_Type0Action1(Entity* this) {
rand = Random();
x = this->field_0x74.HWORD + ((s32)rand % 5) * 0x10 - 0x20;
y = this->field_0x76.HWORD + ((s32)(rand >> 4) % 5) * 0x10 - 0x20;
- if (sub_080B1B18(x, y, this->collisionLayer) == 0) {
+ if (GetCollisionDataAtWorldCoords(x, y, this->collisionLayer) == 0) {
this->action = 2;
this->spriteSettings.draw = 1;
this->x.HALF.HI = x;
diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c
index 967c46c9..976d4802 100644
--- a/src/enemy/bombPeahat.c
+++ b/src/enemy/bombPeahat.c
@@ -200,7 +200,7 @@ void sub_0802AAC0(Entity* this) {
this->child = NULL;
#ifdef EU
} else if (ent->timer == 0) {
- if (GetCollisionData(COORD_TO_TILE(this), 1) == 0) {
+ if (GetCollisionDataAtMetaTilePos(COORD_TO_TILE(this), 1) == 0) {
if (EntityInRectRadius(this, &gPlayerEntity, 0x10, 0x10) && ent->subtimer <= 0x50) {
this->field_0x80.HALF.HI = 0;
}
diff --git a/src/enemy/chuchu.c b/src/enemy/chuchu.c
index 82de5555..2dd0b998 100644
--- a/src/enemy/chuchu.c
+++ b/src/enemy/chuchu.c
@@ -703,11 +703,11 @@ void sub_0801FB68(Entity* this) {
this->zVelocity = 0;
}
-u32 sub_0801FBD0(Entity* this) {
- if (GetTileUnderEntity(this) == 0x10) {
- return 1;
+bool32 sub_0801FBD0(Entity* this) {
+ if (GetVvvAtEntity(this) == 0x10) {
+ return TRUE;
} else {
- return 0;
+ return FALSE;
}
}
diff --git a/src/enemy/cloudPiranha.c b/src/enemy/cloudPiranha.c
index 15f89242..61937366 100644
--- a/src/enemy/cloudPiranha.c
+++ b/src/enemy/cloudPiranha.c
@@ -245,13 +245,13 @@ void sub_080387F0(CloudPiranhaEntity* this) {
const s8* ptr;
if ((super->action != 4) && (this->unk_82 == 0)) {
- iVar4 = GetCollisionData(COORD_TO_TILE(super), super->collisionLayer);
+ iVar4 = GetCollisionDataAtMetaTilePos(COORD_TO_TILE(super), super->collisionLayer);
if ((iVar4 == 0xf) || (iVar4 == 0x2a)) {
this->unk_82 = 0x20;
}
ptr = &gUnk_080CF520[super->direction >> 1];
bVar1 = super->direction;
- iVar4 = sub_080B1AF0(super, ptr[0], ptr[1]);
+ iVar4 = GetCollisionDataRelativeTo(super, ptr[0], ptr[1]);
if ((iVar4 == 0xf) || (iVar4 == 0x2a)) {
super->direction = (super->direction + 0x10) & 0x1f;
} else {
diff --git a/src/enemy/gyorgFemale.c b/src/enemy/gyorgFemale.c
index 6c6f408c..d59e10d9 100644
--- a/src/enemy/gyorgFemale.c
+++ b/src/enemy/gyorgFemale.c
@@ -246,7 +246,7 @@ void sub_08046518(void) {
u16* ptr = gMapTop.metatileTypes;
u16* sl = &gMapTop.mapData[sub_08046518_offset];
u16* stack1 = &gMapTop.mapDataClone[sub_08046518_offset];
- u8* stack2 = &gMapTop.unkData3[sub_08046518_offset];
+ u8* stack2 = &gMapTop.vvv[sub_08046518_offset];
u8* r6 = &gMapTop.collisionData[sub_08046518_offset];
u32 i;
for (i = 0x10; i != 0; i--) {
diff --git a/src/enemy/leever.c b/src/enemy/leever.c
index e7735c04..d9a0be39 100644
--- a/src/enemy/leever.c
+++ b/src/enemy/leever.c
@@ -4,12 +4,10 @@
*
* @brief Leever enemy
*/
-
+#include "asm.h"
#include "enemy.h"
#include "physics.h"
-extern u32 sub_080B1AB4(s32, s32, u32);
-
extern Entity* gUnk_020000B0;
bool32 Leever_PlayerInRange(Entity*, s32);
@@ -119,23 +117,23 @@ void Leever_DigDown(Entity* this) {
}
}
-u32 sub_0801FDE4(Entity* ent, s32 x, s32 y) {
- u32 uVar3;
+bool32 sub_0801FDE4(Entity* ent, s32 x, s32 y) {
+ u32 vvv;
const u16* puVar4;
- if (sub_080B1B18(x, y, gUnk_020000B0->collisionLayer) != 0) {
- return 0;
+ if (GetCollisionDataAtWorldCoords(x, y, gUnk_020000B0->collisionLayer) != 0) {
+ return FALSE;
} else {
- uVar3 = sub_080B1AB4(x, y, gUnk_020000B0->collisionLayer);
+ vvv = GetVvvAtWorldCoords(x, y, gUnk_020000B0->collisionLayer);
for (puVar4 = gUnk_080CA4CA; *puVar4 != (u16)-1;) {
- if (*puVar4++ == uVar3) {
+ if (*puVar4++ == vvv) {
ent->x.HALF.HI = (x & 0xfff0) + 8;
ent->y.HALF.HI = (y & 0xfff0) + 8;
ent->collisionLayer = gUnk_020000B0->collisionLayer;
- return 1;
+ return TRUE;
}
}
- return 0;
+ return FALSE;
}
}
diff --git a/src/enemy/madderpillar.c b/src/enemy/madderpillar.c
index a89b4515..ff5d0ffc 100644
--- a/src/enemy/madderpillar.c
+++ b/src/enemy/madderpillar.c
@@ -340,7 +340,7 @@ void sub_08029E0C(Entity* this) {
tile = COORD_TO_TILE(this);
for (i = 0; i < 3; i++) {
dir = ptr[iVar3];
- if (GetCollisionData(gUnk_080B4488[dir >> 3] + tile, this->collisionLayer) == 0) {
+ if (GetCollisionDataAtMetaTilePos(gUnk_080B4488[dir >> 3] + tile, this->collisionLayer) == 0) {
local_24 = dir;
if (this->direction - this->field_0x74.HALF.LO != dir - this->direction)
break;
diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c
index ce13cff2..d4e014df 100644
--- a/src/enemy/pesto.c
+++ b/src/enemy/pesto.c
@@ -336,7 +336,7 @@ void sub_080244E8(Entity* this) {
switch (this->field_0x80.HALF.LO) {
case 0:
if (--this->timer == 0) {
- if (GetCollisionData(COORD_TO_TILE(this), 1) == 0) {
+ if (GetCollisionDataAtMetaTilePos(COORD_TO_TILE(this), 1) == 0) {
this->field_0x80.HALF.LO++;
this->field_0x82.HALF.LO++;
this->subtimer = 0;
diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c
index 46db91ad..f32fa848 100644
--- a/src/enemy/puffstool.c
+++ b/src/enemy/puffstool.c
@@ -481,10 +481,10 @@ bool32 sub_0802594C(Entity* this, u32 param_2) {
u8 bVar6;
iVar9 = xDiff + unk[0];
iVar11 = yDiff + unk[1];
- bVar4 = sub_080B1B18(iVar9 - 0x00, iVar11 - 0x00, uVar1);
- bVar5 = sub_080B1B18(iVar9 - 0x10, iVar11 - 0x00, uVar1);
- bVar6 = sub_080B1B18(iVar9 - 0x00, iVar11 - 0x10, uVar1);
- bVar7 = sub_080B1B18(iVar9 - 0x10, iVar11 - 0x10, uVar1);
+ bVar4 = GetCollisionDataAtWorldCoords(iVar9 - 0x00, iVar11 - 0x00, uVar1);
+ bVar5 = GetCollisionDataAtWorldCoords(iVar9 - 0x10, iVar11 - 0x00, uVar1);
+ bVar6 = GetCollisionDataAtWorldCoords(iVar9 - 0x00, iVar11 - 0x10, uVar1);
+ bVar7 = GetCollisionDataAtWorldCoords(iVar9 - 0x10, iVar11 - 0x10, uVar1);
if ((bVar4 | bVar5 | bVar6 | bVar7) == 0) {
this->field_0x7c.HALF.LO = gRoomControls.origin_x + iVar9;
this->field_0x7c.HALF.HI = gRoomControls.origin_y + iVar11;
@@ -510,10 +510,10 @@ void sub_08025A54(Entity* this) {
}
bool32 sub_08025AB8(u32 tile, u32 layer) {
- if (GetCollisionData(tile, layer))
+ if (GetCollisionDataAtMetaTilePos(tile, layer))
return FALSE;
- if (sub_080B1AE0(tile, layer) == 10) {
+ if (GetVvvAtMetaTilePos(tile, layer) == 10) {
sub_0807B7D8(0x61, tile, layer);
return TRUE;
}
diff --git a/src/enemy/rope.c b/src/enemy/rope.c
index 098d4b89..53cc1df0 100644
--- a/src/enemy/rope.c
+++ b/src/enemy/rope.c
@@ -196,7 +196,7 @@ void sub_08031600(Entity* this) {
u32 sub_0803163C(Entity* this) {
u32 h;
- if (GetTileUnderEntity(this) == 0x13) {
+ if (GetVvvAtEntity(this) == 0x13) {
h = this->field_0x7a.HWORD / 2;
} else {
h = this->field_0x7a.HWORD;
diff --git a/src/enemy/slime.c b/src/enemy/slime.c
index 494d0459..05f2a32f 100644
--- a/src/enemy/slime.c
+++ b/src/enemy/slime.c
@@ -140,7 +140,7 @@ void sub_08045178(Entity* this, Entity* child, int h, int v) {
return;
sub_0804A4E4(this, child);
- if (sub_080B1AF0(child, h, v))
+ if (GetCollisionDataRelativeTo(child, h, v))
return;
x = child->x.HALF.HI + h;
diff --git a/src/enemy/spinyBeetle.c b/src/enemy/spinyBeetle.c
index 03f0a372..3d4f8e29 100644
--- a/src/enemy/spinyBeetle.c
+++ b/src/enemy/spinyBeetle.c
@@ -323,7 +323,7 @@ void sub_08033D78(SpinyBeetleEntity* this) {
case 0x1c5:
break;
default:
- if (GetCollisionData(tile, super->collisionLayer) - 1 > 0x3e)
+ if (GetCollisionDataAtMetaTilePos(tile, super->collisionLayer) - 1 > 0x3e)
ProcessMovement0(super);
break;
}
diff --git a/src/enemy/tektite.c b/src/enemy/tektite.c
index 04b9769c..f046745b 100644
--- a/src/enemy/tektite.c
+++ b/src/enemy/tektite.c
@@ -158,7 +158,7 @@ void sub_0802F300(Entity* this) {
return;
} else if (this->collisions != COL_NONE) {
sub_0800417E(this, this->collisions);
- } else if ((GetTileUnderEntity(this) & 0xf0) == 0x50) {
+ } else if ((GetVvvAtEntity(this) & 0xf0) == 0x50) {
this->direction = (this->direction + 0x10) & 0x1f;
}
diff --git a/src/enemy/tektiteGolden.c b/src/enemy/tektiteGolden.c
index beaffd3f..c67a5696 100644
--- a/src/enemy/tektiteGolden.c
+++ b/src/enemy/tektiteGolden.c
@@ -134,7 +134,7 @@ void sub_08038048(Entity* this) {
return;
} else if (this->collisions != COL_NONE) {
sub_0800417E(this, this->collisions);
- } else if ((GetTileUnderEntity(this) & 0xf0) == 0x50) {
+ } else if ((GetVvvAtEntity(this) & 0xf0) == 0x50) {
this->direction = (this->direction + 0x10) & 0x1f;
}
diff --git a/src/enemy/vaatiEyesMacro.c b/src/enemy/vaatiEyesMacro.c
index d05f768e..8018cdea 100644
--- a/src/enemy/vaatiEyesMacro.c
+++ b/src/enemy/vaatiEyesMacro.c
@@ -230,7 +230,7 @@ void sub_0802EFB8(Entity* this) {
uVar3 = GetFacingDirection(&gPlayerEntity, this);
uVar1 = (uVar3 + 4) & 0x18;
}
- iVar4 = GetCollisionData(TILE(this->x.HALF.HI, this->y.HALF.HI) + gUnk_080B4488[((uVar1) >> 3)], 1);
+ iVar4 = GetCollisionDataAtMetaTilePos(TILE(this->x.HALF.HI, this->y.HALF.HI) + gUnk_080B4488[((uVar1) >> 3)], 1);
if (iVar4 != 0) {
this->direction = 0xff;
} else {
diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c
index c66a375a..2d735663 100644
--- a/src/enemy/vaatiProjectile.c
+++ b/src/enemy/vaatiProjectile.c
@@ -276,7 +276,7 @@ void sub_0803E4D8(Entity* this) {
u32 tile;
tile = TILE(this->x.HALF.HI, this->y.HALF.HI + 8);
- if (GetCollisionData(tile, gPlayerEntity.collisionLayer) != 0xff) {
+ if (GetCollisionDataAtMetaTilePos(tile, gPlayerEntity.collisionLayer) != 0xff) {
SetTile(0x4074, tile, gPlayerEntity.collisionLayer);
}
}
diff --git a/src/enemy/wizzrobeWind.c b/src/enemy/wizzrobeWind.c
index 2baecef0..0904fea4 100644
--- a/src/enemy/wizzrobeWind.c
+++ b/src/enemy/wizzrobeWind.c
@@ -236,7 +236,7 @@ void sub_0802F8E4(WizzrobeEntity* this) {
iVar4 = ((s32)(rand)&0x7ff0) % (this->unk_6f << 3);
uVar7 = (uVar1 + iVar4) | 8;
uVar6 = TILE(uVar8, uVar7);
- if ((GetCollisionData(uVar6, super->collisionLayer) == 0) &&
+ if ((GetCollisionDataAtMetaTilePos(uVar6, super->collisionLayer) == 0) &&
(GetTileIndex(uVar6, super->collisionLayer) != 0x4071)) {
super->x.HALF.HI = (s16)uVar8;
super->y.HALF.HI = (s16)uVar7;
diff --git a/src/item/itemGustJar.c b/src/item/itemGustJar.c
index c567f197..f00ef63b 100644
--- a/src/item/itemGustJar.c
+++ b/src/item/itemGustJar.c
@@ -12,7 +12,7 @@ void ItemGustJar(ItemBehavior* this, u32 index) {
}
void sub_08076DF4(ItemBehavior* this, u32 index) {
- if (GetCollisionTileInFront(&gPlayerEntity) != 0x29 && gPlayerState.floor_type != SURFACE_DOOR &&
+ if (GetVvvInFront(&gPlayerEntity) != 0x29 && gPlayerState.floor_type != SURFACE_DOOR &&
gPlayerState.floor_type != SURFACE_DOOR_13 && gPlayerState.jump_status == 0) {
sub_08077D38(this, index);
this->timer = 0;
diff --git a/src/item/itemMoleMitts.c b/src/item/itemMoleMitts.c
index 28414cae..fbb62e22 100644
--- a/src/item/itemMoleMitts.c
+++ b/src/item/itemMoleMitts.c
@@ -181,13 +181,13 @@ s32 sub_080774A0(void) {
uVar3 = COORD_TO_TILE_OFFSET((&gPlayerEntity), -gUnk_0811BE1E[gPlayerEntity.animationState & 6],
-gUnk_0811BE1E[(gPlayerEntity.animationState & 6) + 1]);
- iVar2 = GetCollisionData(uVar3, gPlayerEntity.collisionLayer);
+ iVar2 = GetCollisionDataAtMetaTilePos(uVar3, gPlayerEntity.collisionLayer);
if (iVar2 > 0x16)
return 0;
if (iVar2 < 0xf)
return 0;
- if (sub_080B1AE0(uVar3, gPlayerEntity.collisionLayer) != 0x56) {
+ if (GetVvvAtMetaTilePos(uVar3, gPlayerEntity.collisionLayer) != 0x56) {
return 1;
} else {
return 0x56;
diff --git a/src/manager/bombableWallManager.c b/src/manager/bombableWallManager.c
index 52d018bd..efb1af9f 100644
--- a/src/manager/bombableWallManager.c
+++ b/src/manager/bombableWallManager.c
@@ -15,8 +15,6 @@
u32 sub_0805BFC4(u32, u32);
void sub_0805C02C(BombableWallManager*);
-extern u32 sub_080B1AE0(u16, u8);
-
u32 getArchwayType(void);
void BombableWallManager_Init(BombableWallManager*);
void BombableWallManager_Action1(BombableWallManager*);
@@ -47,7 +45,7 @@ void BombableWallManager_Init(BombableWallManager* this) {
}
void BombableWallManager_Action1(BombableWallManager* this) {
- if (sub_080B1AE0(this->tile, this->field_0x35) != 0x2e) {
+ if (GetVvvAtMetaTilePos(this->tile, this->field_0x35) != 0x2e) {
super->action = 2;
super->timer = 90;
sub_0805C02C(this);
diff --git a/src/manager/minishPortalManager.c b/src/manager/minishPortalManager.c
index 47307dea..2107d6ef 100644
--- a/src/manager/minishPortalManager.c
+++ b/src/manager/minishPortalManager.c
@@ -14,8 +14,6 @@
#include "room.h"
#include "sound.h"
-extern u32 sub_080B1AC8(u16, u16, u8);
-
bool32 PortalReadyForMinish(void);
void MinishPortalManager_Main(MinishPortalManager* this) {
@@ -43,7 +41,7 @@ void MinishPortalManager_Main(MinishPortalManager* this) {
gArea.portal_mode = 3;
}
}
- if (sub_080B1AC8(this->unk_38, this->unk_3a, super->timer) == 0x3d) {
+ if (GetVvvAtRoomCoords(this->unk_38, this->unk_3a, super->timer) == 0x3d) {
CreateMagicSparkles(this->unk_38 + gRoomControls.origin_x, this->unk_3a + gRoomControls.origin_y,
super->timer);
if (super->subtimer == 0) {
diff --git a/src/npc/npc5.c b/src/npc/npc5.c
index 4076c54a..d6730cba 100644
--- a/src/npc/npc5.c
+++ b/src/npc/npc5.c
@@ -472,7 +472,7 @@ u32 sub_080611D4(Entity* this) {
0x2b, 0x10, 0x2a, 0x0, 0x2d, 0x8, 0x2c, 0x18, 0x0,
};
- u32 uVar2;
+ u32 vvv;
u32 x;
s32 a;
s32 b;
@@ -482,11 +482,11 @@ u32 sub_080611D4(Entity* this) {
ptr = (s8*)gUnk_0810AC4C;
a = ptr[x];
b = ptr[x + 1];
- uVar2 = GetRelativeCollisionTile(this, a, b);
+ vvv = GetVvvRelativeToEntity(this, a, b);
ptr2 = gUnk_0810AC54;
do {
- if (*ptr2 != uVar2 || this->animationState != (ptr2[1] >> 2)) {
+ if (*ptr2 != vvv || this->animationState != (ptr2[1] >> 2)) {
continue;
}
diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c
index a8cb574b..9808c6e8 100644
--- a/src/npc/townMinish.c
+++ b/src/npc/townMinish.c
@@ -1,10 +1,9 @@
-#include "global.h"
+#include "asm.h"
#include "entity.h"
-#include "npc.h"
#include "functions.h"
#include "item.h"
+#include "npc.h"
-extern u32 sub_080B1AC8(u32, u32, u32);
void sub_0806ACC4(Entity*);
void sub_0806ABFC(Entity*);
void sub_0806AC3C(Entity*);
@@ -792,8 +791,9 @@ void sub_0806B0E0(Entity* this, ScriptExecutionContext* context) {
static const u16 gUnk_08112C5C[2] = { TEXT_INDEX(TEXT_TOWN_MINISH2, 0x25), TEXT_INDEX(TEXT_TOWN_MINISH2, 0x26) };
int idx = 0;
- if (sub_080B1AC8(0x38, 0xb8, 1) == 0x57 && sub_080B1AC8(0x48, 0xb8, 1) == 0x57 &&
- sub_080B1AC8(0x38, 200, 1) == 0x57 && sub_080B1AC8(0x48, 200, 1) == 0x57) {
+ // Checks if the dust is gone at these four meta tiles.
+ if (GetVvvAtRoomCoords(56, 184, 1) == 0x57 && GetVvvAtRoomCoords(72, 184, 1) == 0x57 &&
+ GetVvvAtRoomCoords(56, 200, 1) == 0x57 && GetVvvAtRoomCoords(72, 200, 1) == 0x57) {
idx = 1;
}
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;
diff --git a/src/physics.c b/src/physics.c
index 0929fb35..24bc75f8 100644
--- a/src/physics.c
+++ b/src/physics.c
@@ -18,7 +18,7 @@ const u8 gUnk_08114F38[];
extern u16 gExtraFrameOffsets[];
extern s8 gUnk_08126EE4[];
-extern const u16 gUnk_080046A4[];
+extern const KeyValuePair gUnk_080046A4[];
extern const u16 gUnk_080047F6[];
static void sub_0806FEE8(struct_gUnk_020000C0_1*, u32, u32, u32);
@@ -402,7 +402,7 @@ bool32 CheckPlayerProximity(u32 x, u32 y, u32 distX, u32 DistY) {
bool32 sub_0806FC24(u32 param_1, u32 param_2) {
register u32 rv asm("r0");
- u32 val = sub_08007DD6(param_1, gUnk_080046A4);
+ u32 val = FindValueForKey(param_1, gUnk_080046A4);
if (val) {
rv = (*(gUnk_080047F6 + (val << 2)) >> param_2) & 0x1;
} else {
@@ -413,7 +413,7 @@ bool32 sub_0806FC24(u32 param_1, u32 param_2) {
const u16* sub_0806FC50(u32 param_1, u32 param_2) {
const u16* rv;
- u32 val = sub_08007DD6(param_1, gUnk_080046A4);
+ u32 val = FindValueForKey(param_1, gUnk_080046A4);
if (!val || ((gUnk_080047F6[val << 2] >> param_2) & 0x1) == 0) {
rv = 0;
} else {
diff --git a/src/player.c b/src/player.c
index 9c3b725f..985c1739 100644
--- a/src/player.c
+++ b/src/player.c
@@ -1974,7 +1974,7 @@ static void PlayerRoomTransition(Entity* this) {
static void sub_080724DC(Entity* this) {
this->knockbackDuration = 0;
DeleteClones();
- if (GetTileUnderEntity(this) != 0x29) {
+ if (GetVvvAtEntity(this) != 0x29) {
if ((gPlayerState.remainingDiveTime == 0) && (gPlayerState.swim_state != 0)) {
PlayerUpdateSwimming(this);
}
@@ -2000,7 +2000,7 @@ static void sub_080724DC(Entity* this) {
static void sub_0807258C(Entity* this) {
if (gRoomControls.reload_flags == 0) {
- if (GetCollisionTileInFront(this) == 0x29) {
+ if (GetVvvInFront(this) == 0x29) {
UpdatePlayerMovement();
if (sub_080797C4() != 0) {
gPlayerState.startPosX = gPlayerEntity.x.HALF.HI;
@@ -2336,15 +2336,21 @@ static void sub_08072CFC(Entity* this) {
ResetActiveItems();
}
-static const u16 sTiles[] = {
- 0x1AD, 1, 0, 0x1AE, 1, 0, 0x1AC, 1, 0, 0x1AF, 1, 0,
-};
-
-static const u16* const sTileTable[] = {
- sTiles,
- sTiles + 3,
- sTiles + 6,
- sTiles + 9,
+// TODO Why would this use FindValueForKey just to do a normal comparison?
+static const KeyValuePair sTiles0 = { 0x1AD, 1 };
+static const u16 sTiles0End = 0;
+static const KeyValuePair sTiles1 = { 0x1AE, 1 };
+static const u16 sTiles1End = 0;
+static const KeyValuePair sTiles2 = { 0x1AC, 1 };
+static const u16 sTiles2End = 0;
+static const KeyValuePair sTiles3 = { 0x1AF, 1 };
+static const u16 sTiles3End = 0;
+
+static const KeyValuePair* const sTileTable[] = {
+ &sTiles0,
+ &sTiles1,
+ &sTiles2,
+ &sTiles3,
};
static void sub_08072D54(Entity* this) {
@@ -2359,13 +2365,13 @@ static void sub_08072D54(Entity* this) {
uVar2 = GetTileType(sub_0806F730(this), this->collisionLayer);
switch (this->subtimer) {
case 0:
- if (sub_08007DD6(uVar2, sTileTable[gPlayerEntity.animationState >> 1])) {
+ if (FindValueForKey(uVar2, sTileTable[gPlayerEntity.animationState >> 1])) {
this->timer = 1;
this->subtimer = 1;
}
break;
case 1:
- if (sub_08007DD6(uVar2, sTileTable[gPlayerEntity.animationState >> 1])) {
+ if (FindValueForKey(uVar2, sTileTable[gPlayerEntity.animationState >> 1])) {
this->timer = 1;
} else {
this->subtimer = 2;
@@ -2373,7 +2379,7 @@ static void sub_08072D54(Entity* this) {
break;
case 2:
this->animationState ^= 4;
- if (sub_08007DD6(uVar2, sTileTable[gPlayerEntity.animationState >> 1]) != 0) {
+ if (FindValueForKey(uVar2, sTileTable[gPlayerEntity.animationState >> 1]) != 0) {
this->timer = 1;
this->subtimer = 3;
}
@@ -2381,7 +2387,7 @@ static void sub_08072D54(Entity* this) {
break;
case 3:
this->animationState ^= 4;
- if (sub_08007DD6(uVar2, sTileTable[gPlayerEntity.animationState >> 1])) {
+ if (FindValueForKey(uVar2, sTileTable[gPlayerEntity.animationState >> 1])) {
this->timer = 1;
} else {
this->subtimer = 4;
@@ -2616,7 +2622,7 @@ static void sub_080731D8(Entity* this) {
static void sub_080732D0(Entity* this) {
UpdateAnimationSingleFrame(this);
- if (GetTileUnderEntity(this) != 40) {
+ if (GetVvvAtEntity(this) != 40) {
this->direction = DirectionNorth;
LinearMoveUpdate(this);
} else {
@@ -2878,7 +2884,7 @@ static void sub_080737BC(Entity* this) {
pos = this->y.HALF.HI;
tmp = 0xf;
tmp &= pos;
- if (tmp == 8 && !sub_080B1B0C(this)) {
+ if (tmp == 8 && !GetCollisionDataAtEntity(this)) {
gPlayerState.jump_status |= 0x40;
PlayerSetNormalAndCollide();
}
@@ -4100,7 +4106,7 @@ void sub_0807529C(Entity* this) {
void sub_080752AC(Entity* this, ScriptExecutionContext* ctx) {
LinearMoveUpdate(this);
if (!ctx->unk_18) {
- if (GetTileUnderEntity(this) != 41) {
+ if (GetVvvAtEntity(this) != 41) {
ctx->unk_18 = 1;
ctx->unk_19 = 6;
}
diff --git a/src/playerItem/playerItemBottle.c b/src/playerItem/playerItemBottle.c
index 798dc95e..ac6337f1 100644
--- a/src/playerItem/playerItemBottle.c
+++ b/src/playerItem/playerItemBottle.c
@@ -272,7 +272,7 @@ void PlayerItemBottle_UseEmptyBottle(Entity* this) {
if (this->spriteSettings.flipX != 0) {
iVar2 = -iVar2;
}
- if (GetRelativeCollisionTile(this, iVar2, (s8)ptr2[1]) == 0x10) {
+ if (GetVvvRelativeToEntity(this, iVar2, (s8)ptr2[1]) == 0x10) {
this->type2 = ITEM_BOTTLE_WATER;
}
}
diff --git a/src/playerItem/playerItemCellOverwriteSet.c b/src/playerItem/playerItemCellOverwriteSet.c
index 3c9e766a..fe87694e 100644
--- a/src/playerItem/playerItemCellOverwriteSet.c
+++ b/src/playerItem/playerItemCellOverwriteSet.c
@@ -1,12 +1,36 @@
+#include "asm.h"
+#include "common.h"
#include "entity.h"
#include "player.h"
#include "room.h"
-#include "common.h"
-#include "asm.h"
-extern const u8 gUnk_080B7910[];
-extern const u8 gUnk_080B79A7[];
-extern const u8 gUnk_080B7A3E[]; // TODO figure out type from arm_sub_080B1B84 and arm_sub_080B1BA4
+// vvv for specialMetaTile
+const u8 gUnk_080B7910[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 241, 0, 0, 83, 242, 243,
+ 0, 0, 0, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 61, 61, 61, 61, 61, 61, 61, 61, 61, 0, 0, 0, 0, 0,
+ 0, 0, 0, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 0, 116, 116, 41, 0,
+ 35, 41, 41, 41, 41, 41, 41, 16, 16, 16, 16, 41, 80, 81, 0, 15, 0, 0, 0, 0, 0,
+};
+
+const u8 gUnk_080B79A7[] = {
+ 29, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 40, 40,
+ 40, 15, 0, 0, 0, 0, 32, 0, 15, 3, 5, 10, 12, 1, 2, 4, 8, 15, 5, 10, 69, 68, 0, 0, 15, 0,
+ 0, 0, 15, 0, 0, 0, 0, 15, 0, 0, 15, 0, 1, 3, 2, 5, 15, 10, 4, 12, 8, 71, 15, 0, 0, 0,
+ 0, 0, 15, 15, 3, 5, 0, 13, 12, 11, 10, 0, 15, 15, 15, 15, 15, 15, 15, 15, 80, 7, 11, 13, 14, 15,
+ 15, 39, 15, 15, 16, 17, 18, 19, 0, 0, 15, 15, 0, 1, 2, 3, 4, 5, 8, 10, 12, 15, 5, 12, 0, 0,
+ 95, 39, 103, 104, 105, 106, 107, 49, 50, 58, 60, 35, 43, 43, 5, 34, 1, 2, 4, 8, 12,
+};
+
+const u16 gUnk_080B7A3E[] = {
+ 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 129, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 16, 0, 64, 0, 3, 3, 3, 3, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0,
+}; // TODO no need to store this in an u16?
+// TODO figure out type from arm_sub_080B1B84 and arm_sub_080B1BA4, also related to specialMetaTiles
void PlayerItemCellOverwriteSet(Entity* this) {
static const s8 gUnk_080B7B6C[] = { 0x0, -0x10, 0x10, 0x0, 0x0, 0x10, -0x10, 0x0 };
diff --git a/src/playerItem/playerItemGustBig.c b/src/playerItem/playerItemGustBig.c
index 7e69b965..b417720b 100644
--- a/src/playerItem/playerItemGustBig.c
+++ b/src/playerItem/playerItemGustBig.c
@@ -1,9 +1,8 @@
-#include "global.h"
+#include "asm.h"
#include "entity.h"
-#include "player.h"
#include "functions.h"
+#include "player.h"
#include "sound.h"
-#include "asm.h"
extern void sub_08078CD0(Entity*);
extern void sub_08018FA0(Entity*);
@@ -12,8 +11,6 @@ extern void sub_08018DE8(Entity*);
extern void sub_08018E68(Entity*);
extern void sub_08018F6C(Entity*);
-extern u32 sub_08007DD6(u32, const u16*);
-
extern const u8 gUnk_08003E44[];
void PlayerItemGustBig(Entity* this) {
@@ -40,9 +37,11 @@ static const Hitbox* const gUnk_080B3DE8[] = {
&gUnk_080B3E20,
&gUnk_080B3E28,
};
-static const u16 gUnk_080B3DF4[] = {
- 0x75, 0x1, 0x76, 0x1, 0x3ac, 0x1, 0x4050, 0x1, 0x377, 0x1, 0x378, 0x1, 0x71, 0x1, 0x72, 0x1, 0, 0,
+static const KeyValuePair gUnk_080B3DF4[] = {
+ { 0x75, 0x1 }, { 0x76, 0x1 }, { 0x3ac, 0x1 }, { 0x4050, 0x1 },
+ { 0x377, 0x1 }, { 0x378, 0x1 }, { 0x71, 0x1 }, { 0x72, 0x1 },
};
+static const u16 gUnk_080B3DF4End = 0;
static const Hitbox gUnk_080B3E18 = { 0, 0, { 6, 3, 3, 6 }, 6, 6 };
static const Hitbox gUnk_080B3E20 = { 0, 0, { 6, 3, 3, 6 }, 8, 8 };
@@ -161,10 +160,10 @@ void sub_08018E68(Entity* this) {
if (this->type2 == 0) {
sub_0800451C(this);
}
- if (sub_08007DD6(sub_080B1A0C(this, x, y), gUnk_080B3DF4) != 0) {
+ if (FindValueForKey(sub_080B1A0C(this, x, y), gUnk_080B3DF4) != 0) {
return;
}
- if (GetRelativeCollisionTile(this, x, y) == 0x74) {
+ if (GetVvvRelativeToEntity(this, x, y) == 0x74) {
return;
}
if (sub_080040D8(this, (u8*)gUnk_08003E44, this->x.HALF.HI + x, this->y.HALF.HI + y) == 0) {
diff --git a/src/playerItem/playerItemHeldObject.c b/src/playerItem/playerItemHeldObject.c
index b470c242..bb2340f8 100644
--- a/src/playerItem/playerItemHeldObject.c
+++ b/src/playerItem/playerItemHeldObject.c
@@ -122,11 +122,11 @@ void sub_080AD040(PlayerItemHeldObjectEntity* this) {
super->direction = super->knockbackDirection;
super->knockbackDuration = 0;
}
- if (GetRelativeCollisionTile(super, gUnk_081320C4[super->direction >> 2],
- gUnk_081320C4[(super->direction >> 2) + 1]) == 0x74) {
+ if (GetVvvRelativeToEntity(super, gUnk_081320C4[super->direction >> 2],
+ gUnk_081320C4[(super->direction >> 2) + 1]) == 0x74) {
LinearMoveUpdate(super);
} else {
- tile = sub_080B1B0C(super);
+ tile = GetCollisionDataAtEntity(super);
if ((tile != 0x24) && (tile != 0x26)) {
ProcessMovement10(super);
}
@@ -136,7 +136,7 @@ void sub_080AD040(PlayerItemHeldObjectEntity* this) {
(child->base).x = super->x;
(child->base).y = super->y;
(child->base).z = super->z;
- tile = GetTileUnderEntity(super);
+ tile = GetVvvAtEntity(super);
switch (tile) {
case 0xd:
case 0x10:
diff --git a/src/playerItem/playerItemPacciCaneProjectile.c b/src/playerItem/playerItemPacciCaneProjectile.c
index bdb9e215..255e49c0 100644
--- a/src/playerItem/playerItemPacciCaneProjectile.c
+++ b/src/playerItem/playerItemPacciCaneProjectile.c
@@ -109,7 +109,7 @@ void sub_080701F8(Entity* this) {
}
if (sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) == 0) {
if (sub_080040D8(this, &gUnk_08003E44, this->x.HALF.HI, this->y.HALF.HI) == 0) {
- if (GetTileUnderEntity(this) == 0x19) {
+ if (GetVvvAtEntity(this) == 0x19) {
this->action = 4;
COLLISION_OFF(this);
this->x.HALF.HI = (this->x.HALF.HI & 0xfff0) | 8;
diff --git a/src/playerItem/playerItemSword.c b/src/playerItem/playerItemSword.c
index 43471e77..21e836cc 100644
--- a/src/playerItem/playerItemSword.c
+++ b/src/playerItem/playerItemSword.c
@@ -340,35 +340,35 @@ void sub_080A7A54(PlayerItemSwordEntity* this) {
void sub_080A7A84(PlayerItemSwordEntity* this) {
u32 one;
Entity* effect;
- s16 new_var;
+ s16 xOffset;
s32 uVar3;
- Entity* new_var2;
+ Entity* entity;
const s8* ptr;
u32 tmp;
u32 tmp2;
- u32 r5;
+ u32 yOffset;
if ((gPlayerEntity.frame & 0xf) != 0) {
uVar3 = gUnk_08129072[((gPlayerEntity.frame & 0xf) - 1)][0];
one = 1;
- r5 = gUnk_08129072[(gPlayerEntity.frame & 0xf) - 1][one];
+ yOffset = gUnk_08129072[(gPlayerEntity.frame & 0xf) - 1][one];
if (((gPlayerState.sword_state & 0xc0) == 0) && (gPlayerEntity.spriteSettings.flipX == 1)) {
uVar3 = -uVar3;
}
if (super->type != 0) {
- sub_08008796(super, 0, super->x.HALF.HI + uVar3, super->y.HALF.HI + r5);
+ sub_08008796(super, 0, super->x.HALF.HI + uVar3, super->y.HALF.HI + yOffset);
} else if (super->z.WORD == 0) {
if (gPlayerState.skills & SKILL_ROCK_BREAKER) {
tmp2 = 1;
} else {
tmp2 = 0;
}
- new_var = uVar3;
- if (((sub_08008796(super, tmp2, super->x.HALF.HI + new_var, super->y.HALF.HI + r5) == NULL) &&
+ xOffset = uVar3;
+ if (((sub_08008796(super, tmp2, super->x.HALF.HI + xOffset, super->y.HALF.HI + yOffset) == NULL) &&
(gPlayerState.sword_state != 0)) &&
((gPlayerState.sword_state & 0xc0) == 0)) {
- new_var2 = super;
- if (GetRelativeCollisionTile(new_var2, new_var, r5) == 0x2e) {
+ entity = super;
+ if (GetVvvRelativeToEntity(entity, xOffset, yOffset) == 0x2e) {
SoundReqClipped(&gPlayerEntity, SFX_ITEM_GLOVES_KNOCKBACK);
} else {
SoundReqClipped(&gPlayerEntity, SFX_METAL_CLINK);
@@ -376,10 +376,10 @@ void sub_080A7A84(PlayerItemSwordEntity* this) {
effect = CreateObject(SPECIAL_FX, FX_LIGHTNING, 0);
if (effect != NULL) {
ptr = gUnk_0812908E;
- effect->x.HALF.HI = new_var2->x.HALF.HI + ptr[new_var2->animationState];
- tmp = new_var2->animationState + 1;
- effect->y.HALF.HI = new_var2->y.HALF.HI + ptr[tmp];
- effect->z = new_var2->z;
+ effect->x.HALF.HI = entity->x.HALF.HI + ptr[entity->animationState];
+ tmp = entity->animationState + 1;
+ effect->y.HALF.HI = entity->y.HALF.HI + ptr[tmp];
+ effect->z = entity->z;
}
}
}
diff --git a/src/playerUtils.c b/src/playerUtils.c
index 220fe9d1..0d3a1422 100644
--- a/src/playerUtils.c
+++ b/src/playerUtils.c
@@ -79,7 +79,7 @@ InteractableObject* sub_080784E4(void);
u32 sub_08079778(void);
u32 GetPlayerTilePos(void);
-extern const u16 gUnk_08007CAC[];
+extern const KeyValuePair gMapVvvToSurfaceType[];
u32 sub_0807BEEC(u32 param_1, u32 param_2, u32 param_3);
@@ -107,7 +107,7 @@ extern const u16* sub_0806FC50(u32 param_1, u32 param_2);
bool32 sub_08079F48(u32 param_1, u32 param_2);
-extern void FillUnkData3ForLayer(LayerStruct*);
+extern void FillVvvForLayer(LayerStruct*);
extern void RenderTilemapToScreenblock(u16*, LayerStruct*);
extern u16 gUnk_080B77C0[];
@@ -140,7 +140,8 @@ void sub_0807C5B0(void);
extern u8 gUnk_080082DC[];
extern u32 sub_08004202(Entity*, u8*, u32);
-extern u32 gUnk_02022830[];
+// This just reuses the first 12 bytes of gUnk_02022830 to store a MapDataDefinition there temporarily.
+extern MapDataDefinition gUnk_02022830;
extern u16* gUnk_0800823C[];
void UpdateActiveItems(PlayerEntity* this) {
@@ -733,7 +734,7 @@ void SurfaceAction_AutoLadder(Entity*);
void SurfaceAction_ClimbWall(Entity*);
void SurfaceAction_2C(Entity*);
-void (*const gUnk_0811C120[])(Entity*) = {
+void (*const gSurfaceActions[])(Entity*) = {
SurfaceAction_DoNothing,
SurfaceAction_Pit,
NULL,
@@ -782,37 +783,47 @@ void (*const gUnk_0811C120[])(Entity*) = {
SurfaceAction_Dust,
};
-const u16 gUnk_0811C240[];
-const u16 gUnk_0811C24A[];
-const u16 gUnk_0811C254[];
-const u16 gUnk_0811C25E[];
-const u16 gUnk_0811C1F8[];
-const u16 gUnk_0811C20A[];
-const u16 gUnk_0811C21C[];
-const u16 gUnk_0811C22E[];
+const KeyValuePair gUnk_0811C240[];
+const KeyValuePair gUnk_0811C24A[];
+const KeyValuePair gUnk_0811C254[];
+const KeyValuePair gUnk_0811C25E[];
+const KeyValuePair gUnk_0811C1F8[];
+const KeyValuePair gUnk_0811C20A[];
+const KeyValuePair gUnk_0811C21C[];
+const KeyValuePair gUnk_0811C22E[];
-const u16* const gUnk_0811C1D8[] = {
+const KeyValuePair* const gUnk_0811C1D8[] = {
gUnk_0811C240,
gUnk_0811C24A,
gUnk_0811C254,
gUnk_0811C25E,
};
-const u16* const gUnk_0811C1E8[] = {
+const KeyValuePair* const gUnk_0811C1E8[] = {
gUnk_0811C1F8,
gUnk_0811C20A,
gUnk_0811C21C,
gUnk_0811C22E,
};
-const u16 gUnk_0811C1F8[] = { 43, 1, 65, 1, 78, 8, 76, 2, 0 };
-const u16 gUnk_0811C20A[] = { 44, 3, 66, 3, 76, 2, 77, 4, 0 };
-const u16 gUnk_0811C21C[] = { 42, 5, 64, 5, 79, 6, 77, 4, 0 };
-const u16 gUnk_0811C22E[] = { 45, 7, 67, 7, 78, 8, 79, 6, 0 };
-const u16 gUnk_0811C240[] = { 42, 1, 38, 1, 0 };
-const u16 gUnk_0811C24A[] = { 45, 1, 39, 1, 0 };
-const u16 gUnk_0811C254[] = { 43, 1, 38, 1, 0 };
-const u16 gUnk_0811C25E[] = { 44, 1, 39, 1, 0 };
-const u16 gUnk_0811C268[] = { 16, 1, 90, 1, 17, 1, 19, 1, 0, 0 };
+const KeyValuePair gUnk_0811C1F8[] = { { 43, 1 }, { 65, 1 }, { 78, 8 }, { 76, 2 } };
+const u16 gUnk_0811C1F8End = 0;
+const KeyValuePair gUnk_0811C20A[] = { { 44, 3 }, { 66, 3 }, { 76, 2 }, { 77, 4 } };
+const u16 gUnk_0811C20AEnd = 0;
+const KeyValuePair gUnk_0811C21C[] = { { 42, 5 }, { 64, 5 }, { 79, 6 }, { 77, 4 } };
+const u16 gUnk_0811C21CEnd = 0;
+const KeyValuePair gUnk_0811C22E[] = { { 45, 7 }, { 67, 7 }, { 78, 8 }, { 79, 6 } };
+const u16 gUnk_0811C22EEnd = 0;
+const KeyValuePair gUnk_0811C240[] = { { 42, 1 }, { 38, 1 } };
+const u16 gUnk_0811C240End = 0;
+const KeyValuePair gUnk_0811C24A[] = { { 45, 1 }, { 39, 1 } };
+const u16 gUnk_0811C24AEnd = 0;
+const KeyValuePair gUnk_0811C254[] = { { 43, 1 }, { 38, 1 } };
+const u16 gUnk_0811C254End = 0;
+const KeyValuePair gUnk_0811C25E[] = { { 44, 1 }, { 39, 1 } };
+const u16 gUnk_0811C25EEnd = 0;
+const KeyValuePair gUnk_0811C268[] = { { 16, 1 }, { 90, 1 }, { 17, 1 }, { 19, 1 } };
+const u16 gUnk_0811C268EEnd = 0;
+
void sub_0807B114(PlayerEntity*);
void sub_0807B128(PlayerEntity*);
void (*const gUnk_0811C27C[])(PlayerEntity*) = {
@@ -1506,7 +1517,7 @@ void ResetPlayerVelocity(void) {
bool32 sub_08078F74(Entity* this) {
if ((gArea.portal_mode == 3) && (gPlayerState.field_0x35 != 0xff)) {
gPlayerState.jump_status = 0x81;
- this->action = 0x15;
+ this->action = PLAYER_USEPORTAL;
this->subAction = 0;
this->zVelocity = Q_16_16(2.0);
return TRUE;
@@ -1734,7 +1745,7 @@ void RespawnPlayer(void) {
index = 0;
if (gPlayerState.path_memory[0] != 0xffffffff) {
ptr1 = gPlayerState.path_memory;
- while (GetCollisionData((u16)*ptr1, *ptr1 >> 0x1e) == 0xf) {
+ while (GetCollisionDataAtMetaTilePos((u16)*ptr1, *ptr1 >> 0x1e) == 0xf) {
ptr1++;
index++;
if ((index > 0xf) || (*ptr1 == -1)) {
@@ -1788,11 +1799,11 @@ bool32 sub_08079550(void) {
tilePos2 = COORD_TO_TILE_OFFSET(&gPlayerEntity, (gPlayerEntity.hitbox)->unk2[2], -ptr[1]);
}
- uVar3 = sub_080B1AE0(tilePos1, gPlayerEntity.collisionLayer);
- uVar3 = sub_08007DD6(uVar3, gUnk_0811C1E8[gPlayerEntity.animationState >> 1]);
+ uVar3 = GetVvvAtMetaTilePos(tilePos1, gPlayerEntity.collisionLayer);
+ uVar3 = FindValueForKey(uVar3, gUnk_0811C1E8[gPlayerEntity.animationState >> 1]);
if (uVar3 != 0) {
- uVar3 = sub_080B1AE0(tilePos2, gPlayerEntity.collisionLayer);
- uVar3 = sub_08007DD6(uVar3, gUnk_0811C1E8[gPlayerEntity.animationState >> 1]);
+ uVar3 = GetVvvAtMetaTilePos(tilePos2, gPlayerEntity.collisionLayer);
+ uVar3 = FindValueForKey(uVar3, gUnk_0811C1E8[gPlayerEntity.animationState >> 1]);
if (uVar3 != 0) {
gPlayerState.pushedObject |= 0x80;
if (gPlayerState.dash_state == 0 && (++gPlayerEntity.subtimer <= 5)) {
@@ -1800,7 +1811,7 @@ bool32 sub_08079550(void) {
}
gPlayerEntity.animationState = uVar3 - 1;
- gPlayerEntity.action = 4;
+ gPlayerEntity.action = PLAYER_JUMP;
gPlayerEntity.subAction = 0;
COLLISION_OFF(&gPlayerEntity);
gPlayerState.jump_status = 0x81;
@@ -1817,7 +1828,7 @@ void sub_08079708(Entity* this) {
gPlayerState.framestate = PL_STATE_DIE;
gPlayerState.field_0x3c = 0xff;
this->flags &= ~ENT_COLLIDE;
- this->action = 0xa;
+ this->action = PLAYER_MINISHDIE;
this->subAction = 0;
sub_080085B0(this);
if ((gPlayerState.flags & (PL_CAPTURED | PL_DISABLE_ITEMS)) == 0) {
@@ -1884,7 +1895,7 @@ void sub_080797EC(void) {
} else {
animation = 0x16c;
if (sub_080793E4(0)) {
- if (GetCollisionData(GetPlayerTilePos(), gPlayerEntity.collisionLayer) != 0xff) {
+ if (GetCollisionDataAtMetaTilePos(GetPlayerTilePos(), gPlayerEntity.collisionLayer) != 0xff) {
gPlayerState.sword_state &= ~8;
animation = 0x170;
}
@@ -1918,7 +1929,8 @@ void sub_080797EC(void) {
} else if (gPlayerState.sword_state != 0) {
animation = 0x16c;
if (sub_080793E4(0)) {
- if (GetCollisionData(GetPlayerTilePos(), (u32)gPlayerEntity.collisionLayer) != 0xff) {
+ if (GetCollisionDataAtMetaTilePos(GetPlayerTilePos(), (u32)gPlayerEntity.collisionLayer) !=
+ 0xff) {
gPlayerState.sword_state &= ~8;
animation = 0x170;
}
@@ -2117,13 +2129,13 @@ bool32 sub_08079C30(Entity* param_1) {
return TRUE;
}
- if (gPlayerState.floor_type != sub_08007DD6(GetRelativeCollisionTile(param_1, 0, -1), (u16*)gUnk_08007CAC))
+ if (gPlayerState.floor_type != FindValueForKey(GetVvvRelativeToEntity(param_1, 0, -1), gMapVvvToSurfaceType))
return FALSE;
- if (gPlayerState.floor_type != sub_08007DD6(GetRelativeCollisionTile(param_1, 2, 0), (u16*)gUnk_08007CAC))
+ if (gPlayerState.floor_type != FindValueForKey(GetVvvRelativeToEntity(param_1, 2, 0), gMapVvvToSurfaceType))
return FALSE;
- if (gPlayerState.floor_type == sub_08007DD6(GetRelativeCollisionTile(param_1, -2, 0), (u16*)gUnk_08007CAC)) {
+ if (gPlayerState.floor_type == FindValueForKey(GetVvvRelativeToEntity(param_1, -2, 0), gMapVvvToSurfaceType)) {
return TRUE;
}
}
@@ -2135,7 +2147,7 @@ bool32 sub_08079D48(void) {
return TRUE;
} else {
if (!PlayerCheckNEastTile()) {
- if (!sub_08007DD6((u16)GetTileUnderEntity(&gPlayerEntity), gUnk_0811C268)) {
+ if (!FindValueForKey((u16)GetVvvAtEntity(&gPlayerEntity), gUnk_0811C268)) {
return TRUE;
}
}
@@ -2205,13 +2217,13 @@ bool32 sub_08079E90(u32 param_1) {
tmp1 = -gPlayerEntity.hitbox->unk2[3];
}
}
- if (!sub_08079F48(param_1, sub_080B1AF0(&gPlayerEntity, tmp2, tmp1))) {
+ if (!sub_08079F48(param_1, GetCollisionDataRelativeTo(&gPlayerEntity, tmp2, tmp1))) {
if ((gPlayerEntity.direction & DirectionSouth) != 0) {
tmp1 = -tmp1;
} else {
tmp2 = -tmp2;
}
- if (!sub_08079F48(param_1, sub_080B1AF0(&gPlayerEntity, tmp2, tmp1))) {
+ if (!sub_08079F48(param_1, GetCollisionDataRelativeTo(&gPlayerEntity, tmp2, tmp1))) {
return FALSE;
}
}
@@ -2351,7 +2363,7 @@ void sub_0807A180(Entity* param_1, u32 param_2, u32 param_3, u32 param_4) {
void UpdateFloorType(void) {
gPlayerState.floor_type = GetSurfaceCalcType(&gPlayerEntity, 0, 0);
- gUnk_0811C120[gPlayerState.floor_type](&gPlayerEntity);
+ gSurfaceActions[gPlayerState.floor_type](&gPlayerEntity);
}
SurfaceType GetSurfaceCalcType(Entity* param_1, s32 x, s32 y) {
@@ -2373,8 +2385,8 @@ SurfaceType GetSurfaceCalcType(Entity* param_1, s32 x, s32 y) {
gPlayerState.surfaceTimer++;
}
gPlayerState.floor_type_last = gPlayerState.floor_type;
- tileType = GetRelativeCollisionTile(param_1, x, y);
- return sub_08007DD6(tileType, (u16*)gUnk_08007CAC);
+ tileType = GetVvvRelativeToEntity(param_1, x, y);
+ return FindValueForKey(tileType, gMapVvvToSurfaceType);
}
void EnablePlayerDraw(Entity* this) {
@@ -2474,7 +2486,8 @@ void sub_0807A750(u32 param_1, u32 param_2, const u8* param_3, u32 param_4) {
index = param_1 % 16;
}
if ((index != 0) && (index != 0xf)) {
- uVar2 = GetCollisionData((param_1 >> 4 & 0x3f) | (param_2 >> 4 & 0x3f) << 6, gPlayerEntity.collisionLayer);
+ uVar2 = GetCollisionDataAtMetaTilePos((param_1 >> 4 & 0x3f) | (param_2 >> 4 & 0x3f) << 6,
+ gPlayerEntity.collisionLayer);
if (uVar2 > 0xf) {
if (uVar2 != 0xff) {
uVar2 = param_3[uVar2 - 0x10];
@@ -2531,7 +2544,7 @@ void sub_0807A750(u32 param_1, u32 param_2, const u8* param_3, u32 param_4) {
}
}
-u32 GetCollisionTileInFront(Entity* this) {
+u32 GetVvvInFront(Entity* this) {
s32 x;
s32 y;
switch (this->direction) {
@@ -2556,7 +2569,7 @@ u32 GetCollisionTileInFront(Entity* this) {
x = 0;
break;
}
- return GetRelativeCollisionTile(this, x, y);
+ return GetVvvRelativeToEntity(this, x, y);
}
void nullsub_505(void) {
@@ -2657,7 +2670,7 @@ bool32 sub_0807AC54(Entity* this) {
this->x.HALF.HI = (this->x.HALF.HI & 0xfff0) | 8;
// fallthrough
case SURFACE_CLIMB_WALL:
- this->action = 0x1d;
+ this->action = PLAYER_CLIMB;
this->subAction = 0;
this->y.HALF.LO = 0;
gPlayerState.animation = 0x2cf;
@@ -2666,7 +2679,7 @@ bool32 sub_0807AC54(Entity* this) {
this->x.HALF.HI = (this->x.HALF.HI & 0xfff0) | 8;
// fallthrough
case SURFACE_2C:
- this->action = 0x1d;
+ this->action = PLAYER_CLIMB;
this->subAction = 1;
this->y.HALF.LO = 0;
return TRUE;
@@ -2733,7 +2746,8 @@ bool32 ToggleDiving(Entity* this) {
}
void PlayerUpdateSwimming(Entity* this) {
- if ((((this->action != 0x17) || (gPlayerState.field_0xa == 0)) && (gRoomControls.reload_flags == 0)) &&
+ if ((((this->action != PLAYER_ROOMTRANSITION) || (gPlayerState.field_0xa == 0)) &&
+ (gRoomControls.reload_flags == 0)) &&
((gPlayerState.playerInput.newInput & PLAYER_INPUT_8) != 0)) {
if (GetInventoryValue(ITEM_SWIM_BUTTERFLY) == 1) {
this->speed = 0x1c0;
@@ -2975,7 +2989,7 @@ void SetTileType(u32 tileType, u32 position, u32 layer) {
if ((gRoomControls.scroll_flags & 2) != 0) {
gMapBottom.collisionData[position] = collisionData;
}
- data->unkData3[position] = gUnk_080B37A0[tileType];
+ data->vvv[position] = gUnk_080B37A0[tileType];
if ((gRoomControls.scroll_flags & 1) == 0) {
u32 offset = (position & 0x3f) * 2 + (position & 0xfc0) * 4;
if (layer != 2) {
@@ -3000,18 +3014,18 @@ void SetTileType(u32 tileType, u32 position, u32 layer) {
}
}
-bool32 sub_0807B434(u32 position, u32 layer) {
- switch (GetTileType(position, layer)) {
+bool32 sub_0807B434(u32 metaTilePos, u32 layer) {
+ switch (GetTileType(metaTilePos, layer)) {
case 0x36:
case 0x37:
return FALSE;
default:
- return sub_080B1AE0(position, layer) != 0xd;
+ return GetVvvAtMetaTilePos(metaTilePos, layer) != 0xd;
}
}
-bool32 sub_0807B464(u32 param_1, u32 param_2) {
- return sub_080B1AE0(param_1, param_2) == 0x56;
+bool32 sub_0807B464(u32 metaTilePos, u32 layer) {
+ return GetVvvAtMetaTilePos(metaTilePos, layer) == 0x56;
}
void sub_0807B480(u32 tilePos, u32 param_2) {
@@ -3073,7 +3087,7 @@ u32 sub_0807B600(u32 param_1) {
u32 tile;
tile = param_1 - 0x40;
- if (sub_080B1AE0(param_1, 1) != 0x56) {
+ if (GetVvvAtMetaTilePos(param_1, 1) != 0x56) {
return FALSE;
} else {
tileType = GetTileType(param_1, 1);
@@ -3092,10 +3106,10 @@ u32 sub_0807B600(u32 param_1) {
} else {
if (GetTileType(param_1, 2) != 0) {
SetTileType(0x2f2, param_1, 1);
- if (GetCollisionData(tile, 1) == 3) {
+ if (GetCollisionDataAtMetaTilePos(tile, 1) == 3) {
SetTileType(0x2f4, tile, 1);
}
- if (GetCollisionData(param_1 + 0x40, 1) == 3) {
+ if (GetCollisionDataAtMetaTilePos(param_1 + 0x40, 1) == 3) {
SetTileType(0x2f4, param_1, 1);
}
} else {
@@ -3121,7 +3135,7 @@ u32 sub_0807B600(u32 param_1) {
void sub_0807B778(u32 position, u32 layer) {
u32 tmp;
- if (sub_080B1AE0(position, layer) == 0xd) {
+ if (GetVvvAtMetaTilePos(position, layer) == 0xd) {
tmp = sub_0807B434(position - 0x40, layer);
tmp |= sub_0807B434(position + 1, layer) << 1;
tmp |= sub_0807B434(position + 0x40, layer) << 2;
@@ -3190,7 +3204,7 @@ void SetMetaTileByIndex(u32 tileIndex, u32 position, u32 layer) {
data->mapData[position] = tileIndex;
tileType = data->metatileTypes[tileIndex];
data->collisionData[position] = gUnk_080B3E80[tileType];
- data->unkData3[position] = gUnk_080B37A0[tileType];
+ data->vvv[position] = gUnk_080B37A0[tileType];
if ((gRoomControls.scroll_flags & 1) == 0) {
u32 offset = (position & 0x3f) * 2 + (position & 0xfc0) * 4;
if (layer != 2) {
@@ -3221,7 +3235,7 @@ void RestorePrevTileEntity(u32 position, u32 layer) {
data->mapData[position] = tileIndex = data->mapDataClone[position];
tileType = data->metatileTypes[tileIndex];
data->collisionData[position] = gUnk_080B3E80[tileType];
- data->unkData3[position] = gUnk_080B37A0[tileType];
+ data->vvv[position] = gUnk_080B37A0[tileType];
if ((gRoomControls.scroll_flags & 1) == 0) {
u32 offset = (position & 0x3f) * 2 + (position & 0xfc0) * 4;
if (layer != 2) {
@@ -3517,18 +3531,18 @@ void LoadRoomGfx(void) {
MemCopy(gMapBottom.mapData, gMapBottom.mapDataClone, sizeof(gMapBottom.mapData));
MemCopy(gMapTop.mapData, gMapTop.mapDataClone, sizeof(gMapBottom.mapData));
} else if (gRoomTransition.field_0x2c[0] == 2) {
- MemCopy(gMapBottom.mapData, gMapBottom.unkData3, 0x1000);
+ MemCopy(gMapBottom.mapData, gMapBottom.vvv, 0x1000);
MemCopy(gMapBottom.mapDataClone, gMapBottom.mapData, 0x1000);
- MemCopy(gMapBottom.unkData3, gMapBottom.mapDataClone, 0x1000);
- MemCopy(gMapBottom.mapData + 0x800, gMapBottom.unkData3, 0x1000);
+ MemCopy(gMapBottom.vvv, gMapBottom.mapDataClone, 0x1000);
+ MemCopy(gMapBottom.mapData + 0x800, gMapBottom.vvv, 0x1000);
MemCopy(gMapBottom.mapDataClone + 0x800, gMapBottom.mapData + 0x800, 0x1000);
- MemCopy(gMapBottom.unkData3, gMapBottom.mapDataClone + 0x800, 0x1000);
- MemCopy(gMapTop.mapData, gMapTop.unkData3, 0x1000);
+ MemCopy(gMapBottom.vvv, gMapBottom.mapDataClone + 0x800, 0x1000);
+ MemCopy(gMapTop.mapData, gMapTop.vvv, 0x1000);
MemCopy(gMapTop.mapDataClone, gMapTop.mapData, 0x1000);
- MemCopy(gMapTop.unkData3, gMapTop.mapDataClone, 0x1000);
- MemCopy(gMapTop.mapData + 0x800, gMapTop.unkData3, 0x1000);
+ MemCopy(gMapTop.vvv, gMapTop.mapDataClone, 0x1000);
+ MemCopy(gMapTop.mapData + 0x800, gMapTop.vvv, 0x1000);
MemCopy(gMapTop.mapDataClone + 0x800, gMapTop.mapData + 0x800, 0x1000);
- MemCopy(gMapTop.unkData3, gMapTop.mapDataClone + 0x800, 0x1000);
+ MemCopy(gMapTop.vvv, gMapTop.mapDataClone + 0x800, 0x1000);
}
if (!clearBottomMap) {
sub_0807BBE4();
@@ -3538,8 +3552,8 @@ void LoadRoomGfx(void) {
sub_0807C460();
}
CreateCollisionDataBorderAroundRoom();
- FillUnkData3ForLayer(&gMapBottom);
- FillUnkData3ForLayer(&gMapTop);
+ FillVvvForLayer(&gMapBottom);
+ FillVvvForLayer(&gMapTop);
if (!clearBottomMap) {
// Render the complete bottom and top metatilemaps into the tilemaps.
RenderTilemapToScreenblock((u16*)&gMapDataBottomSpecial, &gMapBottom);
@@ -3627,26 +3641,27 @@ void sub_0807C460(void) {
}
void sub_0807C4F8(void) {
- // TODO convert to MapDataDefinition*
- u32* puVar1;
- u32* ptr;
+ MapDataDefinition* ptr1;
+ MapDataDefinition* ptr2;
if (gRoomControls.area != AREA_PALACE_OF_WINDS_BOSS) {
MemClear(gMapDataBottomSpecial, 0x8000);
MemClear(gMapDataTopSpecial, 0x8000);
- ptr = gUnk_02022830;
- puVar1 = (u32*)(gArea.pCurrentRoomInfo)->map;
- puVar1 -= 3;
+ ptr1 = &gUnk_02022830;
+ ptr2 = (MapDataDefinition*)(gArea.pCurrentRoomInfo)->map;
+ ptr2 -= 1;
do {
- puVar1 += 3;
- if (((u16*)puVar1[1] == gMapDataBottomSpecial) || ((u16*)puVar1[1] == (u16*)&gMapDataTopSpecial)) {
- // only store the map data definitions for bitmap backgrounds in gUnk_02022830?
- ptr[0] = puVar1[0] & 0x7fffffff;
- ptr[1] = puVar1[1];
- ptr[2] = puVar1[2];
- LoadMapData((MapDataDefinition*)ptr);
- }
- } while ((s32)*puVar1 < 0);
+ ptr2 += 1;
+ // TODO why does this not match with ptr2->dest?
+ if (((u16*)((u32*)ptr2)[1] == gMapDataBottomSpecial) ||
+ ((u16*)((u32*)ptr2)[1] == (u16*)&gMapDataTopSpecial)) {
+ // only load the map data definitions for bitmap backgrounds?
+ ptr1->src = ptr2->src & 0x7fffffff;
+ ptr1->dest = ptr2->dest;
+ ptr1->size = ptr2->size;
+ LoadMapData(ptr1);
+ }
+ } while ((s32)ptr2->src < 0);
MemCopy(gMapDataBottomSpecial, gMapDataBottomSpecial + 0x2000, 0x4000);
sub_0807C5F4(gMapDataBottomSpecial, gMapDataBottomSpecial + 0x2000);
diff --git a/src/projectile/projectile5.c b/src/projectile/projectile5.c
index 49b63628..9a89c450 100644
--- a/src/projectile/projectile5.c
+++ b/src/projectile/projectile5.c
@@ -4,7 +4,7 @@
#include "room.h"
#include "physics.h"
-extern u32 GetCollisionData(u32, u32);
+extern u32 GetCollisionDataAtMetaTilePos(u32, u32);
extern void (*const Projectile5_Functions[])(Entity*);
extern void (*const Projectile5_Actions[])(Entity*);
@@ -28,7 +28,8 @@ void sub_080A86F0(Entity* this) {
pbVar2 = &this->parent->field_0x82.HALF.HI;
if ((this->parent->field_0x82.HALF.HI & 0x3f) == 3) {
if (gPlayerState.hurtBlinkSpeed != 0) {
- if (GetCollisionData(TILE(this->x.HALF.HI, this->y.HALF.HI), gPlayerEntity.collisionLayer) == 0) {
+ if (GetCollisionDataAtMetaTilePos(TILE(this->x.HALF.HI, this->y.HALF.HI),
+ gPlayerEntity.collisionLayer) == 0) {
if (this->contactFlags == 0x80) {
*pbVar2 = *pbVar2 & 0x7f;
DeleteThisEntity();
diff --git a/src/projectile/removableDust.c b/src/projectile/removableDust.c
index 7927339f..51ce0d95 100644
--- a/src/projectile/removableDust.c
+++ b/src/projectile/removableDust.c
@@ -5,8 +5,6 @@
#include "object.h"
#include "room.h"
-extern u32 sub_080B1AE0(u16, u8);
-
extern void (*const RemovableDust_Functions[])(Entity*);
extern const u16 gUnk_08129FD0[];
extern const u16 gUnk_08129FE4[];
@@ -88,7 +86,7 @@ void sub_080AA534(Entity* this) {
void sub_080AA544(Entity* this) {
u8* pbVar1;
- s32 iVar2;
+ s32 vvv;
u32 uVar3;
s32 iVar4;
const u16* puVar5;
@@ -101,8 +99,8 @@ void sub_080AA544(Entity* this) {
uVar3 = 0;
iVar4 = 0;
do {
- iVar2 = sub_080B1AE0((param - tmp[uVar3]) & 0xffff, this->collisionLayer);
- if (iVar2 == 0x3e) {
+ vvv = GetVvvAtMetaTilePos((param - tmp[uVar3]) & 0xffff, this->collisionLayer);
+ if (vvv == 0x3e) {
iVar4++;
}
uVar3++;
diff --git a/src/projectile/spiderWeb.c b/src/projectile/spiderWeb.c
index 59ecd7dc..a089d75a 100644
--- a/src/projectile/spiderWeb.c
+++ b/src/projectile/spiderWeb.c
@@ -158,7 +158,7 @@ void SpiderWeb_SubAction0(Entity* this) {
if (tmp * 2 - entity->animationState == 0) {
x = gUnk_0812A064[tmp * 2] + this->x.HALF.HI;
y = gUnk_0812A064[tmp * 2 + 1] + this->y.HALF.HI;
- if (sub_080B1B18(x, y, entity->collisionLayer) == 0) {
+ if (GetCollisionDataAtWorldCoords(x, y, entity->collisionLayer) == 0) {
entity->x.HALF.HI = x;
entity->y.HALF.HI = y;
}
@@ -225,7 +225,7 @@ void sub_080AA9E0(Entity* this) {
}
void sub_080AAA68(Entity* this) {
- static const u16 typeTiles[] = { 16419, 16421, 16422, 16420 };
+ static const u16 typeTiles[] = { 0x4023, 0x4025, 0x4026, 0x4024 };
SetTile(typeTiles[this->type], TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer);
}
diff --git a/src/scroll.c b/src/scroll.c
index a92e4619..8131f5e0 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -28,8 +28,8 @@ extern void sub_0805E248();
extern u8 gUpdateVisibleTiles;
extern u16 gUnk_0200B640;
extern MapDataDefinition** gCaveBorderMapData[];
-extern u32 gUnk_02022830[];
-extern u16 gUnk_020246B0[];
+extern u16 gUnk_02022830[0xc00];
+extern u16 gUnk_020246B0[0xc00];
extern u8 gUnk_080B7910[];
void Scroll0(RoomControls*);
@@ -54,7 +54,7 @@ u32 sub_080803D0();
u32 sub_08080278();
void sub_08080C80(MapDataDefinition*);
void sub_08080368();
-void FillUnkData3ForLayer(LayerStruct*);
+void FillVvvForLayer(LayerStruct*);
bool32 sub_08080794(const Transition* transition, u32 param_2, u32 param_3, u32 param_4);
bool32 sub_08080808(const Transition* transition, u32 param_2, u32 param_3, u32 param_4);
void sub_080808D8(s32);
@@ -357,8 +357,8 @@ void Scroll5Sub3(RoomControls* controls) {
sub_08080368();
gUnk_02034480.unk_00 = gUnk_0200B640;
MemCopy(gUnk_02022830, gUnk_020246B0, 0x1800);
- FillUnkData3ForLayer(&gMapBottom);
- FillUnkData3ForLayer(&gMapTop);
+ FillVvvForLayer(&gMapBottom);
+ FillVvvForLayer(&gMapTop);
sub_0807BBE4();
CreateCollisionDataBorderAroundRoom();
sub_0805E248();
@@ -435,7 +435,7 @@ u32 sub_08080278(void) {
u16* ptr1;
u32 tmp;
- ptr1 = (u16*)gUnk_02022830;
+ ptr1 = gUnk_02022830;
width = gRoomControls.width >> 4;
height = (gRoomControls.height >> 4) << 6;
result = 0;
@@ -803,9 +803,10 @@ void UpdateDoorTransition() {
case 0x1d:
uVar4 = controls->camera_target->y.HALF.HI - controls->origin_y;
uVar3 = controls->camera_target->x.HALF.HI - controls->origin_x;
- uVar1 = sub_080B1AE0((((controls->camera_target->x.HALF.HI - controls->origin_x) >> 4) & 0x3F) |
- ((((controls->camera_target->y.HALF.HI - controls->origin_y) >> 4) & 0x3F) << 6),
- controls->camera_target->collisionLayer);
+ uVar1 = GetVvvAtMetaTilePos(
+ (((controls->camera_target->x.HALF.HI - controls->origin_x) >> 4) & 0x3F) |
+ ((((controls->camera_target->y.HALF.HI - controls->origin_y) >> 4) & 0x3F) << 6),
+ controls->camera_target->collisionLayer);
gRoomTransition.stairs_idx = sub_080B1A48(uVar3, uVar4, controls->camera_target->collisionLayer);
switch (uVar1) {
case 0x3f:
@@ -818,19 +819,19 @@ void UpdateDoorTransition() {
}
}
-// fill the unkData3 for the whole layer
-void FillUnkData3ForLayer(LayerStruct* layer) {
- u32 index;
+// fill the vvv for the whole layer
+void FillVvvForLayer(LayerStruct* layer) {
+ u32 metaTilePos;
u16* metatileTypes = layer->metatileTypes;
const u8* ptr = gUnk_080B37A0;
- u8* ptr3 = layer->unkData3;
+ u8* ptr3 = layer->vvv;
u16* mapData = layer->mapData;
- for (index = 0; index < 0x1000; index++) {
- u16 metaTileIndex = mapData[index];
+ for (metaTilePos = 0; metaTilePos < 0x40 * 0x40; metaTilePos++) {
+ u16 metaTileIndex = mapData[metaTilePos];
if (metaTileIndex < 0x4000) {
- layer->unkData3[index] = ptr[metatileTypes[metaTileIndex]];
+ layer->vvv[metaTilePos] = ptr[metatileTypes[metaTileIndex]];
} else {
- layer->unkData3[index] = gUnk_080B7910[metaTileIndex - 0x4000];
+ layer->vvv[metaTilePos] = gUnk_080B7910[metaTileIndex - 0x4000];
}
}
}