summaryrefslogtreecommitdiff
path: root/src/enemy
diff options
context:
space:
mode:
authorTal Hayon <talhayon1@gmail.com>2022-08-08 20:03:12 +0300
committerTal Hayon <talhayon1@gmail.com>2022-08-08 20:03:12 +0300
commit79bae9cd8a7891dd4545649fa196aad5a36237d2 (patch)
tree1e59403522cbeeaa36c33ca34662f17c49866639 /src/enemy
parent22cbdd2fd645a5525a6ef0c9b8ee8ec11af9e9aa (diff)
Various documentations
Diffstat (limited to 'src/enemy')
-rw-r--r--src/enemy/chuchuBoss.c2
-rw-r--r--src/enemy/enemy64.c83
-rw-r--r--src/enemy/likeLike.c4
-rw-r--r--src/enemy/octorokBoss.c2
-rw-r--r--src/enemy/vaatiArm.c2
-rw-r--r--src/enemy/vaatiWrath.c4
6 files changed, 57 insertions, 40 deletions
diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c
index d86f012c..ea2eab93 100644
--- a/src/enemy/chuchuBoss.c
+++ b/src/enemy/chuchuBoss.c
@@ -613,7 +613,7 @@ void sub_08026414(ChuchuBossEntity* this) {
Entity* child;
if (this->unk_7c-- == 0) {
- super->z.HALF.HI = 0xff40;
+ super->z.HALF.HI = -192;
child = super->child;
parent = super->parent;
this->unk_68->base.spriteSettings.draw = 1;
diff --git a/src/enemy/enemy64.c b/src/enemy/enemy64.c
index 1c675710..e1b3e51a 100644
--- a/src/enemy/enemy64.c
+++ b/src/enemy/enemy64.c
@@ -29,13 +29,6 @@ typedef struct {
extern void sub_08047EA4(Entity*, u32); // gyorgMale
-extern void (*const Enemy64_Actions[])(Enemy64Entity*);
-extern void (*const Enemy64_Action1_SubActions[])(Enemy64Entity*);
-extern void (*const Enemy64_Action2_SubActions[])(Enemy64Entity*);
-extern void (*const Enemy64_Action3_SubActions[])(Enemy64Entity*);
-extern const u8 gUnk_080D29B8[];
-extern void (*const Enemy64_Action4_SubActions[])(Enemy64Entity*);
-
void sub_080499F0(Enemy64Entity*);
void sub_08049998(Enemy64Entity*, u32);
void Enemy64_Action2_SubAction1(Enemy64Entity*);
@@ -43,8 +36,36 @@ void sub_08049944(Enemy64Entity*);
bool32 sub_08049A8C(Enemy64Entity*);
void sub_08049AB0(Enemy64Entity*);
void sub_08049B20(Enemy64Entity*);
+void Enemy64_Init(Enemy64Entity* this);
+void Enemy64_Action1(Enemy64Entity* this);
+void Enemy64_Action2(Enemy64Entity* this);
+void Enemy64_Action3(Enemy64Entity* this);
+void Enemy64_Action4(Enemy64Entity* this);
+void Enemy64_Action1_SubAction0(Enemy64Entity* this);
+void Enemy64_Action1_SubAction1(Enemy64Entity* this);
+void Enemy64_Action2_SubAction0(Enemy64Entity* this);
+void Enemy64_Action2_SubAction1(Enemy64Entity* this);
+void Enemy64_Action2_SubAction2(Enemy64Entity* this);
+void Enemy64_Action2_SubAction3(Enemy64Entity* this);
+void Enemy64_Action2_SubAction4(Enemy64Entity* this);
+void Enemy64_Action2_SubAction5(Enemy64Entity* this);
+void Enemy64_Action3_SubAction0(Enemy64Entity* this);
+void Enemy64_Action3_SubAction1(Enemy64Entity* this);
+void Enemy64_Action3_SubAction2(Enemy64Entity* this);
+void Enemy64_Action3_SubAction3(Enemy64Entity* this);
+void Enemy64_Action4_SubAction0(Enemy64Entity* this);
+void Enemy64_Action4_SubAction1(Enemy64Entity* this);
+void Enemy64_Action4_SubAction2(Enemy64Entity* this);
+void Enemy64_Action4_SubAction3(Enemy64Entity* this);
+void Enemy64_Action4_SubAction4(Enemy64Entity* this);
+void Enemy64_Action4_SubAction5(Enemy64Entity* this);
+void Enemy64_Action4_SubAction6(Enemy64Entity* this);
+void Enemy64_Action4_SubAction7(Enemy64Entity* this);
void Enemy64(Enemy64Entity* this) {
+ static void (*const Enemy64_Actions[])(Enemy64Entity*) = {
+ Enemy64_Init, Enemy64_Action1, Enemy64_Action2, Enemy64_Action3, Enemy64_Action4,
+ };
if (super->action != 0) {
super->spriteSettings.draw = this->unk_7d;
}
@@ -102,6 +123,10 @@ void Enemy64_Init(Enemy64Entity* this) {
}
void Enemy64_Action1(Enemy64Entity* this) {
+ static void (*const Enemy64_Action1_SubActions[])(Enemy64Entity*) = {
+ Enemy64_Action1_SubAction0,
+ Enemy64_Action1_SubAction1,
+ };
Enemy64_Action1_SubActions[super->subAction](this);
UpdateAnimationSingleFrame(super);
}
@@ -133,6 +158,10 @@ void Enemy64_Action1_SubAction1(Enemy64Entity* this) {
}
void Enemy64_Action2(Enemy64Entity* this) {
+ static void (*const Enemy64_Action2_SubActions[])(Enemy64Entity*) = {
+ Enemy64_Action2_SubAction0, Enemy64_Action2_SubAction1, Enemy64_Action2_SubAction2,
+ Enemy64_Action2_SubAction3, Enemy64_Action2_SubAction4, Enemy64_Action2_SubAction5,
+ };
Enemy64_Action2_SubActions[super->subAction](this);
UpdateAnimationSingleFrame(super);
}
@@ -253,6 +282,12 @@ void Enemy64_Action2_SubAction5(Enemy64Entity* this) {
}
void Enemy64_Action3(Enemy64Entity* this) {
+ static void (*const Enemy64_Action3_SubActions[])(Enemy64Entity*) = {
+ Enemy64_Action3_SubAction0,
+ Enemy64_Action3_SubAction1,
+ Enemy64_Action3_SubAction2,
+ Enemy64_Action3_SubAction3,
+ };
Enemy64_Action3_SubActions[super->subAction](this);
UpdateAnimationSingleFrame(super);
}
@@ -275,10 +310,13 @@ void Enemy64_Action3_SubAction0(Enemy64Entity* this) {
}
void Enemy64_Action3_SubAction1(Enemy64Entity* this) {
+ static const s8 gUnk_080D29B8[] = {
+ 144, 112, 56, 200, 0, 0, 0, 0,
+ };
if (EntityWithinDistance(super, gRoomControls.origin_x + 0xa8, gRoomControls.origin_y + 0x80, 0x28)) {
super->subAction = 2;
super->timer = 45;
- this->unk_74 = gUnk_080D29B8[Random() & 7] << 0x18 >> 0x18;
+ this->unk_74 = gUnk_080D29B8[Random() & 7];
this->unk_76 = super->direction << 8;
}
sub_08049998(this, ((0x100 - super->direction) & 0xff) << 8);
@@ -303,6 +341,10 @@ void Enemy64_Action3_SubAction3(Enemy64Entity* this) {
}
void Enemy64_Action4(Enemy64Entity* this) {
+ static void (*const Enemy64_Action4_SubActions[])(Enemy64Entity*) = {
+ Enemy64_Action4_SubAction0, Enemy64_Action4_SubAction1, Enemy64_Action4_SubAction2, Enemy64_Action4_SubAction3,
+ Enemy64_Action4_SubAction4, Enemy64_Action4_SubAction5, Enemy64_Action4_SubAction6, Enemy64_Action4_SubAction7,
+ };
Enemy64_Action4_SubActions[super->subAction](this);
UpdateAnimationSingleFrame(super);
}
@@ -497,28 +539,3 @@ void sub_08049B20(Enemy64Entity* this) {
gPlayerEntity.y.HALF.HI = (super->y.HALF.HI - tmpY) + gPlayerEntity.y.HALF.HI;
}
}
-
-void (*const Enemy64_Actions[])(Enemy64Entity*) = {
- Enemy64_Init, Enemy64_Action1, Enemy64_Action2, Enemy64_Action3, Enemy64_Action4,
-};
-void (*const Enemy64_Action1_SubActions[])(Enemy64Entity*) = {
- Enemy64_Action1_SubAction0,
- Enemy64_Action1_SubAction1,
-};
-void (*const Enemy64_Action2_SubActions[])(Enemy64Entity*) = {
- Enemy64_Action2_SubAction0, Enemy64_Action2_SubAction1, Enemy64_Action2_SubAction2,
- Enemy64_Action2_SubAction3, Enemy64_Action2_SubAction4, Enemy64_Action2_SubAction5,
-};
-void (*const Enemy64_Action3_SubActions[])(Enemy64Entity*) = {
- Enemy64_Action3_SubAction0,
- Enemy64_Action3_SubAction1,
- Enemy64_Action3_SubAction2,
- Enemy64_Action3_SubAction3,
-};
-const u8 gUnk_080D29B8[] = {
- 144, 112, 56, 200, 0, 0, 0, 0,
-};
-void (*const Enemy64_Action4_SubActions[])(Enemy64Entity*) = {
- Enemy64_Action4_SubAction0, Enemy64_Action4_SubAction1, Enemy64_Action4_SubAction2, Enemy64_Action4_SubAction3,
- Enemy64_Action4_SubAction4, Enemy64_Action4_SubAction5, Enemy64_Action4_SubAction6, Enemy64_Action4_SubAction7,
-};
diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c
index 8f7e01bf..9125158f 100644
--- a/src/enemy/likeLike.c
+++ b/src/enemy/likeLike.c
@@ -261,11 +261,11 @@ bool32 LikeLike_StealItem(u32 item) {
bool32 ret = FALSE;
if (GetInventoryValue(item) == 1) {
if (ItemIsShield(gSave.stats.itemButtons[SLOT_A])) {
- gSave.stats.itemButtons[SLOT_A] = 0;
+ gSave.stats.itemButtons[SLOT_A] = ITEM_NONE;
}
if (ItemIsShield(gSave.stats.itemButtons[SLOT_B])) {
- gSave.stats.itemButtons[SLOT_B] = 0;
+ gSave.stats.itemButtons[SLOT_B] = ITEM_NONE;
}
SetInventoryValue(item, 0);
diff --git a/src/enemy/octorokBoss.c b/src/enemy/octorokBoss.c
index cf313f3e..c9343196 100644
--- a/src/enemy/octorokBoss.c
+++ b/src/enemy/octorokBoss.c
@@ -272,7 +272,7 @@ void OctorokBoss_Hit_SubAction6(OctorokBossEntity* this) {
if ((this->unk_80 & 0x80) != 0) {
this->unk_80 -= (Random() & 3);
if ((this->unk_80 & 0x80) == 0) {
- this->unk_80 = ((this->unk_80 & 0x80) << 0x18) >> 0x18;
+ this->unk_80 = 0;
}
} else {
this->unk_80 += (Random() & 3);
diff --git a/src/enemy/vaatiArm.c b/src/enemy/vaatiArm.c
index 8e69fd33..40008e77 100644
--- a/src/enemy/vaatiArm.c
+++ b/src/enemy/vaatiArm.c
@@ -1362,7 +1362,7 @@ static void sub_08043DB0(Entity* this) {
gRoomTransition.field_0x3d = 0x1e - (cVar1 / 0x3c);
gRoomTransition.field_0x3c = this->type2;
pEVar2 = ((VaatiArm_HeapStruct*)this->myHeap)->parent;
- gRoomTransition.hurtType = pEVar2->x.HALF.HI;
+ gRoomTransition.field_0x40 = pEVar2->x.HALF.HI;
gRoomTransition.field_0x42 = pEVar2->y.HALF.HI;
pEVar4 = ((VaatiArm_HeapStruct*)pEVar2->myHeap)->parent;
if (pEVar4 != NULL) {
diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c
index 22df2068..b7c9fd3a 100644
--- a/src/enemy/vaatiWrath.c
+++ b/src/enemy/vaatiWrath.c
@@ -136,7 +136,7 @@ void VaatiWrathType0Action0(Entity* this) {
this->action = 2;
this->timer = 60;
}
- this->x.HALF.HI = gRoomTransition.hurtType;
+ this->x.HALF.HI = gRoomTransition.field_0x40;
this->y.HALF.HI = gRoomTransition.field_0x42;
sub_08042004(this);
} else {
@@ -147,7 +147,7 @@ void VaatiWrathType0Action0(Entity* this) {
this->subAction = bVar1;
this->timer = 120;
this->spritePriority.b1 = 0;
- this->z.HALF.HI = 0xffb0;
+ this->z.HALF.HI = -80;
gRoomControls.camera_target = this;
sub_080809D4();
}