From ee11972a67d034707b53145f083094f0463f64f6 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sun, 27 Feb 2022 15:54:12 +0200 Subject: [PATCH] decompile macroShoes --- asm/object/macroShoes.s | 67 ---------------------------------- assets/assets.json | 10 ----- data/const/object/macroShoes.s | 19 ---------- linker.ld | 4 +- src/object/macroShoes.c | 44 ++++++++++++++++++++++ 5 files changed, 46 insertions(+), 98 deletions(-) delete mode 100644 asm/object/macroShoes.s delete mode 100644 data/const/object/macroShoes.s create mode 100644 src/object/macroShoes.c diff --git a/asm/object/macroShoes.s b/asm/object/macroShoes.s deleted file mode 100644 index 606fb405..00000000 --- a/asm/object/macroShoes.s +++ /dev/null @@ -1,67 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start MacroShoes -MacroShoes: @ 0x080984CC - push {r4, lr} - adds r4, r0, #0 - ldr r1, _080984E8 @ =gUnk_08123504 - ldrb r0, [r4, #0xc] - lsls r0, r0, #2 - adds r0, r0, r1 - ldr r1, [r0] - adds r0, r4, #0 - bl _call_via_r1 - adds r0, r4, #0 - bl sub_0800445C - pop {r4, pc} - .align 2, 0 -_080984E8: .4byte gUnk_08123504 - - thumb_func_start sub_080984EC -sub_080984EC: @ 0x080984EC - push {lr} - movs r1, #1 - strb r1, [r0, #0xc] - ldr r2, _08098528 @ =gUnk_081234EC - ldrb r1, [r0, #0xa] - lsls r1, r1, #2 - adds r1, r1, r2 - ldr r1, [r1] - str r1, [r0, #0x48] - ldrb r0, [r0, #0xb] - cmp r0, #1 - bne _08098524 - ldr r0, _0809852C @ =0x00004024 - movs r1, #0x82 - lsls r1, r1, #3 - movs r2, #1 - bl SetTile - ldr r0, _08098530 @ =0x00004026 - ldr r1, _08098534 @ =0x00000411 - movs r2, #1 - bl SetTile - ldr r0, _08098538 @ =0x00004025 - ldr r1, _0809853C @ =0x00000412 - movs r2, #1 - bl SetTile -_08098524: - pop {pc} - .align 2, 0 -_08098528: .4byte gUnk_081234EC -_0809852C: .4byte 0x00004024 -_08098530: .4byte 0x00004026 -_08098534: .4byte 0x00000411 -_08098538: .4byte 0x00004025 -_0809853C: .4byte 0x00000412 - - thumb_func_start nullsub_532 -nullsub_532: @ 0x08098540 - bx lr - .align 2, 0 diff --git a/assets/assets.json b/assets/assets.json index 410ef933..e0627f3f 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -44895,16 +44895,6 @@ "size": 23, "type": "animation" }, - { - "path": "macroShoes/gUnk_081234F4.bin", - "start": 1193204, - "size": 8 - }, - { - "path": "macroShoes/gUnk_081234FC.bin", - "start": 1193212, - "size": 8 - }, { "path": "animations/gSpriteAnimations_PicoBloom_0.bin", "start": 1193338, diff --git a/data/const/object/macroShoes.s b/data/const/object/macroShoes.s deleted file mode 100644 index c0201eea..00000000 --- a/data/const/object/macroShoes.s +++ /dev/null @@ -1,19 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_081234EC:: @ 081234EC - .4byte gUnk_081234F4 - .4byte gUnk_081234FC - -gUnk_081234F4:: @ 081234F4 - .incbin "macroShoes/gUnk_081234F4.bin" - -gUnk_081234FC:: @ 081234FC - .incbin "macroShoes/gUnk_081234FC.bin" - -gUnk_08123504:: @ 08123504 - .4byte sub_080984EC - .4byte nullsub_532 diff --git a/linker.ld b/linker.ld index 93cf0e43..e2ddbcb5 100644 --- a/linker.ld +++ b/linker.ld @@ -768,7 +768,7 @@ SECTIONS { asm/object/object79.o(.text); src/object/steam.o(.text); src/object/pushableLever.o(.text); - asm/object/macroShoes.o(.text); + src/object/macroShoes.o(.text); src/object/objectOnSpinyBeetle.o(.text); src/object/object7E.o(.text); asm/object/picoBloom.o(.text); @@ -1516,7 +1516,7 @@ SECTIONS { src/object/steam.o(.rodata); src/object/pushableLever.o(.rodata); data/animations/object/pushableLever.o(.rodata); - data/const/object/macroShoes.o(.rodata); + src/object/macroShoes.o(.rodata); src/object/objectOnSpinyBeetle.o(.rodata); data/const/object/picoBloom.o(.rodata); data/animations/object/picoBloom.o(.rodata); diff --git a/src/object/macroShoes.c b/src/object/macroShoes.c new file mode 100644 index 00000000..36cc84e5 --- /dev/null +++ b/src/object/macroShoes.c @@ -0,0 +1,44 @@ +#include "entity.h" +#include "asm.h" + +void sub_0800445C(Entity*); +void MacroShoes_Init(Entity*); +void MacroShoes_Idle(Entity*); + +static const Hitbox MacroShoes_Type0Hitbox; +static const Hitbox MacroShoes_Type1Hitbox; + +static const Hitbox* const MacroShoes_TypeHitboxes[] = { + &MacroShoes_Type0Hitbox, + &MacroShoes_Type1Hitbox, +}; + +static const Hitbox MacroShoes_Type0Hitbox = { + 0, 0, { 4, 0, 0, 0 }, 0x34, 0x20, +}; + +static const Hitbox MacroShoes_Type1Hitbox = { + 0, 0, { 4, 0, 0, 0 }, 0x30, 0x10, +}; + +void MacroShoes(Entity* this) { + static void (*const actionFuncs[])(Entity*) = { + MacroShoes_Init, + MacroShoes_Idle, + }; + actionFuncs[this->action](this); + sub_0800445C(this); +} + +void MacroShoes_Init(Entity* this) { + this->action = 1; + this->hitbox = (Hitbox*)MacroShoes_TypeHitboxes[this->type]; + if (this->type2 == 1) { + SetTile(0x4024, 0x410, 1); + SetTile(0x4026, 0x411, 1); + SetTile(0x4025, 0x412, 1); + } +} + +void MacroShoes_Idle(Entity* this) { +}