mirror of
https://github.com/zeldaret/tmc
synced 2026-07-27 06:45:35 -04:00
Decompile BlockPushed
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
/**
|
||||
* @file blockPushed.c
|
||||
* @ingroup Objects
|
||||
*
|
||||
* @brief Block Pushed object
|
||||
*/
|
||||
|
||||
#define NENT_DEPRECATED
|
||||
#include "global.h"
|
||||
#include "object.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u32 unk_68;
|
||||
} BlockPushedEntity;
|
||||
|
||||
extern void (*const gUnk_0811F624[])(BlockPushedEntity*);
|
||||
extern const Hitbox* const gUnk_0811F64C[];
|
||||
|
||||
void sub_080832D8(u32, BlockPushedEntity*);
|
||||
void sub_080830B8(BlockPushedEntity*);
|
||||
|
||||
void BlockPushed(BlockPushedEntity* this) {
|
||||
gUnk_0811F624[super->action](this);
|
||||
}
|
||||
|
||||
void sub_08082EB4(BlockPushedEntity* this) {
|
||||
u16 tmp;
|
||||
u32 pos;
|
||||
|
||||
if (gRoomControls.area == 0x11) {
|
||||
sub_080AE068(super);
|
||||
if (LoadFixedGFX(super, 0x1c1) == 0) {
|
||||
super->spriteSettings.draw = 0;
|
||||
return;
|
||||
}
|
||||
super->spriteSettings.draw = 1;
|
||||
}
|
||||
super->action = 1;
|
||||
super->actionDelay = 0x20;
|
||||
super->speed = 0x80;
|
||||
super->spritePriority.b0 = 6;
|
||||
pos = COORD_TO_TILE(super);
|
||||
tmp = super->type * 8;
|
||||
super->x.HALF.HI += tmp;
|
||||
super->y.HALF.HI += tmp;
|
||||
super->hitbox = (Hitbox*)gUnk_0811F64C[super->type];
|
||||
this->unk_68 = GetTileType(pos, (u32)super->collisionLayer);
|
||||
switch (super->type) {
|
||||
case 0:
|
||||
sub_080832D8(pos, this);
|
||||
break;
|
||||
case 1:
|
||||
sub_080832D8(pos, this);
|
||||
sub_080832D8(pos + 1, this);
|
||||
sub_080832D8(pos + 0x40, this);
|
||||
sub_080832D8(pos + 0x41, this);
|
||||
break;
|
||||
case 2:
|
||||
sub_080832D8(pos, this);
|
||||
sub_080832D8(pos + 1, this);
|
||||
sub_080832D8(pos + 2, this);
|
||||
sub_080832D8(pos + 0x40, this);
|
||||
sub_080832D8(pos + 0x41, this);
|
||||
sub_080832D8(pos + 0x42, this);
|
||||
sub_080832D8(pos + 0x80, this);
|
||||
sub_080832D8(pos + 0x81, this);
|
||||
sub_080832D8(pos + 0x82, this);
|
||||
break;
|
||||
default:
|
||||
sub_080832D8(pos, this);
|
||||
sub_080832D8(pos + 1, this);
|
||||
sub_080832D8(pos + 2, this);
|
||||
sub_080832D8(pos + 3, this);
|
||||
sub_080832D8(pos + 0x40, this);
|
||||
sub_080832D8(pos + 0x41, this);
|
||||
sub_080832D8(pos + 0x42, this);
|
||||
sub_080832D8(pos + 0x43, this);
|
||||
sub_080832D8(pos + 0x80, this);
|
||||
sub_080832D8(pos + 0x81, this);
|
||||
sub_080832D8(pos + 0x82, this);
|
||||
sub_080832D8(pos + 0x83, this);
|
||||
sub_080832D8(pos + 0xc0, this);
|
||||
sub_080832D8(pos + 0xc1, this);
|
||||
sub_080832D8(pos + 0xc2, this);
|
||||
sub_080832D8(pos + 0xc3, this);
|
||||
break;
|
||||
}
|
||||
EnqueueSFX(SFX_10F);
|
||||
}
|
||||
|
||||
void sub_08083094(BlockPushedEntity* this) {
|
||||
LinearMoveUpdate(super);
|
||||
sub_0800445C(super);
|
||||
if (--super->actionDelay == 0) {
|
||||
sub_080830B8(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080830B8(BlockPushedEntity* this) {
|
||||
s32 offset = super->type * 8;
|
||||
u32 pos = COORD_TO_TILE_OFFSET(super, offset, offset);
|
||||
|
||||
switch (super->type) {
|
||||
case 0:
|
||||
if (sub_0800442E(super)) {
|
||||
return;
|
||||
}
|
||||
sub_0807B7D8(0x365, pos, super->collisionLayer);
|
||||
break;
|
||||
case 1:
|
||||
sub_0807B7D8(this->unk_68, pos, super->collisionLayer);
|
||||
sub_0807B7D8(0x36f, pos + 1, super->collisionLayer);
|
||||
sub_0807B7D8(0x370, pos + 0x40, super->collisionLayer);
|
||||
sub_0807B7D8(0x371, pos + 0x41, super->collisionLayer);
|
||||
break;
|
||||
case 2:
|
||||
sub_0807B7D8(this->unk_68, pos, super->collisionLayer);
|
||||
sub_0807B7D8(0x372, pos + 1, super->collisionLayer);
|
||||
sub_0807B7D8(0x36f, pos + 2, super->collisionLayer);
|
||||
sub_0807B7D8(0x374, pos + 0x40, super->collisionLayer);
|
||||
sub_0807B7D8(0x376, pos + 0x41, super->collisionLayer);
|
||||
sub_0807B7D8(0x375, pos + 0x42, super->collisionLayer);
|
||||
sub_0807B7D8(0x370, pos + 0x80, super->collisionLayer);
|
||||
sub_0807B7D8(0x373, pos + 0x81, super->collisionLayer);
|
||||
sub_0807B7D8(0x371, pos + 0x82, super->collisionLayer);
|
||||
break;
|
||||
default:
|
||||
sub_0807B7D8(this->unk_68, pos, super->collisionLayer);
|
||||
sub_0807B7D8(0x372, pos + 1, super->collisionLayer);
|
||||
sub_0807B7D8(0x372, pos + 2, super->collisionLayer);
|
||||
sub_0807B7D8(0x36f, pos + 3, super->collisionLayer);
|
||||
sub_0807B7D8(0x374, pos + 0x40, super->collisionLayer);
|
||||
sub_0807B7D8(0x376, pos + 0x41, super->collisionLayer);
|
||||
sub_0807B7D8(0x376, pos + 0x42, super->collisionLayer);
|
||||
sub_0807B7D8(0x375, pos + 0x43, super->collisionLayer);
|
||||
sub_0807B7D8(0x374, pos + 0x80, super->collisionLayer);
|
||||
sub_0807B7D8(0x376, pos + 0x81, super->collisionLayer);
|
||||
sub_0807B7D8(0x376, pos + 0x82, super->collisionLayer);
|
||||
sub_0807B7D8(0x375, pos + 0x83, super->collisionLayer);
|
||||
sub_0807B7D8(0x370, pos + 0xc0, super->collisionLayer);
|
||||
sub_0807B7D8(0x373, pos + 0xc1, super->collisionLayer);
|
||||
sub_0807B7D8(0x373, pos + 0xc2, super->collisionLayer);
|
||||
sub_0807B7D8(0x371, pos + 0xc3, super->collisionLayer);
|
||||
break;
|
||||
}
|
||||
DeleteEntity(super);
|
||||
}
|
||||
|
||||
void sub_080832D8(u32 param_1, BlockPushedEntity* this) {
|
||||
if (super->collisionLayer != 2) {
|
||||
if ((super->direction & 8) != 0) {
|
||||
sub_0807B7D8(0x21, param_1, super->collisionLayer);
|
||||
} else {
|
||||
sub_0807B7D8(0x20, param_1, super->collisionLayer);
|
||||
}
|
||||
} else {
|
||||
if ((super->direction & 8) != 0) {
|
||||
sub_0807B7D8(0x2f, param_1, super->collisionLayer);
|
||||
} else {
|
||||
sub_0807B7D8(0x2e, param_1, super->collisionLayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void (*const gUnk_0811F624[])(BlockPushedEntity*) = {sub_08082EB4, sub_08083094, };
|
||||
const Hitbox gUnk_0811F62C = { 0, 0, { 0, 0, 0, 0 }, 5, 4 };
|
||||
const Hitbox gUnk_0811F634 = { 0, 0, { 0, 0, 0, 0 }, 13, 12 };
|
||||
const Hitbox gUnk_0811F63C = { 0, 0, { 0, 0, 0, 0 }, 21, 20 };
|
||||
const Hitbox gUnk_0811F644 = { 0, 0, { 0, 0, 0, 0 }, 29, 28 };
|
||||
|
||||
const Hitbox* const gUnk_0811F64C[] = {&gUnk_0811F62C, &gUnk_0811F634, &gUnk_0811F63C, &gUnk_0811F644, };
|
||||
@@ -3,9 +3,9 @@
|
||||
#include "flags.h"
|
||||
#include "room.h"
|
||||
#include "sound.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_080A0960(Entity*, u32);
|
||||
extern void sub_0801AF18(u8*, u32, u32);
|
||||
|
||||
extern void (*const gUnk_08124950[])(Entity*);
|
||||
extern u8 gUnk_08124960;
|
||||
|
||||
+1
-5
@@ -3,10 +3,6 @@
|
||||
|
||||
extern void (*MaskActionFuncs[])(Entity*);
|
||||
|
||||
extern void sub_08000148(u16, u16, u32);
|
||||
|
||||
extern void sub_0805457C(Entity*, s32);
|
||||
|
||||
void Mask(Entity* this) {
|
||||
MaskActionFuncs[this->action](this);
|
||||
}
|
||||
@@ -79,7 +75,7 @@ void sub_08092A94(Entity* this) {
|
||||
// Presumably, make the mask fall
|
||||
SetTile(this->field_0x7c.HALF_U.LO, this->field_0x7c.HALF_U.HI, 1);
|
||||
|
||||
sub_08000148(this->field_0x7a.HWORD, this->field_0x7c.HALF.HI, 1);
|
||||
sub_08000148(this->field_0x7a.HWORD, (u16)this->field_0x7c.HALF.HI, 1);
|
||||
|
||||
this->action = 2;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ static void sub_0808F2B0(Entity*);
|
||||
void sub_0808F14C(Entity*);
|
||||
void sub_0808F244(Entity*);
|
||||
|
||||
extern void sub_0806FCF4(Entity*, u32, u32, u32);
|
||||
extern void sub_0808F5EC(Entity*);
|
||||
|
||||
extern void (*const gUnk_08121E5C[])(Entity*);
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
#include "object.h"
|
||||
#include "game.h"
|
||||
|
||||
extern void sub_0807B9B8(s32, s32, s32);
|
||||
|
||||
extern void (*const OctorokBossObject_Actions[])(Entity*);
|
||||
extern const u16 gUnk_0812384C[];
|
||||
extern const u16 gUnk_0812388C[];
|
||||
|
||||
Reference in New Issue
Block a user