summaryrefslogtreecommitdiff
path: root/src/enemy
diff options
context:
space:
mode:
authoroctorock <79596758+octorock@users.noreply.github.com>2024-01-06 18:12:53 +0100
committeroctorock <79596758+octorock@users.noreply.github.com>2024-01-06 18:12:53 +0100
commit560dfa45b16d5da212174423d71c67f638366cce (patch)
treefb103ec8abfce76017c37ebb163bd91a8fea1278 /src/enemy
parent06dc15859867c7f2db22ea6e289e28ff12b0b6c9 (diff)
Add more tilemap documentation
Diffstat (limited to 'src/enemy')
-rw-r--r--src/enemy/octorokBoss.c1
-rw-r--r--src/enemy/puffstool.c39
2 files changed, 19 insertions, 21 deletions
diff --git a/src/enemy/octorokBoss.c b/src/enemy/octorokBoss.c
index 0f12becc..306b611b 100644
--- a/src/enemy/octorokBoss.c
+++ b/src/enemy/octorokBoss.c
@@ -1115,7 +1115,6 @@ void sub_08036998(OctorokBossEntity* this) {
s32 tmp3;
s32 a, b;
- // TODO regalloc in this awful structure here
tmp2 = &this->timer;
tmp = super->subtimer + (tmp3 = (u8)*tmp2);
*tmp2 = tmp;
diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c
index fa94c291..cf40c24c 100644
--- a/src/enemy/puffstool.c
+++ b/src/enemy/puffstool.c
@@ -401,14 +401,14 @@ void sub_080256B4(PuffstoolEntity* this) {
bool32 sub_0802571C(PuffstoolEntity* this) {
RoomControls* ctrl = &gRoomControls;
- u16 xDiff = (super->x.HALF.HI - ctrl->origin_x + 8) & -0x10;
- u16 yDiff = (super->y.HALF.HI - ctrl->origin_y + 8) & -0x10;
+ u16 roomX = (super->x.HALF.HI - ctrl->origin_x + 8) & -0x10;
+ u16 roomY = (super->y.HALF.HI - ctrl->origin_y + 8) & -0x10;
u16 unk = this->unk_7a;
u16 i;
for (i = 0; i < 4; i++) {
- u16 sVar3 = xDiff + gUnk_080CC020[unk + 0];
- u16 sVar4 = yDiff + gUnk_080CC020[unk + 1];
+ u16 sVar3 = roomX + gUnk_080CC020[unk + 0];
+ u16 sVar4 = roomY + gUnk_080CC020[unk + 1];
if (sub_080257EC(this, sVar3, sVar4)) {
this->unk_7c = sVar3 + ctrl->origin_x;
@@ -429,25 +429,25 @@ bool32 sub_0802571C(PuffstoolEntity* this) {
bool32 sub_080257EC(PuffstoolEntity* this, u32 x, u32 y) {
u16 tileType = GetTileTypeAtRoomCoords(x - 0x00, y - 0x00, super->collisionLayer);
- if (tileType != 0x312 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
+ if (tileType != TILE_TYPE_786 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
gMapTileTypeToCollisionData[tileType] == 0) {
return TRUE;
}
tileType = GetTileTypeAtRoomCoords(x - 0x10, y - 0x00, super->collisionLayer);
- if (tileType != 0x312 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
+ if (tileType != TILE_TYPE_786 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
gMapTileTypeToCollisionData[tileType] == 0) {
return TRUE;
}
tileType = GetTileTypeAtRoomCoords(x - 0x00, y - 0x10, super->collisionLayer);
- if (tileType != 0x312 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
+ if (tileType != TILE_TYPE_786 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
gMapTileTypeToCollisionData[tileType] == 0) {
return TRUE;
}
tileType = GetTileTypeAtRoomCoords(x - 0x10, y - 0x10, super->collisionLayer);
- if (tileType != 0x312 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
+ if (tileType != TILE_TYPE_786 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
gMapTileTypeToCollisionData[tileType] == 0) {
return TRUE;
}
@@ -482,11 +482,10 @@ bool32 sub_080258C4(PuffstoolEntity* this) {
}
}
-// regalloc
bool32 sub_0802594C(PuffstoolEntity* this, u32 param_2) {
s16 xDiff;
s16 yDiff;
- s16 iVar9;
+ s16 x;
u32 layer;
const s8* unk = gUnk_080CC090[param_2];
layer = super->collisionLayer;
@@ -495,24 +494,24 @@ bool32 sub_0802594C(PuffstoolEntity* this, u32 param_2) {
do {
u8 bVar7;
u8 bVar4;
- s16 iVar11;
+ s16 y;
u8 bVar5;
u8 bVar6;
- iVar9 = xDiff + unk[0];
- iVar11 = yDiff + unk[1];
- bVar4 = GetCollisionDataAtWorldCoords(iVar9 - 0x00, iVar11 - 0x00, layer);
- bVar5 = GetCollisionDataAtWorldCoords(iVar9 - 0x10, iVar11 - 0x00, layer);
- bVar6 = GetCollisionDataAtWorldCoords(iVar9 - 0x00, iVar11 - 0x10, layer);
- bVar7 = GetCollisionDataAtWorldCoords(iVar9 - 0x10, iVar11 - 0x10, layer);
+ x = xDiff + unk[0];
+ y = yDiff + unk[1];
+ bVar4 = GetCollisionDataAtWorldCoords(x - 0x00, y - 0x00, layer);
+ bVar5 = GetCollisionDataAtWorldCoords(x - 0x10, y - 0x00, layer);
+ bVar6 = GetCollisionDataAtWorldCoords(x - 0x00, y - 0x10, layer);
+ bVar7 = GetCollisionDataAtWorldCoords(x - 0x10, y - 0x10, layer);
if ((bVar4 | bVar5 | bVar6 | bVar7) == 0) {
- this->unk_7c = gRoomControls.origin_x + iVar9;
- this->unk_7e = gRoomControls.origin_y + iVar11;
+ this->unk_7c = gRoomControls.origin_x + x;
+ this->unk_7e = gRoomControls.origin_y + y;
return TRUE;
}
unk += 2;
} while (unk[0] != 0x7f);
- return 0;
+ return FALSE;
}
void sub_08025A54(PuffstoolEntity* this) {