Merge pull request #344 from hatal175/cucco

This commit is contained in:
notyourav
2022-02-02 00:55:41 -08:00
committed by GitHub
7 changed files with 67 additions and 181 deletions
+66 -12
View File
@@ -1,20 +1,19 @@
#include "npc.h"
#include "functions.h"
extern void (*const gUnk_081145B4[])(Entity*);
void (*const Cucco_Actions[])(Entity*);
const u16 Cucco_Sounds[];
const u16 Cucco_Messages[];
void sub_0806E4EC(Entity*);
void sub_0806E6A8(Entity*);
extern u16 gUnk_081145C8[];
void Cucco_ShowMessage(Entity*);
void sub_0806E65C(Entity* this);
void Cucco(Entity* this) {
gUnk_081145B4[this->action](this);
Cucco_Actions[this->action](this);
}
void sub_0806E4B8(Entity* this) {
void Cucco_Init(Entity* this) {
this->action += 1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_080787A8(this, this->field_0x68.HALF.LO);
@@ -37,16 +36,56 @@ void sub_0806E4EC(Entity* this) {
}
this->subAction = 0;
if ((Random() & 1) != 0) {
EnqueueSFX(gUnk_081145C8[Random() & 3]);
EnqueueSFX(Cucco_Sounds[Random() & 3]);
}
}
sub_0806E65C(this);
UpdateAnimationSingleFrame(this);
}
ASM_FUNC("asm/non_matching/cucco/sub_0806E564.inc", void sub_0806E564(Entity* this))
void Cucco_Fly(Entity* this) {
if (this->subAction == 0) {
this->subAction++;
if (Random() & 1) {
this->spriteSettings.flipX ^= 1;
}
ASM_FUNC("asm/non_matching/cucco/sub_0806E5E4.inc", void sub_0806E5E4(Entity* this))
this->actionDelay = (Random() & 1) + 1;
this->zVelocity = 0x18000;
InitAnimationForceUpdate(this, 1);
}
if (GravityUpdate(this, 0x2800) == 0) {
if (--this->actionDelay == 0) {
this->action = 1;
this->subAction = 0;
} else {
this->zVelocity = 0x18000;
}
}
sub_0806E65C(this);
UpdateAnimationSingleFrame(this);
}
void Cucco_Idle(Entity* this) {
if (this->subAction == 0) {
this->subAction++;
if (Random() & 1) {
this->spriteSettings.flipX ^= 1;
}
InitAnimationForceUpdate(this, (Random() & 1) + 2);
}
if (this->frame & 0x80) {
this->action = 1;
this->subAction = 0;
}
sub_0806E65C(this);
UpdateAnimationSingleFrame(this);
}
void sub_0806E648(Entity* this) {
if (UpdateFuseInteraction(this) != 0) {
@@ -61,7 +100,7 @@ void sub_0806E65C(Entity* this) {
this->action = 4;
sub_0806F118(this);
} else {
sub_0806E6A8(this);
Cucco_ShowMessage(this);
}
} else {
ResetPlayerAnimationAndAction();
@@ -71,7 +110,15 @@ void sub_0806E65C(Entity* this) {
}
}
ASM_FUNC("asm/non_matching/cucco/sub_0806E6A8.inc", void sub_0806E6A8(Entity* this))
void Cucco_ShowMessage(Entity* this) {
u32 val = 0;
u32 index = sub_08002632(this);
if (gSave.unk1C1[index] == 0xf3) {
val = 1;
}
MessageNoOverlap(Cucco_Messages[val], this);
}
void Cucco_Fusion(Entity* this) {
if (this->action == 0) {
@@ -82,3 +129,10 @@ void Cucco_Fusion(Entity* this) {
UpdateAnimationSingleFrame(this);
}
}
void (*const Cucco_Actions[])(Entity*) = {
Cucco_Init, sub_0806E4EC, Cucco_Fly, Cucco_Idle, sub_0806E648,
};
const u16 Cucco_Sounds[] = { SFX_VO_CUCCO1, SFX_VO_CUCCO2, SFX_VO_CUCCO3, SFX_VO_CUCCO4 };
const u16 Cucco_Messages[] = { 0xdb4, 0xdb5 };