summaryrefslogtreecommitdiff
path: root/src/object
diff options
context:
space:
mode:
authoroctorock <79596758+octorock@users.noreply.github.com>2022-02-27 12:53:18 +0100
committeroctorock <79596758+octorock@users.noreply.github.com>2022-02-27 13:44:06 +0100
commit3fddf8f0702d3fd0f7f43cc384ab0ca5eae21497 (patch)
tree0473440321b110ecf74ad9cb1232ff838a35ece7 /src/object
parentd37be75c49f80b3b5674012e5036b5b21453cbe5 (diff)
Decompile Whirlwind
Diffstat (limited to 'src/object')
-rw-r--r--src/object/bigIceBlock.c1
-rw-r--r--src/object/bossDoor.c1
-rw-r--r--src/object/fairy.c2
-rw-r--r--src/object/lightableSwitch.c1
-rw-r--r--src/object/minecart.c1
-rw-r--r--src/object/objectA8.c1
-rw-r--r--src/object/pot.c1
-rw-r--r--src/object/pushableGrave.c2
-rw-r--r--src/object/pushableStatue.c1
-rw-r--r--src/object/rupee.c1
-rw-r--r--src/object/whirlwind.c99
-rw-r--r--src/object/windTribeTeleporter.c14
12 files changed, 106 insertions, 19 deletions
diff --git a/src/object/bigIceBlock.c b/src/object/bigIceBlock.c
index 13908bc7..916f83fa 100644
--- a/src/object/bigIceBlock.c
+++ b/src/object/bigIceBlock.c
@@ -20,7 +20,6 @@ typedef struct {
/*0x86*/ u16 unk_86;
} BigIceBlockEntity;
-
extern void (*const BigIceBlock_Actions[])(BigIceBlockEntity*);
extern const u16 gUnk_081237B0[];
diff --git a/src/object/bossDoor.c b/src/object/bossDoor.c
index 2719085a..5b1bd36d 100644
--- a/src/object/bossDoor.c
+++ b/src/object/bossDoor.c
@@ -26,7 +26,6 @@ typedef struct {
/*0x86*/ u16 unk_86;
} BossDoorEntity;
-
extern bool32 gUnk_02036BB8;
extern const u8 gUnk_0811F740[];
diff --git a/src/object/fairy.c b/src/object/fairy.c
index 44c3930e..3289562c 100644
--- a/src/object/fairy.c
+++ b/src/object/fairy.c
@@ -22,8 +22,6 @@ typedef struct {
/*0x87*/ u8 unk_87;
} FairyEntity;
-
-
void sub_0808D76C(FairyEntity*);
void sub_0808DAD0(FairyEntity*);
void sub_0808DB2C(FairyEntity*);
diff --git a/src/object/lightableSwitch.c b/src/object/lightableSwitch.c
index 6594193a..ca63ad85 100644
--- a/src/object/lightableSwitch.c
+++ b/src/object/lightableSwitch.c
@@ -11,7 +11,6 @@ extern void (*const gUnk_081243B4[])(Entity*);
extern void (*const gUnk_081243BC[])(Entity*);
extern void (*const gUnk_081243C4[])(Entity*);
-
void LightableSwitch(Entity* this) {
gUnk_081243B4[this->type](this);
sub_0809EB30(this);
diff --git a/src/object/minecart.c b/src/object/minecart.c
index 2c49351b..7c7305b6 100644
--- a/src/object/minecart.c
+++ b/src/object/minecart.c
@@ -9,7 +9,6 @@ extern void sub_08091C0C(Entity*);
extern void (*const gUnk_081223A8[])(Entity*);
-
extern const s8 gUnk_081223C8[];
extern const u32 gUnk_081223D8[];
diff --git a/src/object/objectA8.c b/src/object/objectA8.c
index b2b37b7a..008a8d10 100644
--- a/src/object/objectA8.c
+++ b/src/object/objectA8.c
@@ -21,7 +21,6 @@ typedef struct {
/*0x87*/ u8 unk_87;
} ObjectA8Entity;
-
void sub_0809FECC(ObjectA8Entity*);
bool32 sub_0809FE9C(ObjectA8Entity*);
void ObjectA8_Init(ObjectA8Entity*);
diff --git a/src/object/pot.c b/src/object/pot.c
index 6808c48e..c67721a9 100644
--- a/src/object/pot.c
+++ b/src/object/pot.c
@@ -16,7 +16,6 @@ extern void (*const gUnk_0811F090[])(Entity*);
extern void (*const gUnk_0811F0A8[])(Entity*);
extern void (*const gUnk_0811F0C4[])(Entity*);
-
extern void sub_08078930(Entity*);
extern void sub_08016A6C(Entity*);
diff --git a/src/object/pushableGrave.c b/src/object/pushableGrave.c
index 96bf5386..989f817e 100644
--- a/src/object/pushableGrave.c
+++ b/src/object/pushableGrave.c
@@ -27,8 +27,6 @@ typedef struct {
/*0x86*/ u16 pushedFlag;
} PushableGraveEntity;
-
-
extern void (*const gUnk_081232AC[])(PushableGraveEntity*);
extern const u8 gUnk_081232C0[];
extern const u16 PushableGrave_Tiles[];
diff --git a/src/object/pushableStatue.c b/src/object/pushableStatue.c
index 8dbfdb41..824450fc 100644
--- a/src/object/pushableStatue.c
+++ b/src/object/pushableStatue.c
@@ -21,7 +21,6 @@ typedef struct {
/*0x86*/ u16 unk_86;
} PushableStatueEntity;
-
extern const s16 gUnk_080B4488[];
extern const s16 gUnk_080B4468[];
diff --git a/src/object/rupee.c b/src/object/rupee.c
index cabcca81..5bf774e2 100644
--- a/src/object/rupee.c
+++ b/src/object/rupee.c
@@ -6,7 +6,6 @@ void sub_08086A6C(Entity*);
void (*const gUnk_081206C4[])(Entity*);
-
// Main
void Rupee(Entity* ent) {
gUnk_081206C4[ent->action](ent);
diff --git a/src/object/whirlwind.c b/src/object/whirlwind.c
new file mode 100644
index 00000000..2315052e
--- /dev/null
+++ b/src/object/whirlwind.c
@@ -0,0 +1,99 @@
+/**
+ * @file whirlwind.c
+ * @ingroup Objects
+ *
+ * @brief Whirlwind object
+ */
+
+#define NENT_DEPRECATED
+#include "global.h"
+#include "object.h"
+#include "functions.h"
+#include "area.h"
+#include "hitbox.h"
+
+void Whirlwind_Init(Entity*);
+void Whirlwind_Action1(Entity*);
+void Whirlwind_Action2(Entity*);
+
+void Whirlwind(Entity* this) {
+ static void (*const Whirlwind_Actions[])(Entity*) = {
+ Whirlwind_Init,
+ Whirlwind_Action1,
+ Whirlwind_Action2,
+ };
+ u32 tmp = this->health;
+ if (((tmp & 0x7f) != 0) && (ReadBit(gArea.filler5, tmp - 1) == 0)) {
+ DeleteThisEntity();
+ }
+ Whirlwind_Actions[this->action](this);
+}
+
+void Whirlwind_Init(Entity* this) {
+ this->action = 1;
+ this->hitbox = (Hitbox*)&gUnk_080FD320;
+ this->flags |= ENT_COLLIDE;
+ this->hitType = 1;
+ this->field_0x3c = 0x47;
+ this->hurtType = 0x44;
+ this->flags2 = 0x80;
+ this->spriteOrientation.flipY = 1;
+ this->spriteRendering.b3 = 1;
+ this->animationState = this->type;
+ this->direction = this->type << 3;
+ this->speed = 0x700;
+ if (this->type2 == 1) {
+ ChangeObjPalette(this, 0x161);
+ InitializeAnimation(this, 1);
+ } else {
+ this->z.HALF.HI = 0xffe8;
+ InitializeAnimation(this, 1);
+ }
+ if ((this->flags & ENT_SCRIPTED) != 0) {
+ sub_0807DD64(this);
+ ExecuteScriptForEntity(this, NULL);
+ }
+}
+
+void Whirlwind_Action1(Entity* this) {
+ if ((this->flags & ENT_SCRIPTED) != 0) {
+ ExecuteScriptForEntity(this, NULL);
+ }
+ if (this->spriteSettings.draw != 0) {
+ GetNextFrame(this);
+ if ((((((gPlayerState.flags & PL_MINISH) == 0)) && (gPlayerState.field_0x3c[0] == 0)) &&
+ ((gPlayerEntity.action == 4 || ((gPlayerEntity.flags & ENT_COLLIDE) != 0)))) &&
+ ((gPlayerEntity.action != 6 && (sub_0800419C(this, &gPlayerEntity, 0xc, 0xc) != 0)))) {
+ if (((gPlayerState.flags & PL_PARACHUTE) == 0) && (gPlayerEntity.action != 4)) {
+ if ((this->type2 != 1) && (-0x10 < gPlayerEntity.z.HALF.HI)) {
+ return;
+ }
+ } else if (gPlayerEntity.z.HALF.HI == 0) {
+ return;
+ }
+ CopyPosition(this, &gPlayerEntity);
+ sub_08004542(this);
+ sub_08004542(&gPlayerEntity);
+ gPlayerEntity.collisionLayer = 1;
+ gPlayerEntity.flags |= ENT_COLLIDE;
+ gPlayerState.queued_action = 0x1f;
+ gPlayerState.field_0x38 = this->type2;
+ gPlayerState.field_0x39 = 0xff;
+ this->spritePriority.b0 = gPlayerEntity.spritePriority.b0 - 1;
+ this->action++;
+ sub_08077B20();
+ SoundReq(SFX_153);
+ SoundReq(SFX_PLY_VO5);
+ }
+ }
+}
+
+void Whirlwind_Action2(Entity* this) {
+ UpdateAnimationSingleFrame(this);
+ if (sub_0800419C(this, &gPlayerEntity, 0xc, 0xc) == 0) {
+ ResetCollisionLayer(this);
+ this->spriteOrientation.flipY = 1;
+ this->spriteRendering.b3 = 1;
+ this->action--;
+ }
+}
diff --git a/src/object/windTribeTeleporter.c b/src/object/windTribeTeleporter.c
index 052d4d2e..7dd0e600 100644
--- a/src/object/windTribeTeleporter.c
+++ b/src/object/windTribeTeleporter.c
@@ -107,17 +107,17 @@ void WindTribeTeleporter_Action2(WindTribeTeleporterEntity* this) {
break;
default:
if (--super->actionDelay == 0) {
- #if defined(DEMO_JP) || defined(JP) || defined(EU)
- #ifdef DEMO_JP
- SetLocalFlag(0xfc);
- #endif
- DoExitTransition(&gUnk_0813ADEC[super->type2]);
- #else
+#if defined(DEMO_JP) || defined(JP) || defined(EU)
+#ifdef DEMO_JP
+ SetLocalFlag(0xfc);
+#endif
+ DoExitTransition(&gUnk_0813ADEC[super->type2]);
+#else
if (gRoomControls.area == 3) {
SetLocalFlag(0xf9);
}
DoExitTransition(&gUnk_0813ADEC[super->type2]);
- #endif
+#endif
} else {
if ((gRoomTransition.frameCount & 1) == 0) {
gPlayerEntity.animationState = (gPlayerEntity.animationState + 2) & 6;