mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-06 14:20:11 +00:00
En_Toryo OK (#569)
* En_Toryo OK * en_Toryo fixes Co-authored-by: fig <fig02srl@gmail.com>
This commit is contained in:
parent
2a13d71848
commit
209f0d21b8
17 changed files with 351 additions and 840 deletions
|
@ -15,9 +15,10 @@ void EnToryo_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void EnToryo_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnToryo_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
extern UNK_TYPE D_06007150;
|
||||
void func_80B20914(EnToryo* this, GlobalContext* globalCtx);
|
||||
s32 EnToryo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx);
|
||||
void EnToryo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx);
|
||||
|
||||
/*
|
||||
const ActorInit En_Toryo_InitVars = {
|
||||
ACTOR_EN_TORYO,
|
||||
ACTORTYPE_NPC,
|
||||
|
@ -29,27 +30,349 @@ const ActorInit En_Toryo_InitVars = {
|
|||
(ActorFunc)EnToryo_Update,
|
||||
(ActorFunc)EnToryo_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Toryo/EnToryo_Init.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Toryo/EnToryo_Destroy.s")
|
||||
static ColliderCylinderInit sColliderCylinderInit = {
|
||||
{ COLTYPE_UNK10, 0x00, 0x00, 0x39, 0x20, COLSHAPE_CYLINDER },
|
||||
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x00, 0x00, 0x01 },
|
||||
{ 18, 63, 0, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Toryo/func_80B203D8.s")
|
||||
static CollisionCheckInfoInit2 sCollisionCheckInfoInit2 = { 0x00, 0x00, 0x00, 0x00, 0xFF };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Toryo/func_80B205CC.s")
|
||||
static DamageTable sDamageTable = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Toryo/func_80B20634.s")
|
||||
typedef struct {
|
||||
AnimationHeader* anim;
|
||||
f32 unk_4;
|
||||
u8 mode;
|
||||
f32 transitionRate;
|
||||
} EnToryoAnimation;
|
||||
static EnToryoAnimation sEnToryoAnimation = { 0x06000E50, 1.0f, 0, 0 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Toryo/func_80B206A0.s")
|
||||
static Vec3f sMultVec = { 800.0f, 1000.0f, 0.0f };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Toryo/func_80B20768.s")
|
||||
extern FlexSkeletonHeader D_06007150;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Toryo/func_80B20914.s")
|
||||
void EnToryo_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnToryo* this = THIS;
|
||||
s32 pad;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Toryo/EnToryo_Update.s")
|
||||
switch (globalCtx->sceneNum) {
|
||||
case SCENE_SPOT09:
|
||||
if (LINK_AGE_IN_YEARS == YEARS_ADULT) {
|
||||
this->stateFlags |= 1;
|
||||
}
|
||||
break;
|
||||
case SCENE_SPOT01:
|
||||
if ((LINK_AGE_IN_YEARS == YEARS_CHILD) && (gSaveContext.nightFlag == 0)) {
|
||||
this->stateFlags |= 2;
|
||||
}
|
||||
break;
|
||||
case SCENE_KAKARIKO:
|
||||
if ((LINK_AGE_IN_YEARS == YEARS_CHILD) && (gSaveContext.nightFlag == 1)) {
|
||||
this->stateFlags |= 4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Toryo/EnToryo_Draw.s")
|
||||
if ((this->stateFlags & 7) == 0) {
|
||||
Actor_Kill(&this->actor);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Toryo/func_80B20B04.s")
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 42.0f);
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06007150, NULL, this->jointTable, this->morphTable, 17);
|
||||
Collider_InitCylinder(globalCtx, &this->collider);
|
||||
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sColliderCylinderInit);
|
||||
func_80061EFC(&this->actor.colChkInfo, &sDamageTable, &sCollisionCheckInfoInit2);
|
||||
func_8002E4B4(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
|
||||
Animation_Change(&this->skelAnime, sEnToryoAnimation.anim, 1.0f, 0.0f,
|
||||
Animation_GetLastFrame(sEnToryoAnimation.anim), sEnToryoAnimation.mode,
|
||||
sEnToryoAnimation.transitionRate);
|
||||
this->stateFlags |= 8;
|
||||
this->actor.unk_1F = 6;
|
||||
this->actionFunc = func_80B20914;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Toryo/func_80B20B94.s")
|
||||
void EnToryo_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnToryo* this = THIS;
|
||||
|
||||
Collider_DestroyCylinder(globalCtx, &this->collider);
|
||||
}
|
||||
|
||||
s32 func_80B203D8(EnToryo* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
Player* player = PLAYER;
|
||||
s32 ret = 1;
|
||||
|
||||
switch (func_8010BDBC(&globalCtx->msgCtx)) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 5:
|
||||
ret = 1;
|
||||
break;
|
||||
case 4:
|
||||
if (func_80106BC8(globalCtx)) {
|
||||
if (globalCtx->msgCtx.choiceIndex == 0) {
|
||||
func_80106CCC(globalCtx);
|
||||
this->actor.parent = NULL;
|
||||
player->exchangeItemId = EXCH_ITEM_NONE;
|
||||
globalCtx->msgCtx.msgMode = 0x37;
|
||||
this->actor.textId = 0x601B;
|
||||
ret = 3;
|
||||
} else {
|
||||
this->actor.textId = 0x606F;
|
||||
ret = 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
switch (this->actor.textId) {
|
||||
case 0x5028:
|
||||
ret = 1;
|
||||
if (func_80106BC8(globalCtx) != 0) {
|
||||
gSaveContext.infTable[23] |= 4;
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
case 0x601B:
|
||||
ret = 1;
|
||||
if (func_80106BC8(globalCtx) != 0) {
|
||||
ret = 4;
|
||||
}
|
||||
break;
|
||||
case 0x606F:
|
||||
ret = 1;
|
||||
if (func_80106BC8(globalCtx) != 0) {
|
||||
gSaveContext.infTable[23] |= 2;
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
case 0x606A:
|
||||
ret = 1;
|
||||
if (func_80106BC8(globalCtx) != 0) {
|
||||
gSaveContext.infTable[23] |= 1;
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
case 0x606B:
|
||||
case 0x606C:
|
||||
case 0x606D:
|
||||
case 0x606E:
|
||||
default:
|
||||
ret = 1;
|
||||
if (func_80106BC8(globalCtx) != 0) {
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 func_80B205CC(EnToryo* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
Player* player = PLAYER;
|
||||
s32 ret = 5;
|
||||
|
||||
switch (func_8010BDBC(&globalCtx->msgCtx)) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
ret = 5;
|
||||
break;
|
||||
case 6:
|
||||
if (func_80106BC8(globalCtx) != 0) {
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 func_80B20634(EnToryo* this, GlobalContext* globalCtx) {
|
||||
u32 ret;
|
||||
|
||||
if (this->unk_1E0 != 0) {
|
||||
if (this->unk_1E0 == 10) {
|
||||
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
|
||||
if (gSaveContext.infTable[23] & 2) {
|
||||
ret = 0x606E;
|
||||
} else {
|
||||
ret = 0x606D;
|
||||
}
|
||||
} else {
|
||||
ret = 0x200F;
|
||||
}
|
||||
}
|
||||
//! @bug return value may be unitialized
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 func_80B206A0(EnToryo* this, GlobalContext* globalCtx) {
|
||||
s32 textId = Text_GetFaceReaction(globalCtx, 0);
|
||||
s32 ret = textId;
|
||||
|
||||
if (textId == 0) {
|
||||
if ((this->stateFlags & 1)) {
|
||||
if ((gSaveContext.eventChkInf[9] & 0xF) == 0xF) {
|
||||
ret = 0x606C;
|
||||
} else if ((gSaveContext.infTable[23] & 1)) {
|
||||
ret = 0x606B;
|
||||
} else {
|
||||
ret = 0x606A;
|
||||
}
|
||||
} else if ((this->stateFlags & 2)) {
|
||||
if ((gSaveContext.infTable[23] & 4)) {
|
||||
ret = 0x5029;
|
||||
} else {
|
||||
ret = 0x5028;
|
||||
}
|
||||
} else {
|
||||
ret = textId;
|
||||
if ((this->stateFlags & 4)) {
|
||||
ret = 0x506C;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void func_80B20768(EnToryo* this, GlobalContext* globalCtx) {
|
||||
Player* player = PLAYER;
|
||||
s16 sp32;
|
||||
s16 sp30;
|
||||
|
||||
if (this->unk_1E4 == 3) {
|
||||
func_8002F194(&this->actor, globalCtx);
|
||||
func_8010B720(globalCtx, this->actor.textId);
|
||||
this->unk_1E4 = 1;
|
||||
}
|
||||
|
||||
if (this->unk_1E4 == 1) {
|
||||
this->unk_1E4 = func_80B203D8(this, globalCtx);
|
||||
}
|
||||
|
||||
if (this->unk_1E4 == 5) {
|
||||
this->unk_1E4 = func_80B205CC(this, globalCtx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->unk_1E4 == 2) {
|
||||
func_8010B720(globalCtx, this->actor.textId);
|
||||
this->unk_1E4 = 1;
|
||||
}
|
||||
|
||||
if (this->unk_1E4 == 4) {
|
||||
if (Actor_HasParent(&this->actor, globalCtx)) {
|
||||
this->actor.parent = NULL;
|
||||
this->unk_1E4 = 5;
|
||||
} else {
|
||||
func_8002F434(&this->actor, globalCtx, 0x22, 100.0f, 10.0f);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->unk_1E4 == 0) {
|
||||
if (func_8002F194(&this->actor, globalCtx) != 0) {
|
||||
this->unk_1E0 = func_8002F368(globalCtx);
|
||||
if (this->unk_1E0 != 0) {
|
||||
player->actor.textId = func_80B20634(this, globalCtx);
|
||||
this->actor.textId = player->actor.textId;
|
||||
}
|
||||
this->unk_1E4 = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
func_8002F374(globalCtx, &this->actor, &sp32, &sp30);
|
||||
if ((sp32 >= 0) && (sp32 < 0x141) && (sp30 >= 0) && (sp30 < 0xF1)) {
|
||||
this->actor.textId = func_80B206A0(this, globalCtx);
|
||||
func_8002F298(&this->actor, globalCtx, 100.0f, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_80B20914(EnToryo* this, GlobalContext* globalCtx) {
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
func_80B20768(this, globalCtx);
|
||||
if (this->unk_1E4 != 0) {
|
||||
this->stateFlags |= 0x10;
|
||||
} else {
|
||||
this->stateFlags &= ~0x10;
|
||||
}
|
||||
}
|
||||
|
||||
void EnToryo_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnToryo* this = THIS;
|
||||
ColliderCylinder* collider = &this->collider;
|
||||
Player* player = PLAYER;
|
||||
f32 rot;
|
||||
|
||||
Collider_CylinderUpdate(thisx, collider);
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, (Collider*)collider);
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
|
||||
if ((this->stateFlags & 8)) {
|
||||
this->unk_1EC.unk_18.x = player->actor.posRot2.pos.x;
|
||||
this->unk_1EC.unk_18.y = player->actor.posRot2.pos.y;
|
||||
this->unk_1EC.unk_18.z = player->actor.posRot2.pos.z;
|
||||
|
||||
if ((this->stateFlags & 0x10)) {
|
||||
func_80034A14(thisx, &this->unk_1EC, 0, 4);
|
||||
return;
|
||||
}
|
||||
|
||||
rot = thisx->yawTowardsLink - thisx->shape.rot.y;
|
||||
if ((rot < 14563.0f) && (rot > -14563.0f)) {
|
||||
func_80034A14(thisx, &this->unk_1EC, 0, 2);
|
||||
} else {
|
||||
func_80034A14(thisx, &this->unk_1EC, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnToryo_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnToryo* this = THIS;
|
||||
|
||||
func_80093D18(globalCtx->state.gfxCtx);
|
||||
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
|
||||
EnToryo_OverrideLimbDraw, EnToryo_PostLimbDraw, this);
|
||||
}
|
||||
|
||||
s32 EnToryo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
||||
void* thisx) {
|
||||
EnToryo* this = THIS;
|
||||
|
||||
if ((this->stateFlags & 8)) {
|
||||
switch (limbIndex) {
|
||||
case 8:
|
||||
rot->x += this->unk_1EC.unk_0E.y;
|
||||
rot->y -= this->unk_1EC.unk_0E.x;
|
||||
break;
|
||||
case 15:
|
||||
rot->x += this->unk_1EC.unk_08.y;
|
||||
rot->z += this->unk_1EC.unk_08.x;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EnToryo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
|
||||
EnToryo* this = THIS;
|
||||
|
||||
switch (limbIndex) {
|
||||
case 15:
|
||||
Matrix_MultVec3f(&sMultVec, &this->actor.posRot2.pos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,20 @@
|
|||
|
||||
struct EnToryo;
|
||||
|
||||
typedef void (*EnToryoActionFunc)(struct EnToryo* this, GlobalContext* globalCtx);
|
||||
|
||||
typedef struct EnToryo {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x194];
|
||||
/* 0x014C */ SkelAnime skelAnime;
|
||||
/* 0x0190 */ EnToryoActionFunc actionFunc;
|
||||
/* 0x0194 */ ColliderCylinder collider;
|
||||
/* 0x01E0 */ s32 unk_1E0;
|
||||
/* 0x01E4 */ s32 unk_1E4;
|
||||
/* 0x01E8 */ u16 stateFlags;
|
||||
/* 0x01EA */ s16 unk_1EA;
|
||||
/* 0x01EC */ struct_80034A14_arg1 unk_1EC;
|
||||
/* 0x0214 */ Vec3s jointTable[17];
|
||||
/* 0x027A */ Vec3s morphTable[17];
|
||||
} EnToryo; // size = 0x02E0
|
||||
|
||||
extern const ActorInit En_Toryo_InitVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue