Put const data in mineralWaterSource

This commit is contained in:
Tal Hayon 2022-04-18 00:33:29 +03:00
parent 90eac705f2
commit 551c36849c
4 changed files with 19 additions and 30 deletions

View File

@ -43552,11 +43552,6 @@
"size": 4,
"type": "animation"
},
{
"path": "mineralWaterSource/MineralWaterSourceParameters.bin",
"start": 1192608,
"size": 4
},
{
"path": "lilypadSmall/gUnk_08123318.bin",
"start": 1192728,

View File

@ -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"

View File

@ -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);

View File

@ -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);