mirror of
https://github.com/zeldaret/tmc
synced 2026-07-10 23:22:03 -04:00
Decompile BossDoor
This commit is contained in:
+2
-2
@@ -65,13 +65,13 @@ s32 sub_08078828(Entity* ent) {
|
||||
return iVar1;
|
||||
}
|
||||
|
||||
void sub_08078850(u32 arg0, u32 arg1, u32 arg2, u32 arg3) {
|
||||
void sub_08078850(Entity* arg0, u32 arg1, u32 arg2, void* arg3) {
|
||||
s32 iVar1;
|
||||
|
||||
iVar1 = sub_08078904();
|
||||
if (iVar1 >= 0) {
|
||||
gUnk_03003DF0[iVar1].unk[8] = arg1;
|
||||
gUnk_03003DF0[iVar1].unk[10] = arg2;
|
||||
*(&gUnk_03003DF0[iVar1].unk4 + 1) = arg3;
|
||||
*(&gUnk_03003DF0[iVar1].unk4 + 1) = (u32)arg3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
#include "projectile.h"
|
||||
#include "game.h"
|
||||
|
||||
extern u32 GetRandomByWeight(const u8*);
|
||||
extern void sub_080792BC(s32, u32, u32);
|
||||
|
||||
enum OctorokRotation { ROTATION_CW, ROTATION_CCW, NO_ROTATION = 0xff };
|
||||
|
||||
typedef struct HelperStruct {
|
||||
|
||||
+1
-2
@@ -5,14 +5,13 @@
|
||||
#include "script.h"
|
||||
#include "npc.h"
|
||||
#include "game.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
u32 unk_00;
|
||||
s8 unk_04;
|
||||
} gUnk_0810C89C_struct;
|
||||
|
||||
extern void sub_08078850(Entity*, u32, s8, gUnk_0810C89C_struct*);
|
||||
|
||||
extern u8 gUnk_0810C88C[];
|
||||
extern Hitbox gUnk_0810C894;
|
||||
extern gUnk_0810C89C_struct gUnk_0810C89C[];
|
||||
|
||||
@@ -34,7 +34,6 @@ extern void sub_08067DCC(Entity*, u32);
|
||||
|
||||
extern u8 gUnk_0811110C[2];
|
||||
extern u32 gUnk_0811110F;
|
||||
extern void sub_08078850(Entity*, u32, u8, u32*);
|
||||
|
||||
extern u16 gUnk_08111104[];
|
||||
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
#include "npc.h"
|
||||
|
||||
extern void sub_08078850(Entity*, u32, u8, u32*);
|
||||
#include "functions.h"
|
||||
extern u32 gUnk_081133B4;
|
||||
|
||||
void sub_0806BFD8(Entity* this);
|
||||
|
||||
+1
-2
@@ -5,7 +5,6 @@
|
||||
|
||||
extern void (*gUnk_08113D8C[])(Entity*);
|
||||
|
||||
extern void sub_08078850(Entity*, u32, u8, u32*);
|
||||
extern u32 gUnk_08113D84[];
|
||||
|
||||
void Gregal(Entity* this) {
|
||||
@@ -32,7 +31,7 @@ void sub_0806CAF4(Entity* this) {
|
||||
}
|
||||
sub_0807DD64(this);
|
||||
sub_08078778(this);
|
||||
sub_08078850(this, 1, gUnk_08113D84[1], gUnk_08113D84);
|
||||
sub_08078850(this, 1, (u8)gUnk_08113D84[1], gUnk_08113D84);
|
||||
}
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
#include "player.h"
|
||||
#include "flags.h"
|
||||
#include "npc.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_08078850(Entity*, u32, u32, u32*);
|
||||
extern u32 gUnk_08113F44;
|
||||
extern Dialog gUnk_08113F48[];
|
||||
|
||||
|
||||
+1
-3
@@ -14,8 +14,6 @@ typedef struct {
|
||||
s8 unk_04;
|
||||
} gUnk_0810C89C_struct;
|
||||
|
||||
extern void sub_08078850(Entity*, u32, u8 /* TODO this is a s8 in beedle.c*/, gUnk_0810C89C_struct*);
|
||||
|
||||
extern void script_Object3ELeftStoneOpening; // Cutscene data type?
|
||||
extern void script_Object3ERightStoneOpening; // Cutscene data type?
|
||||
|
||||
@@ -46,7 +44,7 @@ void sub_0806DA04(Entity* this, ScriptExecutionContext* context) {
|
||||
// TODO gUnk_0811415C should be a gUnk_0810C89C_struct[], but then a lot of bytes everywhere are wrong?
|
||||
gUnk_0810C89C_struct* a = (gUnk_0810C89C_struct*)&(
|
||||
(gUnk_0810C89C_struct*)gUnk_0811415C)[context->intVariable]; // cast necessary to no longer make it a const* ?
|
||||
sub_08078850(this, 1, a->unk_04, a);
|
||||
sub_08078850(this, 1, (u8)a->unk_04, a);
|
||||
}
|
||||
|
||||
void sub_0806DA1C(Entity* this, ScriptExecutionContext* context) {
|
||||
|
||||
@@ -8,7 +8,6 @@ extern void (*gUnk_08112278[])(Entity*);
|
||||
|
||||
extern void script_Rem;
|
||||
|
||||
extern void sub_08078850(Entity*, u32, u32, u32*);
|
||||
extern u32 gUnk_0811229C;
|
||||
|
||||
extern void sub_0807F950(Entity* this, ScriptExecutionContext* context);
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
#include "script.h"
|
||||
#include "save.h"
|
||||
#include "npc.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern Hitbox gUnk_081142FC;
|
||||
extern void sub_08078850(Entity*, u32, u32, u32*);
|
||||
extern u32 gUnk_08114304;
|
||||
|
||||
extern Dialog gUnk_08114308[];
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
#include "npc.h"
|
||||
|
||||
extern void sub_08078850(Entity*, u32, u32, u32*);
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const gUnk_08110360[])(Entity*);
|
||||
extern void (*const gUnk_0811036C[])(Entity*);
|
||||
|
||||
@@ -14,8 +14,6 @@ extern u16 script_StockwellBuy[];
|
||||
extern u16 script_StockwellDogFood[];
|
||||
extern u8 gUnk_0810FDB8[];
|
||||
|
||||
extern void sub_08078850(Entity*, u32, u8, u32*);
|
||||
extern void InitScriptExecutionContext(ScriptExecutionContext* context, u16* script);
|
||||
extern u32 gUnk_0810FDA0;
|
||||
extern u16 script_Stockwell;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ extern void sub_0806ACC4(Entity*);
|
||||
extern void sub_0806AEA8(Entity*);
|
||||
extern void sub_0806AEE4(Entity*);
|
||||
extern void sub_0806AFE8(Entity*, ScriptExecutionContext*);
|
||||
extern void sub_08078850(Entity*, u32, u32, u32*);
|
||||
|
||||
extern u8 gUnk_081125F4[12];
|
||||
extern SpriteLoadData gUnk_08112674[];
|
||||
|
||||
@@ -13,7 +13,6 @@ extern void (*const gUnk_0810B77C[])(Entity*);
|
||||
extern void sub_08061CB4(Entity*, u32);
|
||||
extern void sub_08061D64(Entity*);
|
||||
extern void sub_08062048(Entity*);
|
||||
extern void sub_08078850(Entity*, u32, u8, u32*);
|
||||
|
||||
extern SpriteLoadData* gUnk_0810B6EC[];
|
||||
extern u8 gUnk_0810B78C[];
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
/**
|
||||
* @file bossDoor.c
|
||||
* @ingroup Objects
|
||||
*
|
||||
* @brief Boss Door object
|
||||
*/
|
||||
|
||||
#define NENT_DEPRECATED
|
||||
#include "global.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unk_68[8];
|
||||
/*0x70*/ u16 unk_70;
|
||||
/*0x72*/ u16 unk_72;
|
||||
/*0x74*/ u16 unk_74;
|
||||
/*0x76*/ u16 unk_76;
|
||||
/*0x78*/ u16 unk_78;
|
||||
/*0x7a*/ u16 unk_7a;
|
||||
/*0x7c*/ u16 unk_7c;
|
||||
/*0x7e*/ u8 unk_7e[6];
|
||||
/*0x84*/ u16 unk_84;
|
||||
/*0x86*/ u16 unk_86;
|
||||
} BossDoorEntity;
|
||||
|
||||
extern Hitbox gHitbox_3;
|
||||
extern bool32 gUnk_02036BB8;
|
||||
extern const u8 gUnk_0811F740[];
|
||||
|
||||
void sub_0808C500(BossDoorEntity*);
|
||||
void sub_0808C4BC(BossDoorEntity*);
|
||||
void sub_0808C5D0(BossDoorEntity*);
|
||||
void BossDoor_Init(BossDoorEntity*);
|
||||
void BossDoor_Action1(BossDoorEntity*);
|
||||
void BossDoor_Action2(BossDoorEntity*);
|
||||
void BossDoor_Action3(BossDoorEntity*);
|
||||
void BossDoor_Action4(BossDoorEntity*);
|
||||
void BossDoor_Action5(BossDoorEntity*);
|
||||
void BossDoor_Action6(BossDoorEntity*);
|
||||
|
||||
void BossDoor(BossDoorEntity* this) {
|
||||
static void (*const BossDoor_Actions[])(BossDoorEntity*) = {
|
||||
BossDoor_Init, BossDoor_Action1, BossDoor_Action2, BossDoor_Action3,
|
||||
BossDoor_Action4, BossDoor_Action5, BossDoor_Action6,
|
||||
};
|
||||
BossDoor_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void BossDoor_Init(BossDoorEntity* this) {
|
||||
if ((this->unk_84 != 0xffff) && CheckFlags(this->unk_84)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if ((this->unk_86 != BEGIN) && CheckFlags(this->unk_86)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
super->type2 = super->type >> 2;
|
||||
super->speed = 0x300;
|
||||
this->unk_70 = super->x.HALF.HI;
|
||||
this->unk_72 = super->y.HALF.HI;
|
||||
super->hitbox = (Hitbox*)&gHitbox_3;
|
||||
super->spritePriority.b0 = 5;
|
||||
this->unk_76 = super->type & 3;
|
||||
this->unk_74 = COORD_TO_TILE(super);
|
||||
InitializeAnimation(super, super->type & 0x1f);
|
||||
switch (super->type2) {
|
||||
case 0:
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
sub_0808C500(this);
|
||||
sub_08078800(super);
|
||||
sub_08078850(super, 0, gUnk_0811F740[this->unk_76], 0);
|
||||
break;
|
||||
case 1:
|
||||
super->action = 4;
|
||||
super->spriteSettings.draw = 0;
|
||||
break;
|
||||
case 2:
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
sub_0808C500(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BossDoor_Action1(BossDoorEntity* this) {
|
||||
if (super->interactType != 0) {
|
||||
super->action = 2;
|
||||
sub_080788E0(super);
|
||||
SetFlag(this->unk_86);
|
||||
}
|
||||
}
|
||||
|
||||
void BossDoor_Action2(BossDoorEntity* this) {
|
||||
if ((super->frame & 0x80) == 0) {
|
||||
if ((gRoomTransition.frameCount & 3) == 0) {
|
||||
SoundReq(SFX_185);
|
||||
}
|
||||
GetNextFrame(super);
|
||||
} else {
|
||||
sub_0808C4BC(this);
|
||||
}
|
||||
}
|
||||
|
||||
void BossDoor_Action3(BossDoorEntity* this) {
|
||||
LinearMoveUpdate(super);
|
||||
if (--super->actionDelay == 0) {
|
||||
if (super->type < 4) {
|
||||
sub_08078AC0(0x40, 0, 1);
|
||||
gPlayerEntity.direction = super->type << 3;
|
||||
}
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void BossDoor_Action4(BossDoorEntity* this) {
|
||||
static const s8 gUnk_081214F4[] = { 0, -36, 36, 0, 0, 36, -36, 0 };
|
||||
const s8* ptr;
|
||||
|
||||
if (sub_08083734(super, this->unk_76)) {
|
||||
super->action = 5;
|
||||
super->actionDelay = 0xc;
|
||||
super->spriteSettings.draw = 1;
|
||||
super->direction = *(u8*)&this->unk_76 << 3 ^ 0x10;
|
||||
ptr = &gUnk_081214F4[this->unk_76 * 2];
|
||||
super->x.HALF.HI += ptr[0];
|
||||
super->y.HALF.HI += ptr[1];
|
||||
sub_0808C500(this);
|
||||
}
|
||||
}
|
||||
|
||||
void BossDoor_Action5(BossDoorEntity* this) {
|
||||
static const s8 gUnk_081214FC[] = { 12, 12, -12, 12, -12, 12, -12, -12, 12, -12, -12, -12, 12, 12, 12, -12 };
|
||||
Entity* effect;
|
||||
const s8* ptr;
|
||||
|
||||
LinearMoveUpdate(super);
|
||||
if (--super->actionDelay == 0) {
|
||||
super->action = 6;
|
||||
super->z.HALF.HI = 0;
|
||||
super->x.HALF.HI = this->unk_70;
|
||||
super->y.HALF.HI = this->unk_72;
|
||||
ptr = &gUnk_081214FC[this->unk_76 * 4];
|
||||
effect = CreateFx(super, FX_DASH, 0x40);
|
||||
if (effect != NULL) {
|
||||
effect->x.HALF.HI += ptr[0];
|
||||
effect->y.HALF.HI += ptr[1];
|
||||
}
|
||||
effect = CreateFx(super, FX_DASH, 0x40);
|
||||
if (effect != NULL) {
|
||||
effect->x.HALF.HI += ptr[2];
|
||||
effect->y.HALF.HI += ptr[3];
|
||||
}
|
||||
EnqueueSFX(SFX_10B);
|
||||
}
|
||||
}
|
||||
|
||||
void BossDoor_Action6(BossDoorEntity* this) {
|
||||
if (CheckFlags(this->unk_86)) {
|
||||
super->action = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808C4BC(BossDoorEntity* this) {
|
||||
static const s8 gUnk_0812150C[] = { 0, -2, 2, 0, 0, 2, -2, 0 };
|
||||
const s8* ptr;
|
||||
super->action = 3;
|
||||
super->actionDelay = 0xc;
|
||||
super->direction = this->unk_76 * 8;
|
||||
ptr = &gUnk_0812150C[this->unk_76 * 2];
|
||||
super->x.HALF.HI += ptr[0];
|
||||
super->y.HALF.HI += ptr[1];
|
||||
sub_0808C5D0(this);
|
||||
SoundReq(SFX_10B);
|
||||
}
|
||||
|
||||
void sub_0808C500(BossDoorEntity* this) {
|
||||
if ((this->unk_76 == 0) || (this->unk_76 == 2)) {
|
||||
this->unk_78 = GetTileIndex(this->unk_74 - 1, super->collisionLayer);
|
||||
this->unk_7a = GetTileIndex(this->unk_74, super->collisionLayer);
|
||||
this->unk_7c = GetTileIndex(this->unk_74 + 1, super->collisionLayer);
|
||||
SetTile(0x4022, this->unk_74 - 1, super->collisionLayer);
|
||||
SetTile(0x4022, this->unk_74, super->collisionLayer);
|
||||
SetTile(0x4022, this->unk_74 + 1, super->collisionLayer);
|
||||
} else {
|
||||
this->unk_78 = GetTileIndex(this->unk_74 - 0x40, super->collisionLayer);
|
||||
this->unk_7a = GetTileIndex(this->unk_74, super->collisionLayer);
|
||||
this->unk_7c = GetTileIndex(this->unk_74 + 0x40, super->collisionLayer);
|
||||
SetTile(0x4022, this->unk_74 - 0x40, super->collisionLayer);
|
||||
SetTile(0x4022, this->unk_74, super->collisionLayer);
|
||||
SetTile(0x4022, this->unk_74 + 0x40, super->collisionLayer);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808C5D0(BossDoorEntity* this) {
|
||||
if ((this->unk_76 == 0) || (this->unk_76 == 2)) {
|
||||
SetTile(this->unk_78, this->unk_74 - 1, super->collisionLayer);
|
||||
SetTile(this->unk_7a, this->unk_74, super->collisionLayer);
|
||||
SetTile(this->unk_7c, this->unk_74 + 1, super->collisionLayer);
|
||||
} else {
|
||||
SetTile(this->unk_78, this->unk_74 - 0x40, super->collisionLayer);
|
||||
SetTile(this->unk_7a, this->unk_74, super->collisionLayer);
|
||||
SetTile(this->unk_7c, this->unk_74 + 0x40, super->collisionLayer);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808C650(Entity* this, u32 param_2) {
|
||||
Entity* obj = CreateObject(OBJECT_3A, 0, param_2);
|
||||
if (obj != NULL) {
|
||||
obj->parent = this;
|
||||
gUnk_02036BB8 = FALSE;
|
||||
} else {
|
||||
gUnk_02036BB8 = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_0808C67C(void) {
|
||||
return gUnk_02036BB8;
|
||||
}
|
||||
|
||||
void sub_0808C688(void) {
|
||||
sub_0801E104();
|
||||
gUnk_02036BB8 = TRUE;
|
||||
}
|
||||
@@ -28,8 +28,6 @@ static bool32 sub_080867CC(u32);
|
||||
void sub_0808681C(Entity*);
|
||||
static u8 sub_08086954(Entity*);
|
||||
|
||||
extern u32 CheckRegionOnScreen(u32, u32, u32, u32);
|
||||
|
||||
extern void (*const gUnk_081206B4[])(Entity*);
|
||||
extern Hitbox gUnk_081206AC; // TODO: should be const
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unk_68[8];
|
||||
/*0x70*/ u16 timer;
|
||||
/*0x72*/ u16 wobbleTime; /**< Time the player can stand on the platform. */
|
||||
/*0x72*/ u16 wobbleTime; /**< Time the player can stand on the platform. */
|
||||
/*0x74*/ u16 respawnTime; /**< Time until the platform respawns after it has sunk. */
|
||||
/*0x76*/ u16 unk_76;
|
||||
/*0x78*/ Entity* unk_78; // Typed same as second argument of sub_080A2CC0
|
||||
|
||||
@@ -37,8 +37,6 @@ void LockedDoor(Entity* this) {
|
||||
|
||||
extern Hitbox gHitbox_2;
|
||||
|
||||
extern void sub_08078850(Entity*, u32, u32, u32);
|
||||
|
||||
typedef struct PACKED {
|
||||
s8 x;
|
||||
s8 y;
|
||||
|
||||
@@ -29,7 +29,7 @@ void Object3E_Type8_Action2(Object3EEntity*);
|
||||
|
||||
void Object3E(Object3EEntity* this) {
|
||||
static void (*const Object3E_Types[])(Object3EEntity*) = {
|
||||
Object3E_Type0, Object3E_Type1, Object3E_Type1, Object3E_Type3, Object3E_Type4,
|
||||
Object3E_Type0, Object3E_Type1, Object3E_Type1, Object3E_Type3, Object3E_Type4,
|
||||
Object3E_Type5, Object3E_Type6, Object3E_Type7, Object3E_Type8, Object3E_Type1,
|
||||
};
|
||||
Object3E_Types[super->type](this);
|
||||
|
||||
@@ -103,11 +103,6 @@ Object6ATypeAction sub_080961F4;
|
||||
Object6ATypeAction sub_08096284;
|
||||
Object6ATypeAction sub_08096290;
|
||||
|
||||
extern void sub_08080CB4(Entity*);
|
||||
extern u32 sub_080002B8(Entity*);
|
||||
extern u32 CheckOnScreen(Entity*);
|
||||
extern void sub_08078850(Entity*, u32, u32, u8*);
|
||||
|
||||
void sub_08095754(Object6AEntity*);
|
||||
void sub_080957B4(Object6AEntity*);
|
||||
void sub_08095954(Object6AEntity*);
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
#include "save.h"
|
||||
#include "script.h"
|
||||
#include "effects.h"
|
||||
|
||||
extern void sub_08078850(Entity*, u32, u32, u8*);
|
||||
#include "functions.h"
|
||||
|
||||
extern u8 gUnk_08125010;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user