2022-03-21 21:51:23 -04:00
|
|
|
|
/*
|
|
|
|
|
* File: z_en_heishi2.c
|
|
|
|
|
* Overlay: ovl_En_Heishi2
|
|
|
|
|
* Description: Hyrulian Guards
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "vt.h"
|
|
|
|
|
#include "z_en_heishi2.h"
|
|
|
|
|
#include "objects/object_sd/object_sd.h"
|
|
|
|
|
#include "objects/object_link_child/object_link_child.h"
|
|
|
|
|
#include "overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h"
|
|
|
|
|
#include "overlays/actors/ovl_En_Bom/z_en_bom.h"
|
|
|
|
|
#include "overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h"
|
|
|
|
|
|
|
|
|
|
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3)
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void EnHeishi2_Init(Actor* thisx, PlayState* play);
|
|
|
|
|
void EnHeishi2_Destroy(Actor* thisx, PlayState* play);
|
|
|
|
|
void EnHeishi2_Update(Actor* thisx, PlayState* play);
|
|
|
|
|
void EnHeishi2_Draw(Actor* thisx, PlayState* play);
|
|
|
|
|
|
|
|
|
|
void EnHeishi2_DrawKingGuard(Actor* thisx, PlayState* play);
|
|
|
|
|
void EnHeishi2_DoNothing1(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void EnHeishi_DoNothing2(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A531E4(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A53278(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A5344C(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A54954(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A53538(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A535BC(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A5399C(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A53638(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A5372C(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A5475C(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A53AD4(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A53C0C(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A53C90(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A53D0C(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A544AC(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A53908(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A53F30(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A54038(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A5427C(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A549E8(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A53850(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A54320(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A543A0(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A5455C(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A546DC(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A541FC(EnHeishi2* this, PlayState* play);
|
|
|
|
|
void func_80A53DF8(EnHeishi2* this, PlayState* play);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
|
|
|
|
|
const ActorInit En_Heishi2_InitVars = {
|
|
|
|
|
ACTOR_EN_HEISHI2,
|
|
|
|
|
ACTORCAT_NPC,
|
|
|
|
|
FLAGS,
|
|
|
|
|
OBJECT_SD,
|
|
|
|
|
sizeof(EnHeishi2),
|
|
|
|
|
(ActorFunc)EnHeishi2_Init,
|
|
|
|
|
(ActorFunc)EnHeishi2_Destroy,
|
|
|
|
|
(ActorFunc)EnHeishi2_Update,
|
|
|
|
|
(ActorFunc)EnHeishi2_Draw,
|
|
|
|
|
NULL,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static ColliderCylinderInit sCylinderInit = {
|
|
|
|
|
{
|
|
|
|
|
COLTYPE_NONE,
|
|
|
|
|
AT_NONE,
|
|
|
|
|
AC_NONE,
|
|
|
|
|
OC1_ON | OC1_TYPE_ALL,
|
|
|
|
|
OC2_TYPE_2,
|
|
|
|
|
COLSHAPE_CYLINDER,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
ELEMTYPE_UNK0,
|
|
|
|
|
{ 0x00000000, 0x00, 0x00 },
|
|
|
|
|
{ 0x00000000, 0x00, 0x00 },
|
|
|
|
|
TOUCH_NONE,
|
|
|
|
|
BUMP_NONE,
|
|
|
|
|
OCELEM_ON,
|
|
|
|
|
},
|
|
|
|
|
{ 33, 40, 0, { 0, 0, 0 } },
|
|
|
|
|
};
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void EnHeishi2_Init(Actor* thisx, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
ColliderCylinder* collider;
|
|
|
|
|
EnHeishi2* this = (EnHeishi2*)thisx;
|
|
|
|
|
|
|
|
|
|
Actor_SetScale(&this->actor, 0.01f);
|
|
|
|
|
this->type = this->actor.params & 0xFF;
|
|
|
|
|
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
|
|
|
|
|
|
|
|
|
|
if ((this->type == 6) || (this->type == 9)) {
|
|
|
|
|
this->actor.draw = EnHeishi2_DrawKingGuard;
|
|
|
|
|
this->actor.flags &= ~ACTOR_FLAG_0;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Actor_ChangeCategory(play, &play->actorCtx, &this->actor, 6);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
if (this->type == 6) {
|
|
|
|
|
this->actionFunc = EnHeishi2_DoNothing1;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
osSyncPrintf("\n\n");
|
|
|
|
|
// "No, I'm completely disappointed" (message for when shooting guard window in courtyard)
|
|
|
|
|
osSyncPrintf(VT_FGCOL(PURPLE) " ☆☆☆☆☆ いやー ついうっかり ☆☆☆☆☆ \n" VT_RST);
|
|
|
|
|
|
|
|
|
|
Actor_SetScale(&this->actor, 0.02f);
|
|
|
|
|
|
|
|
|
|
this->unk_274 = this->actor.world.pos;
|
|
|
|
|
this->actor.world.rot.y = 0x7918;
|
|
|
|
|
this->actor.world.pos.x += 90.0f;
|
|
|
|
|
this->actor.world.pos.y -= 60.0f;
|
|
|
|
|
this->actor.world.pos.z += 90.0f;
|
|
|
|
|
this->actor.shape.rot.y = this->actor.world.rot.y;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Collider_DestroyCylinder(play, &this->collider);
|
|
|
|
|
func_8002DF54(play, 0, 8);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_4;
|
|
|
|
|
this->actionFunc = func_80A544AC;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this->unk_2E0 = 60.0f;
|
|
|
|
|
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
SkelAnime_Init(play, &this->skelAnime, &gEnHeishiSkel, &gEnHeishiIdleAnim, this->jointTable,
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->morphTable, 17);
|
|
|
|
|
collider = &this->collider;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Collider_InitCylinder(play, collider);
|
|
|
|
|
Collider_SetCylinder(play, collider, &this->actor, &sCylinderInit);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->collider.dim.yShift = 0;
|
|
|
|
|
this->collider.dim.radius = 15;
|
|
|
|
|
this->collider.dim.height = 70;
|
|
|
|
|
this->actor.targetMode = 6;
|
|
|
|
|
|
|
|
|
|
switch (this->type) {
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
this->actionFunc = func_80A531E4;
|
|
|
|
|
this->actor.gravity = -1.0f;
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
this->actionFunc = func_80A53908;
|
|
|
|
|
this->actor.gravity = -1.0f;
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
osSyncPrintf("\n\n");
|
|
|
|
|
// "Peep hole soldier!"
|
|
|
|
|
osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ 覗き穴奥兵士ふぃ〜 ☆☆☆☆☆ \n" VT_RST);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Collider_DestroyCylinder(play, collider);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_3);
|
|
|
|
|
this->actionFunc = EnHeishi_DoNothing2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this->unk_2F0 = (this->actor.params >> 8) & 0xFF;
|
|
|
|
|
osSyncPrintf("\n\n");
|
|
|
|
|
// "Soldier Set 2 Completed!"
|
|
|
|
|
osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ 兵士2セット完了! ☆☆☆☆☆ %d\n" VT_RST, this->actor.params);
|
|
|
|
|
// "Identification Completed!"
|
|
|
|
|
osSyncPrintf(VT_FGCOL(YELLOW) " ☆☆☆☆☆ 識別完了! ☆☆☆☆☆ %d\n" VT_RST, this->type);
|
|
|
|
|
// "Message completed!"
|
|
|
|
|
osSyncPrintf(VT_FGCOL(PURPLE) " ☆☆☆☆☆ メッセージ完了! ☆☆☆☆☆ %x\n\n" VT_RST, (this->actor.params >> 8) & 0xF);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void EnHeishi2_Destroy(Actor* thisx, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
EnHeishi2* this = (EnHeishi2*)thisx;
|
|
|
|
|
|
|
|
|
|
if ((this->collider.dim.radius != 0) || (this->collider.dim.height != 0)) {
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Collider_DestroyCylinder(play, &this->collider);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
}
|
2023-05-22 09:20:06 -04:00
|
|
|
|
|
|
|
|
|
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void EnHeishi2_DoNothing1(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void EnHeishi_DoNothing2(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A531E4(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim);
|
|
|
|
|
|
|
|
|
|
Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f);
|
|
|
|
|
this->actionFunc = func_80A53278;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A53278(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->unk_30B = 0;
|
|
|
|
|
this->unk_30E = 0;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
if (Text_GetFaceReaction(play, 5) != 0) {
|
|
|
|
|
this->actor.textId = Text_GetFaceReaction(play, 5);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->unk_30B = 1;
|
|
|
|
|
this->unk_300 = TEXT_STATE_DONE;
|
|
|
|
|
this->actionFunc = func_80A5475C;
|
|
|
|
|
} else if ((gSaveContext.eventChkInf[0] & 0x200) && (gSaveContext.eventChkInf[2] & 0x20) &&
|
|
|
|
|
(gSaveContext.eventChkInf[3] & 0x80)) {
|
|
|
|
|
// "Get all spiritual stones!"
|
|
|
|
|
osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ 全部の精霊石GET! ☆☆☆☆☆ \n" VT_RST);
|
|
|
|
|
this->unk_300 = TEXT_STATE_DONE;
|
|
|
|
|
this->actor.textId = 0x7006;
|
|
|
|
|
this->actionFunc = func_80A5475C;
|
|
|
|
|
} else if (!IS_DAY) {
|
|
|
|
|
// "Sleep early for children!"
|
|
|
|
|
osSyncPrintf(VT_FGCOL(YELLOW) " ☆☆☆☆☆ 子供ははやくネロ! ☆☆☆☆☆ \n" VT_RST);
|
|
|
|
|
this->unk_300 = TEXT_STATE_DONE;
|
|
|
|
|
this->actor.textId = 0x7002;
|
|
|
|
|
this->actionFunc = func_80A5475C;
|
|
|
|
|
|
|
|
|
|
} else if (this->unk_30C != 0) {
|
|
|
|
|
// "Anything passes"
|
|
|
|
|
osSyncPrintf(VT_FGCOL(BLUE) " ☆☆☆☆☆ なんでも通るよ ☆☆☆☆☆ \n" VT_RST);
|
|
|
|
|
this->unk_300 = TEXT_STATE_DONE;
|
|
|
|
|
this->actor.textId = 0x7099;
|
|
|
|
|
this->actionFunc = func_80A5475C;
|
|
|
|
|
} else if (gSaveContext.eventChkInf[1] & 4) {
|
|
|
|
|
if (this->unk_30E == 0) {
|
|
|
|
|
// "Start under the first sleeve!"
|
|
|
|
|
osSyncPrintf(VT_FGCOL(PURPLE) " ☆☆☆☆☆ 1回目袖の下開始! ☆☆☆☆☆ \n" VT_RST);
|
|
|
|
|
this->actor.textId = 0x7071;
|
|
|
|
|
this->unk_30E = 1;
|
|
|
|
|
} else {
|
|
|
|
|
// "Start under the second sleeve!"
|
|
|
|
|
osSyncPrintf(VT_FGCOL(PURPLE) " ☆☆☆☆☆ 2回目袖の下開始! ☆☆☆☆☆ \n" VT_RST);
|
|
|
|
|
this->actor.textId = 0x7072;
|
|
|
|
|
}
|
|
|
|
|
this->unk_300 = TEXT_STATE_CHOICE;
|
|
|
|
|
this->actionFunc = func_80A5475C;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
// "That's okay"
|
|
|
|
|
osSyncPrintf(VT_FGCOL(CYAN) " ☆☆☆☆☆ それはとおらんよぉ ☆☆☆☆☆ \n" VT_RST);
|
|
|
|
|
this->unk_300 = TEXT_STATE_DONE;
|
|
|
|
|
this->actor.textId = 0x7029;
|
|
|
|
|
this->actionFunc = func_80A5475C;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A5344C(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
SkelAnime_Update(&this->skelAnime);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->unk_300 = TEXT_STATE_EVENT;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
switch (play->msgCtx.choiceIndex) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
case 0:
|
|
|
|
|
if (gSaveContext.rupees >= 10) {
|
|
|
|
|
Rupees_ChangeBy(-10);
|
|
|
|
|
this->actor.textId = 0x7098;
|
|
|
|
|
this->actionFunc = func_80A53538;
|
|
|
|
|
break;
|
|
|
|
|
} else {
|
|
|
|
|
this->actor.textId = 0x7097;
|
|
|
|
|
this->actionFunc = func_80A54954;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 1:
|
|
|
|
|
this->actor.textId = 0x7096;
|
|
|
|
|
this->actionFunc = func_80A54954;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Message_ContinueTextbox(play, this->actor.textId);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A53538(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
SkelAnime_Update(&this->skelAnime);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
if (this->unk_300 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) {
|
|
|
|
|
func_8002DF54(play, NULL, 8);
|
|
|
|
|
play->msgCtx.msgMode = MSGMODE_PAUSED;
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->actionFunc = func_80A535BC;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A535BC(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
f32 frameCount = Animation_GetLastFrame(&gEnHeishiSlamSpearAnim);
|
|
|
|
|
|
|
|
|
|
this->unk_2EC = frameCount;
|
|
|
|
|
Animation_Change(&this->skelAnime, &gEnHeishiSlamSpearAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, -10.0f);
|
|
|
|
|
this->actionFunc = func_80A53638;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A53638(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
s32 pad;
|
|
|
|
|
f32 frameCount = this->skelAnime.curFrame;
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
BgSpot15Saku* actor = (BgSpot15Saku*)play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head;
|
2022-03-21 21:51:23 -04:00
|
|
|
|
|
|
|
|
|
SkelAnime_Update(&this->skelAnime);
|
|
|
|
|
if ((frameCount >= 12.0f) && (!this->audioFlag)) {
|
|
|
|
|
Audio_PlayActorSound2(&this->actor, NA_SE_EV_SPEAR_HIT);
|
|
|
|
|
this->audioFlag = 1;
|
|
|
|
|
}
|
|
|
|
|
if (this->unk_2EC <= frameCount) {
|
|
|
|
|
while (actor != NULL) {
|
|
|
|
|
if (actor->dyna.actor.id != ACTOR_BG_SPOT15_SAKU) {
|
|
|
|
|
actor = (BgSpot15Saku*)(actor->dyna.actor.next);
|
|
|
|
|
} else {
|
|
|
|
|
this->gate = &actor->dyna.actor;
|
|
|
|
|
actor->unk_168 = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// "I've come!"
|
|
|
|
|
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆ きたきたきたぁ! ☆☆☆ %x\n" VT_RST, actor->dyna.actor.next);
|
|
|
|
|
this->actionFunc = func_80A5372C;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A5372C(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim);
|
|
|
|
|
|
|
|
|
|
Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f);
|
|
|
|
|
this->unk_2F2[0] = 200;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
this->cameraId = Play_CreateSubCamera(play);
|
|
|
|
|
Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT);
|
|
|
|
|
Play_ChangeCameraStatus(play, this->cameraId, CAM_STAT_ACTIVE);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->unk_280.x = 947.0f;
|
|
|
|
|
this->unk_280.y = 1195.0f;
|
|
|
|
|
this->unk_280.z = 2682.0f;
|
|
|
|
|
|
|
|
|
|
this->unk_28C.x = 1164.0f;
|
|
|
|
|
this->unk_28C.y = 1145.0f;
|
|
|
|
|
this->unk_28C.z = 3014.0f;
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->actionFunc = func_80A53850;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A53850(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
BgSpot15Saku* gate;
|
|
|
|
|
|
|
|
|
|
SkelAnime_Update(&this->skelAnime);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
gate = (BgSpot15Saku*)this->gate;
|
|
|
|
|
if ((this->unk_2F2[0] == 0) || (gate->unk_168 == 0)) {
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Play_ClearCamera(play, this->cameraId);
|
|
|
|
|
Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE);
|
|
|
|
|
Message_CloseTextbox(play);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->unk_30C = 1;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
func_8002DF54(play, NULL, 7);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->actionFunc = func_80A531E4;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A53908(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim);
|
|
|
|
|
|
|
|
|
|
Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f);
|
|
|
|
|
this->actionFunc = func_80A5399C;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A5399C(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
s16 var;
|
|
|
|
|
|
|
|
|
|
this->unk_30B = 0;
|
|
|
|
|
var = 0;
|
|
|
|
|
if (gSaveContext.infTable[7] & 0x40) {
|
|
|
|
|
if (!(gSaveContext.infTable[7] & 0x80)) {
|
2022-11-06 03:24:34 -05:00
|
|
|
|
if (Player_GetMask(play) == PLAYER_MASK_KEATON) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
if (this->unk_309 == 0) {
|
|
|
|
|
this->actor.textId = 0x200A;
|
|
|
|
|
} else {
|
|
|
|
|
this->actor.textId = 0x200B;
|
|
|
|
|
}
|
|
|
|
|
this->unk_300 = TEXT_STATE_CHOICE;
|
|
|
|
|
this->unk_30B = 1;
|
|
|
|
|
var = 1;
|
|
|
|
|
} else {
|
|
|
|
|
this->actor.textId = 0x2016;
|
|
|
|
|
this->unk_300 = TEXT_STATE_DONE;
|
|
|
|
|
var = 1;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this->actor.textId = 0x2020;
|
|
|
|
|
this->unk_300 = TEXT_STATE_EVENT;
|
|
|
|
|
this->unk_30E = 0;
|
|
|
|
|
}
|
2022-11-06 03:24:34 -05:00
|
|
|
|
if (Text_GetFaceReaction(play, 5) != 0) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
if (var == 0) {
|
2022-11-06 03:24:34 -05:00
|
|
|
|
this->actor.textId = Text_GetFaceReaction(play, 5);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->unk_30B = 1;
|
|
|
|
|
this->unk_300 = TEXT_STATE_DONE;
|
|
|
|
|
this->unk_30E = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this->actionFunc = func_80A5475C;
|
|
|
|
|
} else {
|
|
|
|
|
// "I don't know"
|
|
|
|
|
osSyncPrintf(VT_FGCOL(PURPLE) " ☆☆☆☆☆ とおしゃしねぇちゅーの ☆☆☆☆☆ \n" VT_RST);
|
|
|
|
|
this->actionFunc = func_80A53AD4;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A53AD4(EnHeishi2* this, PlayState* play) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
s32 exchangeItemId;
|
|
|
|
|
s16 yawDiffTemp;
|
|
|
|
|
s16 yawDiff;
|
|
|
|
|
|
|
|
|
|
SkelAnime_Update(&this->skelAnime);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
if (Text_GetFaceReaction(play, 5) != 0) {
|
|
|
|
|
this->actor.textId = Text_GetFaceReaction(play, 5);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
} else {
|
|
|
|
|
this->actor.textId = 0x200E;
|
|
|
|
|
}
|
|
|
|
|
this->unk_300 = TEXT_STATE_DONE;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
if (Actor_ProcessTalkRequest(&this->actor, play)) {
|
|
|
|
|
exchangeItemId = func_8002F368(play);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
if (exchangeItemId == EXCH_ITEM_LETTER_ZELDA) {
|
|
|
|
|
func_80078884(NA_SE_SY_CORRECT_CHIME);
|
|
|
|
|
player->actor.textId = 0x2010;
|
|
|
|
|
this->unk_300 = TEXT_STATE_EVENT;
|
|
|
|
|
this->actionFunc = func_80A53C0C;
|
|
|
|
|
} else if (exchangeItemId != EXCH_ITEM_NONE) {
|
|
|
|
|
player->actor.textId = 0x200F;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
yawDiffTemp = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
|
|
|
|
|
yawDiff = ABS(yawDiffTemp);
|
|
|
|
|
if (!(120.0f < this->actor.xzDistToPlayer) && (yawDiff < 0x4300)) {
|
2022-11-06 03:24:34 -05:00
|
|
|
|
func_8002F298(&this->actor, play, 100.0f, EXCH_ITEM_LETTER_ZELDA);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A53C0C(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
SkelAnime_Update(&this->skelAnime);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
if ((this->unk_300 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) {
|
|
|
|
|
func_8002DF54(play, 0, 8);
|
|
|
|
|
play->msgCtx.msgMode = MSGMODE_PAUSED;
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->actionFunc = func_80A53C90;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A53C90(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
f32 frameCount = Animation_GetLastFrame(&gEnHeishiSlamSpearAnim);
|
|
|
|
|
|
|
|
|
|
this->unk_2EC = frameCount;
|
|
|
|
|
Animation_Change(&this->skelAnime, &gEnHeishiSlamSpearAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, -10.0f);
|
|
|
|
|
this->actionFunc = func_80A53D0C;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A53D0C(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
s32 pad;
|
|
|
|
|
f32 frameCount;
|
|
|
|
|
BgGateShutter* gate;
|
|
|
|
|
|
|
|
|
|
frameCount = this->skelAnime.curFrame;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
gate = (BgGateShutter*)play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head;
|
2022-03-21 21:51:23 -04:00
|
|
|
|
SkelAnime_Update(&this->skelAnime);
|
|
|
|
|
if (12.0f <= frameCount) {
|
|
|
|
|
if (this->audioFlag == 0) {
|
|
|
|
|
Audio_PlayActorSound2(&this->actor, NA_SE_EV_SPEAR_HIT);
|
|
|
|
|
this->audioFlag = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this->unk_2EC <= frameCount) {
|
|
|
|
|
while (gate != NULL) {
|
|
|
|
|
if (gate->dyna.actor.id != ACTOR_BG_GATE_SHUTTER) {
|
|
|
|
|
gate = (BgGateShutter*)gate->dyna.actor.next;
|
|
|
|
|
} else {
|
|
|
|
|
this->gate = &gate->dyna.actor;
|
|
|
|
|
gate->openingState = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// "I've come!"
|
|
|
|
|
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆ きたきたきたぁ! ☆☆☆ %x\n" VT_RST, gate->dyna.actor.next);
|
|
|
|
|
this->actionFunc = func_80A53DF8;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A53DF8(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim);
|
|
|
|
|
|
|
|
|
|
Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f);
|
|
|
|
|
this->unk_2F2[0] = 200;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
this->cameraId = Play_CreateSubCamera(play);
|
|
|
|
|
Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT);
|
|
|
|
|
Play_ChangeCameraStatus(play, this->cameraId, CAM_STAT_ACTIVE);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->unk_2BC.x = -71.0f;
|
|
|
|
|
this->unk_280.x = -71.0f;
|
|
|
|
|
this->unk_2BC.y = 571.0f;
|
|
|
|
|
this->unk_280.y = 571.0f;
|
|
|
|
|
this->unk_2BC.z = -1487.0f;
|
|
|
|
|
this->unk_280.z = -1487.0f;
|
|
|
|
|
this->unk_298.x = 181.0f;
|
|
|
|
|
this->unk_28C.x = 181.0f;
|
|
|
|
|
this->unk_298.y = 417.0f;
|
|
|
|
|
this->unk_28C.y = 417.0f;
|
|
|
|
|
this->unk_298.z = -1079.0f;
|
|
|
|
|
this->unk_28C.z = -1079.0f;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->actionFunc = func_80A53F30;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A53F30(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
BgGateShutter* gate;
|
|
|
|
|
|
|
|
|
|
SkelAnime_Update(&this->skelAnime);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
gate = (BgGateShutter*)this->gate;
|
|
|
|
|
if ((this->unk_2F2[0] == 0) || (gate->openingState == 0)) {
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Play_ClearCamera(play, this->cameraId);
|
|
|
|
|
Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
if ((this->unk_30A != 2)) {
|
|
|
|
|
if (this->unk_30A == 0) {
|
|
|
|
|
this->actor.textId = 0x2015;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Message_ContinueTextbox(play, this->actor.textId);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->actionFunc = func_80A54038;
|
|
|
|
|
} else {
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Message_CloseTextbox(play);
|
|
|
|
|
func_8002DF54(play, NULL, 7);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->actionFunc = func_80A53908;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this->unk_30E = 0;
|
|
|
|
|
this->actor.textId = 0x2021;
|
|
|
|
|
Rupees_ChangeBy(15);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Message_ContinueTextbox(play, this->actor.textId);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->actionFunc = func_80A5427C;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A54038(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
SkelAnime_Update(&this->skelAnime);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
gSaveContext.infTable[7] |= 0x40;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Message_CloseTextbox(play);
|
|
|
|
|
func_8002DF54(play, 0, 7);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->actionFunc = func_80A53908;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A540C0(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
SkelAnime_Update(&this->skelAnime);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) {
|
|
|
|
|
switch (play->msgCtx.choiceIndex) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
case 0:
|
|
|
|
|
this->actor.textId = 0x2020;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Message_ContinueTextbox(play, this->actor.textId);
|
|
|
|
|
Player_UnsetMask(play);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
gSaveContext.infTable[7] |= 0x80;
|
|
|
|
|
gSaveContext.itemGetInf[3] |= 0x100;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Item_Give(play, ITEM_SOLD_OUT);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
if (this->unk_30A != 0) {
|
|
|
|
|
this->unk_30A = 2;
|
|
|
|
|
this->unk_30E = 1;
|
|
|
|
|
this->actionFunc = func_80A5427C;
|
|
|
|
|
} else {
|
|
|
|
|
this->unk_30E = 0;
|
|
|
|
|
this->actionFunc = func_80A541FC;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
this->unk_30E = 1;
|
|
|
|
|
this->actor.textId = 0x200C;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Message_ContinueTextbox(play, this->actor.textId);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->unk_300 = TEXT_STATE_EVENT;
|
|
|
|
|
if (this->unk_30A == 0) {
|
|
|
|
|
this->actionFunc = func_80A5427C;
|
|
|
|
|
} else {
|
|
|
|
|
this->actionFunc = func_80A54954;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A541FC(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
SkelAnime_Update(&this->skelAnime);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->actor.textId = 0x2021;
|
|
|
|
|
Rupees_ChangeBy(15);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Message_ContinueTextbox(play, this->actor.textId);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->actionFunc = func_80A5427C;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A5427C(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
SkelAnime_Update(&this->skelAnime);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
if (this->unk_30E == 0) {
|
|
|
|
|
this->unk_30E = 0;
|
|
|
|
|
this->unk_30A = this->unk_30E;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Message_CloseTextbox(play);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->actionFunc = func_80A53908;
|
|
|
|
|
} else {
|
2022-11-06 03:24:34 -05:00
|
|
|
|
play->msgCtx.msgMode = MSGMODE_PAUSED;
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->actionFunc = func_80A54320;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A54320(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
f32 frameCount = Animation_GetLastFrame(&gEnHeishiSlamSpearAnim);
|
|
|
|
|
|
|
|
|
|
this->unk_2EC = frameCount;
|
|
|
|
|
Animation_Change(&this->skelAnime, &gEnHeishiSlamSpearAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, -10.0f);
|
|
|
|
|
this->audioFlag = 0;
|
|
|
|
|
this->actionFunc = func_80A543A0;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A543A0(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
s32 pad;
|
|
|
|
|
f32 frameCount = this->skelAnime.curFrame;
|
2022-11-06 03:24:34 -05:00
|
|
|
|
BgGateShutter* gate = (BgGateShutter*)(play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
SkelAnime_Update(&this->skelAnime);
|
|
|
|
|
|
|
|
|
|
if ((frameCount >= 12.0f) && (!this->audioFlag)) {
|
|
|
|
|
Audio_PlayActorSound2(&this->actor, NA_SE_EV_SPEAR_HIT);
|
|
|
|
|
this->audioFlag = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this->unk_2EC <= frameCount) {
|
|
|
|
|
while (gate != NULL) {
|
|
|
|
|
if (ACTOR_BG_GATE_SHUTTER != gate->dyna.actor.id) {
|
|
|
|
|
gate = (BgGateShutter*)(gate->dyna.actor.next);
|
|
|
|
|
} else {
|
|
|
|
|
this->gate = &gate->dyna.actor;
|
|
|
|
|
if (this->unk_30A != 2) {
|
|
|
|
|
gate->openingState = -1;
|
|
|
|
|
break;
|
|
|
|
|
} else {
|
|
|
|
|
gate->openingState = 2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this->unk_30A == 0) {
|
|
|
|
|
this->unk_30A = 1;
|
|
|
|
|
}
|
|
|
|
|
this->actionFunc = func_80A53DF8;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A544AC(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
Math_SmoothStepToS(&this->actor.shape.rot.z, -6100, 5, this->unk_2E4, 0);
|
|
|
|
|
Math_ApproachF(&this->unk_2E4, 3000.0f, 1.0f, 500.0f);
|
|
|
|
|
this->actor.world.rot.z = this->actor.shape.rot.z;
|
|
|
|
|
if (this->actor.shape.rot.z < -6000) {
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Message_StartTextbox(play, 0x708F, NULL);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
this->actor.flags |= ACTOR_FLAG_16;
|
|
|
|
|
this->actionFunc = func_80A5455C;
|
|
|
|
|
this->unk_2E4 = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A5455C(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
s32 pad;
|
|
|
|
|
Vec3f pos;
|
|
|
|
|
f32 rotY;
|
|
|
|
|
EnBom* bomb;
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
|
|
|
|
|
func_8002DF54(play, NULL, 7);
|
|
|
|
|
Message_CloseTextbox(play);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
|
|
|
|
|
pos.x = Rand_CenteredFloat(20.0f) + this->unk_274.x;
|
|
|
|
|
pos.y = Rand_CenteredFloat(20.0f) + (this->unk_274.y - 40.0f);
|
|
|
|
|
pos.z = Rand_CenteredFloat(20.0f) + (this->unk_274.z - 20.0f);
|
|
|
|
|
rotY = Rand_CenteredFloat(7000.0f) + this->actor.yawTowardsPlayer;
|
2022-12-06 04:33:50 -05:00
|
|
|
|
bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, pos.x, pos.y, pos.z, 0, rotY, 0, 0, true);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
if (bomb != NULL) {
|
|
|
|
|
bomb->actor.speedXZ = Rand_CenteredFloat(5.0f) + 10.0f;
|
|
|
|
|
bomb->actor.velocity.y = Rand_CenteredFloat(5.0f) + 10.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// "This is down!"
|
|
|
|
|
osSyncPrintf(VT_FGCOL(YELLOW) " ☆☆☆☆☆ これでダウンだ! ☆☆☆☆☆ \n" VT_RST);
|
|
|
|
|
this->actionFunc = func_80A546DC;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A546DC(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
Math_SmoothStepToS(&this->actor.shape.rot.z, 200, 5, this->unk_2E4, 0);
|
|
|
|
|
Math_ApproachF(&this->unk_2E4, 3000.0f, 1.0f, 500.0f);
|
|
|
|
|
this->actor.world.rot.z = this->actor.shape.rot.z;
|
|
|
|
|
if (this->actor.shape.rot.z > 0) {
|
|
|
|
|
Actor_Kill(&this->actor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A5475C(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
s16 yawDiff;
|
|
|
|
|
|
|
|
|
|
SkelAnime_Update(&this->skelAnime);
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
if (Text_GetFaceReaction(play, 5) != 0) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
if (this->unk_30B == 0) {
|
|
|
|
|
if (this->type == 2) {
|
|
|
|
|
this->actionFunc = func_80A53278;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (this->type == 5) {
|
|
|
|
|
this->actionFunc = func_80A5399C;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (this->unk_30B != 0) {
|
|
|
|
|
if (this->type == 2) {
|
|
|
|
|
this->actionFunc = func_80A53278;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (this->type == 5) {
|
|
|
|
|
this->actionFunc = func_80A5399C;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
if (Actor_ProcessTalkRequest(&this->actor, play)) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
if (this->type == 2) {
|
|
|
|
|
if (this->unk_30E == 1) {
|
|
|
|
|
this->actionFunc = func_80A5344C;
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
this->actionFunc = func_80A53278;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else if (this->type == 5) {
|
|
|
|
|
if (this->unk_300 == TEXT_STATE_DONE) {
|
|
|
|
|
this->actionFunc = func_80A5399C;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this->unk_300 == TEXT_STATE_EVENT) {
|
|
|
|
|
this->actionFunc = func_80A54954;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this->unk_300 == TEXT_STATE_CHOICE) {
|
|
|
|
|
this->unk_309 = 1;
|
|
|
|
|
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
|
|
|
|
|
this->actionFunc = func_80A540C0;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (((this->type != 2) && (this->type != 5)) ||
|
|
|
|
|
((yawDiff = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)),
|
|
|
|
|
!(this->actor.xzDistToPlayer > 120.0f)) &&
|
|
|
|
|
(yawDiff < 0x4300))) {
|
2022-11-06 03:24:34 -05:00
|
|
|
|
func_8002F2F4(&this->actor, play);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A54954(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim);
|
|
|
|
|
|
|
|
|
|
Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f);
|
|
|
|
|
this->actionFunc = func_80A549E8;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void func_80A549E8(EnHeishi2* this, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
SkelAnime_Update(&this->skelAnime);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
if (this->unk_300 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) {
|
|
|
|
|
Message_CloseTextbox(play);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
if (this->type == 2) {
|
|
|
|
|
this->actionFunc = func_80A531E4;
|
|
|
|
|
}
|
|
|
|
|
if (this->type == 5) {
|
|
|
|
|
this->actionFunc = func_80A53908;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void EnHeishi2_Update(Actor* thisx, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
s32 pad;
|
|
|
|
|
EnHeishi2* this = (EnHeishi2*)thisx;
|
|
|
|
|
s32 i;
|
|
|
|
|
|
|
|
|
|
Actor_SetFocus(&this->actor, this->unk_2E0);
|
|
|
|
|
if ((this->type == 2) || (this->type == 5)) {
|
|
|
|
|
this->actor.focus.pos.y = 70.0f;
|
|
|
|
|
Actor_SetFocus(&this->actor, 70.0f);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
func_80038290(play, &this->actor, &this->unk_260, &this->unk_26C, this->actor.focus.pos);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this->unk_2FC++;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i != 5; i++) {
|
|
|
|
|
if (this->unk_2F2[i] != 0) {
|
|
|
|
|
this->unk_2F2[i]--;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-11-06 03:24:34 -05:00
|
|
|
|
this->actionFunc(this, play);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
Actor_MoveForward(&this->actor);
|
|
|
|
|
switch (this->type) {
|
|
|
|
|
case 6:
|
|
|
|
|
break;
|
|
|
|
|
case 9:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2022-11-06 03:24:34 -05:00
|
|
|
|
Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 30.0f, 0x1D);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
Collider_UpdateCylinder(&this->actor, &this->collider);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
s32 EnHeishi2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
2022-03-21 21:51:23 -04:00
|
|
|
|
void* thisx) {
|
|
|
|
|
EnHeishi2* this = (EnHeishi2*)thisx;
|
|
|
|
|
|
|
|
|
|
switch (this->type) {
|
|
|
|
|
case 1:
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
if (limbIndex == 9) {
|
|
|
|
|
rot->x = rot->x + this->unk_26C.y;
|
|
|
|
|
}
|
|
|
|
|
if (limbIndex == 16) {
|
|
|
|
|
rot->x = rot->x + this->unk_260.y;
|
|
|
|
|
rot->z = rot->z + this->unk_260.z;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void EnHeishi2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
EnHeishi2* this = (EnHeishi2*)thisx;
|
|
|
|
|
|
|
|
|
|
if (limbIndex == 16) {
|
|
|
|
|
Matrix_Get(&this->mtxf_330);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void EnHeishi2_DrawKingGuard(Actor* thisx, PlayState* play) {
|
|
|
|
|
OPEN_DISPS(play->state.gfxCtx);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
|
2022-03-21 21:51:23 -04:00
|
|
|
|
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, gHeishiKingGuardDL);
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
void EnHeishi2_Draw(Actor* thisx, PlayState* play) {
|
2022-03-21 21:51:23 -04:00
|
|
|
|
EnHeishi2* this = (EnHeishi2*)thisx;
|
|
|
|
|
Mtx* mtx;
|
|
|
|
|
s32 linkObjBankIndex;
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
OPEN_DISPS(play->state.gfxCtx);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
|
2022-11-29 18:29:36 -05:00
|
|
|
|
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi2_OverrideLimbDraw,
|
2022-03-21 21:51:23 -04:00
|
|
|
|
EnHeishi2_PostLimbDraw, this);
|
|
|
|
|
if ((this->type == 5) && (gSaveContext.infTable[7] & 0x80)) {
|
2022-11-06 03:24:34 -05:00
|
|
|
|
linkObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_LINK_CHILD);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
if (linkObjBankIndex >= 0) {
|
|
|
|
|
Matrix_Put(&this->mtxf_330);
|
|
|
|
|
Matrix_Translate(-570.0f, 0.0f, 0.0f, MTXMODE_APPLY);
|
|
|
|
|
Matrix_RotateZ(DEGTORAD(70.0), MTXMODE_APPLY);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
mtx = MATRIX_NEWMTX(play->state.gfxCtx) - 7;
|
2022-03-21 21:51:23 -04:00
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[linkObjBankIndex].segment);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x0D, mtx);
|
|
|
|
|
gSPDisplayList(POLY_OPA_DISP++, gLinkChildKeatonMaskDL);
|
2022-11-06 03:24:34 -05:00
|
|
|
|
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 03:24:34 -05:00
|
|
|
|
CLOSE_DISPS(play->state.gfxCtx);
|
2022-03-21 21:51:23 -04:00
|
|
|
|
}
|