Move some const data into code files

This commit is contained in:
Tal Hayon
2022-04-13 00:02:03 +03:00
parent 02cec8ca8d
commit e809532548
42 changed files with 326 additions and 526 deletions
+39 -21
View File
@@ -10,18 +10,36 @@ typedef struct {
u32 unk_68;
} PlayerItemBombEntity;
extern void (*const gUnk_080B77C8[])(Entity*);
void sub_0801B418(Entity*);
void sub_0801B3A4(PlayerItemBombEntity*);
void sub_0801B250(PlayerItemBombEntity*);
void sub_0801B2CC(PlayerItemBombEntity*);
void sub_0801B318(PlayerItemBombEntity*);
void sub_0801B38C(PlayerItemBombEntity*);
void sub_0801B330(PlayerItemBombEntity*);
void sub_0801B340(PlayerItemBombEntity*);
void sub_0801B354(PlayerItemBombEntity*);
void sub_0801B368(PlayerItemBombEntity*);
void sub_0801B384(PlayerItemBombEntity*);
extern void (*const gUnk_080B77D8[])(Entity*);
static void (*const actionFuncs[])(PlayerItemBombEntity*) = {
sub_0801B250,
sub_0801B2CC,
sub_0801B318,
sub_0801B38C,
};
extern const Hitbox gUnk_080B77F4;
static void (*const subActionFuncs[])(PlayerItemBombEntity*) = {
sub_0801B330, sub_0801B340, sub_0801B354, sub_0801B368, sub_0801B384,
};
static const Hitbox unusedHitbox = { 0, 0, { 4, 0, 0, 4 }, 22, 22 };
static const Hitbox gUnk_080B77F4 = { 0, 0, 6, 0, 0, 6, 4, 4 };
void PlayerItemBomb(PlayerItemBombEntity* this) {
u8 uVar1, uVar2;
gUnk_080B77C8[super->action](super);
actionFuncs[super->action](this);
GetNextFrame(super);
uVar2 = uVar1 = super->action;
if (uVar1 != 0x03) {
@@ -102,37 +120,37 @@ void sub_0801B2CC(PlayerItemBombEntity* this) {
}
}
void sub_0801B318(Entity* this) {
gUnk_080B77D8[this->subAction](this);
void sub_0801B318(PlayerItemBombEntity* this) {
subActionFuncs[super->subAction](this);
}
void sub_0801B330(Entity* this) {
this->subAction += 1;
sub_08079BD8(this);
void sub_0801B330(PlayerItemBombEntity* this) {
super->subAction += 1;
sub_08079BD8(super);
}
void sub_0801B340(Entity* this) {
this->spritePriority.b1 = 2;
void sub_0801B340(PlayerItemBombEntity* this) {
super->spritePriority.b1 = 2;
}
void sub_0801B354(Entity* this) {
this->spritePriority.b1 = 3;
void sub_0801B354(PlayerItemBombEntity* this) {
super->spritePriority.b1 = 3;
}
void sub_0801B368(Entity* this) {
this->action -= 1;
this->subAction = 0;
if (0x3c < this->timer) {
this->timer = 0x3c;
void sub_0801B368(PlayerItemBombEntity* this) {
super->action -= 1;
super->subAction = 0;
if (0x3c < super->timer) {
super->timer = 0x3c;
}
}
void sub_0801B384(Entity* this) {
void sub_0801B384(PlayerItemBombEntity* this) {
DeleteThisEntity();
}
void sub_0801B38C(Entity* this) {
if (this->timer-- == 0) {
void sub_0801B38C(PlayerItemBombEntity* this) {
if (super->timer-- == 0) {
DeleteThisEntity();
}
}
+11 -9
View File
@@ -4,13 +4,14 @@
#include "item.h"
#include "object.h"
extern void (*const gUnk_080FEEA8[])(Entity*);
void sub_08054AC8(Entity*);
extern const s8 gUnk_080FEEB0[];
void sub_08054A60(Entity*);
void PlayerItemLantern(Entity* this) {
static void (*const gUnk_080FEEA8[])(Entity*) = {
sub_08054A60,
sub_08054AC8,
};
gUnk_080FEEA8[this->action](this);
this->contactFlags = 0;
}
@@ -35,9 +36,10 @@ void sub_08054A60(Entity* this) {
void sub_08054AC8(Entity* this) {
Entity* object;
static const s8 offsets[] = { 6, -6, 7, -3, -5, 2, -7, -3 };
this->animationState = gPlayerEntity.animationState & 0xe;
this->hitbox->offset_x = gUnk_080FEEB0[this->animationState];
this->hitbox->offset_y = gUnk_080FEEB0[this->animationState + 1];
this->hitbox->offset_x = offsets[this->animationState];
this->hitbox->offset_y = offsets[this->animationState + 1];
this->hitbox->width = 4;
this->hitbox->height = 4;
if (!((gPlayerEntity.frameIndex < 0x37) && ((u32)gPlayerEntity.spriteIndex == 6))) {
@@ -59,10 +61,10 @@ void sub_08054AC8(Entity* this) {
this->timer = 4;
object = CreateObject(OBJECT_45, 0, 0x10);
if (object != NULL) {
PositionRelative(this, object, 0, 0x20000);
PositionRelative(this, object, 0, Q_16_16(2.0));
object->spritePriority.b0 = this->spritePriority.b0;
object->spriteOffsetX = gUnk_080FEEB0[this->animationState];
object->spriteOffsetY = gUnk_080FEEB0[this->animationState + 1];
object->spriteOffsetX = offsets[this->animationState];
object->spriteOffsetY = offsets[this->animationState + 1];
}
}
sub_08078E84(this, &gPlayerEntity);