From 551c36849c528574da44d93e964fe8ded3d3307b Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Mon, 18 Apr 2022 00:33:29 +0300 Subject: [PATCH] Put const data in mineralWaterSource --- assets/assets.json | 5 ----- data/const/object/mineralWaterSource.s | 12 ----------- linker.ld | 2 +- src/object/mineralWaterSource.c | 30 +++++++++++++++----------- 4 files changed, 19 insertions(+), 30 deletions(-) delete mode 100644 data/const/object/mineralWaterSource.s diff --git a/assets/assets.json b/assets/assets.json index 50118494..118e1fa1 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -43552,11 +43552,6 @@ "size": 4, "type": "animation" }, - { - "path": "mineralWaterSource/MineralWaterSourceParameters.bin", - "start": 1192608, - "size": 4 - }, { "path": "lilypadSmall/gUnk_08123318.bin", "start": 1192728, diff --git a/data/const/object/mineralWaterSource.s b/data/const/object/mineralWaterSource.s deleted file mode 100644 index 5518b904..00000000 --- a/data/const/object/mineralWaterSource.s +++ /dev/null @@ -1,12 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -MineralWaterSourceActionFuncs:: @ 08123298 - .4byte MineralWaterSource_Init - .4byte sub_080973DC - -MineralWaterSourceParameters:: @ 081232A0 - .incbin "mineralWaterSource/MineralWaterSourceParameters.bin" diff --git a/linker.ld b/linker.ld index 68c8e5b3..40b322d5 100644 --- a/linker.ld +++ b/linker.ld @@ -1467,7 +1467,7 @@ SECTIONS { data/animations/object/crenelBeanSprout.o(.rodata); src/object/minecartDoor.o(.rodata); src/object/objectOnPillar.o(.rodata); - data/const/object/mineralWaterSource.o(.rodata); + src/object/mineralWaterSource.o(.rodata); src/object/object70.o(.rodata); src/object/pushableGrave.o(.rodata); src/object/stoneTablet.o(.rodata); diff --git a/src/object/mineralWaterSource.c b/src/object/mineralWaterSource.c index 40f40837..12f066f4 100644 --- a/src/object/mineralWaterSource.c +++ b/src/object/mineralWaterSource.c @@ -1,22 +1,28 @@ #include "object.h" -extern void (*MineralWaterSourceActionFuncs[])(Entity*); +void MineralWaterSource_Init(Entity*); +void sub_080973DC(Entity*); typedef struct { - u8 field_0x00; - u8 field_0x01; - u8 field_0x02; - u8 field_0x03; + u8 type2; + u8 hitboxWidth; + u8 hitboxHeight; + u8 hurtType; } UnkStruct_MineralWater; -extern UnkStruct_MineralWater MineralWaterSourceParameters[]; - void MineralWaterSource(Entity* this) { + static void (*const MineralWaterSourceActionFuncs[])(Entity*) = { + MineralWaterSource_Init, + sub_080973DC, + }; MineralWaterSourceActionFuncs[this->action](this); } void MineralWaterSource_Init(Entity* this) { - UnkStruct_MineralWater* unknownParameters; + static const UnkStruct_MineralWater MineralWaterSourceParameters[] = { + { 0x27, 0x30, 0x20, 0x4D }, + }; + const UnkStruct_MineralWater* unknownParameters; if (AllocMutableHitbox(this) == NULL) { return; @@ -24,11 +30,11 @@ void MineralWaterSource_Init(Entity* this) { unknownParameters = &MineralWaterSourceParameters[this->type]; - this->type2 = unknownParameters->field_0x00; - this->hurtType = unknownParameters->field_0x03; + this->type2 = unknownParameters->type2; + this->hurtType = unknownParameters->hurtType; - this->hitbox->width = unknownParameters->field_0x01; - this->hitbox->height = unknownParameters->field_0x02; + this->hitbox->width = unknownParameters->hitboxWidth; + this->hitbox->height = unknownParameters->hitboxHeight; COLLISION_ON(this);