summaryrefslogtreecommitdiff
path: root/src/enemy
diff options
context:
space:
mode:
authoroctorock <79596758+octorock@users.noreply.github.com>2022-02-06 13:41:48 +0100
committeroctorock <79596758+octorock@users.noreply.github.com>2022-02-12 20:03:27 +0100
commit75c57e31240c706e1ca9364954970861c1a85e78 (patch)
tree09a1bf54aa8f250d91abea199ef15744a839e212 /src/enemy
parentb9876fd30f2bc04036a3a223c193fd8fd833cafa (diff)
Decompile movement
Diffstat (limited to 'src/enemy')
-rw-r--r--src/enemy/helmasaur.c12
-rw-r--r--src/enemy/octorokGolden.c7
-rw-r--r--src/enemy/sensorBladeTrap.c8
3 files changed, 13 insertions, 14 deletions
diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c
index fc90c307..292d9b0b 100644
--- a/src/enemy/helmasaur.c
+++ b/src/enemy/helmasaur.c
@@ -11,8 +11,8 @@
extern u32 sub_0804A024(Entity*, u32, u32);
-extern Entity gUnk_0200D654;
-extern Entity gUnk_02027EB4;
+extern u8 gUnk_0200D654[];
+extern u8 gUnk_02027EB4[];
void sub_0802C18C(Entity*);
void sub_0802C218(Entity*);
@@ -316,13 +316,13 @@ bool32 sub_0802C06C(Entity* this) {
u32 xdiff = gUnk_080CD45C[(this->direction >> 2) + 0];
u32 ydiff = gUnk_080CD45C[(this->direction >> 2) + 1];
- Entity* ent = this->collisionLayer == 2 ? &gUnk_0200D654 : &gUnk_02027EB4;
+ u8* layer = this->collisionLayer == 2 ? gUnk_0200D654 : gUnk_02027EB4;
u32 i;
for (i = 0; i < 8; i++) {
x += xdiff;
y += ydiff;
- if (sub_080AE4CC(ent, x, y, 0))
+ if (sub_080AE4CC(layer, x, y, 0))
return FALSE;
}
@@ -339,10 +339,10 @@ bool32 sub_0802C0E8(Entity* this) {
s32 x = this->x.HALF.HI + this->hitbox->offset_x + ptr[0] * 6;
s32 y = this->y.HALF.HI + this->hitbox->offset_y + ptr[1] * 6;
- Entity* ent = this->collisionLayer == 2 ? &gUnk_0200D654 : &gUnk_02027EB4;
+ u8* layer = this->collisionLayer == 2 ? gUnk_0200D654 : gUnk_02027EB4;
u32 ret = FALSE;
if (!sub_0806FC24(TILE(x, y), 9)) {
- if (sub_080AE4CC(ent, x, y, 0)) {
+ if (sub_080AE4CC(layer, x, y, 0)) {
ret = 1;
} else {
ret = 0;
diff --git a/src/enemy/octorokGolden.c b/src/enemy/octorokGolden.c
index 60137119..5167cc4c 100644
--- a/src/enemy/octorokGolden.c
+++ b/src/enemy/octorokGolden.c
@@ -8,7 +8,6 @@ extern void (*const gUnk_080012C8[])(Entity*);
const s8 gUnk_080CF490[];
const u8 gUnk_080CF498[];
-extern u16* GetLayerByIndex(u32);
extern s32 sub_080012DC(Entity*);
extern u32 sub_0804A044(Entity*, Entity*, u32);
@@ -108,16 +107,16 @@ void sub_08037D54(Entity* this) {
void sub_08037E14(Entity* this) {
u32 dir;
- u16* pLayer;
+ u8* layer;
const s8* ptr;
s32 x, y;
this->actionDelay = 0x8;
dir = (GetFacingDirection(this, &gPlayerEntity) + 4) & 0x18;
- pLayer = GetLayerByIndex(this->collisionLayer) + 0x1002;
+ layer = (u8*)GetLayerByIndex(this->collisionLayer)->_2004;
ptr = gUnk_080CF498 + (dir >> 2);
x = this->x.HALF.HI + *ptr;
y = this->y.HALF.HI + *(ptr + 1);
- if (sub_080AE4CC((Entity*)pLayer, x, y, 0)) {
+ if (sub_080AE4CC(layer, x, y, 0)) {
this->direction = Random() & 0x18;
} else {
this->direction = dir;
diff --git a/src/enemy/sensorBladeTrap.c b/src/enemy/sensorBladeTrap.c
index 2c8c4ecf..d3e28c2f 100644
--- a/src/enemy/sensorBladeTrap.c
+++ b/src/enemy/sensorBladeTrap.c
@@ -11,8 +11,8 @@
extern u32 sub_0804A024(Entity*, u32, u32);
extern bool32 sub_080AF038(Entity*);
-extern Entity gUnk_02027EB4;
-extern Entity gUnk_0200D654;
+extern u8 gUnk_02027EB4[];
+extern u8 gUnk_0200D654[];
void sub_0802BB10(Entity*);
bool32 sub_0802BB2C(Entity*, u32);
@@ -99,9 +99,9 @@ void sub_0802BB10(Entity* this) {
}
bool32 sub_0802BB2C(Entity* this, u32 param_2) {
- Entity* ent = this->collisionLayer == 2 ? &gUnk_0200D654 : &gUnk_02027EB4;
+ u8* layer = this->collisionLayer == 2 ? gUnk_0200D654 : gUnk_02027EB4;
const s8* ptr = &gUnk_080CD3DC[param_2 >> 2];
- return sub_080AE4CC(ent, this->x.HALF.HI + ptr[0], this->y.HALF.HI + ptr[1], 0);
+ return sub_080AE4CC(layer, this->x.HALF.HI + ptr[0], this->y.HALF.HI + ptr[1], 0);
}
// clang-format off