Decompile OctorokBoss

This commit is contained in:
octorock
2021-12-13 21:53:29 +01:00
parent 83fc028502
commit 2580b33a20
74 changed files with 2906 additions and 5587 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ void ResolveEntityOnTop(Entity* param_1, Entity* param_2) {
param_2->spritePriority.b0 = gUnk_08114F78[param_1->spritePriority.b0];
}
void sub_0806FAD8(Entity* param_1, Entity* param_2) {
void ResolveEntityBelow(Entity* param_1, Entity* param_2) {
param_2->spritePriority.b0 = gUnk_08114F80[param_1->spritePriority.b0];
}
+7 -7
View File
@@ -57,7 +57,7 @@ void sub_080298A4(Entity* this) {
this->actionDelay = 0;
this->hitType = 0x6b;
this->field_0x76.HALF.HI = 0;
sub_0801D2B4(this, 0x7f);
ChangeObjPalette(this, 0x7f);
EnqueueSFX(0xfe);
this->child->action = 2;
break;
@@ -155,7 +155,7 @@ void sub_08029AE0(Entity* this) {
this->speed = 0xa0;
this->field_0x74.HALF.HI = 0;
sub_08029EEC(this);
sub_0801D2B4(this, 0x77);
ChangeObjPalette(this, 0x77);
EnqueueSFX(0x182);
}
}
@@ -217,7 +217,7 @@ void sub_08029C08(Entity* this) {
void sub_08029C2C(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 4;
sub_0801D2B4(this, 0x7f);
ChangeObjPalette(this, 0x7f);
EnqueueSFX(0x6c);
}
}
@@ -234,7 +234,7 @@ void sub_08029C6C(Entity* this) {
sub_08029BC4(this);
if (this->parent->action != 3) {
this->action = 1;
sub_0801D2B4(this, 0x77);
ChangeObjPalette(this, 0x77);
} else {
sub_0802A16C(this);
}
@@ -271,7 +271,7 @@ void sub_08029D14(Entity* this) {
if (this->actionDelay) {
if (--this->actionDelay == 0) {
InitializeAnimation(this, this->animationState + 0xc);
sub_0801D2B4(this, 0x7f);
ChangeObjPalette(this, 0x7f);
EnqueueSFX(0x6c);
}
} else {
@@ -313,7 +313,7 @@ void sub_08029DE4(Entity* this) {
sub_08029CF0(this);
if (this->parent->action != 3) {
this->action = 1;
sub_0801D2B4(this, 0x77);
ChangeObjPalette(this, 0x77);
} else {
sub_0802A16C(this);
}
@@ -486,7 +486,7 @@ bool32 sub_0802A14C(Entity* this) {
}
void sub_0802A16C(Entity* this) {
sub_0801D2B4(this, gUnk_080CCDD4[this->parent->field_0x7a.HWORD >> 2 & 3]);
ChangeObjPalette(this, gUnk_080CCDD4[this->parent->field_0x7a.HWORD >> 2 & 3]);
}
void sub_0802A18C(Entity* this) {
+1 -1
View File
@@ -1390,7 +1390,7 @@ void sub_0803BA8C(Entity* this, u32 unk) {
}
}
if (sVar2 != 0) {
sub_0801D2B4(this, sVar2);
ChangeObjPalette(this, sVar2);
(*(Entity**)&this->parent->field_0x78)->palette.b.b0 = this->palette.raw << 0x1c >> 0x1c;
(*(Entity**)&this->parent->field_0x78)->palette.b.b4 = this->palette.b.b0;
this->parent->child->palette.b.b0 = this->palette.raw << 0x1c >> 0x1c;
+2 -2
View File
@@ -483,13 +483,13 @@ bool32 sub_08023A38(u32 unk) {
}
void sub_08023A68(Entity* this) {
sub_0801D2B4(this, 5);
ChangeObjPalette(this, 5);
this->spritePriority.b0 = 7;
InitializeAnimation(this, 0x17);
}
void sub_08023A88(Entity* this, u32 unk) {
sub_0801D2B4(this, 0x22);
ChangeObjPalette(this, 0x22);
this->spritePriority.b0 = 4;
InitializeAnimation(this, unk);
}
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -68,7 +68,7 @@ void sub_08025020(Entity* this) {
this->cutsceneBeh.HWORD = 0x294;
this->hitType = 0x83;
this->field_0x82.HALF.LO = 0;
sub_0801D2B4(this, 0x7c);
ChangeObjPalette(this, 0x7c);
}
this->action = 7;
this->actionDelay = 0x3c;
@@ -133,7 +133,7 @@ void sub_080251AC(Entity* this) {
this->cutsceneBeh.HWORD = 0x294;
this->hitType = 0x83;
this->field_0x82.HALF.LO = 0;
sub_0801D2B4(this, 0x7c);
ChangeObjPalette(this, 0x7c);
}
GetNextFrame(this);
}
@@ -360,7 +360,7 @@ void sub_0802563C(Entity* this) {
GetNextFrame(this);
if (--this->cutsceneBeh.HWORD == 0) {
sub_0801D2B4(this, 0x28);
ChangeObjPalette(this, 0x28);
this->hitType = 0x82;
this->field_0x82.HALF.LO = 240;
sub_080256B4(this);
@@ -369,9 +369,9 @@ void sub_0802563C(Entity* this) {
u32 tmp3 = gUnk_080CBFF8[this->cutsceneBeh.HWORD >> 4];
if ((this->cutsceneBeh.HWORD & tmp3) == 0) {
if (this->cutsceneBeh.HWORD & (tmp3 + 1)) {
sub_0801D2B4(this, 124);
ChangeObjPalette(this, 124);
} else {
sub_0801D2B4(this, 40);
ChangeObjPalette(this, 40);
}
}
}
+2 -2
View File
@@ -6,7 +6,7 @@
static bool32 ShouldSpawnTreeItem(Entity*);
extern u32 sub_080028F4(const u8*);
extern u32 GetRandomByWeight(const u8*);
extern void sub_08049CF4(Entity*);
const u8 gTreeItemDropTables[][16] = {
@@ -33,7 +33,7 @@ void TreeItem(Entity* this) {
if (this->action == 0) {
this->action++;
this->field_0x68.HALF.LO = sub_080028F4(gTreeItemDropTables[this->type]);
this->field_0x68.HALF.LO = GetRandomByWeight(gTreeItemDropTables[this->type]);
if (this->field_0x68.HALF.LO > FAIRY_INDEX) {
DeleteThisEntity();
}
+13 -13
View File
@@ -228,12 +228,12 @@ void sub_08045A28(Entity* this) {
switch (frames) {
case 0x20:
this->field_0x82.HALF.HI = 1;
sub_0801D2B4(this, 0x13e);
ChangeObjPalette(this, 0x13e);
break;
case 0x00:
case 0x40:
this->field_0x82.HALF.HI = 2;
sub_0801D2B4(this, 0x13f);
ChangeObjPalette(this, 0x13f);
break;
default:
break;
@@ -243,11 +243,11 @@ void sub_08045A28(Entity* this) {
switch (frames) {
case 0x10:
this->field_0x82.HALF.HI = type;
sub_0801D2B4(this, 0x13b);
ChangeObjPalette(this, 0x13b);
break;
case 0:
this->field_0x82.HALF.HI = 2;
sub_0801D2B4(this, 0x13f);
ChangeObjPalette(this, 0x13f);
break;
default:
break;
@@ -257,15 +257,15 @@ void sub_08045A28(Entity* this) {
switch (frames) {
case 0x20:
this->field_0x82.HALF.HI = 1;
sub_0801D2B4(this, 0x13e);
ChangeObjPalette(this, 0x13e);
break;
case 0x10:
this->field_0x82.HALF.HI = 0;
sub_0801D2B4(this, 0x13b);
ChangeObjPalette(this, 0x13b);
break;
case 0x40:
this->field_0x82.HALF.HI = 2;
sub_0801D2B4(this, 0x13f);
ChangeObjPalette(this, 0x13f);
break;
default:
break;
@@ -275,7 +275,7 @@ void sub_08045A28(Entity* this) {
switch (frames) {
case 0:
this->field_0x82.HALF.HI = 2;
sub_0801D2B4(this, 0x13f);
ChangeObjPalette(this, 0x13f);
break;
default:
break;
@@ -291,11 +291,11 @@ void sub_08045A28(Entity* this) {
switch (this->frame & 0x70) {
case 0x10:
this->field_0x82.HALF.HI = 2;
sub_0801D2B4(this, 0x13b);
ChangeObjPalette(this, 0x13b);
break;
case 0x20:
this->field_0x82.HALF.HI = 1;
sub_0801D2B4(this, 0x13e);
ChangeObjPalette(this, 0x13e);
break;
default:
break;
@@ -306,11 +306,11 @@ void sub_08045A28(Entity* this) {
switch (temp) {
case 0:
this->field_0x82.HALF.HI = temp;
sub_0801D2B4(this, 0x13f);
ChangeObjPalette(this, 0x13f);
break;
case 0x10:
this->field_0x82.HALF.HI = 2;
sub_0801D2B4(this, 0x13b);
ChangeObjPalette(this, 0x13b);
break;
default:
break;
@@ -320,7 +320,7 @@ void sub_08045A28(Entity* this) {
switch (this->frame & 0x70) {
case 0:
this->field_0x82.HALF.HI = this->frame & 0x70;
sub_0801D2B4(this, 0x13f);
ChangeObjPalette(this, 0x13f);
break;
default:
break;
+7 -7
View File
@@ -457,7 +457,7 @@ void VaatiWrathType0ActionA(Entity* this) {
this->direction = 0;
this->speed = 0x100;
this->zVelocity = 0x12000;
sub_0801D2B4(this, 0x16b);
ChangeObjPalette(this, 0x16b);
InitAnimationForceUpdate(this, 5);
type1 = ((VaatiWrathHeapStruct*)this->myHeap)->type1;
type1->subAction = 1;
@@ -501,7 +501,7 @@ void VaatiWrathType0ActionB(Entity* this) {
if (this->actionDelay == 0) {
this->action = 0xc;
this->subAction = 0;
sub_0801D2B4(this, 0x140);
ChangeObjPalette(this, 0x140);
InitAnimationForceUpdate(this, 8);
InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type1, 0x10);
InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type2, 0x18);
@@ -579,7 +579,7 @@ void sub_08041BE8(Entity* this) {
entity->updatePriority = 3;
sub_080AE068(entity);
LoadFixedGFX(entity, 0x1f5);
sub_0801D2B4(entity, 0x16b);
ChangeObjPalette(entity, 0x16b);
InitializeAnimation(entity, 0x1a);
entity = ((VaatiWrathHeapStruct*)this->myHeap)->type3;
@@ -664,9 +664,9 @@ void sub_08041D84(Entity* this) {
} else {
if (this->field_0xf < 0xf0) {
if ((0xb7 < this->field_0xf) && ((this->field_0xf & 7) == 0)) {
sub_0801D2B4(((VaatiWrathHeapStruct*)this->myHeap)->type2,
gUnk_080D0E80[(this->field_0xf - 0xb8) >> 3]);
sub_0801D2B4(this->child, gUnk_080D0E80[(this->field_0xf - 0xb8) >> 3]);
ChangeObjPalette(((VaatiWrathHeapStruct*)this->myHeap)->type2,
gUnk_080D0E80[(this->field_0xf - 0xb8) >> 3]);
ChangeObjPalette(this->child, gUnk_080D0E80[(this->field_0xf - 0xb8) >> 3]);
}
if (this->field_0xf == 0xe6) {
DoFade(7, 4);
@@ -674,7 +674,7 @@ void sub_08041D84(Entity* this) {
} else {
this->subAction = 4;
this->spriteSettings.draw = 1;
sub_0801D2B4(this, 0x173);
ChangeObjPalette(this, 0x173);
InitAnimationForceUpdate(this, 0xb);
}
this->field_0xf++;
+4 -4
View File
@@ -80,7 +80,7 @@ void sub_0805BD5C(Manager23* this) {
} else {
if (GetTileType(this->field_0x20, this->manager.unk_0b) == 0x76) {
SetFlag(this->field_0x3e);
sub_0805308C(this->manager.unk_0e);
ChangeLightLevel(this->manager.unk_0e);
DeleteThisEntity();
}
}
@@ -106,7 +106,7 @@ void sub_0805BDB4(Manager23* this) {
return;
}
SetFlag(this->field_0x3e);
sub_0805308C(this->manager.unk_0e);
ChangeLightLevel(this->manager.unk_0e);
this->manager.action = 2;
this->field_0x22 = this->field_0x36 * 0x3c;
return;
@@ -117,7 +117,7 @@ void sub_0805BDB4(Manager23* this) {
CreateDustAt(*(s16*)&this->field_0x38, *(s16*)&this->field_0x3a, this->manager.unk_0b);
ClearFlag(this->field_0x3e);
sub_0807BA8C(this->field_0x20, this->manager.unk_0b);
sub_0805308C(-this->manager.unk_0e);
ChangeLightLevel(-this->manager.unk_0e);
this->manager.action = 1;
} else {
if (CheckFlags(this->field_0x3c) == 0) {
@@ -139,7 +139,7 @@ void sub_0805BE70(Manager23* this, u32 param_2) {
void sub_0805BE94(Manager23* this) {
SetTileType(0x76, ((this->field_0x38 << 0x10) >> 0x14 & 0x3fU) | ((this->field_0x3a << 0x10) >> 0x14 & 0x3fU) << 6,
this->manager.unk_0b);
sub_0805308C(this->manager.unk_0e);
ChangeLightLevel(this->manager.unk_0e);
DeleteThisEntity();
}
-2
View File
@@ -19,8 +19,6 @@ extern void (*const gUnk_08108DD8[])(Manager*);
void sub_0805E094(void);
extern Entity* CreateSpeechBubbleExclamationMark(Entity*, u32, u32);
void Manager37_Main(Manager* this) {
gUnk_08108DBC[this->unk_0a](this);
}
+7 -7
View File
@@ -253,18 +253,18 @@ void sub_080591CC(ManagerF* this) {
this->manager.action = 1;
this->manager.unk_0b = CheckFlags(this->unk_3e);
if (this->manager.unk_0b) {
gRoomVars.field_0xc = this->unk_3a;
gRoomVars.lightLevel = this->unk_3a;
} else {
gRoomVars.field_0xc = this->unk_38;
gRoomVars.lightLevel = this->unk_38;
}
} else {
u32 tmp = CheckFlags(this->unk_3e);
if (this->manager.unk_0b != tmp) {
this->manager.unk_0b = tmp;
if (tmp) {
gRoomVars.field_0xc = this->unk_3a;
gRoomVars.lightLevel = this->unk_3a;
} else {
gRoomVars.field_0xc = this->unk_38;
gRoomVars.lightLevel = this->unk_38;
}
}
}
@@ -272,16 +272,16 @@ void sub_080591CC(ManagerF* this) {
void sub_08059220(ManagerF* this) {
const ManagerF_HelperStruct* data;
gRoomVars.field_0xc = 0;
gRoomVars.lightLevel = 0;
for (data = gUnk_08108354; data->x != 0xFFFF; data++) {
if (CheckPlayerInRegion(data->x, data->y, data->width, data->height)) {
gRoomVars.field_0xc = data->unk_08;
gRoomVars.lightLevel = data->unk_08;
}
}
if (!this->manager.action) {
this->manager.action = 1;
gArea.unk_0a = gRoomVars.field_0xc;
gArea.unk_0a = gRoomVars.lightLevel;
}
}
+1 -1
View File
@@ -101,7 +101,7 @@ void sub_08068AA4(Entity* this) {
if (this->type2 == 0) {
this->type2 += 1;
}
sub_0801D2B4(this, gUnk_081115DC[this->type2]);
ChangeObjPalette(this, gUnk_081115DC[this->type2]);
}
}
+1 -1
View File
@@ -126,7 +126,7 @@ void CastorWildsStatue_Fusion(Entity* this) {
this->spriteSettings.draw = 1;
this->y.HALF.HI -= 0x18;
InitializeAnimation(this, 1);
sub_0801D2B4(this, 0x17b);
ChangeObjPalette(this, 0x17b);
} else {
GetNextFrame(this);
}
+1 -1
View File
@@ -28,7 +28,7 @@ void DrLeft(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->frameIndex = 0;
sub_0806FAD8(this, this);
ResolveEntityBelow(this, this);
}
}
}
+9 -9
View File
@@ -3,7 +3,7 @@
#include "functions.h"
#include "npc.h"
void sub_0801D2B4(Entity*, u32);
void ChangeObjPalette(Entity*, u32);
extern void (*gUnk_08113D8C[])(Entity*);
@@ -24,7 +24,7 @@ void sub_0806CAF4(Entity* this) {
if (npc != NULL) {
npc->parent = this;
CopyPosition(this, npc);
sub_0806FAD8(this, npc);
ResolveEntityBelow(this, npc);
}
npc = CreateNPC(0x4a, 2, 0);
if (npc != NULL) {
@@ -118,31 +118,31 @@ void sub_0806CCD0(Entity* this, ScriptExecutionContext* context) {
}
void sub_0806CCF8(Entity* this) {
sub_0801D2B4(this, 0x10a);
ChangeObjPalette(this, 0x10a);
}
void sub_0806CD04(Entity* this) {
sub_0801D2B4(this, 0x10b);
ChangeObjPalette(this, 0x10b);
}
void sub_0806CD14(Entity* this) {
sub_0801D2B4(this, 0x10c);
ChangeObjPalette(this, 0x10c);
}
void sub_0806CD20(Entity* this) {
sub_0801D2B4(this, 0x10d);
ChangeObjPalette(this, 0x10d);
}
void sub_0806CD30(Entity* this) {
sub_0801D2B4(this, 0x10e);
ChangeObjPalette(this, 0x10e);
}
void sub_0806CD3C(Entity* this) {
sub_0801D2B4(this, 0x10f);
ChangeObjPalette(this, 0x10f);
}
void sub_0806CD4C(Entity* this) {
sub_0801D2B4(this, 0x110);
ChangeObjPalette(this, 0x110);
}
void sub_0806CD58(Entity* this) {
-2
View File
@@ -10,8 +10,6 @@ void sub_08063A80(Entity* this);
extern void (*gUnk_0810CDF8[])(Entity*);
extern void CreateSpeechBubbleExclamationMark(Entity*, u32, u32);
extern Dialog gUnk_0810CE04[];
void Pina(Entity* this) {
+2 -2
View File
@@ -10,7 +10,7 @@ extern Hitbox gUnk_0810C428;
extern u8 gUnk_0810C430[4];
extern u8 gUnk_0810C435[];
extern u8 gUnk_0810C43D[];
extern u32 sub_080028F4(const u8*);
extern u32 GetRandomByWeight(const u8*);
void Pita(Entity* this) {
if (this->action == 0) {
@@ -58,7 +58,7 @@ bool32 sub_08062EDC(Entity* this, ScriptExecutionContext* context) {
context->condition = FALSE;
return FALSE;
} else {
tmp = sub_080028F4(gUnk_0810C435);
tmp = GetRandomByWeight(gUnk_0810C435);
tmp2 = gUnk_0810C43D[tmp];
sub_080A7C18(0x5c, tmp2, 1);
MessageNoOverlap(0x3c05, this);
+1 -1
View File
@@ -285,7 +285,7 @@ void sub_0806A9E8(Entity* this) {
Entity* npc = CreateNPC(0x37, 4, 0);
if (npc != NULL) {
CopyPosition(this, npc);
sub_0806FAD8(this, npc);
ResolveEntityBelow(this, npc);
}
}
-3
View File
@@ -4,9 +4,6 @@
#include "textbox.h"
#include "functions.h"
extern void CreateSpeechBubbleQuestionMark(Entity*, u32, u32);
extern void CreateSpeechBubbleExclamationMark(Entity*, u32, u32);
extern void (*const gUnk_0810FDC8[])(Entity*);
extern void (*const gUnk_0810FDA4[])(Entity*);
+1 -1
View File
@@ -136,7 +136,7 @@ void VaatiRebornAction1(Entity* this) {
case 1:
if (this->frame & 0x80) {
this->subAction = 2;
sub_0801D2B4(this, 0x13f);
ChangeObjPalette(this, 0x13f);
InitAnimationForceUpdate(this, this->subAction - 1);
}
break;
+1 -1
View File
@@ -139,7 +139,7 @@ void (*const gObjectFunctions[])(Entity*) = {
[SMALL_ICE_BLOCK] = SmallIceBlock,
[BIG_ICE_BLOCK] = BigIceBlock,
[OBJECT_86] = Object86,
[OBJECT_87] = Object87,
[OCTOROK_BOSS_OBJECT] = OctorokBossObject,
[HUGE_BOOK] = MacroBook,
[OBJECT_89] = Object89,
[OBJECT_8A] = Object8A,
+1 -1
View File
@@ -102,7 +102,7 @@ void sub_0809D0AC(Entity* this) {
SoundReq(SFX_SECRET);
fx = CreateFx(this, FX_DASH, 0);
if (fx != NULL) {
sub_0806FAD8(this, fx);
ResolveEntityBelow(this, fx);
}
}
}
+2 -2
View File
@@ -262,7 +262,7 @@ void sub_0808EB74(Entity* this) {
this->x.WORD = entity->x.WORD;
this->y.WORD = entity->y.WORD;
this->spriteRendering.b3 = entity->spriteRendering.b3;
sub_0806FAD8(entity, this);
ResolveEntityBelow(entity, this);
} else {
this->x.HALF.HI = 0xF000;
this->y.HALF.HI = 0xF000;
@@ -312,7 +312,7 @@ void sub_0808EBB8(Entity* this) {
default:
entity = sub_0808EC80(var0);
if (entity) {
sub_0806FAD8(entity, this);
ResolveEntityBelow(entity, this);
this->spriteRendering.b3 = entity->spriteRendering.b3;
x = entity->x.HALF.HI;
y = entity->y.HALF.HI;
+2 -2
View File
@@ -304,10 +304,10 @@ u32 sub_080837B0(Entity* this) {
tmp = gUnk_0811F690[tmp2 - 0x40];
}
if (tmp2 == 0x68) {
sub_0801D2B4(this, 0);
ChangeObjPalette(this, 0);
} else {
if (tmp2 == 0x88) {
sub_0801D2B4(this, 1);
ChangeObjPalette(this, 1);
}
}
LoadFixedGFX(this, tmp);
+2 -2
View File
@@ -184,7 +184,7 @@ void sub_0808F3DC(Entity* this) {
// TODO: This block of code might supposed to be a switch statement.
if (this->type != 8) {
if (this->type == 7) {
sub_0806FAD8(this->child, this);
ResolveEntityBelow(this->child, this);
return;
}
} else {
@@ -239,7 +239,7 @@ void sub_0808F498(Entity* this) {
this->x.HALF.HI += (s32)Random() % (this->parent->hitbox->width * 2);
this->y.HALF.HI -= this->parent->hitbox->height;
this->y.HALF.HI += (s32)Random() % (this->parent->hitbox->height * 2);
sub_0801D2B4(this, var0);
ChangeObjPalette(this, var0);
InitializeAnimation(this, 4);
}
}
+1 -1
View File
@@ -39,7 +39,7 @@ void sub_0809F318(Entity* this) {
this->z.HALF.HI = 0xFFB0;
this->spriteOrientation.flipY = 2;
this->action = 1;
sub_0801D2B4(this, gUnk_08124704[this->type]);
ChangeObjPalette(this, gUnk_08124704[this->type]);
SetDefaultPriority(this, 7);
}
+405
View File
@@ -0,0 +1,405 @@
#include "global.h"
#include "entity.h"
#include "coord.h"
#include "audio.h"
#include "functions.h"
#include "random.h"
#include "object.h"
extern void sub_0807B9B8(s32, s32, s32);
extern void (*const OctorokBossObject_Actions[])(Entity*);
extern const u16 gUnk_0812384C[];
extern const u16 gUnk_0812388C[];
extern const u16 gUnk_081238A0[];
bool32 sub_0809A6F8(u32, u32, u32, u32);
bool32 sub_0809A758(u32, u32);
typedef struct HelperStruct {
u8 field_0x0; // [0,1,2,4] is later stored in this->field_0xf
u8 tailCount;
u8 field_0x2; // [0,1]
u8 field_0x3; // relates to this->field_0x7a.HALF.HI
u8 field_0x4; // [0,1,0xff]
u8 field_0x5; // [0-4], sets this->field_0x80.HALF.HI
u8 fallingStonesTimer;
u8 field_0x7; // some sort of counter that is only set when hit for the first time?
Entity* mouthObject;
Entity* tailObjects[5];
Entity* legObjects[4];
} HelperStruct;
enum OctorokBossObjectType {
TYPE0, // OctorokBoss_Action1 / TAIL_END
TYPE_FIRE, // this->OctorokBossObject_Action1
TYPE_SUCKING, // OctorokBoss_ExecuteAttackVacuum
TYPE_SMOKE, // OctorokBoss_ExecuteAttackSmoke
TYPE4, // OctorokBoss_Action1_Attack_Type2_2
TYPE_ICE_CRYSTALS, // OctorokBoss_Hit_SubAction1
TYPE6, // OctorokBoss_Hit_SubAction1 // Scar thingy appearing on first defrost?
TYPE7,
TYPE8, // OctorokBoss_Hit_SubAction1
TYPE9 // OctorokBoss_Hit_SubAction4
};
#define GET_HELPER(this) (*(HelperStruct**)&this->cutsceneBeh)
extern u32 sub_0806FC80(Entity*, Entity*, s32);
void OctorokBossObject(Entity* this) {
OctorokBossObject_Actions[this->action](this);
}
void OctorokBossObject_Init(Entity* this) {
this->action = 1;
this->speed = 0x200;
switch (this->type) {
case 0:
this->field_0x78.HALF.HI = 0x96;
this->actionDelay = 0;
this->field_0xf = 0x1e;
case 1:
InitializeAnimation(this, 0);
EnqueueSFX(SFX_124);
break;
case 2:
this->direction = -(this->parent->field_0x7a.HALF.HI + -0x80);
if ((Random() & 1) != 0) {
switch (Random() & 3) {
case 0:
this->direction = this->direction - 0x10;
break;
case 1:
this->direction = this->direction + 0x10;
break;
case 2:
this->direction = this->direction - 8;
break;
case 3:
this->direction = this->direction + 8;
break;
}
}
this->speed = 0xf0 - (Random() & 0x3f);
sub_0806F62C(this, ((s16)this->speed >> 1) << 8, (u32)this->direction);
sub_0806F62C(this, ((s16)this->speed >> 1) << 8, (u32)this->direction);
InitializeAnimation(this, 5);
SoundReq(SFX_14C);
break;
case 3:
this->direction = -(this->parent->field_0x7a.HALF.HI + -0x80);
sub_0806F62C(this, 0x4800, (u32)this->direction);
if ((Random() & 1) != 0) {
this->direction = (Random() & 0x3f) + this->direction;
} else {
this->direction = this->direction - (Random() & 0x3f);
}
InitializeAnimation(this, 6);
break;
case 6:
sub_0806F62C(this, (0x30 - (Random() & 0x2f)) * 0x100, Random() & 0xff);
if ((Random() & 1) != 0) {
this->direction = (Random() & 0x3f) + this->direction;
} else {
this->direction = this->direction - (Random() & 0x3f);
}
InitializeAnimation(this, 5);
break;
case 4:
*(u32*)&this->field_0x78 = 0x30c;
break;
case 5:
this->spritePriority.b0 = 0;
*(u32*)&this->field_0x78 = 0x18;
this->field_0x76.HWORD = 0x400;
this->field_0x74.HWORD = 0x400;
this->field_0x7a.HWORD = 0;
sub_0806F62C(this,
((-(u32)this->parent->field_0x7a.HALF.HI << 0x18) >> 0x18) +
(u32)gUnk_0812388C[(u32)this->type2 * 2 + 1],
(u32)gUnk_0812388C[(u32)this->type2 * 2]);
sub_0805EC9C(this, this->field_0x76.HWORD, this->field_0x74.HWORD, this->field_0x7a.HWORD);
InitializeAnimation(this, 7);
break;
case 7:
this->actionDelay = 0;
InitializeAnimation(this, 8);
CopyPosition(this->parent, this);
break;
case 8:
this->type2 = this->parent->field_0x7c.BYTES.byte0;
this->actionDelay = 4;
this->field_0xf = 0;
this->field_0x82.HWORD = (this->x.HALF.HI - (gRoomControls.roomOriginX)) & 0x1f0;
this->field_0x80.HWORD = (this->y.HALF.HI - ((u32)gRoomControls.roomOriginY)) & 0x1f0;
*(int*)&this->cutsceneBeh =
((s32)(this->field_0x82.HWORD - 0x10) >> 4) + (this->field_0x80.HWORD >> 4) * 0x1f;
sub_0809A6F8(this->field_0x82.HWORD, this->field_0x80.HWORD, *(int*)&this->cutsceneBeh, this->type2);
if ((this->parent->field_0x7c.BYTES.byte0 & 1) != 0) {
SoundReq(SFX_1A3);
} else {
SoundReq(SFX_WIND2);
}
break;
case 9:
*(u32*)&this->field_0x78 = 0x1e0;
break;
}
}
NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc",
void OctorokBossObject_Action1(Entity* this)) {
s32 tmp_c;
u32 loop_var;
s32 t1, t2;
GetNextFrame(this);
switch (this->type) {
case 0:
if (this->field_0x78.HALF.HI != 0) {
this->field_0x78.HALF.HI--;
if (this->field_0xf-- == 0) {
this->field_0xf = 5;
this->child = CreateObjectWithParent(this, OCTOROK_BOSS_OBJECT, 1, this->type2);
if (this->child != NULL) {
this->child->parent = this->parent;
GET_HELPER(this->child) = GET_HELPER(this);
}
this->type2 += 1;
}
CopyPosition(GET_HELPER(this)->tailObjects[0], this);
return;
}
case 1:
this->direction = sub_080045DA(GET_HELPER(this)->tailObjects[this->actionDelay]->x.WORD - this->x.WORD,
GET_HELPER(this)->tailObjects[this->actionDelay]->y.WORD - this->y.WORD);
sub_0806F62C(this, this->speed, this->direction);
if (sub_080041A0(this, GET_HELPER(this)->tailObjects[this->actionDelay], 2, 2) == 0) {
return;
}
if (this->type == 0) {
GET_HELPER(this)->tailObjects[this->actionDelay]->spriteSettings.draw &= -2;
}
if ((u32)this->actionDelay == GET_HELPER(this)->tailCount - 1) {
this->action = 2;
this->actionDelay = 0xf0;
this->direction = gUnk_0812384C[(this->type2 & 0xf) * 2] + ((u8)Random() & 0xf);
this->speed = gUnk_0812384C[(this->type2 & 0xf) * 2 + 1] + ((u16)Random() & 0x1ff);
if (this->type != 0) {
return;
}
this->parent->action = 4;
this->parent->subAction = 0;
return;
}
this->actionDelay += 1;
return;
case 2:
if (this->parent->type2 == 3) {
Entity* object = GET_HELPER(this->parent)->mouthObject;
this->direction = sub_080045DA(object->x.WORD - this->x.WORD, object->y.WORD - this->y.WORD);
sub_0806F62C(this, 0x280, this->direction);
if (sub_0806FC80(this, this->parent, 0x48) == 0) {
return;
}
}
DeleteThisEntity();
break;
case 3:
case 6:
sub_0806F62C(this, 0x80, this->direction);
if (this->frame != 0) {
DeleteThisEntity();
}
break;
case 4:
if (*(u32*)&this->field_0x78 == 0) {
if ((s16)gRoomVars.lightLevel != 0x100) {
ChangeLightLevel(8);
return;
} else {
}
} else {
if (this->parent->health == 0) {
this->subAction = 1;
*(u32*)&this->field_0x78 = 0;
return;
}
if ((this->subAction == 0) && (this->parent->type2 != 0)) {
return;
}
this->subAction = 1;
*(int*)&this->field_0x78 += -1;
return;
}
DeleteThisEntity();
break;
case 5:
if (*(int*)&this->field_0x78 == 0) {
if (this->field_0x76.HWORD == 0x100) {
if ((*(u8*)&this->parent->field_0x7c & 1) != 0) {
DeleteThisEntity();
}
} else {
this->field_0x76.HWORD -= 0x20;
this->field_0x74.HWORD -= 0x20;
}
sub_0805EC9C(this, (u32)this->field_0x76.HWORD, (u32)(u16)this->field_0x74.HWORD,
(u32)(u16)this->field_0x7a.HWORD);
} else {
*(int*)&this->field_0x78 -= 1;
}
CopyPosition(this->parent, this);
sub_0806F62C(this, (u32)gUnk_0812388C[(u32)this->type2 * 2 + 1],
((u8) - this->parent->field_0x7a.HALF.HI & 0xff) + (u32)gUnk_0812388C[(u32)this->type2 * 2]);
return;
case 7:
if (this->actionDelay == 0) {
CopyPosition(this->parent, this);
return;
}
DeleteThisEntity();
break;
case 8:
if (this->actionDelay-- != 0) {
return;
}
this->actionDelay = 4;
this->field_0xf++;
t2 = t1 = (*(int*)&this->cutsceneBeh) - this->field_0xf * 0x1f;
this->field_0x7c.HALF_U.HI = this->field_0x82.HWORD;
this->field_0x7a.HWORD = this->field_0x82.HWORD;
this->field_0x7c.HALF_U.LO = this->field_0x80.HWORD - this->field_0xf * 0x10;
this->field_0x78.HWORD = this->field_0x7c.HALF.LO;
tmp_c = sub_0809A6F8(this->field_0x7a.HWORD, this->field_0x78.HWORD, t1, this->type2);
for (loop_var = this->field_0xf; loop_var != 0; loop_var--) {
this->field_0x7a.HWORD -= 0x10;
this->field_0x78.HWORD += 0x10;
t1 += 0x1e;
tmp_c += sub_0809A6F8(this->field_0x7a.HWORD, this->field_0x78.HWORD, t1, this->type2);
this->field_0x7c.HALF.HI += 0x10;
this->field_0x7c.HALF.LO += 0x10;
t2 += 0x20;
tmp_c += sub_0809A6F8(this->field_0x7c.HALF_U.HI, this->field_0x7c.HALF_U.LO, t2, this->type2);
}
t2 = t1 = (*(int*)&this->cutsceneBeh) + this->field_0xf * 0x1f;
this->field_0x7c.HALF.HI = this->field_0x82.HWORD;
this->field_0x7a.HWORD = this->field_0x82.HWORD;
this->field_0x7c.HALF.LO = this->field_0xf * 0x10 + this->field_0x80.HWORD;
this->field_0x78.HWORD = this->field_0x7c.HALF.LO;
tmp_c += sub_0809A6F8(this->field_0x7a.HWORD, this->field_0x78.HWORD, t1, this->type2);
for (loop_var = this->field_0xf - 1; loop_var != 0; loop_var--) {
this->field_0x7a.HWORD -= 0x10;
this->field_0x78.HWORD -= 0x10;
t1 -= 0x20;
tmp_c += sub_0809A6F8(this->field_0x7a.HWORD, this->field_0x78.HWORD, t1, this->type2);
this->field_0x7c.HALF_U.HI += 0x10;
this->field_0x7c.HALF_U.LO -= 0x10;
t2 -= 0x1e;
tmp_c += sub_0809A6F8(this->field_0x7c.HALF_U.HI, this->field_0x7c.HALF_U.LO, t2, this->type2);
}
if (tmp_c == 0) {
DeleteThisEntity();
}
break;
case 9:
sub_08078B48();
if ((*(int*)&this->field_0x78)-- == 0) {
gRoomControls.cameraTarget = &gPlayerEntity;
DeleteThisEntity();
}
break;
}
}
END_NONMATCH
void OctorokBossObject_Action2(Entity* this) {
s32 tmp;
s32 radius;
GetNextFrame(this);
if (this->actionDelay-- != 0) {
tmp = (0x10000 / this->parent->field_0x74.HWORD);
radius = (this->speed * tmp) >> 8;
this->field_0x7a.HALF.HI = -this->parent->field_0x7a.HALF.HI + this->direction;
tmp = FixedMul(gSineTable[this->field_0x7a.HALF.HI], radius);
tmp = FixedDiv(tmp, 0x100);
this->x.WORD = this->parent->x.WORD + ((tmp << 0x10) >> 8);
tmp = FixedMul(gSineTable[this->field_0x7a.HALF.HI + 0x40], radius);
tmp = FixedDiv(tmp, 0x100);
this->y.WORD = this->parent->y.WORD - ((tmp << 0x10) >> 8);
} else {
DeleteThisEntity();
}
}
bool32 sub_0809A6F8(u32 param_1, u32 param_2, u32 param_3, u32 param_4) {
if (sub_0809A758(param_1, param_2) != 0) {
if (gUnk_081238A0[param_3] != 0) {
if ((param_4 & 1) != 0) {
sub_0807B9B8(gUnk_081238A0[param_3], (param_1 >> 4 & 0x3f) | (param_2 >> 4 & 0x3f) << 6, 1);
} else {
sub_0807BA8C((param_1 >> 4 & 0x3f) | (param_2 >> 4 & 0x3f) << 6, 1);
}
}
return TRUE;
} else {
return FALSE;
}
}
bool32 sub_0809A758(u32 param_1, u32 param_2) {
if (param_1 >= 0x10) {
if (param_1 <= 0x1f0 && param_2 <= 0xf0) {
return TRUE;
}
}
return FALSE;
}
void (*const OctorokBossObject_Actions[])(Entity*) = {
OctorokBossObject_Init,
OctorokBossObject_Action1,
OctorokBossObject_Action2,
};
const u16 gUnk_0812384C[] = {
0, 4096, 16, 6144, 240, 7168, 32, 6144, 224, 5120, 48, 4096, 192, 4096, 208, 7168,
64, 4096, 192, 6144, 80, 7168, 176, 6144, 96, 5120, 160, 4096, 112, 4096, 144, 7168,
};
const u16 gUnk_0812388C[] = {
0, 0, 32, 8192, 96, 8192, 160, 8704, 208, 8192,
};
const u16 gUnk_081238A0[] = {
0, 292, 293, 292, 293, 292, 293, 292, 293, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 292, 293, 292, 293, 292, 293, 293, 293, 0, 347, 1220, 1201, 1202, 1201, 1202, 1201,
1202, 1236, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1220, 1202, 1201, 1201,
1202, 1201, 1202, 1236, 348, 363, 1205, 1252, 1253, 1229, 1229, 1229, 1229, 1264, 1202, 1201, 1202, 1201, 1202,
1201, 1202, 1201, 1202, 1201, 1202, 1201, 1202, 1265, 1229, 1229, 1252, 1253, 1229, 1229, 1206, 364, 347, 1221,
1268, 1269, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1268, 1269, 1229, 1229,
1229, 1229, 1229, 1229, 1268, 1269, 1229, 1229, 1222, 348, 363, 1205, 1229, 1229, 1229, 1229, 1229, 1229, 1229,
1229, 1229, 1229, 1252, 1253, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1252, 1253, 1229, 1229, 1229, 1229,
1229, 1206, 364, 347, 1221, 1229, 1229, 1229, 1229, 1229, 1252, 1253, 1229, 1229, 1229, 1268, 1269, 1229, 1252,
1253, 1229, 1229, 1229, 1229, 1229, 1268, 1269, 1229, 1229, 1229, 1229, 1229, 1222, 348, 363, 1205, 1229, 1229,
1229, 1229, 1229, 1268, 1269, 1229, 1229, 1229, 1229, 1229, 1229, 1268, 1269, 1229, 1229, 1229, 1229, 1229, 1229,
1229, 1229, 1229, 1229, 1229, 1229, 1206, 364, 347, 1221, 1229, 1252, 1253, 1229, 1229, 1229, 1229, 1229, 1229,
1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1252, 1253, 1229, 1222,
348, 363, 1205, 1229, 1268, 1269, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229,
1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1268, 1269, 1229, 1206, 364, 347, 1221, 1229, 1229, 1229, 1229,
1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1252, 1253, 1229, 1229, 1229, 1229, 1229, 1229,
1229, 1229, 1229, 1229, 1222, 348, 363, 1205, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229,
1229, 1229, 1229, 1229, 1268, 1269, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1206, 364, 347,
1221, 1252, 1253, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1252, 1253, 1229, 1229, 1229, 1229, 1229, 1229,
1229, 1229, 1252, 1253, 1229, 1252, 1253, 1229, 1229, 1222, 348, 363, 1205, 1268, 1269, 1229, 1229, 1229, 1252,
1253, 1229, 1229, 1229, 1268, 1269, 1229, 1252, 1253, 1229, 1229, 1229, 1229, 1229, 1268, 1269, 1229, 1268, 1269,
1229, 1229, 1206, 364, 347, 1221, 1229, 1229, 1229, 1229, 1229, 1268, 1269, 1229, 1229, 1229, 1229, 1229, 1229,
1268, 1269, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1229, 1222, 348, 363, 1237, 1203,
1204, 1203, 1204, 1203, 1204, 1203, 1204, 1203, 1204, 1203, 1204, 1203, 1204, 1203, 1204, 1203, 1204, 1203, 1204,
1203, 1204, 1203, 1203, 1204, 1203, 1204, 1238, 364, 0, 308, 309, 308, 309, 308, 309, 308, 309, 308,
309, 308, 309, 308, 309, 308, 309, 308, 309, 308, 309, 308, 309, 308, 309, 308, 309, 308, 309,
308, 0,
};
+8 -8
View File
@@ -789,7 +789,7 @@ void sub_08052EA0(void) {
gRoomVars.unk_10[1] = gRoomVars.unk_10[0];
gRoomVars.unk_10[2] = gRoomVars.unk_10[0];
gRoomVars.unk_10[3] = gRoomVars.unk_10[0];
gRoomVars.field_0xc = 256;
gRoomVars.lightLevel = 256;
gArea.locationIndex = gAreaMetadata[gRoomControls.areaID].location;
sub_08049D30();
InitScriptData();
@@ -875,13 +875,13 @@ void sub_08052FF4(u32 area, u32 room) {
gArea.currentRoomInfo.bg_anim = gUnk_080B755C[area];
}
void sub_0805308C(s32 a1) {
a1 += gRoomVars.field_0xc;
if (a1 < 0)
a1 = 0;
if (a1 > 256)
a1 = 256;
gRoomVars.field_0xc = a1;
void ChangeLightLevel(s32 lightLevel) {
lightLevel += gRoomVars.lightLevel;
if (lightLevel < 0)
lightLevel = 0;
if (lightLevel > 256)
lightLevel = 256;
gRoomVars.lightLevel = lightLevel;
}
void sub_080530B0(void) {
+1 -1
View File
@@ -99,6 +99,6 @@ void sub_08019644(Entity* this) {
if (gUnk_080B4400[this->field_0x70.WORD] == 0xff) {
this->field_0x70.WORD = iVar1;
}
sub_0801D2B4(this, (u32)gUnk_080B4400[this->field_0x70.WORD]);
ChangeObjPalette(this, (u32)gUnk_080B4400[this->field_0x70.WORD]);
}
}
+1 -1
View File
@@ -83,7 +83,7 @@ void MandiblesProjectile_Init(Entity* this) {
this->animationState = 0xff;
this->field_0x82.HALF.LO = 0;
this->spritePriority.b0 = 4;
sub_0806FAD8(this, this->parent);
ResolveEntityBelow(this, this->parent);
sub_080AA270(this);
}
+9 -1
View File
@@ -4,6 +4,7 @@
#include "functions.h"
#include "audio.h"
#include "effects.h"
#include "projectile.h"
void OctorokBossProjectile_Action2(Entity*);
extern void sub_080AE58C(Entity*, u32, u32);
@@ -13,6 +14,13 @@ extern void (*const OctorokBossProjectile_Functions[])(Entity*);
extern void (*const OctorokBossProjectile_Actions[])(Entity*);
extern const u8 gUnk_08129ADC[];
enum OctorokBossProjectileType {
TYPE0, // rock
TYPE1, // rock fragment
TYPE2,
TYPE3 // falling stones
};
void OctorokBossProjectile(Entity* this) {
OctorokBossProjectile_Functions[GetNextFunction(this)](this);
}
@@ -132,7 +140,7 @@ void OctorokBossProjectile_Action1(Entity* this) {
return;
}
for (index = 0; index < 3; ++index) {
this->child = CreateProjectileWithParent(this, 0xf, 1);
this->child = CreateProjectileWithParent(this, OCTOROK_BOSS_PROJECTILE, 1);
if (this->child != NULL) {
this->child->parent = this->parent;
this->child->direction = this->direction + gUnk_08129ADC[index];
+1 -1
View File
@@ -202,7 +202,7 @@ void sub_080AB034(Entity* this) {
} else {
tmp = 0x139;
}
sub_0801D2B4(this, tmp);
ChangeObjPalette(this, tmp);
}
void (*const V1DarkMagicProjectile_Functions[])(Entity*) = {
+1 -1
View File
@@ -111,7 +111,7 @@ void sub_080ABEA8(Entity* this) {
this->direction = (Random() & 0xf) << 1;
} else {
this->direction = sub_08049F84(this, 0);
sub_0801D2B4(this, 0x13f);
ChangeObjPalette(this, 0x13f);
}
InitializeAnimation(this, 0);
SoundReq(SFX_193);
+2 -2
View File
@@ -2848,7 +2848,7 @@ u32 sub_unk3_TempleOfDroplets_BigOcto() {
extern EntityData gUnk_additional_a_TempleOfDroplets_BigOcto;
void sub_StateChange_TempleOfDroplets_BigOcto(void) {
sub_0805308C(0x100);
ChangeLightLevel(0x100);
if (CheckGlobalFlag(LV4_CLEAR)) {
LoadRoomEntityList(&gUnk_additional_a_TempleOfDroplets_BigOcto);
} else {
@@ -6105,7 +6105,7 @@ void sub_StateChange_Caves_LonLonRanchSecret(void) {
if (CheckLocalFlag(0x11)) {
SetRoomFlag(0);
SetRoomFlag(1);
sub_0805308C(0x100);
ChangeLightLevel(0x100);
if (!CheckLocalFlag(0x12)) {
SetTileType(0x73, 0xcb, 1);
}
+1 -3
View File
@@ -157,8 +157,6 @@ void ScriptCommand_CameraTargetPlayer(Entity* entity, ScriptExecutionContext* co
void ScriptCommand_0807F0B4(Entity* entity, ScriptExecutionContext* context);
void ScriptCommand_0807F0C8(Entity* entity, ScriptExecutionContext* context);
extern void CreateSpeechBubbleExclamationMark(Entity*, u32, u32);
extern void CreateSpeechBubbleQuestionMark(Entity*, u32, u32);
extern void RecoverUI(u32);
typedef void (*ScriptCommand)(Entity*, ScriptExecutionContext*);
@@ -1861,7 +1859,7 @@ void sub_0807F714(Entity* entity, ScriptExecutionContext* context) {
void sub_0807F738(Entity* entity, ScriptExecutionContext* context) {
entity->spriteRendering.b3 = gUnk_08114F34[entity->spriteRendering.b3];
sub_0806FAD8(entity, entity);
ResolveEntityBelow(entity, entity);
}
void sub_0807F75C(Entity* entity, ScriptExecutionContext* context) {