1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-06 06:10:21 +00:00

Forest Stage and related actors and objects (#618)

* starting out

* match demo

* full match

* cleanup

* more names

* more names

* headers

* dist from link

* docs

* objects

* format

* organization of xmls

* merge actor

* Update src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c

Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>

* Update src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c

Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>

* format

Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Fig02 <fig02srl@gmail.com>
Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>
This commit is contained in:
petrie911 2021-02-12 16:25:02 -06:00 committed by GitHub
parent ef272322eb
commit b8c2ec1f60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
90 changed files with 1734 additions and 5992 deletions

View file

@ -1,14 +1,33 @@
/*
* File: z_en_dnt_demo.c
* Overlay: ovl_En_Dnt_Demo
* Description: Forest Stage minigame
*/
#include "z_en_dnt_demo.h"
#include "overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h"
#include "overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h"
#include "vt.h"
#define FLAGS 0x00000000
#define THIS ((EnDntDemo*)thisx)
typedef enum {
/* 0 */ DNT_LIKE,
/* 1 */ DNT_HATE,
/* 2 */ DNT_LOVE
} EnDntDemoResults;
void EnDntDemo_Init(Actor* thisx, GlobalContext* globalCtx);
void EnDntDemo_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnDntDemo_Update(Actor* thisx, GlobalContext* globalCtx);
void EnDntDemo_Update(Actor* this, GlobalContext* globalCtx);
void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx);
void EnDntDemo_Results(EnDntDemo* this, GlobalContext* globalCtx);
void EnDntDemo_Prize(EnDntDemo* this, GlobalContext* globalCtx);
/*
const ActorInit En_Dnt_Demo_InitVars = {
ACTOR_EN_DNT_DEMO,
ACTORCAT_PROP,
@ -20,15 +39,302 @@ const ActorInit En_Dnt_Demo_InitVars = {
(ActorFunc)EnDntDemo_Update,
NULL,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Demo/EnDntDemo_Destroy.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Demo/EnDntDemo_Init.s")
//! @bug
//! This table is missing a column for the Mask of Truth, so it reads the first value of the next row. In the last row,
//! it reads the first entry of sResultValues (4), which is an invalid result. The scrubs have no reaction in this case.
static s16 sResultTable[8][7] = {
/* Keaton Skull Spooky Bunny Goron Zora Gerudo Truth */
{ DNT_LIKE, DNT_HATE, DNT_LIKE, DNT_HATE, DNT_LOVE, DNT_LIKE, DNT_HATE }, /* DNT_HATE */
{ DNT_HATE, DNT_LIKE, DNT_HATE, DNT_LIKE, DNT_HATE, DNT_HATE, DNT_LOVE }, /* DNT_LOVE */
{ DNT_LOVE, DNT_HATE, DNT_HATE, DNT_HATE, DNT_LIKE, DNT_LIKE, DNT_LIKE }, /* DNT_HATE */
{ DNT_HATE, DNT_LOVE, DNT_HATE, DNT_HATE, DNT_HATE, DNT_HATE, DNT_LIKE }, /* DNT_LIKE */
{ DNT_LIKE, DNT_LIKE, DNT_LOVE, DNT_LIKE, DNT_LIKE, DNT_LIKE, DNT_HATE }, /* DNT_LIKE */
{ DNT_LIKE, DNT_LIKE, DNT_LIKE, DNT_LOVE, DNT_HATE, DNT_LOVE, DNT_LIKE }, /* DNT_HATE */
{ DNT_HATE, DNT_HATE, DNT_HATE, DNT_HATE, DNT_HATE, DNT_HATE, DNT_HATE }, /* DNT_LOVE */
{ DNT_LOVE, DNT_LOVE, DNT_LOVE, DNT_LOVE, DNT_LOVE, DNT_LOVE, DNT_LOVE }, /* INVALID */
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Demo/func_809F0AA4.s")
static s16 sResultValues[3][2] = {
/* DNT_LIKE */ { DNT_SIGNAL_HIDE, DNT_ACTION_LOW_RUPEES },
/* DNT_HATE */ { DNT_SIGNAL_HIDE, DNT_ACTION_ATTACK },
/* DNT_LOVE */ { DNT_SIGNAL_DANCE, DNT_ACTION_DANCE },
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Demo/func_809F1100.s")
static Vec3f sScrubPos[] = {
{ 3810.0f, -20.0f, 1010.0f }, { 3890.0f, -20.0f, 990.0f }, { 3730.0f, -20.0f, 950.0f },
{ 3840.0f, -20.0f, 930.0f }, { 3910.0f, -20.0f, 870.0f }, { 3780.0f, -20.0f, 860.0f },
{ 3710.0f, -20.0f, 840.0f }, { 3860.0f, -20.0f, 790.0f }, { 3750.0f, -20.0f, 750.0f },
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Demo/func_809F1374.s")
void EnDntDemo_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Demo/EnDntDemo_Update.s")
void EnDntDemo_Init(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
EnDntDemo* this = THIS;
s32 i;
s32 pad;
osSyncPrintf("\n\n");
// Deku Scrub mask show start
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ デグナッツお面品評会開始 ☆☆☆☆☆ \n" VT_RST);
for (i = 0; i < 9; i++) {
this->scrubPos[i] = sScrubPos[i];
this->scrubs[i] = (EnDntNomal*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx,
ACTOR_EN_DNT_NOMAL, this->scrubPos[i].x, this->scrubPos[i].y,
this->scrubPos[i].z, 0, 0, 0, i + ENDNTNOMAL_STAGE);
if (this->scrubs[i] != NULL) {
// zako zako [small fries]
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ ザコザコ ☆☆☆☆☆ %x\n" VT_RST, this->scrubs[i]);
}
}
this->leaderPos.x = 4050.0f;
this->leaderPos.y = -20.0f;
this->leaderPos.z = 1000.0f;
this->leader = (EnDntJiji*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_DNT_JIJI,
this->leaderPos.x, this->leaderPos.y, this->leaderPos.z, 0, 0, 0, 0);
if (this->leader != NULL) {
// jiji jiji jiji jiji jiji [onomatopoeia for the scrub sound?]
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ じじじじじじじじじじい ☆☆☆☆☆ %x\n" VT_RST, this->leader);
}
this->subCamera = 0;
this->actor.flags &= ~1;
this->actionFunc = EnDntDemo_Judge;
}
void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) {
s16 delay;
s16 reaction;
s16 rand9;
s16 maskIdx;
s16 resultIdx;
u8 ignore;
s32 i;
if (this->leaderSignal != DNT_SIGNAL_NONE) {
for (i = 0; i < 9; i++) {
this->scrubs[i]->stageSignal = this->leaderSignal;
this->scrubs[i]->action = this->action;
this->scrubs[i]->stagePrize = DNT_PRIZE_NONE;
}
if (this->leader->isSolid) {
this->leader->stageSignal = DNT_LEADER_SIGNAL_BURROW;
}
this->leaderSignal = DNT_SIGNAL_NONE;
this->actionFunc = EnDntDemo_Results;
} else if ((this->actor.xzDistToPlayer > 30.0f) || (Player_GetMask(globalCtx) == 0)) {
this->debugArrowTimer++;
if (this->subCamera != 0) {
this->subCamera = 0;
}
if (this->judgeTimer != 0) {
for (i = 0; i < 9; i++) {
this->scrubs[i]->stageSignal = DNT_SIGNAL_HIDE;
}
this->judgeTimer = 0;
}
} else {
if ((Player_GetMask(globalCtx) != 0) && (this->subCamera == 0)) {
this->subCamera = func_800800F8(globalCtx, 0x8AC, -0x63, &this->scrubs[3]->actor, 0);
}
this->debugArrowTimer = 0;
if (this->judgeTimer == 40) {
for (i = 0; i < 9; i++) {
this->scrubs[i]->stageSignal = DNT_SIGNAL_LOOK;
}
}
if (this->judgeTimer > 40) {
// gera gera [onomatopoeia for loud giggling]
osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ げらげら ☆☆☆☆☆ \n" VT_RST);
func_800F436C(&this->actor.projectedPos, NA_SE_EV_CROWD - SFX_FLAG, 2.0f);
}
if (this->judgeTimer < 120) {
this->judgeTimer++;
} else {
ignore = false;
reaction = DNT_SIGNAL_NONE;
delay = 0;
switch (Player_GetMask(globalCtx)) {
case PLAYER_MASK_SKULL:
if (!(gSaveContext.itemGetInf[1] & 0x4000)) {
reaction = DNT_SIGNAL_CELEBRATE;
this->prize = DNT_PRIZE_STICK;
Audio_SetBGM(0x3E);
break;
}
case PLAYER_MASK_TRUTH:
if (!(gSaveContext.itemGetInf[1] & 0x8000) && (Player_GetMask(globalCtx) != PLAYER_MASK_SKULL)) {
Audio_PlaySoundGeneral(NA_SE_SY_TRE_BOX_APPEAR, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
this->prize = DNT_PRIZE_NUTS;
this->leader->stageSignal = DNT_LEADER_SIGNAL_UP;
reaction = DNT_SIGNAL_LOOK;
if (this->subCamera != 0) {
this->subCamera = 0;
reaction = DNT_SIGNAL_LOOK;
func_800800F8(globalCtx, 0x924, -0x63, &this->leader->actor, 0);
}
break;
}
case PLAYER_MASK_KEATON:
case PLAYER_MASK_SPOOKY:
case PLAYER_MASK_BUNNY:
case PLAYER_MASK_GORON:
case PLAYER_MASK_ZORA:
case PLAYER_MASK_GERUDO:
rand9 = Rand_ZeroFloat(8.99f);
maskIdx = Player_GetMask(globalCtx);
maskIdx--;
if (rand9 == 8) {
ignore = true;
delay = 8;
reaction = DNT_SIGNAL_HIDE;
// Special!
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 特別! ☆☆☆☆☆ \n" VT_RST);
} else {
if (maskIdx >= PLAYER_MASK_MAX - 1) {
// This is dangerous!
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ ヤバいよこれ! ☆☆☆☆☆ \n" VT_RST);
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ ヤバいよこれ! ☆☆☆☆☆ \n" VT_RST);
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ ヤバいよこれ! ☆☆☆☆☆ \n" VT_RST);
osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ ヤバいよこれ! ☆☆☆☆☆ \n" VT_RST);
maskIdx = Rand_ZeroFloat(7.99f);
}
resultIdx = sResultTable[rand9][maskIdx];
reaction = sResultValues[resultIdx][0];
this->action = sResultValues[resultIdx][1];
switch (this->action) {
case DNT_ACTION_LOW_RUPEES:
Audio_SetBGM(0x2D);
break;
case DNT_ACTION_ATTACK:
if (this->subCamera != 0) {
this->subCamera = 0;
func_800800F8(globalCtx, 0x92E, -0x63, &this->scrubs[3]->actor, 0);
}
Audio_SetBGM(0x81A);
break;
case DNT_ACTION_DANCE:
Audio_SetBGM(0x55);
break;
}
osSyncPrintf("\n\n");
// Each index 1
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 各インデックス1 ☆☆☆☆☆ %d\n" VT_RST, rand9);
// Each index 2
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 各インデックス2 ☆☆☆☆☆ %d\n" VT_RST, maskIdx);
// Each index 3
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 各インデックス3 ☆☆☆☆☆ %d\n" VT_RST, resultIdx);
osSyncPrintf("\n");
// What kind of evaluation?
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ どういう評価? ☆☆☆☆☆☆ %d\n" VT_RST, reaction);
// What kind of action?
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ どういうアクション? ☆☆☆ %d\n" VT_RST, this->action);
osSyncPrintf("\n\n");
break;
}
}
if (reaction != DNT_SIGNAL_NONE) {
for (i = 0; i < 9; i++) {
if (delay != 0) {
this->scrubs[i]->timer3 = delay * i;
}
this->scrubs[i]->action = this->action;
this->scrubs[i]->stageSignal = reaction;
this->scrubs[i]->ignore = ignore;
if (this->prize != DNT_PRIZE_NONE) {
this->scrubs[i]->timer1 = 300;
this->scrubs[i]->stagePrize = this->prize;
this->scrubs[i]->targetPos = this->leader->actor.world.pos;
if (this->prize == DNT_PRIZE_NUTS) {
this->leader->stageSignal = DNT_LEADER_SIGNAL_UP;
}
if (this->prize == DNT_PRIZE_STICK) {
this->leader->timer = 300;
}
}
}
this->actionFunc = EnDntDemo_Results;
}
}
}
}
void EnDntDemo_Results(EnDntDemo* this, GlobalContext* globalCtx) {
s32 i;
if (this->leaderSignal != DNT_SIGNAL_NONE) {
for (i = 0; i < 9; i++) {
this->scrubs[i]->action = this->action;
this->scrubs[i]->stageSignal = this->leaderSignal;
this->scrubs[i]->stagePrize = DNT_PRIZE_NONE;
}
if (this->leader->action == DNT_LEADER_ACTION_UP) {
this->leader->stageSignal = DNT_LEADER_SIGNAL_BURROW;
} else if (this->leader->unburrow) {
this->leader->stageSignal = DNT_LEADER_SIGNAL_RETURN;
} else {
this->leader->action = DNT_LEADER_ACTION_ATTACK;
}
this->leader->timer = 0;
this->leaderSignal = this->action = DNT_SIGNAL_NONE;
this->actionFunc = EnDntDemo_Prize;
} else if (this->prize == DNT_PRIZE_STICK) {
for (i = 0; i < 9; i++) {
s16 offsetAngle = -this->leader->actor.shape.rot.y;
Vec3f leaderPos = this->leader->actor.world.pos;
f32 offsetDist;
if (!(i & 1)) {
offsetAngle -= 0x59D8;
}
offsetDist = ((i + 1) * 20.0f) + 20.0f;
this->scrubs[i]->timer2 = 10;
this->scrubs[i]->targetPos.x = leaderPos.x + Math_SinS(offsetAngle) * offsetDist;
this->scrubs[i]->targetPos.y = leaderPos.y;
this->scrubs[i]->targetPos.z = leaderPos.z + Math_CosS(offsetAngle) * offsetDist;
}
}
}
void EnDntDemo_Prize(EnDntDemo* this, GlobalContext* globalCtx) {
s32 i;
if (this->leaderSignal != DNT_SIGNAL_NONE) {
for (i = 0; i < 9; i++) {
this->scrubs[i]->action = this->action;
this->scrubs[i]->stageSignal = this->leaderSignal;
this->scrubs[i]->stagePrize = DNT_PRIZE_NONE;
}
this->leaderSignal = this->action = DNT_SIGNAL_NONE;
}
}
void EnDntDemo_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnDntDemo* this = THIS;
if (this->unkTimer2 != 0) {
this->unkTimer2--;
}
if (this->unkTimer1 != 0) {
this->unkTimer1--;
}
this->actionFunc(this, globalCtx);
if (BREG(0)) {
if (this->debugArrowTimer != 0) {
if (!(this->debugArrowTimer & 1)) {
DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z,
this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f,
1.0f, 1.0f, 120, 120, 0, 255, 4, globalCtx->state.gfxCtx);
}
} else {
DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z,
this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f,
1.0f, 1.0f, 255, 255, 255, 255, 4, globalCtx->state.gfxCtx);
}
}
}

