Put const data in cow

This commit is contained in:
Tal Hayon 2022-04-19 19:51:17 +03:00
parent 6e38ea7c86
commit 7239c05a1a
4 changed files with 27 additions and 36 deletions

View File

@ -37598,11 +37598,6 @@
"size": 8, "size": 8,
"type": "animation" "type": "animation"
}, },
{
"path": "cow/gUnk_08111938.bin",
"start": 1120568,
"size": 40
},
{ {
"path": "animations/gSpriteAnimations_Goron_0.bin", "path": "animations/gSpriteAnimations_Goron_0.bin",
"start": 1120964, "start": 1120964,

View File

@ -1,21 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_08111914:: @ 08111914
.4byte sub_08068FC0
.4byte sub_08069018
.4byte sub_08069068
.4byte sub_08069124
.4byte sub_080691E0
gUnk_08111928:: @ 08111928
.4byte sub_08069148
.4byte sub_08069168
.4byte sub_08069188
.4byte sub_080691BC
gUnk_08111938:: @ 08111938
.incbin "cow/gUnk_08111938.bin"

View File

@ -1234,7 +1234,7 @@ SECTIONS {
data/animations/npc/melari.o(.rodata); data/animations/npc/melari.o(.rodata);
data/const/npc/bladeBrothers.o(.rodata); data/const/npc/bladeBrothers.o(.rodata);
data/animations/npc/bladeBrothers.o(.rodata); data/animations/npc/bladeBrothers.o(.rodata);
data/const/npc/cow.o(.rodata); src/npc/cow.o(.rodata);
data/animations/npc/cow.o(.rodata); data/animations/npc/cow.o(.rodata);
src/npc/goron.o(.rodata); src/npc/goron.o(.rodata);
data/animations/npc/goron.o(.rodata); data/animations/npc/goron.o(.rodata);

View File

@ -7,13 +7,21 @@
void sub_0806920C(Entity* ent); void sub_0806920C(Entity* ent);
void sub_0806924C(Entity* ent); void sub_0806924C(Entity* ent);
void sub_08068FC0(Entity* ent);
extern void (*gUnk_08111914[])(Entity*); void sub_08069018(Entity* ent);
extern void (*gUnk_08111928[])(Entity*); void sub_08069068(Entity* ent);
extern Dialog gUnk_08111938[]; void sub_08069124(Entity* ent);
void sub_080691E0(Entity* ent);
void sub_08069148(Entity* ent);
void sub_08069168(Entity* ent);
void sub_08069188(Entity* ent);
void sub_080691BC(Entity* ent);
void Cow(Entity* ent) { void Cow(Entity* ent) {
gUnk_08111914[ent->action](ent); static void (*const actionFuncs[])(Entity*) = {
sub_08068FC0, sub_08069018, sub_08069068, sub_08069124, sub_080691E0,
};
actionFuncs[ent->action](ent);
sub_0806ED78(ent); sub_0806ED78(ent);
sub_0806920C(ent); sub_0806920C(ent);
} }
@ -127,8 +135,14 @@ void sub_08069068(Entity* ent) {
} }
void sub_08069124(Entity* ent) { void sub_08069124(Entity* ent) {
static void (*const subActionFuncs[])(Entity*) = {
sub_08069148,
sub_08069168,
sub_08069188,
sub_080691BC,
};
UpdateAnimationSingleFrame(ent); UpdateAnimationSingleFrame(ent);
gUnk_08111928[ent->subAction](ent); subActionFuncs[ent->subAction](ent);
sub_0806924C(ent); sub_0806924C(ent);
} }
@ -152,7 +166,7 @@ void sub_08069188(Entity* ent) {
return; return;
ent->frame = 0; ent->frame = 0;
if (((s8)--ent->subtimer) != 0) if (--ent->subtimer != 0)
return; return;
ent->subAction = 3; ent->subAction = 3;
InitAnimationForceUpdate(ent, ent->animationState + 16); InitAnimationForceUpdate(ent, ent->animationState + 16);
@ -175,11 +189,15 @@ void sub_080691E0(Entity* ent) {
// Show dialogue // Show dialogue
void Cow_ShowDialogue(Entity* ent) { void Cow_ShowDialogue(Entity* ent) {
static const Dialog gUnk_08111938[] = { { 0x0, 0x0, 6, 1, { 0x2018, 0x3f34 } },
{ 0x0, 0x0, 6, 1, { 0x2018, 0x3f35 } },
{ 0x0, 0x0, 6, 1, { 0x2018, 0x3f36 } },
{ 0x0, 0x0, 6, 1, { 0x2018, 0x3f37 } },
{ 0x0, 0x0, 6, 1, { 0x2018, 0x3f38 } } };
ShowNPCDialogue(ent, &gUnk_08111938[ent->type]); ShowNPCDialogue(ent, &gUnk_08111938[ent->type]);
} }
void sub_0806920C(Entity* ent) { void sub_0806920C(Entity* ent) {
// TODO: figure out what bitfield flag this is
u32 var0 = gPlayerState.flags & PL_MINISH; u32 var0 = gPlayerState.flags & PL_MINISH;
u32 var1 = -var0 >> 0x1F; u32 var1 = -var0 >> 0x1F;
@ -198,7 +216,6 @@ void sub_0806920C(Entity* ent) {
void sub_0806924C(Entity* ent) { void sub_0806924C(Entity* ent) {
s8 itype = ent->interactType; s8 itype = ent->interactType;
if (itype != 0) { if (itype != 0) {
// TODO: figure out what bitfield flag this is
if ((gPlayerState.flags & PL_MINISH) != 0) { if ((gPlayerState.flags & PL_MINISH) != 0) {
if (itype == 2) { if (itype == 2) {
ent->action = 4; ent->action = 4;