Decompile Whirlwind

This commit is contained in:
octorock
2022-02-27 12:53:18 +01:00
parent d37be75c49
commit 3fddf8f070
17 changed files with 108 additions and 315 deletions
-1
View File
@@ -20,7 +20,6 @@ typedef struct {
/*0x86*/ u16 unk_86;
} BigIceBlockEntity;
extern void (*const BigIceBlock_Actions[])(BigIceBlockEntity*);
extern const u16 gUnk_081237B0[];
-1
View File
@@ -26,7 +26,6 @@ typedef struct {
/*0x86*/ u16 unk_86;
} BossDoorEntity;
extern bool32 gUnk_02036BB8;
extern const u8 gUnk_0811F740[];
-2
View File
@@ -22,8 +22,6 @@ typedef struct {
/*0x87*/ u8 unk_87;
} FairyEntity;
void sub_0808D76C(FairyEntity*);
void sub_0808DAD0(FairyEntity*);
void sub_0808DB2C(FairyEntity*);
-1
View File
@@ -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);
-1
View File
@@ -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[];
-1
View File
@@ -21,7 +21,6 @@ typedef struct {
/*0x87*/ u8 unk_87;
} ObjectA8Entity;
void sub_0809FECC(ObjectA8Entity*);
bool32 sub_0809FE9C(ObjectA8Entity*);
void ObjectA8_Init(ObjectA8Entity*);
-1
View File
@@ -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*);
-2
View File
@@ -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[];
-1
View File
@@ -21,7 +21,6 @@ typedef struct {
/*0x86*/ u16 unk_86;
} PushableStatueEntity;
extern const s16 gUnk_080B4488[];
extern const s16 gUnk_080B4468[];
-1
View File
@@ -6,7 +6,6 @@ void sub_08086A6C(Entity*);
void (*const gUnk_081206C4[])(Entity*);
// Main
void Rupee(Entity* ent) {
gUnk_081206C4[ent->action](ent);
+99
View File
@@ -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--;
}
}
+7 -7
View File
@@ -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;