From 8eaddf08c275cc9d636d4229d1c7d14eda1c7595 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Wed, 13 Apr 2022 19:32:41 +0300 Subject: [PATCH] Move const data into playerItemSwordBeam --- assets/assets.json | 15 --------------- data/const/playerItem/playerItemSwordBeam.s | 18 ------------------ linker.ld | 2 +- src/playerItem/playerItemSwordBeam.c | 21 ++++++++++++--------- 4 files changed, 13 insertions(+), 43 deletions(-) delete mode 100644 data/const/playerItem/playerItemSwordBeam.s diff --git a/assets/assets.json b/assets/assets.json index 5148aa2c..805dae82 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -3626,21 +3626,6 @@ "start": 736896, "size": 1396 }, - { - "path": "playerItemSwordBeam/gUnk_080B43FC.bin", - "start": 738300, - "size": 4 - }, - { - "path": "playerItemSwordBeam/gUnk_080B4400.bin", - "start": 738304, - "size": 8 - }, - { - "path": "playerItemSwordBeam/gUnk_080B4408.bin", - "start": 738312, - "size": 8 - }, { "path": "data_080B4410/gUnk_080B4410_JP.bin", "variants": [ diff --git a/data/const/playerItem/playerItemSwordBeam.s b/data/const/playerItem/playerItemSwordBeam.s deleted file mode 100644 index ee57f440..00000000 --- a/data/const/playerItem/playerItemSwordBeam.s +++ /dev/null @@ -1,18 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_080B43F4:: @ 080B43F4 - .4byte sub_08019498 - .4byte sub_08019580 - -gUnk_080B43FC:: @ 080B43FC - .incbin "playerItemSwordBeam/gUnk_080B43FC.bin" - -gUnk_080B4400:: @ 080B4400 - .incbin "playerItemSwordBeam/gUnk_080B4400.bin" - -gUnk_080B4408:: @ 080B4408 - .incbin "playerItemSwordBeam/gUnk_080B4408.bin" diff --git a/linker.ld b/linker.ld index 69e6f8e6..e9cc6385 100644 --- a/linker.ld +++ b/linker.ld @@ -895,7 +895,7 @@ SECTIONS { data/const/playerItem/playerItemGustBig.o(.rodata); data/const/playerItem/playerItemBow.o(.rodata); data/data_080B3E70.o(.rodata); - data/const/playerItem/playerItemSwordBeam.o(.rodata); + src/playerItem/playerItemSwordBeam.o(.rodata); data/data_080B4410.o(.rodata); src/playerItem/playerItemBomb.o(.rodata); src/playerItem/playerItemBoomerang.o(.rodata); diff --git a/src/playerItem/playerItemSwordBeam.c b/src/playerItem/playerItemSwordBeam.c index 34ee2993..ec5160db 100644 --- a/src/playerItem/playerItemSwordBeam.c +++ b/src/playerItem/playerItemSwordBeam.c @@ -7,27 +7,30 @@ #include "common.h" #include "asm.h" -extern void (*const gUnk_080B43F4[])(Entity*); - -extern Hitbox gUnk_080B4408; -extern u8 gUnk_080B43FC[]; +void sub_08019498(Entity*); void sub_08019580(Entity*); - -extern u8 gUnk_08003E44; void sub_08019644(Entity*); -extern u8 gUnk_080B4400[]; +extern u8 gUnk_08003E44; void PlayerItemSwordBeam(Entity* this) { - gUnk_080B43F4[this->action](this); + static void (*const actionFuncs[])(Entity*) = { + sub_08019498, + sub_08019580, + }; + actionFuncs[this->action](this); } +static const u8 gUnk_080B43FC[] = { 30, 29, 30, 29 }; +static const u8 gUnk_080B4400[] = { 0, 4, 1, 2, -1, 0, 0, 0 }; + void sub_08019498(Entity* this) { + static const Hitbox gUnk_080B4408 = { 0, 0, { 4, 0, 0, 0 }, 6, 6 }; CopyPosition(&gPlayerEntity, this); this->action += 0x01; this->spriteSettings.draw = 1; this->collisionFlags = gPlayerEntity.collisionFlags + 1; - this->hitbox = &gUnk_080B4408; + this->hitbox = (Hitbox*)&gUnk_080B4408; this->speed = 0x380; *(u32*)&this->field_0x74 = 2; this->field_0x70.WORD = 0;