summaryrefslogtreecommitdiff
path: root/src/object
diff options
context:
space:
mode:
authornotyourav <65437533+notyourav@users.noreply.github.com>2022-11-06 10:45:10 -0800
committerGitHub <noreply@github.com>2022-11-06 10:45:10 -0800
commit1ceeac3c8498a84db73f9441d8aae4d3f84d4885 (patch)
tree25af23b18664b7e815dbf0c8aa08a60acfc03361 /src/object
parent5209d6af3ae4697c36c1d2ab557b80dcb00b7653 (diff)
parent6531b8828535d6cb347a6d008feb7b1fcfdd4f9a (diff)
Merge pull request #583 from nonmatch/patch-61
Diffstat (limited to 'src/object')
-rw-r--r--src/object/frozenOctorok.c85
-rw-r--r--src/object/octorokBossObject.c8
2 files changed, 87 insertions, 6 deletions
diff --git a/src/object/frozenOctorok.c b/src/object/frozenOctorok.c
index fe537c4b..7805839c 100644
--- a/src/object/frozenOctorok.c
+++ b/src/object/frozenOctorok.c
@@ -40,6 +40,8 @@ void FrozenOctorok_ChangeObjPaletteOfChildren(FrozenOctorokEntity*, u32);
void sub_0809CBE4(FrozenOctorokEntity*);
void sub_0809CB70(FrozenOctorokEntity*, s32, s32);
+extern const u8 gUnk_08123E1C[];
+
void FrozenOctorok(FrozenOctorokEntity* this) {
static void (*const FrozenOctorok_Actions[])(FrozenOctorokEntity*) = {
FrozenOctorok_Init,
@@ -162,8 +164,87 @@ const u8 gUnk_08123E1C[] = {
128,
};
-ASM_FUNC("asm/non_matching/frozenOctorok/FrozenOctorok_Action1.inc",
- void FrozenOctorok_Action1(FrozenOctorokEntity* this))
+void FrozenOctorok_Action1(FrozenOctorokEntity* this) {
+ u32 tmp1;
+ u32 tmp2;
+
+ switch (super->type) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ SortEntityBelow(super->parent, super);
+ if (super->parent->subAction == 6) {
+ if ((s8)super->subtimer < 0) {
+ super->subtimer = -this->heap->unk_0;
+ } else {
+ super->subtimer = this->heap->unk_0;
+ }
+ sub_0809CBE4(this);
+ }
+ tmp1 = 0x10000 / (((FrozenOctorokEntity*)super->parent)->unk_76);
+ tmp1 = ((tmp1 << 0xd) >> 8);
+ tmp1 -= 0x2000;
+ if (this->heap->mouthObject->base.health == 1) {
+ tmp1 = 0x2200 + tmp1;
+ } else {
+ tmp1 = (tmp1 >> 1) + 0x2200;
+ }
+ tmp2 = (u8) - (((FrozenOctorokEntity*)super->parent)->unk_7b + gUnk_08123E18[super->type - 1]);
+ sub_0809CB70(this, tmp2, tmp1);
+ this->unk_7b =
+ ((FrozenOctorokEntity*)super->parent)->unk_7b + gUnk_08123E1C[super->type - 1] + this->unk_79;
+ SetAffineInfo(super, this->unk_76, this->unk_74, *(u16*)&this->unk_7a);
+ break;
+ case 5:
+ SortEntityBelow(super->parent, super);
+ if ((super->parent->subAction != 4) && (super->health != 1)) {
+ if (0x1c < this->unk_79) {
+ this->unk_79--;
+ }
+ if (this->unk_76 > 0x100) {
+ this->unk_76--;
+ } else {
+ this->unk_76 = 0x100;
+ }
+ }
+ tmp1 = (0x10000 / ((FrozenOctorokEntity*)super->parent)->unk_74);
+ tmp1 = ((this->unk_79 << 8) * tmp1 >> 8);
+ tmp2 = (u8) - (((FrozenOctorokEntity*)super->parent)->unk_7b + 0x80);
+ sub_0809CB70(this, tmp2, tmp1);
+ this->unk_7b = ((FrozenOctorokEntity*)super->parent)->unk_7b;
+ SetAffineInfo(super, this->unk_76, this->unk_74, *(u16*)&this->unk_7a);
+ return;
+ case 0:
+ if (CheckFlags(OUGONTEKI_G)) {
+ RequestPriorityDuration(super, 0x1e);
+ }
+ FrozenOctorok_Action1SubActions[super->subAction](this);
+ if (super->subtimer != 0) {
+ if ((gRoomTransition.frameCount & 7) == 0) {
+ CreateSparkle(super->child);
+ }
+ if (this->unk_7e != 0) {
+ super->child->zVelocity = super->child->zVelocity - (s16)this->unk_7e;
+ super->child->z.WORD += super->child->zVelocity;
+ if (((super->child)->zVelocity == 0x3000) || ((super->child)->zVelocity == -0x3000)) {
+ this->unk_7e = -this->unk_7e;
+ }
+ }
+ }
+ SetAffineInfo(super, this->unk_76, this->unk_74, *(u16*)&this->unk_7a);
+ break;
+ case 6:
+ CopyPosition(super->parent, super);
+ SetAffineInfo(super, this->unk_76, this->unk_74, *(u16*)&this->unk_7a);
+ break;
+ case 7:
+ if (gRoomControls.camera_target != super) {
+ DeleteThisEntity();
+ }
+ break;
+ }
+}
void FrozenOctorok_Action1SubAction0(FrozenOctorokEntity* this) {
Entity* child;
diff --git a/src/object/octorokBossObject.c b/src/object/octorokBossObject.c
index eb1a2f1e..22e3561e 100644
--- a/src/object/octorokBossObject.c
+++ b/src/object/octorokBossObject.c
@@ -146,8 +146,7 @@ void OctorokBossObject_Init(Entity* this) {
}
}
-NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc",
- void OctorokBossObject_Action1(Entity* this)) {
+void OctorokBossObject_Action1(Entity* this) {
s32 tmp_c;
u32 loop_var;
@@ -184,7 +183,7 @@ NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc",
if ((u32)this->timer == GET_HELPER(this)->tailCount - 1) {
this->action = 2;
this->timer = 240;
- this->direction = gUnk_0812384C[(this->type2 & 0xf) * 2] + ((u8)Random() & 0xf);
+ this->direction = gUnk_0812384C[(u8)((this->type2 & 0xf) * 2)] + ((u8)Random() & 0xf);
this->speed = gUnk_0812384C[(this->type2 & 0xf) * 2 + 1] + ((u16)Random() & 0x1ff);
if (this->type != 0) {
return;
@@ -233,6 +232,7 @@ NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc",
*(int*)&this->field_0x78 += -1;
return;
}
+ GET_HELPER(this)->tailObjects[this->timer]->x = GET_HELPER(this)->tailObjects[this->timer]->x;
DeleteThisEntity();
break;
case 5:
@@ -245,6 +245,7 @@ NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc",
this->field_0x76.HWORD -= 0x20;
this->field_0x74.HWORD -= 0x20;
}
+
SetAffineInfo(this, (u32)this->field_0x76.HWORD, (u32)(u16)this->field_0x74.HWORD,
(u32)(u16)this->field_0x7a.HWORD);
} else {
@@ -313,7 +314,6 @@ NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc",
break;
}
}
-END_NONMATCH
void OctorokBossObject_Action2(Entity* this) {
s32 tmp;