Put const data into cat

This commit is contained in:
Tal Hayon 2022-04-15 22:31:55 +03:00
parent 08eba596c4
commit 1dc422e07c
4 changed files with 113 additions and 101 deletions

View File

@ -37517,36 +37517,6 @@
"size": 36, "size": 36,
"type": "animation" "type": "animation"
}, },
{
"path": "cat/gUnk_08110EF0.bin",
"start": 1117936,
"size": 8
},
{
"path": "cat/gUnk_08110EF8.bin",
"start": 1117944,
"size": 480
},
{
"path": "cat/gUnk_081110FC.bin",
"start": 1118460,
"size": 8
},
{
"path": "cat/gUnk_08111104.bin",
"start": 1118468,
"size": 8
},
{
"path": "cat/gUnk_0811110C.bin",
"start": 1118476,
"size": 3
},
{
"path": "cat/gUnk_0811110F.bin",
"start": 1118479,
"size": 5
},
{ {
"path": "animations/gSpriteAnimations_MountainMinish_0.bin", "path": "animations/gSpriteAnimations_MountainMinish_0.bin",
"start": 1119104, "start": 1119104,

View File

@ -1,34 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_08110EF0:: @ 08110EF0
.incbin "cat/gUnk_08110EF0.bin"
gUnk_08110EF8:: @ 08110EF8
.incbin "cat/gUnk_08110EF8.bin"
gCat:: @ 081110D8
.4byte sub_080677EC
.4byte sub_080678AC
.4byte sub_08067904
.4byte sub_0806797C
.4byte sub_0806799C
.4byte sub_080679C4
.4byte sub_08067A0C
.4byte sub_08067A78
.4byte sub_08067A98
gUnk_081110FC:: @ 081110FC
.incbin "cat/gUnk_081110FC.bin"
gUnk_08111104:: @ 08111104
.incbin "cat/gUnk_08111104.bin"
gUnk_0811110C:: @ 0811110C
.incbin "cat/gUnk_0811110C.bin"
gUnk_0811110F:: @ 0811110F
.incbin "cat/gUnk_0811110F.bin"

View File

@ -1227,7 +1227,7 @@ SECTIONS {
data/animations/npc/carpenter.o(.rodata); data/animations/npc/carpenter.o(.rodata);
src/npc/castorWildsStatue.o(.rodata); src/npc/castorWildsStatue.o(.rodata);
data/animations/npc/castorWildsStatue.o(.rodata); data/animations/npc/castorWildsStatue.o(.rodata);
data/const/npc/cat.o(.rodata); src/npc/cat.o(.rodata);
data/animations/npc/cat.o(.rodata); data/animations/npc/cat.o(.rodata);
src/npc/mountainMinish.o(.rodata); src/npc/mountainMinish.o(.rodata);
data/animations/npc/mountainMinish.o(.rodata); data/animations/npc/mountainMinish.o(.rodata);

View File

@ -6,47 +6,106 @@
#include "npc.h" #include "npc.h"
#include "enemy.h" #include "enemy.h"
extern void sub_08067C44(Entity*); static const Hitbox gUnk_08110EF0 = { 0, -1, { 5, 3, 3, 5 }, 5, 4 };
extern void (*gCat[9])(Entity*); void sub_08067C44(Entity*);
void sub_08067B08(Entity*);
extern Dialog gUnk_08110EF8; u32 sub_08067D20(Entity*);
void sub_08067AAC(Entity*);
extern Hitbox gUnk_08110EF0; void sub_08067B34(Entity*);
extern void sub_08067B08(Entity*); void sub_08067B80(Entity*, u32);
void sub_08067B70(Entity*);
extern u32 sub_08067D20(Entity*); void sub_08067C24(Entity*);
extern void sub_08067AAC(Entity*); void sub_08067BD4(Entity*);
extern void sub_08067B34(Entity*); u32 sub_08067D74(Entity*);
extern void sub_08067B80(Entity*, u32); void sub_08067C18(Entity*);
void sub_08067DCC(Entity*, u32);
extern void sub_08067B70(Entity*); void sub_08067DDC(Entity*);
void sub_080677EC(Entity*);
extern void sub_08067C24(Entity*); void sub_080678AC(Entity*);
extern void sub_08067BD4(Entity*); void sub_08067904(Entity*);
extern u32 sub_08067D74(Entity*); void sub_0806797C(Entity*);
extern void sub_08067C18(Entity*); void sub_0806799C(Entity*);
void sub_080679C4(Entity*);
void sub_08067A0C(Entity*);
void sub_08067A78(Entity*);
void sub_08067A98(Entity*);
extern Hitbox* gUnk_08111154[8]; extern Hitbox* gUnk_08111154[8];
extern void sub_08067DDC(Entity*);
extern u16 gUnk_081110FC[4];
extern void sub_08067DCC(Entity*, u32);
extern u8 gUnk_0811110C[2];
extern u32 gUnk_0811110F;
extern u16 gUnk_08111104[];
extern u32 sub_0806FCA0(Entity*, Entity*);
void sub_08067790(Entity* this) { void sub_08067790(Entity* this) {
ShowNPCDialogue(this, &gUnk_08110EF8 + this->type * 10 + gSave.global_progress); static const Dialog dialogs[][10] = {
{ { 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3503, 0x3504 },
{ 0, 0, 6, 1, 0x3603, 0x3604 },
{ 0, 0, 6, 1, 0x3703, 0x3704 },
{ 0, 0, 6, 1, 0x3803, 0x3804 },
{ 0, 0, 6, 1, 0x3902, 0x3903 },
{ 0, 0, 6, 1, 0x3902, 0x3903 } },
{ { 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3503, 0x3504 },
{ 0, 0, 6, 1, 0x3603, 0x3604 },
{ 0, 0, 6, 1, 0x3703, 0x3704 },
{ 0, 0, 6, 1, 0x3803, 0x3804 },
{ 0, 0, 6, 1, 0x3902, 0x3903 },
{ 0, 0, 6, 1, 0x3902, 0x3903 } },
{ { 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3503, 0x3504 },
{ 0, 0, 6, 1, 0x3603, 0x3604 },
{ 0, 0, 6, 1, 0x3703, 0x3704 },
{ 0, 0, 6, 1, 0x3803, 0x3804 },
{ 0, 0, 6, 1, 0x3902, 0x3903 },
{ 0, 0, 6, 1, 0x3902, 0x3903 } },
{ { 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3503, 0x3504 },
{ 0, 0, 6, 1, 0x3603, 0x3604 },
{ 0, 0, 6, 1, 0x3703, 0x3704 },
{ 0, 0, 6, 1, 0x3803, 0x3804 },
{ 0, 0, 6, 1, 0x3902, 0x3903 },
{ 0, 0, 6, 1, 0x3902, 0x3903 } },
{ { 0, 0, 6, 1, 0x4e17, 0x4e18 },
{ 0, 0, 6, 1, 0x4e17, 0x4e18 },
{ 0, 0, 6, 1, 0x4e17, 0x4e18 },
{ 0, 0, 6, 1, 0x4e17, 0x4e18 },
{ 0, 0, 6, 1, 0x4e17, 0x4e18 },
{ 0, 0, 6, 1, 0x4e17, 0x4e18 },
{ 0, 0, 6, 1, 0x4e17, 0x4e18 },
{ 0, 0, 6, 1, 0x4e17, 0x4e18 },
{ 0, 0, 6, 1, 0x4e17, 0x4e18 },
{ 0, 0, 6, 1, 0x4e17, 0x4e18 } },
{ { 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3407, 0x3408 },
{ 0, 0, 6, 1, 0x3503, 0x3504 },
{ 0, 0, 6, 1, 0x3603, 0x3604 },
{ 0, 0, 6, 1, 0x3703, 0x3704 },
{ 0, 0, 6, 1, 0x3803, 0x3804 },
{ 0, 0, 6, 1, 0x3902, 0x3903 },
{ 0, 0, 6, 1, 0x3902, 0x3903 } },
};
ShowNPCDialogue(this, &dialogs[this->type][gSave.global_progress]);
} }
// Main // Main
void Cat(Entity* ent) { void Cat(Entity* ent) {
gCat[ent->action](ent); static void (*const actionFuncs[9])(Entity*) = {
sub_080677EC, sub_080678AC, sub_08067904, sub_0806797C, sub_0806799C,
sub_080679C4, sub_08067A0C, sub_08067A78, sub_08067A98,
};
actionFuncs[ent->action](ent);
sub_08067C44(ent); sub_08067C44(ent);
if (((ent->flags & ENT_COLLIDE) == 0) && (ent->type != 5)) { if (((ent->flags & ENT_COLLIDE) == 0) && (ent->type != 5)) {
sub_0806ED78(ent); sub_0806ED78(ent);
@ -71,7 +130,7 @@ void sub_080677EC(Entity* this) {
} }
this->field_0x68.HALF.LO = sub_0801E99C(this); this->field_0x68.HALF.LO = sub_0801E99C(this);
this->hitbox = &gUnk_08110EF0; this->hitbox = (Hitbox*)&gUnk_08110EF0;
uVar2 = sub_0805ACC0(this); uVar2 = sub_0805ACC0(this);
if (uVar2 == 0) { if (uVar2 == 0) {
uVar2 = this->x.HALF.HI; uVar2 = this->x.HALF.HI;
@ -198,6 +257,23 @@ void sub_08067A98(Entity* this) {
} }
} }
static const u16 gUnk_081110FC[4] = {
60,
150,
240,
400,
};
static const u16 gUnk_08111104[] = {
180,
300,
450,
600,
};
static const u8 gUnk_0811110C[] = { 0x3c, 0x96, 0x14 };
static const u8 gUnk_0811110F[] = { 0, -4, 8, 8, 0 };
void sub_08067AAC(Entity* this) { void sub_08067AAC(Entity* this) {
this->action = 2; this->action = 2;
this->field_0x70.HALF.HI = gUnk_081110FC[(Random() & 3)]; this->field_0x70.HALF.HI = gUnk_081110FC[(Random() & 3)];
@ -205,7 +281,7 @@ void sub_08067AAC(Entity* this) {
this->spriteSettings.flipX = this->direction >> 4 ^ 1; this->spriteSettings.flipX = this->direction >> 4 ^ 1;
sub_08067DCC(this, 3); sub_08067DCC(this, 3);
sub_08078850(this, 0, gUnk_0811110C[2], &gUnk_0811110F); sub_08078850(this, 0, gUnk_0811110C[2], gUnk_0811110F);
} }
void sub_08067B08(Entity* this) { void sub_08067B08(Entity* this) {
@ -217,7 +293,7 @@ void sub_08067B08(Entity* this) {
void sub_08067B34(Entity* this) { void sub_08067B34(Entity* this) {
sub_08067DCC(this, 0); sub_08067DCC(this, 0);
this->frameDuration = (Random() & 0x30) + 0xb4; this->frameDuration = (Random() & 0x30) + 0xb4;
sub_08078850(this, 0, gUnk_0811110C[this->spriteSettings.flipX], &gUnk_0811110F); sub_08078850(this, 0, gUnk_0811110C[this->spriteSettings.flipX], gUnk_0811110F);
} }
void sub_08067B70(Entity* this) { void sub_08067B70(Entity* this) {
@ -368,7 +444,7 @@ void sub_08067DDC(Entity* this) {
COLLISION_OFF(this); COLLISION_OFF(this);
this->contactFlags = 0; this->contactFlags = 0;
this->iframes = 0; this->iframes = 0;
this->hitbox = &gUnk_08110EF0; this->hitbox = (Hitbox*)&gUnk_08110EF0;
} }
void Cat_Fusion(Entity* this) { void Cat_Fusion(Entity* this) {