Decompile Object20

This commit is contained in:
octorock
2022-03-11 17:08:27 +01:00
parent 2044fdcaff
commit cbae0aa1e5
8 changed files with 203 additions and 264 deletions
+6 -4
View File
@@ -11,13 +11,15 @@
#include "functions.h"
#include "area.h"
void sub_08087528(Entity*);
void sub_080875F4(Entity*);
void sub_08087640(Entity*);
void Object1E(Entity* this) {
static void (*const gUnk_081208B8[])(Entity*) = {sub_08087528, sub_080875F4, };
static void (*const gUnk_081208B8[])(Entity*) = {
sub_08087528,
sub_080875F4,
};
if (!EntityIsDeleted(this)) {
gUnk_081208B8[this->action](this);
}
@@ -60,7 +62,7 @@ NONMATCH("asm/non_matching/object1E/sub_08087528.inc", void sub_08087528(Entity*
if (this->type == 0x40) {
this->spriteSettings.flipX = 1;
}
break;
break;
}
}
SetDefaultPriority(this, 3);
@@ -74,7 +76,7 @@ void sub_080875F4(Entity* this) {
DeleteThisEntity();
}
if (this->type2 != 0) {
this->spritePriority.b0 =gPlayerEntity.spritePriority.b0 + 1 - this->frame;
this->spritePriority.b0 = gPlayerEntity.spritePriority.b0 + 1 - this->frame;
}
}
+91
View File
@@ -0,0 +1,91 @@
/**
* @file object20.c
* @ingroup Objects
*
* @brief Object20 object
*/
#define NENT_DEPRECATED
#include "global.h"
#include "object.h"
#include "functions.h"
void sub_08087824(Entity*);
void sub_08087888(Entity*);
void sub_080878CC(Entity*);
void (*const gUnk_08120A28[])(Entity*) = {
sub_08087824,
sub_08087888,
};
const Hitbox3D gUnk_08120A30 = { 0, 0, { 0, 0, 0, 0 }, 6, 6, 10, { 0, 0, 0 } };
const Hitbox3D gUnk_08120A3C = { 0, 0, { 0, 0, 0, 0 }, 12, 12, 16, { 0, 0, 0 } };
const Hitbox3D gUnk_08120A48 = { 0, 0, { 0, 0, 0, 0 }, 16, 16, 20, { 0, 0, 0 } };
const Hitbox3D* const gUnk_08120A54[] = { &gUnk_08120A30, &gUnk_08120A30, &gUnk_08120A48, &gUnk_08120A3C,
&gUnk_08120A3C };
void Object20(Entity* this) {
gUnk_08120A28[this->action](this);
}
void sub_08087824(Entity* this) {
if (this->collisionLayer == 0) {
ResolveCollisionLayer(this);
}
this->action = 1;
this->flags |= 0x80;
this->field_0x3c = 0x13;
this->health = 0xff;
this->hitType = 0xa9;
this->hurtType = 0x16;
this->hitbox = (Hitbox*)gUnk_08120A54[0];
this->flags2 = 0x8b;
sub_080878CC(this);
InitializeAnimation(this, 1);
sub_0801766C(this);
EnqueueSFX(SFX_ITEM_BOMB_EXPLODE);
}
void sub_08087888(Entity* this) {
GetNextFrame(this);
if ((this->frame & 0x80) != 0) {
DeleteThisEntity();
} else {
if (this->frame < 5) {
this->hitbox = (Hitbox*)gUnk_08120A54[this->frame];
} else {
this->flags &= 0x7f;
}
}
}
NONMATCH("asm/non_matching/object20/sub_080878CC.inc", void sub_080878CC(Entity* this)) {
s32 x;
s32 y;
s32 itX;
s32 itY;
u32 layer;
u32 tileType;
u32 pos;
x = this->x.HALF.HI;
y = this->y.HALF.HI;
layer = this->collisionLayer;
for (itX = -0x10; itX < 0x11; itX += 0x10) {
for (itY = -0x10; itY < 0x11; itY += 0x10) {
pos = TILE((u32)x + itX, (u32)y + itY);
if (sub_080B1AE0(pos, layer) == 0x2e) {
tileType = GetTileType(pos, layer);
if (tileType == 0x368 || tileType == 0x367
/*(tileType < 0x369) && (0x366 < tileType)*/) {
sub_08008796(this, 3, x + itX, y + itY);
} else {
SetTile(0x4022, pos, layer);
}
} else {
sub_08008796(this, 3, x + itX, y + itY);
}
}
}
}
END_NONMATCH