View file

@ -6,11 +6,64 @@
struct EnDntDemo;
typedef void (*EnDntDemoActionFunc)(struct EnDntDemo*, GlobalContext*);
typedef struct EnDntDemo {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0xB4];
/* 0x014C */ EnDntDemoActionFunc actionFunc;
/* 0x0150 */ s16 judgeTimer;
/* 0x0152 */ s16 unkTimer1;
/* 0x0154 */ s16 unkTimer2;
/* 0x0156 */ s16 debugArrowTimer;
/* 0x0158 */ s16 leaderSignal;
/* 0x015A */ s16 action;
/* 0x015C */ s16 prize;
/* 0x015E */ s16 subCamera;
/* 0x0160 */ Vec3f scrubPos[9];
/* 0x01CC */ Vec3f leaderPos;
/* 0x01D8 */ struct EnDntNomal* scrubs[9];
/* 0x01FC */ struct EnDntJiji* leader;
} EnDntDemo; // size = 0x0200
typedef enum {
/* 0 */ DNT_SIGNAL_NONE,
/* 1 */ DNT_SIGNAL_LOOK,
/* 2 */ DNT_SIGNAL_CELEBRATE,
/* 3 */ DNT_SIGNAL_DANCE,
/* 4 */ DNT_SIGNAL_HIDE,
/* 5 */ DNT_SIGNAL_RETURN,
/* 6 */ DNT_SIGNAL_UNUSED
} EnDntSignal;
typedef enum {
/* 0 */ DNT_LEADER_ACTION_NONE,
/* 1 */ DNT_LEADER_ACTION_UP,
/* 2 */ DNT_LEADER_ACTION_UNUSED,
/* 3 */ DNT_LEADER_ACTION_ATTACK
} EnDntLeaderAction;
typedef enum {
/* 0 */ DNT_LEADER_SIGNAL_NONE,
/* 1 */ DNT_LEADER_SIGNAL_UP,
/* 2 */ DNT_LEADER_SIGNAL_BURROW,
/* 3 */ DNT_LEADER_SIGNAL_RETURN
} EnDntLeaderSignal;
typedef enum {
/* 0 */ DNT_PRIZE_NONE,
/* 1 */ DNT_PRIZE_NUTS,
/* 2 */ DNT_PRIZE_STICK
} EnDntPrize;
typedef enum {
/* 0 */ DNT_ACTION_NONE,
/* 1 */ DNT_ACTION_DANCE,
/* 2 */ DNT_ACTION_ATTACK,
/* 3 */ DNT_ACTION_LOW_RUPEES,
/* 4 */ DNT_ACTION_HIGH_RUPEES,
/* 5 */ DNT_ACTION_PRIZE
} EnDntAction;
extern const ActorInit En_Dnt_Demo_InitVars;
#endif

View file

