Decompile Object74

This commit is contained in:
octorock
2022-02-28 23:35:23 +01:00
parent 241c0312d9
commit cffa1024ca
12 changed files with 289 additions and 498 deletions
+1 -1
View File
@@ -310,7 +310,7 @@ void sub_080842D8(ChestSpawnerEntity* this) {
if ((super->y.HALF.HI & 8) != 0) {
index += 2;
}
sub_0801AF18((u8*)gUnk_0811F898[index], COORD_TO_TILE(super), super->collisionLayer);
SetMultipleTiles((u16*)gUnk_0811F898[index], COORD_TO_TILE(super), super->collisionLayer);
}
const Hitbox gUnk_0811F8A8 = { 0, -3, { 0, 0, 0, 0 }, 6, 6 };
+6 -6
View File
@@ -8,8 +8,8 @@
extern void sub_080A0960(Entity*, u32);
extern void (*const gUnk_08124950[])(Entity*);
extern u8 gUnk_08124960;
extern u8 gUnk_0812497A;
extern u16 gUnk_08124960[];
extern u16 gUnk_0812497A[];
void JailBars(Entity* this) {
gUnk_08124950[this->action](this);
@@ -49,11 +49,11 @@ void nullsub_127(Entity* this) {
}
void sub_080A0960(Entity* this, u32 arg1) {
u8* puVar1;
u16* puVar1;
puVar1 = &gUnk_08124960;
puVar1 = gUnk_08124960;
if (arg1 == 1) {
puVar1 = &gUnk_0812497A;
puVar1 = gUnk_0812497A;
}
sub_0801AF18(puVar1, COORD_TO_TILE(this), 1);
SetMultipleTiles(puVar1, COORD_TO_TILE(this), 1);
}
+116
View File
@@ -0,0 +1,116 @@
/**
* @file object74.c
* @ingroup Objects
*
* @brief Object74 object
*/
#define NENT_DEPRECATED
#include "global.h"
#include "object.h"
#include "functions.h"
#include "screen.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unk_68[0x1e];
/*0x86*/ u16 unk_86;
} Object74Entity;
void sub_08097B84(Object74Entity*);
void sub_08097BDC(Object74Entity*);
void sub_08097C18(Object74Entity*);
void sub_08097C20(Object74Entity*);
void sub_08097C1C(Object74Entity*);
void sub_08097CFC(Object74Entity*);
bool32 sub_08097CB0(Object74Entity*);
void sub_08097CB4(Object74Entity*);
const Hitbox gUnk_08123328 = { 0, 0, { 4, 0, 0, 4 }, 18, 18 };
void Object74(Object74Entity* this) {
static void (*const gUnk_08123330[])(Object74Entity*) = {
sub_08097B84, sub_08097BDC, sub_08097C18, sub_08097C20, sub_08097C1C,
};
gUnk_08123330[super->action](this);
}
void sub_08097B84(Object74Entity* this) {
super->action = 1;
super->spritePriority.b0 = 7;
super->hitbox = (Hitbox*)&gUnk_08123328;
if ((this->unk_86 == 0xffff) || (CheckFlags(this->unk_86))) {
super->spriteSettings.draw = 1;
super->action = 4;
sub_08097CFC(this);
} else {
sub_0805BC4C();
}
}
void sub_08097BDC(Object74Entity* this) {
if (CheckFlags(this->unk_86)) {
SetPlayerControl(CONTROL_1);
gUnk_02034490.unk0 = 1;
RequestPriorityDuration(super, 0x1e);
if (sub_08097CB0(this) == FALSE) {
sub_08097CB4(this);
}
}
}
void sub_08097C18(Object74Entity* this) {
}
void sub_08097C1C(Object74Entity* this) {
}
void sub_08097C20(Object74Entity* this) {
u32 tmp;
SetPriorityTimer(0x1e);
sub_0800445C(super);
CreateMagicSparkles(super->x.HALF.HI, super->y.HALF.HI, super->collisionLayer);
if (--super->actionDelay == 0) {
super->actionDelay = 8;
tmp = ++super->field_0xf;
gScreen.controls.alphaBlend = (((0x10 - tmp) * 0x100)) | tmp;
if (gScreen.controls.alphaBlend == 0x10) {
SetPlayerControl(CONTROL_ENABLED);
gUnk_02034490.unk0 = 0;
gScreen.controls.layerFXControl = 0;
sub_08097CFC(this);
super->action = 4;
super->spriteRendering.alphaBlend = 0;
SoundReq(SFX_SECRET);
SetGlobalFlag(TINY_ENTRANCE);
}
}
}
bool32 sub_08097CB0(Object74Entity* this) {
return FALSE;
}
void sub_08097CB4(Object74Entity* this) {
super->action = 3;
super->spriteSettings.draw = 1;
super->spriteRendering.alphaBlend = 1;
super->actionDelay = 0x1e;
super->field_0xf = 0;
gScreen.controls.layerFXControl = 0xf40;
gScreen.controls.alphaBlend = 0x1000;
SoundReq(SFX_14A);
}
void sub_08097CFC(Object74Entity* this) {
static const u16 gUnk_08123344[] = { 16448, 65471, 16449, 65472, 16450, 65473, 16451, 65535, 16452, 0,
16453, 1, 16454, 63, 16455, 64, 16456, 65, 65535 };
static const u16 gUnk_0812336A[] = {
16449, 65471, 16449, 65472, 16452, 65535, 16452, 0, 16455, 63, 16455, 64, 65535
};
if ((super->x.HALF.HI & 0xf) == 0) {
SetMultipleTiles((u16*)gUnk_0812336A, COORD_TO_TILE(super), super->collisionLayer);
} else {
SetMultipleTiles((u16*)gUnk_08123344, COORD_TO_TILE(super), super->collisionLayer);
}
}
+1 -1
View File
@@ -78,7 +78,7 @@ void PushableGrave_Init(PushableGraveEntity* this) {
super->hitbox = (Hitbox*)&gUnk_080FD570;
SetTile(tileIndex, tilePosition, super->collisionLayer);
if (super->type2 == 2) {
sub_0801AF18((u8*)gUnk_081232C0, tilePosition, super->collisionLayer);
SetMultipleTiles((u16*)gUnk_081232C0, tilePosition, super->collisionLayer);
}
}
}
+5 -10
View File
@@ -15,22 +15,17 @@ void StoneTablet(Entity* this) {
}
void sub_080979CC(Entity* this) {
static const u8 gUnk_081232EC[] = {
0x22, 0x40, 0xFE, 0xFF, 0x22, 0x40, 0xFF, 0xFF, 0x22, 0x40, 0x0, 0x0, 0x22, 0x40, 0x1, 0x0, 0xFF, 0xFF,
};
static const u8 gUnk_081232FE[] = {
0x65, 0x40, 0xBF, 0xFF, 0x22, 0x40, 0xC0, 0xFF, 0x66, 0x40, 0xC1, 0xFF, 0x29,
0x40, 0xFF, 0xFF, 0x26, 0x40, 0x0, 0x0, 0x2A, 0x40, 0x1, 0x0, 0xFF, 0xFF,
};
static const u16 gUnk_081232EC[] = { 0x4022, 0xfffe, 0x4022, 0xffff, 0x4022, 0x0, 0x4022, 0x1, 0xffff };
static const u16 gUnk_081232FE[] = { 0x4065, 0xffbf, 0x4022, 0xffc0, 0x4066, 0xffc1, 0x4029,
0xffff, 0x4026, 0x0, 0x402a, 0x1, 0xffff };
this->action = 1;
this->spriteSettings.draw = 1;
if (this->type == 3) {
this->frameIndex = 0;
sub_0801AF18(gUnk_081232FE, COORD_TO_TILE(this), this->collisionLayer);
SetMultipleTiles((u16*)gUnk_081232FE, COORD_TO_TILE(this), this->collisionLayer);
} else {
this->frameIndex = this->type;
sub_0801AF18(gUnk_081232EC, COORD_TO_TILE(this), this->collisionLayer);
SetMultipleTiles((u16*)gUnk_081232EC, COORD_TO_TILE(this), this->collisionLayer);
}
}