summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTal Hayon <talhayon1@gmail.com>2022-04-13 19:48:14 +0300
committerTal Hayon <talhayon1@gmail.com>2022-04-13 19:48:14 +0300
commit875fd3e02455352f54eea51b8bfeba62343c750f (patch)
tree56523c8e075082d5acfca173b9563f67b81287c1
parent8eaddf08c275cc9d636d4229d1c7d14eda1c7595 (diff)
put const data in playerItemBow
-rw-r--r--assets/assets.json30
-rw-r--r--data/const/playerItem/playerItemBow.s21
-rw-r--r--data/data_080B3E70.s6
-rw-r--r--linker.ld2
-rw-r--r--src/playerItem/playerItemBow.c53
5 files changed, 36 insertions, 76 deletions
diff --git a/assets/assets.json b/assets/assets.json
index 805dae82..59ff182f 100644
--- a/assets/assets.json
+++ b/assets/assets.json
@@ -3592,36 +3592,6 @@
"size": 8
},
{
- "path": "playerItemBow/gUnk_080B3E40.bin",
- "start": 736832,
- "size": 8
- },
- {
- "path": "playerItemBow/gUnk_080B3E40_1.bin",
- "start": 736844,
- "size": 8
- },
- {
- "path": "playerItemBow/gUnk_080B3E40_2.bin",
- "start": 736856,
- "size": 8
- },
- {
- "path": "playerItemBow/gUnk_080B3E40_3.bin",
- "start": 736868,
- "size": 8
- },
- {
- "path": "data_080B3E70/gUnk_080B3E70.bin",
- "start": 736880,
- "size": 8
- },
- {
- "path": "data_080B3E70/gUnk_080B3E78.bin",
- "start": 736888,
- "size": 8
- },
- {
"path": "data_080B3E70/gUnk_080B3E80.bin",
"start": 736896,
"size": 1396
diff --git a/data/const/playerItem/playerItemBow.s b/data/const/playerItem/playerItemBow.s
deleted file mode 100644
index 45d3e213..00000000
--- a/data/const/playerItem/playerItemBow.s
+++ /dev/null
@@ -1,21 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .section .rodata
- .align 2
-
-gUnk_080B3E30:: @ 080B3E30
- .4byte sub_08018FE4
- .4byte sub_0801917C
- .4byte sub_08019410
- .4byte sub_08019444
-
-gUnk_080B3E40:: @ 080B3E40
- .incbin "playerItemBow/gUnk_080B3E40.bin"
- .4byte gUnk_080B3E78
- .incbin "playerItemBow/gUnk_080B3E40_1.bin"
- .4byte gUnk_080B3E70
- .incbin "playerItemBow/gUnk_080B3E40_2.bin"
- .4byte gUnk_080B3E78
- .incbin "playerItemBow/gUnk_080B3E40_3.bin"
- .4byte gUnk_080B3E70
diff --git a/data/data_080B3E70.s b/data/data_080B3E70.s
index d8421c03..772b73cc 100644
--- a/data/data_080B3E70.s
+++ b/data/data_080B3E70.s
@@ -4,11 +4,5 @@
.section .rodata
.align 2
-gUnk_080B3E70:: @ 080B3E70
- .incbin "data_080B3E70/gUnk_080B3E70.bin"
-
-gUnk_080B3E78:: @ 080B3E78
- .incbin "data_080B3E70/gUnk_080B3E78.bin"
-
gUnk_080B3E80:: @ 080B3E80
.incbin "data_080B3E70/gUnk_080B3E80.bin"
diff --git a/linker.ld b/linker.ld
index e9cc6385..a38a9b18 100644
--- a/linker.ld
+++ b/linker.ld
@@ -893,7 +893,7 @@ SECTIONS {
src/collision.o(.rodata);
data/data_080B3740.o(.rodata);
data/const/playerItem/playerItemGustBig.o(.rodata);
- data/const/playerItem/playerItemBow.o(.rodata);
+ src/playerItem/playerItemBow.o(.rodata);
data/data_080B3E70.o(.rodata);
src/playerItem/playerItemSwordBeam.o(.rodata);
data/data_080B4410.o(.rodata);
diff --git a/src/playerItem/playerItemBow.c b/src/playerItem/playerItemBow.c
index 8d58c563..5451585f 100644
--- a/src/playerItem/playerItemBow.c
+++ b/src/playerItem/playerItemBow.c
@@ -9,8 +9,6 @@
#include "sound.h"
#include "save.h"
-extern void (*const gUnk_080B3E30[])(Entity*);
-
typedef struct {
Entity base;
u8 unk_68;
@@ -30,13 +28,9 @@ typedef struct {
s8 unk_5;
u8 animIndex;
u8 unk_7;
- Hitbox* hitbox;
+ const Hitbox* hitbox;
} struct_080B3E40;
-extern const struct_080B3E40 gUnk_080B3E40[];
-
-void sub_0801917C(PlayerItemBowEntity*);
-
extern u8 gUnk_08003E44;
extern Entity* sub_08008782(Entity*, u32, s32, s32);
@@ -44,11 +38,34 @@ extern void sub_08017744(Entity*);
extern void ModArrows(s32);
void sub_08019468(PlayerItemBowEntity*);
+void sub_08018FE4(PlayerItemBowEntity*);
+void sub_0801917C(PlayerItemBowEntity*);
+void sub_08019410(PlayerItemBowEntity*);
+void sub_08019444(PlayerItemBowEntity*);
void PlayerItemBow(Entity* this) {
- gUnk_080B3E30[(this->action)](this);
+ static void (*const gUnk_080B3E30[])(PlayerItemBowEntity*) = {
+ sub_08018FE4,
+ sub_0801917C,
+ sub_08019410,
+ sub_08019444,
+ };
+ gUnk_080B3E30[this->action]((PlayerItemBowEntity*)this);
}
+static const Hitbox gUnk_080B3E70;
+static const Hitbox gUnk_080B3E78;
+
+static const struct_080B3E40 gUnk_080B3E40[] = {
+ { -3, -12, 0, 0, 0, -5, 2, 0, &gUnk_080B3E78 },
+ { 8, -4, 1, 0, 5, 0, 1, 0, &gUnk_080B3E70 },
+ { 0, 1, 0, 1, 0, 5, 2, 0, &gUnk_080B3E78 },
+ { -8, -4, 0, 0, -5, 0, 1, 0, &gUnk_080B3E70 },
+};
+
+static const Hitbox gUnk_080B3E70 = { 0, 0, { 4, 0, 0, 0 }, 6, 4 };
+static const Hitbox gUnk_080B3E78 = { 0, 0, { 0, 0, 0, 4 }, 4, 6 };
+
void sub_08018FE4(PlayerItemBowEntity* this) {
Entity* object;
const struct_080B3E40* ptr;
@@ -81,7 +98,7 @@ void sub_08018FE4(PlayerItemBowEntity* this) {
super->animIndex = ptr->animIndex;
this->unk_6c = ptr->unk_4;
this->unk_70 = ptr->unk_5;
- super->hitbox = ptr->hitbox;
+ super->hitbox = (Hitbox*)ptr->hitbox;
sub_0801766C(super);
if (super->hurtType == 0x0e) {
super->animIndex += 6;
@@ -221,21 +238,21 @@ void sub_0801917C(PlayerItemBowEntity* this) {
}
}
-void sub_08019410(Entity* this) {
- if (this->timer < 0xf) {
- InitializeAnimation(this, this->animIndex);
+void sub_08019410(PlayerItemBowEntity* this) {
+ if (super->timer < 0xf) {
+ InitializeAnimation(super, super->animIndex);
} else {
- GetNextFrame(this);
+ GetNextFrame(super);
}
- if (this->timer-- == 0) {
+ if (super->timer-- == 0) {
DeleteThisEntity();
}
}
-void sub_08019444(Entity* this) {
- GetNextFrame(this);
- LinearMoveUpdate(this);
- if (GravityUpdate(this, Q_8_8(32.0)) == 0) {
+void sub_08019444(PlayerItemBowEntity* this) {
+ GetNextFrame(super);
+ LinearMoveUpdate(super);
+ if (GravityUpdate(super, Q_8_8(32.0)) == 0) {
DeleteThisEntity();
}
}