@ -1,4 +1,14 @@
/*
* File: z_en_dnt_jiji.c
* Overlay: ovl_En_Dnt_Jiji
* Description: Forest Stage scrub leader
*/
#include "z_en_dnt_jiji.h"
#include "objects/object_dns/object_dns.h"
#include "overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h"
#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h"
#include "vt.h"
#define FLAGS 0x00000019
@ -9,17 +19,28 @@ void EnDntJiji_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnDntJiji_Update(Actor* thisx, GlobalContext* globalCtx);
void EnDntJiji_Draw(Actor* thisx, GlobalContext* globalCtx);
extern UNK_TYPE D_06000560;
extern UNK_TYPE D_06000944;
extern UNK_TYPE D_06000A70;
extern UNK_TYPE D_06000BD0;
extern UNK_TYPE D_06000DF8;
extern UNK_TYPE D_060012B0;
extern UNK_TYPE D_06002310;
extern UNK_TYPE D_060033E0;
extern UNK_TYPE D_060037C0;
void EnDntJiji_SetFlower(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_SetupWait(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_SetupUnburrow(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_SetupWalk(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_SetupCower(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_SetupGivePrize(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_SetupHide(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_SetupReturn(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_Wait(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_Up(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_Unburrow(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_Walk(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_Burrow(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_Cower(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_SetupTalk(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_Talk(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_GivePrize(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_Hide(EnDntJiji* this, GlobalContext* globalCtx);
void EnDntJiji_Return(EnDntJiji* this, GlobalContext* globalCtx);
/*
const ActorInit En_Dnt_Jiji_InitVars = {
ACTOR_EN_DNT_JIJI,
ACTORCAT_NPC,
@ -32,7 +53,7 @@ const ActorInit En_Dnt_Jiji_InitVars = {
(ActorFunc)EnDntJiji_Draw,
};
static ColliderCylinderInit D_809F2FA0 = {
static ColliderCylinderInit sCylinderInit = {
{
COLTYPE_NONE,
AT_NONE,
@ -51,53 +72,376 @@ static ColliderCylinderInit D_809F2FA0 = {
},
{ 30, 80, 0, { 0, 0, 0 } },
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/EnDntJiji_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/EnDntJiji_Destroy.s")
void EnDntJiji_Init(Actor* thisx, GlobalContext* globalCtx) {
EnDntJiji* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F1C04.s")
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f);
SkelAnime_Init(globalCtx, &this->skelAnime, &gDntJijiSkel, &gDntJijiBurrowAnim, this->jointTable, this->morphTable,
13);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
this->stage = (EnDntDemo*)this->actor.parent;
osSyncPrintf("\n\n");
// Deku Scrub mask show elder
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ デグナッツお面品評会長老 ☆☆☆☆☆ %x\n" VT_RST, this->stage);
this->actor.flags &= ~1;
this->actor.colChkInfo.mass = 0xFF;
this->actor.targetMode = 6;
this->actionFunc = EnDntJiji_SetFlower;
this->actor.gravity = -2.0f;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F1C44.s")
void EnDntJiji_Destroy(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnDntJiji* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F1CF4.s")
Collider_DestroyCylinder(globalCtx, &this->collider);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F1DA8.s")
void EnDntJiji_SetFlower(EnDntJiji* this, GlobalContext* globalCtx) {
if (this->actor.bgCheckFlags & 1) {
this->flowerPos = this->actor.world.pos;
this->actionFunc = EnDntJiji_SetupWait;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F1E8C.s")
void EnDntJiji_SetupWait(EnDntJiji* this, GlobalContext* globalCtx) {
this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiBurrowAnim);
Animation_Change(&this->skelAnime, &gDntJijiBurrowAnim, 0.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f);
this->skelAnime.curFrame = 8.0f;
this->isSolid = this->action = DNT_LEADER_ACTION_NONE;
this->actionFunc = EnDntJiji_Wait;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F1EFC.s")
void EnDntJiji_Wait(EnDntJiji* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F1FE0.s")
SkelAnime_Update(&this->skelAnime);
if ((this->timer == 1) && (this->actor.xzDistToPlayer < 150.0f) && !Gameplay_InCsMode(globalCtx) &&
!(player->stateFlags1 & 0x800)) {
func_800800F8(globalCtx, 0x8B6, -0x63, &this->actor, 0);
this->timer = 0;
func_8002DF54(globalCtx, NULL, 8);
this->actionFunc = EnDntJiji_SetupUnburrow;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F2068.s")
void EnDntJiji_SetupUp(EnDntJiji* this, GlobalContext* globalCtx) {
this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiUpAnim);
Animation_Change(&this->skelAnime, &gDntJijiUpAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f);
EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 15, 5, 20, HAHEN_OBJECT_DEFAULT, 10, NULL);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP);
this->actionFunc = EnDntJiji_Up;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F2118.s")
void EnDntJiji_Up(EnDntJiji* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0);
if (this->actor.xzDistToPlayer < 150.0f) {
this->actionFunc = EnDntJiji_SetupCower;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F2254.s")
void EnDntJiji_SetupUnburrow(EnDntJiji* this, GlobalContext* globalCtx) {
this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiUnburrowAnim);
Animation_Change(&this->skelAnime, &gDntJijiUnburrowAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f);
EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 15, 5, 20, HAHEN_OBJECT_DEFAULT, 10, NULL);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP);
this->actionFunc = EnDntJiji_Unburrow;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F2344.s")
void EnDntJiji_Unburrow(EnDntJiji* this, GlobalContext* globalCtx) {
f32 frame = this->skelAnime.curFrame;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F236C.s")
SkelAnime_Update(&this->skelAnime);
if (this->endFrame <= frame) {
if (this->action != DNT_LEADER_ACTION_ATTACK) {
this->actionFunc = EnDntJiji_SetupWalk;
} else {
this->actionFunc = EnDntJiji_SetupReturn;
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F24AC.s")
void EnDntJiji_SetupWalk(EnDntJiji* this, GlobalContext* globalCtx) {
this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiWalkAnim);
Animation_Change(&this->skelAnime, &gDntJijiWalkAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f);
this->actor.speedXZ = 1.0f;
this->isSolid = true;
this->unburrow = true;
this->actionFunc = EnDntJiji_Walk;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F2550.s")
void EnDntJiji_Walk(EnDntJiji* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x3E8, 0);
this->actor.world.rot.y = this->actor.shape.rot.y;
Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.2f, 0.4f);
if (this->sfxTimer == 0) {
this->sfxTimer = 5;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_WALK);
}
if ((this->actor.bgCheckFlags & 8) && (this->actor.bgCheckFlags & 1)) {
this->actor.velocity.y = 9.0f;
this->actor.speedXZ = 3.0f;
}
if (this->actor.xzDistToPlayer < 100.0f) {
if (CUR_UPG_VALUE(UPG_STICKS) == 1) {
this->getItemId = GI_STICK_UPGRADE_20;
} else {
this->getItemId = GI_STICK_UPGRADE_30;
}
this->actor.textId = 0x104D;
func_8010B680(globalCtx, this->actor.textId, NULL);
this->actor.speedXZ = 0.0f;
this->unused = 5;
this->actionFunc = EnDntJiji_Talk;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F25E4.s")
void EnDntJiji_SetupBurrow(EnDntJiji* this, GlobalContext* globalCtx) {
this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiBurrowAnim);
Animation_Change(&this->skelAnime, &gDntJijiBurrowAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f);
EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 15, 5, 20, HAHEN_OBJECT_DEFAULT, 10, NULL);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DOWN);
this->actionFunc = EnDntJiji_Burrow;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F26B0.s")
void EnDntJiji_Burrow(EnDntJiji* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F2720.s")
void EnDntJiji_SetupCower(EnDntJiji* this, GlobalContext* globalCtx) {
this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiCowerAnim);
Animation_Change(&this->skelAnime, &gDntJijiCowerAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f);
EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 3.0f, 0, 9, 3, 10, HAHEN_OBJECT_DEFAULT, 10, NULL);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F28DC.s")
if ((CUR_UPG_VALUE(UPG_NUTS) == 1) || (CUR_UPG_VALUE(UPG_NUTS) == 0)) {
this->getItemId = GI_NUT_UPGRADE_30;
} else {
this->getItemId = GI_NUT_UPGRADE_40;
}
this->actor.flags |= 1;
this->actor.textId = 0x10DB;
this->unused = 5;
this->actionFunc = EnDntJiji_Cower;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F2974.s")
void EnDntJiji_Cower(EnDntJiji* this, GlobalContext* globalCtx) {
f32 frame = this->skelAnime.curFrame;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F29E0.s")
SkelAnime_Update(&this->skelAnime);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0);
if (frame >= this->endFrame) {
if (func_8002F194(&this->actor, globalCtx)) {
this->actionFunc = EnDntJiji_SetupTalk;
} else {
func_8002F2CC(&this->actor, globalCtx, 100.0f);
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/func_809F2A90.s")
void EnDntJiji_SetupTalk(EnDntJiji* this, GlobalContext* globalCtx) {
this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiTalkAnim);
Animation_Change(&this->skelAnime, &gDntJijiTalkAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f);
this->actionFunc = EnDntJiji_Talk;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/EnDntJiji_Update.s")
void EnDntJiji_Talk(EnDntJiji* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0);
if ((func_8010BDBC(&globalCtx->msgCtx) == 5) && func_80106BC8(globalCtx)) {
func_8005B1A4(ACTIVE_CAM);
func_80106CCC(globalCtx);
func_8002DF54(globalCtx, NULL, 7);
this->actor.parent = NULL;
func_8002F434(&this->actor, globalCtx, this->getItemId, 400.0f, 200.0f);
this->actionFunc = EnDntJiji_SetupGivePrize;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Jiji/EnDntJiji_Draw.s")
void EnDntJiji_SetupGivePrize(EnDntJiji* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
if (Actor_HasParent(&this->actor, globalCtx)) {
this->actionFunc = EnDntJiji_GivePrize;
} else {
func_8002F434(&this->actor, globalCtx, this->getItemId, 400.0f, 200.0f);
}
}
void EnDntJiji_GivePrize(EnDntJiji* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
if ((func_8010BDBC(&globalCtx->msgCtx) == 6) && func_80106BC8(globalCtx)) {
if ((this->getItemId == GI_NUT_UPGRADE_30) || (this->getItemId == GI_NUT_UPGRADE_40)) {
// nut
osSyncPrintf("\n");
osSyncPrintf("\n");
osSyncPrintf("\n");
osSyncPrintf("\n");
osSyncPrintf("\n");
osSyncPrintf("\n");
osSyncPrintf("\n");
osSyncPrintf("\n");
gSaveContext.itemGetInf[1] |= 0x8000;
} else {
// stick
osSyncPrintf("\n");
osSyncPrintf("\n");
osSyncPrintf("\n");
osSyncPrintf("\n");
osSyncPrintf("\n");
osSyncPrintf("\n");
gSaveContext.itemGetInf[1] |= 0x4000;
}
this->actor.textId = 0;
if ((this->stage != NULL) && (this->stage->actor.update != NULL)) {
this->stage->action = DNT_ACTION_NONE;
if (!this->unburrow) {
this->stage->leaderSignal = DNT_SIGNAL_HIDE;
} else {
this->stage->leaderSignal = DNT_SIGNAL_RETURN;
}
}
this->actor.flags &= ~1;
if (!this->unburrow) {
this->actionFunc = EnDntJiji_SetupHide;
} else {
this->actionFunc = EnDntJiji_SetupReturn;
}
}
}
void EnDntJiji_SetupHide(EnDntJiji* this, GlobalContext* globalCtx) {
this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiHideAnim);
Animation_Change(&this->skelAnime, &gDntJijiHideAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f);
this->actionFunc = EnDntJiji_Hide;
}
void EnDntJiji_Hide(EnDntJiji* this, GlobalContext* globalCtx) {
f32 frame = this->skelAnime.curFrame;
SkelAnime_Update(&this->skelAnime);
if (this->endFrame <= frame) {
this->actionFunc = EnDntJiji_SetupWait;
}
}
void EnDntJiji_SetupReturn(EnDntJiji* this, GlobalContext* globalCtx) {
this->endFrame = (f32)Animation_GetLastFrame(&gDntJijiWalkAnim);
Animation_Change(&this->skelAnime, &gDntJijiWalkAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f);
this->actor.speedXZ = 2.0f;
this->isSolid = this->unburrow = true;
this->actionFunc = EnDntJiji_Return;
}
void EnDntJiji_Return(EnDntJiji* this, GlobalContext* globalCtx) {
f32 dx;
f32 dz;
SkelAnime_Update(&this->skelAnime);
dx = this->flowerPos.x - this->actor.world.pos.x;
dz = this->flowerPos.z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(dx, dz) * 10430.378f, 1, 0xBB8, 0);
this->actor.world.rot.y = this->actor.shape.rot.y;
if ((this->actor.bgCheckFlags & 8) && (this->actor.bgCheckFlags & 1)) {
this->actor.velocity.y = 9.0f;
this->actor.speedXZ = 3.0f;
}
if (this->sfxTimer == 0) {
this->sfxTimer = 3;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_WALK);
}
if ((fabsf(dx) < 5.0f) && (fabsf(dz) < 5.0f)) {
this->actor.world.pos.x = this->flowerPos.x;
this->actor.world.pos.z = this->flowerPos.z;
if (this->attackFlag) {
if ((this->stage->actor.update != NULL) && (this->stage->leaderSignal == DNT_SIGNAL_NONE)) {
this->stage->leaderSignal = DNT_SIGNAL_HIDE;
this->stage->action = DNT_ACTION_ATTACK;
Audio_SetBGM(0x81A);
}
}
this->actor.speedXZ = 0.0f;
this->isSolid = 0;
this->actionFunc = EnDntJiji_SetupBurrow;
}
}
void EnDntJiji_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnDntJiji* this = THIS;
Actor_SetScale(&this->actor, 0.015f);
this->unkTimer++;
if (BREG(0)) {
// time
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 時間 ☆☆☆☆☆ %d\n" VT_RST, this->timer);
}
if ((this->timer > 1) && (this->timer != 0)) {
this->timer--;
}
if (this->sfxTimer != 0) {
this->sfxTimer--;
}
if (this->blinkTimer != 0) {
this->blinkTimer--;
}
switch (this->stageSignal) {
case DNT_LEADER_SIGNAL_UP:
this->isSolid = true;
this->action = DNT_LEADER_ACTION_UP;
this->actionFunc = EnDntJiji_SetupUp;
break;
case DNT_LEADER_SIGNAL_BURROW:
this->isSolid = false;
this->action = DNT_LEADER_ACTION_NONE;
this->actionFunc = EnDntJiji_SetupBurrow;
break;
case DNT_LEADER_SIGNAL_RETURN:
this->actionFunc = EnDntJiji_SetupReturn;
break;
case DNT_LEADER_SIGNAL_NONE:
break;
}
if (this->actor.textId != 0) {
Actor_SetFocus(&this->actor, 30.0f);
}
if (this->stageSignal != DNT_LEADER_SIGNAL_NONE) {
this->stageSignal = DNT_LEADER_SIGNAL_NONE;
}
if (this->blinkTimer == 0) {
this->eyeState++;
if (this->eyeState > 2) {
this->eyeState = 0;
this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20;
}
}
this->actionFunc(this, globalCtx);
Actor_MoveForward(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D);
Collider_UpdateCylinder(&this->actor, &this->collider);
if (this->isSolid != 0) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
}
void EnDntJiji_Draw(Actor* thisx, GlobalContext* globalCtx) {
static void* blinkTex[] = { &gDntJijiEyeOpenTex, &gDntJijiEyeHalfTex, &gDntJijiEyeShutTex };
EnDntJiji* this = THIS;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_jiji.c", 1019);
func_80093D18(globalCtx->state.gfxCtx);
Matrix_Push();
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(blinkTex[this->eyeState]));
SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, this);
Matrix_Pull();
Matrix_Translate(this->flowerPos.x, this->flowerPos.y, this->flowerPos.z, MTXMODE_NEW);
Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dnt_jiji.c", 1040),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gDntJijiFlowerDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_jiji.c", 1043);
}

View file

@ -6,9 +6,30 @@
struct EnDntJiji;
typedef void (*EnDntJijiActionFunc)(struct EnDntJiji*, GlobalContext*);
typedef struct EnDntJiji {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x15C];
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ Vec3s jointTable[13];
/* 0x01DE */ Vec3s morphTable[13];
/* 0x022C */ EnDntJijiActionFunc actionFunc;
/* 0x0230 */ Vec3f flowerPos;
/* 0x023C */ u8 isSolid;
/* 0x023E */ s16 action;
/* 0x0240 */ s16 timer;
/* 0x0242 */ s16 sfxTimer;
/* 0x0244 */ s16 blinkTimer;
/* 0x0246 */ s16 unkTimer;
/* 0x0248 */ s16 endFrame;
/* 0x024A */ s16 unburrow;
/* 0x024C */ s16 eyeState;
/* 0x024E */ s16 stageSignal;
/* 0x0250 */ s16 unused; // always set to 5
/* 0x0252 */ s16 attackFlag; // Is never set
/* 0x0254 */ s32 getItemId;
/* 0x0258 */ struct EnDntDemo* stage;
/* 0x025C */ ColliderCylinder collider;
} EnDntJiji; // size = 0x02A8
extern const ActorInit En_Dnt_Jiji_InitVars;

View file

@ -1,4 +1,17 @@
/*
* File: z_en_dnt_nomal
* Overlay: ovl_En_Dnt_Nomal
* Description: Lost Woods minigame scrubs
*/
#include "z_en_dnt_nomal.h"
#include "objects/object_dnk/object_dnk.h"
#include "overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h"
#include "overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h"
#include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h"
#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h"
#include "objects/object_hintnuts/object_hintnuts.h"
#include "vt.h"
#define FLAGS 0x00000030
@ -7,23 +20,44 @@
void EnDntNomal_Init(Actor* thisx, GlobalContext* globalCtx);
void EnDntNomal_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnDntNomal_Update(Actor* thisx, GlobalContext* globalCtx);
void EnDntNomal_DrawTargetScrub(Actor* thisx, GlobalContext* globalCtx);
void EnDntNomal_DrawStageScrub(Actor* thisx, GlobalContext* globalCtx);
extern UNK_TYPE D_06000168;
extern UNK_TYPE D_0600031C;
extern UNK_TYPE D_06000430;
extern UNK_TYPE D_060006CC;
extern UNK_TYPE D_06000894;
extern UNK_TYPE D_06000B70;
extern UNK_TYPE D_060014E0;
extern UNK_TYPE D_06001B00;
extern UNK_TYPE D_060023B8;
extern UNK_TYPE D_060024CC;
extern UNK_TYPE D_060026C4;
extern UNK_TYPE D_06002E1C;
extern UNK_TYPE D_06002E84;
extern UNK_TYPE D_06003128;
void EnDntNomal_WaitForObject(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_SetFlower(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_SetupTargetWait(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_SetupTargetUnburrow(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_SetupTargetWalk(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_SetupTargetTalk(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_SetupTargetGivePrize(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_TargetWait(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_TargetUnburrow(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_TargetWalk(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_TargetFacePlayer(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_TargetTalk(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_TargetGivePrize(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_TargetReturn(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_TargetBurrow(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_SetupStageWait(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_SetupStageCelebrate(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_SetupStageDance(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_SetupStageHide(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_SetupStageAttack(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_StageSetupReturn(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_StageWait(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_StageUp(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_StageUnburrow(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_StageCelebrate(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_StageDance(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_StageHide(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_StageAttackHide(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_StageAttack(EnDntNomal* this, GlobalContext* globalCtx);
void EnDntNomal_StageReturn(EnDntNomal* this, GlobalContext* globalCtx);
/*
const ActorInit En_Dnt_Nomal_InitVars = {
ACTOR_EN_DNT_NOMAL,
ACTORCAT_PROP,
@ -36,7 +70,27 @@ const ActorInit En_Dnt_Nomal_InitVars = {
NULL,
};
static ColliderQuadInit D_809F5DFC = {
static ColliderCylinderInit sBodyCylinderInit = {
{
COLTYPE_NONE,
AT_NONE,
AC_NONE,
OC1_ON | OC1_TYPE_ALL,
OC2_TYPE_1,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK0,
{ 0x00000000, 0x00, 0x00 },
{ 0x00000000, 0x00, 0x00 },
TOUCH_NONE,
BUMP_NONE,
OCELEM_ON,
},
{ 16, 46, 0, { 0, 0, 0 } },
};
static ColliderQuadInit sTargetQuadInit = {
{
COLTYPE_NONE,
AT_NONE,
@ -56,100 +110,780 @@ static ColliderQuadInit D_809F5DFC = {
{ { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } },
};
static ColliderCylinderInit D_809F5DD0 = {
{
COLTYPE_NONE,
AT_NONE,
AC_NONE,
OC1_ON | OC1_TYPE_ALL,
OC2_TYPE_1,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK0,
{ 0x00000000, 0x00, 0x00 },
{ 0x00000000, 0x00, 0x00 },
TOUCH_NONE,
BUMP_NONE,
OCELEM_ON,
},
{ 16, 46, 0, { 0, 0, 0 } },
static Color_RGBA8 sLeafColors[] = {
{ 255, 255, 255, 255 }, { 255, 195, 175, 255 }, { 210, 255, 0, 255 },
{ 255, 255, 255, 255 }, { 210, 255, 0, 255 }, { 255, 195, 175, 255 },
{ 255, 255, 255, 255 }, { 255, 195, 175, 255 }, { 210, 255, 0, 255 },
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/EnDntNomal_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/EnDntNomal_Destroy.s")
void EnDntNomal_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnDntNomal* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F3480.s")
this->type = this->actor.params;
if (this->type < ENDNTNOMAL_TARGET) {
this->type = ENDNTNOMAL_TARGET;
}
this->actor.flags &= ~1;
this->actor.colChkInfo.mass = 0xFF;
this->objId = -1;
if (this->type == ENDNTNOMAL_TARGET) {
osSyncPrintf("\n\n");
// Deku Scrub target
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ デグナッツ的当て ☆☆☆☆☆ \n" VT_RST);
Collider_InitQuad(globalCtx, &this->targetQuad);
Collider_SetQuad(globalCtx, &this->targetQuad, &this->actor, &sTargetQuadInit);
this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
this->objId = OBJECT_HINTNUTS;
} else {
osSyncPrintf("\n\n");
// Deku Scrub mask show audience
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ デグナッツお面品評会一般人 ☆☆☆☆☆ \n" VT_RST);
Collider_InitCylinder(globalCtx, &this->bodyCyl);
Collider_SetCylinder(globalCtx, &this->bodyCyl, &this->actor, &sBodyCylinderInit);
this->objId = OBJECT_DNK;
}
if (this->objId >= 0) {
this->objIndex = Object_GetIndex(&globalCtx->objectCtx, this->objId);
if (this->objIndex < 0) {
Actor_Kill(&this->actor);
// What?
osSyncPrintf(VT_FGCOL(PURPLE) " なにみの? %d\n" VT_RST "\n", this->objIndex);
// Bank is funny
osSyncPrintf(VT_FGCOL(CYAN) " バンクおかしいしぞ!%d\n" VT_RST "\n", this->actor.params);
return;
}
} else {
Actor_Kill(&this->actor);
}
this->actionFunc = EnDntNomal_WaitForObject;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F35CC.s")
void EnDntNomal_Destroy(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnDntNomal* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F3624.s")
if (this->type == ENDNTNOMAL_TARGET) {
Collider_DestroyQuad(globalCtx, &this->targetQuad);
} else {
Collider_DestroyCylinder(globalCtx, &this->bodyCyl);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F36CC.s")
void EnDntNomal_WaitForObject(EnDntNomal* this, GlobalContext* globalCtx) {
if (Object_IsLoaded(&globalCtx->objectCtx, this->objIndex)) {
gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objIndex].segment);
this->actor.objBankIndex = this->objIndex;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f);
this->actor.gravity = -2.0f;
Actor_SetScale(&this->actor, 0.01f);
if (this->type == ENDNTNOMAL_TARGET) {
SkelAnime_Init(globalCtx, &this->skelAnime, &gHintNutsSkel, &gHintNutsBurrowAnim, this->jointTable,
this->morphTable, 10);
this->actor.draw = EnDntNomal_DrawTargetScrub;
} else {
SkelAnime_Init(globalCtx, &this->skelAnime, &gDntStageSkel, &gDntStageHideAnim, this->jointTable,
this->morphTable, 11);
this->actor.draw = EnDntNomal_DrawStageScrub;
}
this->actionFunc = EnDntNomal_SetFlower;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F39B8.s")
void EnDntNomal_SetFlower(EnDntNomal* this, GlobalContext* globalCtx) {
if (this->actor.bgCheckFlags & 1) {
this->flowerPos = this->actor.world.pos;
if (this->type == ENDNTNOMAL_TARGET) {
this->actionFunc = EnDntNomal_SetupTargetWait;
} else {
this->actionFunc = EnDntNomal_SetupStageWait;
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F3AD4.s")
void EnDntNomal_SetupTargetWait(EnDntNomal* this, GlobalContext* globalCtx) {
this->endFrame = (f32)Animation_GetLastFrame(&gHintNutsBurrowAnim);
Animation_Change(&this->skelAnime, &gHintNutsBurrowAnim, 0.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f);
this->skelAnime.curFrame = 8.0f;
this->actionFunc = EnDntNomal_TargetWait;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F3B40.s")
void EnDntNomal_TargetWait(EnDntNomal* this, GlobalContext* globalCtx) {
Vec3f scorePos;
f32 targetX = 1340.0f;
f32 targetY = 50.0f;
f32 targetZ = -30.0f;
f32 dx;
f32 dy;
f32 dz;
Vec3f scoreAccel = { 0.0f, 0.0f, 0.0f };
Vec3f scoreVel = { 0.0f, 0.0f, 0.0f };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F3BE4.s")
this->targetVtx[0].x = this->targetVtx[1].x = this->targetVtx[2].x = this->targetVtx[3].x = targetX;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F3CD0.s")
this->targetVtx[1].y = this->targetVtx[0].y = targetY - 24.0f;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F3D84.s")
this->targetVtx[2].z = this->targetVtx[0].z = targetZ + 24.0f;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F3E30.s")
this->targetVtx[3].z = this->targetVtx[1].z = targetZ - 24.0f;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F3ED4.s")
this->targetVtx[3].y = this->targetVtx[2].y = targetY + 24.0f;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F3F6C.s")
SkelAnime_Update(&this->skelAnime);
if ((this->targetQuad.base.acFlags & AC_HIT) || BREG(0)) {
this->targetQuad.base.acFlags &= ~AC_HIT;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F40D4.s")
dx = fabsf(targetX - this->targetQuad.info.bumper.hitPos.x);
dy = fabsf(targetY - this->targetQuad.info.bumper.hitPos.y);
dz = fabsf(targetZ - this->targetQuad.info.bumper.hitPos.z);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F42A4.s")
scoreVel.y = 5.0f;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F4310.s")
if (sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) < 8.0f) {
scorePos.x = this->actor.world.pos.x - 20.0f;
scorePos.y = this->actor.world.pos.y + 20.0f;
scorePos.z = this->actor.world.pos.z;
EffectSsExtra_Spawn(globalCtx, &scorePos, &scoreVel, &scoreAccel, 4, 2);
func_800F8D04(NA_SE_SY_TRE_BOX_APPEAR);
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
// Big hit
osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ 大当り ☆☆☆☆☆ %d\n" VT_RST, this->hitCounter);
if (LINK_IS_CHILD && !(gSaveContext.itemGetInf[1] & 0x2000)) {
this->hitCounter++;
if (this->hitCounter >= 3) {
func_800800F8(globalCtx, 0x102C, -0x63, &this->actor, 0);
func_8002DF54(globalCtx, &this->actor, 1);
this->timer4 = 50;
this->actionFunc = EnDntNomal_SetupTargetUnburrow;
}
}
} else if (sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) < 24.0f) {
scorePos.x = this->actor.world.pos.x;
scorePos.y = this->actor.world.pos.y + 20.0f;
scorePos.z = this->actor.world.pos.z;
EffectSsExtra_Spawn(globalCtx, &scorePos, &scoreVel, &scoreAccel, 4, 0);
this->hitCounter = 0;
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F43C8.s")
void EnDntNomal_SetupTargetUnburrow(EnDntNomal* this, GlobalContext* globalCtx) {
Vec3f spawnPos;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F43F0.s")
if (this->timer4 == 0) {
this->endFrame = (f32)Animation_GetLastFrame(&gHintNutsUnburrowAnim);
Animation_Change(&this->skelAnime, &gHintNutsUnburrowAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f);
spawnPos = this->actor.world.pos;
spawnPos.y = this->actor.world.pos.y + 50.0f;
EffectSsHahen_SpawnBurst(globalCtx, &spawnPos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP);
this->actionFunc = EnDntNomal_TargetUnburrow;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F44FC.s")
void EnDntNomal_TargetUnburrow(EnDntNomal* this, GlobalContext* globalCtx) {
f32 frame = this->skelAnime.curFrame;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F4730.s")
SkelAnime_Update(&this->skelAnime);
if (frame >= this->endFrame) {
this->actionFunc = EnDntNomal_SetupTargetWalk;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F4824.s")
void EnDntNomal_SetupTargetWalk(EnDntNomal* this, GlobalContext* globalCtx) {
this->endFrame = (f32)Animation_GetLastFrame(&gHintNutsRunAnim);
Animation_Change(&this->skelAnime, &gHintNutsRunAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f);
this->actor.speedXZ = 1.0f;
this->actor.colChkInfo.mass = 0;
this->actionFunc = EnDntNomal_TargetWalk;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F48FC.s")
void EnDntNomal_TargetWalk(EnDntNomal* this, GlobalContext* globalCtx) {
f32 dx;
f32 dz;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F49A4.s")
SkelAnime_Update(&this->skelAnime);
dx = 1340.0f + 3.0f - this->actor.world.pos.x;
dz = 0.0f - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(dx, dz) * (0x8000 / M_PI), 0x32, 0xBB8, 0);
this->actor.world.rot.y = this->actor.shape.rot.y;
if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_WALK);
}
if (this->actor.world.pos.z > -30.0f) {
this->actor.speedXZ = 0.0f;
this->actionFunc = EnDntNomal_TargetFacePlayer;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F4BA4.s")
void EnDntNomal_TargetFacePlayer(EnDntNomal* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0);
if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_WALK);
}
if (fabsf(this->actor.shape.rot.y - this->actor.yawTowardsPlayer) < 30.0f) {
this->actionFunc = EnDntNomal_SetupTargetTalk;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F4CB4.s")
void EnDntNomal_SetupTargetTalk(EnDntNomal* this, GlobalContext* globalCtx) {
this->endFrame = (f32)Animation_GetLastFrame(&gHintNutsTalkAnim);
Animation_Change(&this->skelAnime, &gHintNutsTalkAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f);
this->actor.textId = 0x10AF;
func_8010B680(globalCtx, this->actor.textId, NULL);
this->actionFunc = EnDntNomal_TargetTalk;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F4E18.s")
void EnDntNomal_TargetTalk(EnDntNomal* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
if ((func_8010BDBC(&globalCtx->msgCtx) == 5) && func_80106BC8(globalCtx)) {
func_80106CCC(globalCtx);
func_8005B1A4(ACTIVE_CAM);
ACTIVE_CAM->unk_168 = 0;
func_8002DF54(globalCtx, NULL, 8);
this->actionFunc = EnDntNomal_SetupTargetGivePrize;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F4EF4.s")
void EnDntNomal_SetupTargetGivePrize(EnDntNomal* this, GlobalContext* globalCtx) {
this->endFrame = (f32)Animation_GetLastFrame(&gHintNutsSpitAnim);
Animation_Change(&this->skelAnime, &gHintNutsSpitAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f);
this->actionFunc = EnDntNomal_TargetGivePrize;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F50B8.s")
void EnDntNomal_TargetGivePrize(EnDntNomal* this, GlobalContext* globalCtx) {
f32 frame = this->skelAnime.curFrame;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F50EC.s")
SkelAnime_Update(&this->skelAnime);
if ((frame >= 8.0f) && !this->spawnedItem) {
f32 itemX = this->mouthPos.x - 10.0f;
f32 itemY = this->mouthPos.y;
f32 itemZ = this->mouthPos.z;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F51B8.s")
if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EX_ITEM, itemX, itemY, itemZ, 0,
0, 0, EXITEM_BULLET_BAG) == NULL) {
func_8002DF54(globalCtx, NULL, 7);
Actor_Kill(&this->actor);
}
this->spawnedItem = true;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_THROW);
}
if (frame >= this->endFrame) {
this->endFrame = (f32)Animation_GetLastFrame(&gHintNutsRunAnim);
Animation_Change(&this->skelAnime, &gHintNutsRunAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f);
this->actionFunc = EnDntNomal_TargetReturn;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F5478.s")
void EnDntNomal_TargetReturn(EnDntNomal* this, GlobalContext* globalCtx) {
f32 dx;
f32 dz;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F551C.s")
SkelAnime_Update(&this->skelAnime);
dx = this->flowerPos.x - this->actor.world.pos.x;
dz = -180.0f - this->actor.world.pos.z;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/EnDntNomal_Update.s")
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(dx, dz) * (0x8000 / M_PI), 3, 0x1388, 0);
if (fabsf(this->actor.shape.rot.y - (s16)(Math_FAtan2F(dx, dz) * (0x8000 / M_PI))) < 20.0f) {
this->actor.speedXZ = 1.0f;
}
if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_WALK);
}
this->actor.world.rot.y = this->actor.shape.rot.y;
if (this->actor.world.pos.z < -172.0f) {
this->endFrame = (f32)Animation_GetLastFrame(&gHintNutsBurrowAnim);
Animation_Change(&this->skelAnime, &gHintNutsBurrowAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f);
this->actor.world.pos.z = -173.0f;
this->actor.speedXZ = 0.0f;
this->actionFunc = EnDntNomal_TargetBurrow;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F58E4.s")
void EnDntNomal_TargetBurrow(EnDntNomal* this, GlobalContext* globalCtx) {
f32 frame = this->skelAnime.curFrame;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F59E4.s")
SkelAnime_Update(&this->skelAnime);
if (frame >= this->endFrame) {
this->actionFunc = EnDntNomal_SetupTargetWait;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F5A6C.s")
void EnDntNomal_SetupStageWait(EnDntNomal* this, GlobalContext* globalCtx) {
if (this->timer3 == 0) {
this->endFrame = (f32)Animation_GetLastFrame(&gDntStageHideAnim);
Animation_Change(&this->skelAnime, &gDntStageHideAnim, 0.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f);
this->skelAnime.curFrame = 8.0f;
this->isSolid = false;
this->actionFunc = EnDntNomal_StageWait;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dnt_Nomal/func_809F5C98.s")
void EnDntNomal_StageWait(EnDntNomal* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
}
void EnDntNomal_SetupStageUp(EnDntNomal* this, GlobalContext* globalCtx) {
if (this->timer3 == 0) {
this->endFrame = (f32)Animation_GetLastFrame(&gDntStageUpAnim);
Animation_Change(&this->skelAnime, &gDntStageUpAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f);
if (this->action != DNT_ACTION_ATTACK) {
this->rotDirection = -1;
}
EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP);
this->isSolid = true;
this->actionFunc = EnDntNomal_StageUp;
}
}
void EnDntNomal_StageUp(EnDntNomal* this, GlobalContext* globalCtx) {
s16 rotTarget;
f32 frame = this->skelAnime.curFrame;
f32 turnMod;
SkelAnime_Update(&this->skelAnime);
if ((frame >= this->endFrame) && (this->action == DNT_ACTION_ATTACK)) {
this->actionFunc = EnDntNomal_SetupStageAttack;
} else {
if (this->timer4 == 0) {
turnMod = 0.0f;
if (this->stagePrize == DNT_PRIZE_NONE) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0);
} else {
f32 dx = this->targetPos.x - this->actor.world.pos.x;
f32 dz = this->targetPos.z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(dx, dz) * (0x8000 / M_PI), 1, 0xBB8, 0);
turnMod = 90.0f;
}
if ((Rand_ZeroFloat(10.0f + turnMod) < 1.0f) && (this->action != DNT_ACTION_ATTACK)) {
this->timer4 = (s16)Rand_ZeroFloat(30.0f) + 30;
}
} else {
if (this->timer2 == 0) {
this->rotDirection++;
if (this->rotDirection > 1) {
this->rotDirection = -1;
}
this->timer2 = (s16)Rand_ZeroFloat(10.0f) + 10;
}
rotTarget = this->actor.yawTowardsPlayer;
if (this->rotDirection != 0) {
rotTarget += this->rotDirection * 0x1388;
}
Math_SmoothStepToS(&this->actor.shape.rot.y, rotTarget, 3, 0x1388, 0);
}
if (this->actor.xzDistToPlayer < 70.0f) {
this->actionFunc = EnDntNomal_SetupStageHide;
}
}
}
void EnDntNomal_SetupStageUnburrow(EnDntNomal* this, GlobalContext* globalCtx) {
if (this->timer3 == 0) {
this->endFrame = (f32)Animation_GetLastFrame(&gDntStageUnburrowAnim);
Animation_Change(&this->skelAnime, &gDntStageUnburrowAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f);
this->isSolid = false;
EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP);
this->actionFunc = EnDntNomal_StageUnburrow;
}
}
void EnDntNomal_StageUnburrow(EnDntNomal* this, GlobalContext* globalCtx) {
f32 frame = this->skelAnime.curFrame;
SkelAnime_Update(&this->skelAnime);
if (frame >= this->endFrame) {
if (this->action != DNT_ACTION_DANCE) {
this->timer3 = (s16)Rand_ZeroFloat(2.0f) + (s16)(this->type * 0.5f);
this->actionFunc = EnDntNomal_SetupStageCelebrate;
} else {
this->timer2 = 300;
this->actionFunc = EnDntNomal_SetupStageDance;
}
}
}
void EnDntNomal_SetupStageCelebrate(EnDntNomal* this, GlobalContext* globalCtx) {
this->endFrame = (f32)Animation_GetLastFrame(&gDntStageWalkAnim);
Animation_Change(&this->skelAnime, &gDntStageWalkAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f);
this->actor.speedXZ = 3.0f;
this->isSolid = true;
this->actionFunc = EnDntNomal_StageCelebrate;
}
void EnDntNomal_StageCelebrate(EnDntNomal* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
if ((this->timer1 == 0) && (this->timer3 == 0)) {
f32 dx = this->targetPos.x - this->actor.world.pos.x;
f32 dz = this->targetPos.z - this->actor.world.pos.z;
if ((fabsf(dx) < 10.0f) && (fabsf(dz) < 10.0f) && func_8010BDBC(&globalCtx->msgCtx)) {
this->action = DNT_ACTION_PRIZE;
this->actionFunc = EnDntNomal_SetupStageDance;
this->actor.speedXZ = 0.0f;
return;
}
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(dx, dz) * (0x8000 / M_PI), 1, 0xBB8, 0);
this->actor.world.rot.y = this->actor.shape.rot.y;
} else {
if (this->timer1 == 1) {
this->timer3 = (s16)Rand_ZeroFloat(20.0f) + 20.0f;
}
Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x14, 0x1388, 0);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0);
}
if (this->timer5 == 0) {
this->timer5 = 20;
if ((this->type & 1) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DAMAGE);
}
} else if ((this->timer5 & 3) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_WALK);
}
if ((this->actor.bgCheckFlags & 8) && (this->actor.bgCheckFlags & 1)) {
this->actor.velocity.y = 7.5f;
}
}
void EnDntNomal_SetupStageDance(EnDntNomal* this, GlobalContext* globalCtx) {
this->endFrame = (f32)Animation_GetLastFrame(&gDntStageDanceAnim);
Animation_Change(&this->skelAnime, &gDntStageDanceAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f);
this->isSolid = true;
this->timer3 = (s16)Rand_ZeroFloat(20.0f) + 20.0f;
this->rotDirection = -1;
if (Rand_ZeroFloat(1.99f) < 1.0f) {
this->rotDirection = 1;
}
this->actionFunc = EnDntNomal_StageDance;
}
void EnDntNomal_StageDance(EnDntNomal* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
if (this->timer2 == 0) {
if (this->action == DNT_ACTION_DANCE) {
this->action = DNT_ACTION_HIGH_RUPEES;
this->actionFunc = EnDntNomal_SetupStageHide;
} else {
this->action = DNT_ACTION_NONE;
this->actionFunc = EnDntNomal_StageSetupReturn;
}
} else if (this->timer3 != 0) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0);
if (this->timer3 == 1) {
this->timer4 = (s16)Rand_ZeroFloat(20.0f) + 20.0f;
this->rotDirection = -this->rotDirection;
}
} else if (this->timer4 != 0) {
this->actor.shape.rot.y += this->rotDirection * 0x800;
if (this->timer4 == 1) {
this->timer3 = (s16)Rand_ZeroFloat(20.0f) + 20.0f;
}
}
}
void EnDntNomal_SetupStageHide(EnDntNomal* this, GlobalContext* globalCtx) {
if (this->timer3 != 0) {
if ((this->timer3 == 1) && (this->ignore == 1)) {
func_80078884(NA_SE_SY_ERROR);
}
} else {
this->endFrame = (f32)Animation_GetLastFrame(&gDntStageHideAnim);
Animation_Change(&this->skelAnime, &gDntStageHideAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f);
this->isSolid = false;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DOWN);
this->actionFunc = EnDntNomal_StageHide;
}
}
void EnDntNomal_StageHide(EnDntNomal* this, GlobalContext* globalCtx) {
EnExRuppy* rupee;
f32 frame = this->skelAnime.curFrame;
s16 rupeeColor;
SkelAnime_Update(&this->skelAnime);
if (frame >= this->endFrame) {
EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_UP);
switch (this->action) {
case DNT_ACTION_NONE:
this->actionFunc = EnDntNomal_SetupStageWait;
break;
case DNT_ACTION_ATTACK:
this->actionFunc = EnDntNomal_StageAttackHide;
break;
case DNT_ACTION_LOW_RUPEES:
case DNT_ACTION_HIGH_RUPEES:
rupee =
(EnExRuppy*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_EX_RUPPY, this->actor.world.pos.x,
this->actor.world.pos.y + 20.0f, this->actor.world.pos.z, 0, 0, 0, 3);
if (rupee != NULL) {
rupeeColor = this->action - DNT_ACTION_LOW_RUPEES;
rupee->colorIdx = rupeeColor;
if (Rand_ZeroFloat(3.99f) < 1.0f) {
rupee->colorIdx = rupeeColor + 1;
}
rupee->actor.velocity.y = 5.0f;
if (rupee->colorIdx == 2) {
rupee->actor.velocity.y = 7.0f;
}
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
}
this->action = DNT_ACTION_NONE;
this->actionFunc = EnDntNomal_SetupStageWait;
break;
}
}
}
void EnDntNomal_StageAttackHide(EnDntNomal* this, GlobalContext* globalCtx) {
if (this->actor.xzDistToPlayer > 70.0f) {
this->actionFunc = EnDntNomal_SetupStageUp;
}
}
void EnDntNomal_SetupStageAttack(EnDntNomal* this, GlobalContext* globalCtx) {
if (this->timer3 == 0) {
this->endFrame = (f32)Animation_GetLastFrame(&gDntStageSpitAnim);
Animation_Change(&this->skelAnime, &gDntStageSpitAnim, 1.0f, 0.0f, this->endFrame, ANIMMODE_ONCE, -10.0f);
this->actor.colChkInfo.mass = 0xFF;
this->isSolid = true;
this->timer2 = 0;
Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY);
this->actionFunc = EnDntNomal_StageAttack;
}
}
void EnDntNomal_StageAttack(EnDntNomal* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
Actor* nut;
f32 frame = this->skelAnime.curFrame;
f32 dz;
f32 dx;
f32 dy;
SkelAnime_Update(&this->skelAnime);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0);
dx = player->actor.world.pos.x - this->mouthPos.x;
dy = player->actor.world.pos.y + 30.0f - this->mouthPos.y;
dz = player->actor.world.pos.z - this->mouthPos.z;
Math_SmoothStepToS(&this->actor.shape.rot.x, -(s16)(Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz))) * 10430.378f), 3,
0x1388, 0);
if ((frame >= this->endFrame) && (this->timer2 == 0)) {
this->timer2 = (s16)Rand_ZeroFloat(10.0f) + 10;
}
if (this->timer2 == 1) {
this->spawnedItem = false;
this->actionFunc = EnDntNomal_SetupStageAttack;
} else if (this->actor.xzDistToPlayer < 50.0f) {
this->action = DNT_ACTION_ATTACK;
this->actionFunc = EnDntNomal_SetupStageHide;
} else if ((frame >= 8.0f) && (!this->spawnedItem)) {
Vec3f baseOffset;
Vec3f spawnOffset;
f32 spawnX;
f32 spawnY;
f32 spawnZ;
Matrix_RotateY(this->actor.shape.rot.y / (f32)0x8000 * M_PI, MTXMODE_NEW);
Matrix_RotateX(this->actor.shape.rot.x / (f32)0x8000 * M_PI, MTXMODE_APPLY);
baseOffset.x = 0.0f;
baseOffset.y = 0.0f;
baseOffset.z = 5.0f;
Matrix_MultVec3f(&baseOffset, &spawnOffset);
spawnX = this->mouthPos.x + spawnOffset.x;
spawnY = this->mouthPos.y + spawnOffset.y;
spawnZ = this->mouthPos.z + spawnOffset.z;
nut = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_NUTSBALL, spawnX, spawnY, spawnZ,
this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, 4);
if (nut != NULL) {
nut->velocity.y = spawnOffset.y * 0.5f;
}
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_THROW);
this->spawnedItem = true;
}
}
void EnDntNomal_StageSetupReturn(EnDntNomal* this, GlobalContext* globalCtx) {
this->endFrame = (f32)Animation_GetLastFrame(&gDntStageWalkAnim);
Animation_Change(&this->skelAnime, &gDntStageWalkAnim, 1.5f, 0.0f, this->endFrame, ANIMMODE_LOOP, -10.0f);
this->actor.speedXZ = 4.0f;
this->isSolid = false;
this->actionFunc = EnDntNomal_StageReturn;
}
void EnDntNomal_StageReturn(EnDntNomal* this, GlobalContext* globalCtx) {
f32 sp2C;
f32 sp28;
SkelAnime_Update(&this->skelAnime);
sp2C = this->flowerPos.x - this->actor.world.pos.x;
sp28 = this->flowerPos.z - this->actor.world.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(sp2C, sp28) * 10430.378f, 1, 0xBB8, 0);
if (this->timer5 == 0) {
this->timer5 = 10;
} else if (!(this->timer5 & 1)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_WALK);
}
if ((fabsf(sp2C) < 7.0f) && (fabsf(sp28) < 7.0f)) {
this->actor.world.pos.x = this->flowerPos.x;
this->actor.world.pos.z = this->flowerPos.z;
this->actor.speedXZ = 0.0f;
this->actionFunc = EnDntNomal_SetupStageHide;
}
}
void EnDntNomal_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnDntNomal* this = THIS;
if (this->timer1 != 0) {
this->timer1--;
}
if (this->timer2 != 0) {
this->timer2--;
}
if (this->timer3 != 0) {
this->timer3--;
}
if (this->timer4 != 0) {
this->timer4--;
}
if (this->timer5 != 0) {
this->timer5--;
}
if (this->blinkTimer != 0) {
this->blinkTimer--;
}
this->actor.world.rot.x = this->actor.shape.rot.x;
if (this->actionFunc != EnDntNomal_StageCelebrate) {
this->actor.world.rot.y = this->actor.shape.rot.y;
}
this->unkCounter++;
if (this->type != ENDNTNOMAL_TARGET) {
switch (this->stageSignal) {
case DNT_SIGNAL_LOOK:
if (this->stagePrize == DNT_PRIZE_NONE) {
this->actionFunc = EnDntNomal_SetupStageUp;
} else {
this->actionFunc = EnDntNomal_StageUp;
}
break;
case DNT_SIGNAL_CELEBRATE:
this->action = DNT_ACTION_NONE;
this->actor.colChkInfo.mass = 0;
this->timer3 = (s16)Rand_ZeroFloat(3.0f) + (s16)(this->type * 0.5f);
this->actionFunc = EnDntNomal_SetupStageUnburrow;
break;
case DNT_SIGNAL_DANCE:
this->action = DNT_ACTION_DANCE;
this->actionFunc = EnDntNomal_SetupStageUnburrow;
break;
case DNT_SIGNAL_HIDE:
this->actionFunc = EnDntNomal_SetupStageHide;
break;
case DNT_SIGNAL_RETURN:
this->actionFunc = EnDntNomal_StageSetupReturn;
break;
case DNT_SIGNAL_UNUSED:
this->actionFunc = EnDntNomal_SetupStageDance;
break;
case DNT_SIGNAL_NONE:
break;
}
}
if (this->stageSignal != DNT_SIGNAL_NONE) {
this->stageSignal = DNT_SIGNAL_NONE;
}
if (this->blinkTimer == 0) {
this->eyeState++;
if (this->eyeState >= 3) {
this->eyeState = 0;
this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20;
}
}
this->actionFunc(this, globalCtx);
Actor_MoveForward(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 0x1D);
if (this->type == ENDNTNOMAL_TARGET) {
Collider_SetQuadVertices(&this->targetQuad, &this->targetVtx[0], &this->targetVtx[1], &this->targetVtx[2],
&this->targetVtx[3]);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->targetQuad.base);
} else {
Collider_UpdateCylinder(&this->actor, &this->bodyCyl);
if (this->isSolid) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCyl.base);
}
}
}
s32 EnDntNomal_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* thisx) {
EnDntNomal* this = THIS;
if ((limbIndex == 1) || (limbIndex == 3) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6)) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1733);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, sLeafColors[this->type - ENDNTNOMAL_STAGE].r,
sLeafColors[this->type - ENDNTNOMAL_STAGE].g, sLeafColors[this->type - ENDNTNOMAL_STAGE].b, 255);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1743);
}
return false;
}
void EnDntNomal_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
EnDntNomal* this = THIS;
Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
if (this->type == ENDNTNOMAL_TARGET) {
if (limbIndex == 5) {
Matrix_MultVec3f(&zeroVec, &this->mouthPos);
}
} else if (limbIndex == 7) {
Matrix_MultVec3f(&zeroVec, &this->mouthPos);
}
}
void EnDntNomal_DrawStageScrub(Actor* thisx, GlobalContext* globalCtx) {
static void* blinkTex[] = { &gDntStageEyeOpenTex, &gDntStageEyeHalfTex, &gDntStageEyeShutTex };
EnDntNomal* this = THIS;
Vec3f dustScale = { 0.25f, 0.25f, 0.25f };
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1790);
func_80093D18(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(blinkTex[this->eyeState]));
SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDntNomal_OverrideLimbDraw,
EnDntNomal_PostLimbDraw, this);
Matrix_Translate(this->flowerPos.x, this->flowerPos.y, this->flowerPos.z, MTXMODE_NEW);
Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, sLeafColors[this->type - ENDNTNOMAL_STAGE].r,
sLeafColors[this->type - ENDNTNOMAL_STAGE].g, sLeafColors[this->type - ENDNTNOMAL_STAGE].b, 255);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1814),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gDntStageFlowerDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1817);
if (this->actionFunc == EnDntNomal_StageCelebrate) {
func_80033C30(&this->actor.world.pos, &dustScale, 255, globalCtx);
}
}
void EnDntNomal_DrawTargetScrub(Actor* thisx, GlobalContext* globalCtx) {
EnDntNomal* this = THIS;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1833);
func_80093D18(globalCtx->state.gfxCtx);
SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnDntNomal_PostLimbDraw,
this);
Matrix_Translate(this->flowerPos.x, this->flowerPos.y, this->flowerPos.z, MTXMODE_NEW);
Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1848),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gHintNutsFlowerDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dnt_nomal.c", 1851);
}

View file

@ -6,11 +6,45 @@
struct EnDntNomal;
typedef void (*EnDntNomalActionFunc)(struct EnDntNomal*, GlobalContext*);
typedef struct EnDntNomal {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x214];
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ Vec3s jointTable[11];
/* 0x01D2 */ Vec3s morphTable[11];
/* 0x0214 */ EnDntNomalActionFunc actionFunc;
/* 0x0218 */ u8 isSolid;
/* 0x0219 */ Vec3f flowerPos;
/* 0x0228 */ Vec3f targetVtx[4];
/* 0x0258 */ s16 timer1;
/* 0x025A */ s16 timer2;
/* 0x025C */ s16 timer4;
/* 0x025E */ s16 timer5;
/* 0x0260 */ s16 blinkTimer;
/* 0x0262 */ s16 unkCounter;
/* 0x0264 */ s16 timer3;
/* 0x0266 */ s16 objId;
/* 0x0268 */ s16 eyeState;
/* 0x026A */ s16 type;
/* 0x026C */ s16 hitCounter;
/* 0x026E */ s16 endFrame;
/* 0x0270 */ s16 stageSignal;
/* 0x0272 */ s16 rotDirection;
/* 0x0274 */ s16 action;
/* 0x0276 */ u8 ignore;
/* 0x0277 */ u8 spawnedItem;
/* 0x0278 */ u8 stagePrize;
/* 0x0279 */ s8 objIndex;
/* 0x027C */ Vec3f mouthPos;
/* 0x0288 */ Vec3f targetPos;
/* 0x0294 */ ColliderQuad targetQuad;
/* 0x0314 */ ColliderCylinder bodyCyl;
} EnDntNomal; // size = 0x0360
#define ENDNTNOMAL_TARGET 0
#define ENDNTNOMAL_STAGE 1
extern const ActorInit En_Dnt_Nomal_InitVars;
#endif

View file

@ -5,6 +5,7 @@
*/
#include "z_en_hintnuts.h"
#include "objects/object_hintnuts/object_hintnuts.h"
#define FLAGS 0x00000005
@ -28,18 +29,6 @@ void EnHintnuts_Talk(EnHintnuts* this, GlobalContext* globalCtx);
void EnHintnuts_Leave(EnHintnuts* this, GlobalContext* globalCtx);
void EnHintnuts_Freeze(EnHintnuts* this, GlobalContext* globalCtx);
extern AnimationHeader D_06000168;
extern Gfx D_060014E0[];
extern SkeletonHeader D_060023B8;
extern AnimationHeader D_060024CC;
extern AnimationHeader D_060026C4;
extern AnimationHeader D_06002B90;
extern AnimationHeader D_06002894;
extern AnimationHeader D_060029BC;
extern AnimationHeader D_06002E84;
extern AnimationHeader D_06002F7C;
extern AnimationHeader D_06003128;
const ActorInit En_Hintnuts_InitVars = {
ACTOR_EN_HINTNUTS,
ACTORCAT_ENEMY,
@ -91,7 +80,8 @@ void EnHintnuts_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.flags &= ~5;
} else {
ActorShape_Init(&this->actor.shape, 0x0, ActorShadow_DrawCircle, 35.0f);
SkelAnime_Init(globalCtx, &this->skelAnime, &D_060023B8, &D_06002F7C, this->jointTable, this->morphTable, 10);
SkelAnime_Init(globalCtx, &this->skelAnime, &gHintNutsSkel, &gHintNutsStandAnim, this->jointTable,
this->morphTable, 10);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
@ -128,7 +118,7 @@ void EnHintnuts_HitByScrubProjectile1(EnHintnuts* this, GlobalContext* globalCtx
}
void EnHintnuts_SetupWait(EnHintnuts* this) {
Animation_PlayOnceSetSpeed(&this->skelAnime, &D_06002B90, 0.0f);
Animation_PlayOnceSetSpeed(&this->skelAnime, &gHintNutsUpAnim, 0.0f);
this->animFlagAndTimer = Rand_S16Offset(100, 50);
this->collider.dim.height = 5;
this->actor.world.pos = this->actor.home.pos;
@ -137,18 +127,18 @@ void EnHintnuts_SetupWait(EnHintnuts* this) {
}
void EnHintnuts_SetupLookAround(EnHintnuts* this) {
Animation_PlayLoop(&this->skelAnime, &D_06002894);
Animation_PlayLoop(&this->skelAnime, &gHintNutsLookAroundAnim);
this->animFlagAndTimer = 2;
this->actionFunc = EnHintnuts_LookAround;
}
void EnHintnuts_SetupThrowScrubProjectile(EnHintnuts* this) {
Animation_PlayOnce(&this->skelAnime, &D_06000168);
Animation_PlayOnce(&this->skelAnime, &gHintNutsSpitAnim);
this->actionFunc = EnHintnuts_ThrowNut;
}
void EnHintnuts_SetupStand(EnHintnuts* this) {
Animation_MorphToLoop(&this->skelAnime, &D_06002F7C, -3.0f);
Animation_MorphToLoop(&this->skelAnime, &gHintNutsStandAnim, -3.0f);
if (this->actionFunc == EnHintnuts_ThrowNut) {
this->animFlagAndTimer = 2 | 0x1000; // sets timer and flag
} else {
@ -158,13 +148,13 @@ void EnHintnuts_SetupStand(EnHintnuts* this) {
}
void EnHintnuts_SetupBurrow(EnHintnuts* this) {
Animation_MorphToPlayOnce(&this->skelAnime, &D_060024CC, -5.0f);
Animation_MorphToPlayOnce(&this->skelAnime, &gHintNutsBurrowAnim, -5.0f);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DOWN);
this->actionFunc = EnHintnuts_Burrow;
}
void EnHintnuts_HitByScrubProjectile2(EnHintnuts* this) {
Animation_MorphToPlayOnce(&this->skelAnime, &D_060026C4, -3.0f);
Animation_MorphToPlayOnce(&this->skelAnime, &gHintNutsUnburrowAnim, -3.0f);
this->collider.dim.height = 0x25;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DAMAGE);
this->collider.base.acFlags &= ~AC_ON;
@ -189,19 +179,19 @@ void EnHintnuts_HitByScrubProjectile2(EnHintnuts* this) {
}
void EnHintnuts_SetupRun(EnHintnuts* this) {
Animation_PlayLoop(&this->skelAnime, &D_06003128);
Animation_PlayLoop(&this->skelAnime, &gHintNutsRunAnim);
this->animFlagAndTimer = 5;
this->actionFunc = EnHintnuts_Run;
}
void EnHintnuts_SetupTalk(EnHintnuts* this) {
Animation_MorphToLoop(&this->skelAnime, &D_06002E84, -5.0f);
Animation_MorphToLoop(&this->skelAnime, &gHintNutsTalkAnim, -5.0f);
this->actionFunc = EnHintnuts_Talk;
this->actor.speedXZ = 0.0f;
}
void EnHintnuts_SetupLeave(EnHintnuts* this, GlobalContext* globalCtx) {
Animation_MorphToLoop(&this->skelAnime, &D_06003128, -5.0f);
Animation_MorphToLoop(&this->skelAnime, &gHintNutsRunAnim, -5.0f);
this->actor.speedXZ = 3.0f;
this->animFlagAndTimer = 100;
this->actor.world.rot.y = this->actor.shape.rot.y;
@ -214,7 +204,7 @@ void EnHintnuts_SetupLeave(EnHintnuts* this, GlobalContext* globalCtx) {
}
void EnHintnuts_SetupFreeze(EnHintnuts* this) {
Animation_PlayLoop(&this->skelAnime, &D_060029BC);
Animation_PlayLoop(&this->skelAnime, &gHintNutsFreezeAnim);
this->actor.flags &= ~1;
func_8003426C(&this->actor, 0, 0xFF, 0, 100);
this->actor.colorFilterTimer = 1;
@ -507,7 +497,7 @@ void EnHintnuts_Update(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetFocus(&this->actor, this->skelAnime.curFrame);
} else if (this->actionFunc == EnHintnuts_Burrow) {
Actor_SetFocus(&this->actor,
20.0f - ((this->skelAnime.curFrame * 20.0f) / Animation_GetLastFrame(&D_060024CC)));
20.0f - ((this->skelAnime.curFrame * 20.0f) / Animation_GetLastFrame(&gHintNutsBurrowAnim)));
} else {
Actor_SetFocus(&this->actor, 20.0f);
}
@ -547,7 +537,7 @@ void EnHintnuts_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnHintnuts* this = THIS;
if (this->actor.params == 0xA) {
Gfx_DrawDListOpa(globalCtx, D_060014E0);
Gfx_DrawDListOpa(globalCtx, gHintNutsFlowerDL);
} else {
SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHintnuts_OverrideLimbDraw,
NULL, this);

View file

@ -5,6 +5,9 @@
*/
#include "z_en_nutsball.h"
#include "objects/object_dns/object_dns.h"
#include "objects/object_hintnuts/object_hintnuts.h"
#include "objects/object_dnk/object_dnk.h"
#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h"
#define FLAGS 0x00000010
@ -53,7 +56,7 @@ static ColliderCylinderInit sCylinderInit = {
static s16 sObjectIDs[] = { OBJECT_DEKUNUTS, OBJECT_HINTNUTS, OBJECT_SHOPNUTS, OBJECT_DNS, OBJECT_DNK };
static Gfx* sDLists[] = { 0x06002028, 0x060012F0, 0x06004008, 0x06002410, 0x06001890 };
static Gfx* sDLists[] = { 0x06002028, gHintNutsNutDL, 0x06004008, gDntJijiNutDL, gDntStageNutDL };
void EnNutsball_Init(Actor* thisx, GlobalContext* globalCtx) {
EnNutsball* this = THIS;