1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-07 14:50:15 +00:00

Decomp Heishi4 All OK (#364)

* Fixed upstream

* Migrate data, fix header, and begin Init function

* Lots of progress

* Almost done

* One non matching left

* Decomp EnHeishi4 All OK

* PR fixes

* PR fixes
This commit is contained in:
louist103 2020-09-05 10:18:02 -04:00 committed by GitHub
parent bb1aacbd0b
commit eef2a005b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 546 additions and 1445 deletions

View file

@ -1,4 +1,5 @@
#include "z_en_heishi4.h"
#include "vt.h"
#define FLAGS 0x00000009
@ -9,7 +10,18 @@ void EnHeishi4_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnHeishi4_Update(Actor* thisx, GlobalContext* globalCtx);
void EnHeishi4_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
void func_80A56544(EnHeishi4* this, GlobalContext* globalCtx);
void func_80A5673C(EnHeishi4* this, GlobalContext* globalCtx);
void func_80A56328(EnHeishi4* this, GlobalContext* globalCtx);
void func_80A563BC(EnHeishi4* this, GlobalContext* globalCtx);
void func_80A56B40(EnHeishi4* this, GlobalContext* globalCtx);
void func_80A56614(EnHeishi4* this, GlobalContext* globalCtx);
void func_80A56874(EnHeishi4* this, GlobalContext* globalCtx);
void func_80A56900(EnHeishi4* this, GlobalContext* globalCtx);
void func_80A56994(EnHeishi4* this, GlobalContext* globalCtx);
void func_80A56A50(EnHeishi4* this, GlobalContext* globalCtx);
void func_80A56ACC(EnHeishi4* this, GlobalContext* globalCtx);
const ActorInit En_Heishi4_InitVars = {
ACTOR_EN_HEISHI4,
ACTORTYPE_NPC,
@ -21,35 +33,347 @@ const ActorInit En_Heishi4_InitVars = {
(ActorFunc)EnHeishi4_Update,
(ActorFunc)EnHeishi4_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Heishi4/EnHeishi4_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Heishi4/EnHeishi4_Destroy.s")
static u32 sFaceReactionSets[] = { 6, 7 };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Heishi4/func_80A56328.s")
static ColliderCylinderInit sCylinderInit = {
{ COLTYPE_UNK10, 0x00, 0x00, 0x39, 0x20, COLSHAPE_CYLINDER },
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x00, 0x00, 0x01 },
{ 33, 40, 0, { 0, 0, 0 } },
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Heishi4/func_80A563BC.s")
extern SkeletonHeader D_0600BAC8;
extern AnimationHeader D_0600C444;
extern AnimationHeader D_06005C30;
extern AnimationHeader D_0600C6C8;
extern AnimationHeader D_0600C374;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Heishi4/func_80A56544.s")
void EnHeishi4_Init(Actor* thisx, GlobalContext* globalCtx) {
EnHeishi4* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Heishi4/func_80A56614.s")
Actor_SetScale(thisx, 0.01f);
this->type = thisx->params & 0xFF;
thisx->colChkInfo.mass = 0xFF;
this->pos = thisx->posRot.pos;
thisx->unk_1F = 6;
if (this->type == HEISHI4_AT_MARKET_DYING) {
this->height = 30.0f;
ActorShape_Init(&thisx->shape, 0.0f, NULL, 30.0f);
SkelAnime_Init(globalCtx, &this->skelAnime, &D_0600BAC8, &D_0600C444, &this->limbDrawTable,
&this->transitionDrawTable, 17);
} else {
this->height = 60.0f;
ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawFunc_Circle, 30.0f);
SkelAnime_Init(globalCtx, &this->skelAnime, &D_0600BAC8, &D_06005C30, &this->limbDrawTable,
&this->transitionDrawTable, 17);
}
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit);
this->collider.dim.yShift = 0;
this->collider.dim.radius = 15;
this->collider.dim.height = 70;
switch (this->type) {
case HEISHI4_AT_KAKRIKO_ENTRANCE:
case HEISHI4_AT_IMPAS_HOUSE:
this->actionFunc = func_80A56328;
break;
case HEISHI4_AT_MARKET_DYING:
this->collider.dim.radius = 28;
this->collider.dim.height = 5;
this->actionFunc = func_80A5673C;
break;
case HEISHI4_AT_MARKET_NIGHT:
this->actionFunc = func_80A56544;
break;
}
this->unk_27C = ((thisx->params >> 8) & 0xFF);
osSyncPrintf("\n\n");
osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ 兵士2セット完了! ☆☆☆☆☆ %d\n" VT_RST, thisx->params);
osSyncPrintf(VT_FGCOL(YELLOW) " ☆☆☆☆☆ 識別完了!\t ☆☆☆☆☆ %d\n" VT_RST, this->type);
osSyncPrintf(VT_FGCOL(PURPLE) " ☆☆☆☆☆ メッセージ完了! ☆☆☆☆☆ %x\n\n" VT_RST, (thisx->params >> 8) & 0xF);
osSyncPrintf("\n\n");
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Heishi4/func_80A5673C.s")
void EnHeishi4_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnHeishi4* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Heishi4/func_80A56874.s")
Collider_DestroyCylinder(globalCtx, &this->collider);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Heishi4/func_80A56900.s")
void func_80A56328(EnHeishi4* this, GlobalContext* globalCtx) {
f32 frames = SkelAnime_GetFrameCount(&D_06005C30);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Heishi4/func_80A56994.s")
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, (s16)frames, 0, -10.0f);
this->actionFunc = func_80A563BC;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Heishi4/func_80A56A50.s")
void func_80A563BC(EnHeishi4* this, GlobalContext* globalCtx) {
s16 reactionOffset;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Heishi4/func_80A56ACC.s")
this->unk_2B4 = 0;
reactionOffset = this->type - 4;
if (reactionOffset < 0) {
reactionOffset = 0;
}
if (reactionOffset >= 3) {
reactionOffset = 1;
}
if (Text_GetFaceReaction(globalCtx, sFaceReactionSets[reactionOffset]) != 0) {
this->actor.textId = Text_GetFaceReaction(globalCtx, sFaceReactionSets[reactionOffset]);
this->unk_2B4 = 1;
this->actionFunc = func_80A56B40;
} else {
if (gSaveContext.eventChkInf[8] & 1) {
this->actor.textId = 0x5065;
this->actionFunc = func_80A56B40;
return;
}
if (gSaveContext.eventChkInf[4] & 0x20) {
this->actor.textId = 0x5068;
this->actionFunc = func_80A56B40;
return;
}
if (this->type == HEISHI4_AT_IMPAS_HOUSE) {
if (this->unk_284 == 0) {
this->actor.textId = 0x5079;
} else {
this->actor.textId = 0x507A;
}
} else if (!gSaveContext.nightFlag) {
if (this->unk_284 == 0) {
this->actor.textId = 0x5063;
} else {
this->actor.textId = 0x5064;
}
} else if (this->unk_284 == 0) {
this->actor.textId = 0x5066;
} else {
this->actor.textId = 0x5067;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Heishi4/func_80A56B40.s")
this->actionFunc = func_80A56B40;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Heishi4/EnHeishi4_Update.s")
void func_80A56544(EnHeishi4* this, GlobalContext* globalCtx) {
f32 frames = SkelAnime_GetFrameCount(&D_06005C30);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Heishi4/func_80A56E14.s")
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, (s16)frames, 0, -10.0f);
if (LINK_AGE_IN_YEARS != YEARS_CHILD) {
osSyncPrintf(VT_FGCOL(GREEN) " ☆☆☆☆☆ ぎゃぁ!オトナだー ☆☆☆☆☆ \n" VT_RST);
Actor_Kill(&this->actor);
} else {
this->actionFunc = func_80A56614;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Heishi4/EnHeishi4_Draw.s")
void func_80A56614(EnHeishi4* this, GlobalContext* globalCtx) {
s16 reactionOffset;
reactionOffset = this->type - 4;
this->unk_2B4 = 0;
if (reactionOffset < 0) {
reactionOffset = 0;
}
if (reactionOffset >= 3) {
reactionOffset = 1;
}
if (Text_GetFaceReaction(globalCtx, sFaceReactionSets[reactionOffset]) != 0) {
this->actor.textId = Text_GetFaceReaction(globalCtx, sFaceReactionSets[reactionOffset]);
this->unk_2B4 = 1;
this->actionFunc = func_80A56B40;
return;
}
if (globalCtx->sceneNum == SCENE_MIHARIGOYA) {
if (gSaveContext.nightFlag == 0) {
this->actor.textId = 0x7004;
} else {
this->actor.textId = 0x709A;
}
} else if (globalCtx->sceneNum != SCENE_MARKET_NIGHT) {
if (!gSaveContext.nightFlag) {
this->actor.textId = 0x7002;
} else {
this->actor.textId = 0x7003;
}
} else {
this->actor.textId = 0x7003;
}
this->actionFunc = func_80A56B40;
}
void func_80A5673C(EnHeishi4* this, GlobalContext* globalCtx) {
if (gSaveContext.eventChkInf[4] & 0x20) {
osSyncPrintf(VT_FGCOL(YELLOW) " ☆☆☆☆☆ マスターソード祝入手! ☆☆☆☆☆ \n" VT_RST);
Actor_Kill(&this->actor);
return;
}
this->unk_284 = 0;
if (gSaveContext.eventChkInf[8] & 1) {
if (!(gSaveContext.infTable[6] & 0x1000)) {
f32 frames = SkelAnime_GetFrameCount(&D_0600C444);
SkelAnime_ChangeAnim(&this->skelAnime, &D_0600C444, 1.0f, 0.0f, (s16)frames, 0, -10.0f);
this->actor.textId = 0x7007;
this->unk_282 = 5;
this->unk_284 = 1;
osSyncPrintf(VT_FGCOL(YELLOW) " ☆☆☆☆☆ デモ開始! ☆☆☆☆☆ \n" VT_RST);
} else {
this->actor.textId = 0x7008;
this->unk_282 = 6;
osSyncPrintf(VT_FGCOL(BLUE) " ☆☆☆☆☆ 返事なし ☆☆☆☆☆ \n" VT_RST);
}
this->actionFunc = func_80A56874;
} else {
Actor_Kill(&this->actor);
}
}
void func_80A56874(EnHeishi4* this, GlobalContext* globalCtx) {
if (this->unk_284 != 0) {
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
}
if (func_8002F194(&this->actor, globalCtx) != 0) {
if (this->unk_284 == 0) {
this->actionFunc = func_80A5673C;
} else {
this->actionFunc = func_80A56900;
}
} else {
func_8002F2CC(&this->actor, globalCtx, 100.0f);
}
}
void func_80A56900(EnHeishi4* this, GlobalContext* globalCtx) {
f32 frames = SkelAnime_GetFrameCount(&D_0600C6C8);
SkelAnime_ChangeAnim(&this->skelAnime, &D_0600C6C8, 1.0f, 0.0f, (s16)frames, 0, -10.0f);
this->actionFunc = func_80A56994;
}
void func_80A56994(EnHeishi4* this, GlobalContext* globalCtx) {
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
func_80038290(globalCtx, &this->actor, &this->unk_260.x, &this->unk_266.x, this->actor.posRot2.pos);
if (this->unk_282 == func_8010BDBC(&globalCtx->msgCtx)) {
if (func_80106BC8(globalCtx) != 0) {
func_80106CCC(globalCtx);
gSaveContext.infTable[6] |= 0x1000;
func_8002DF54(globalCtx, NULL, 8);
this->actionFunc = func_80A56A50;
}
}
}
void func_80A56A50(EnHeishi4* this, GlobalContext* globalCtx) {
f32 frames = SkelAnime_GetFrameCount(&D_0600C374);
this->unk_288 = frames;
SkelAnime_ChangeAnim(&this->skelAnime, &D_0600C374, 1.0f, 0.0f, frames, 2, -10.0f);
this->actionFunc = func_80A56ACC;
}
void func_80A56ACC(EnHeishi4* this, GlobalContext* globalCtx) {
f32 currentFrame = this->skelAnime.animCurrentFrame;
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
if (this->unk_288 <= currentFrame) {
func_8002DF54(globalCtx, NULL, 7);
this->actionFunc = func_80A5673C;
}
}
void func_80A56B40(EnHeishi4* this, GlobalContext* globalCtx) {
s16 reactionOffset;
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
reactionOffset = (this->type - 4);
if (reactionOffset < 0) {
reactionOffset = 0;
}
if (reactionOffset >= 3) {
reactionOffset = 1;
}
if (Text_GetFaceReaction(globalCtx, sFaceReactionSets[reactionOffset]) != 0) {
if (this->unk_2B4 == 0) {
if ((this->type == HEISHI4_AT_KAKRIKO_ENTRANCE) || (this->type == HEISHI4_AT_IMPAS_HOUSE)) {
this->actionFunc = func_80A563BC;
return;
}
if (this->type == HEISHI4_AT_MARKET_NIGHT) {
this->actionFunc = func_80A56614;
return;
}
}
} else {
if (this->unk_2B4 != 0) {
if ((this->type == HEISHI4_AT_KAKRIKO_ENTRANCE) || (this->type == HEISHI4_AT_IMPAS_HOUSE)) {
this->actionFunc = func_80A563BC;
return;
}
if (this->type == HEISHI4_AT_MARKET_NIGHT) {
this->actionFunc = func_80A56614;
return;
}
}
}
if (func_8002F194(&this->actor, globalCtx) != 0) {
if ((this->type == HEISHI4_AT_KAKRIKO_ENTRANCE) || (this->type == HEISHI4_AT_IMPAS_HOUSE)) {
this->unk_284 = 1;
this->actionFunc = func_80A563BC;
return;
}
if (this->type == HEISHI4_AT_MARKET_NIGHT) {
this->actionFunc = func_80A56614;
return;
}
}
func_8002F2F4(&this->actor, globalCtx);
}
void EnHeishi4_Update(Actor* thisx, GlobalContext* globalCtx) {
EnHeishi4* this = THIS;
s32 pad;
Player* player = PLAYER;
thisx->posRot.pos.x = this->pos.x;
thisx->posRot.pos.y = this->pos.y;
thisx->posRot.pos.z = this->pos.z;
Actor_SetHeight(thisx, this->height);
if (this->type != HEISHI4_AT_MARKET_DYING) {
this->unk_28C.unk_18 = player->actor.posRot.pos;
if (LINK_IS_CHILD) {
this->unk_28C.unk_18.y = (player->actor.posRot.pos.y - 10.0f);
}
func_80034A14(thisx, &this->unk_28C, 2, 4);
this->unk_260 = this->unk_28C.unk_08;
this->unk_266 = this->unk_28C.unk_0E;
}
this->unk_27E += 1;
this->actionFunc(this, globalCtx);
Actor_MoveForward(thisx);
func_8002E4B4(globalCtx, thisx, 10.0f, 10.0f, 30.0f, 0x1D);
Collider_CylinderUpdate(&this->actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider);
}
s32 EnHeishi_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
Actor* thisx) {
EnHeishi4* this = THIS;
if (limbIndex == 9) {
rot->x += this->unk_266.y;
}
if (limbIndex == 16) {
rot->x += this->unk_260.y;
rot->z += this->unk_260.z;
}
return 0;
}
void EnHeishi4_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnHeishi4* this = THIS;
func_80093D18(globalCtx->state.gfxCtx);
SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, EnHeishi_OverrideLimbDraw, NULL,
&this->actor);
}

View file

@ -4,11 +4,37 @@
#include <ultra64.h>
#include <global.h>
typedef enum {
/* 0x00 */ HEISHI4_AT_KAKRIKO_ENTRANCE,
/* 0x04 */ HEISHI4_AT_IMPAS_HOUSE = 4,
/* 0x07 */ HEISHI4_AT_MARKET_DYING = 7,
/* 0x08 */ HEISHI4_AT_MARKET_NIGHT
} Heishi4Type;
struct EnHeishi4;
typedef void (*EnHeishi4ActionFunc)(struct EnHeishi4*, GlobalContext*);
typedef struct EnHeishi4 {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x1BC];
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ Vec3s limbDrawTable[17];
/* 0x01F6 */ Vec3s transitionDrawTable[17];
/* 0x025C */ EnHeishi4ActionFunc actionFunc;
/* 0x0260 */ Vec3s unk_260;
/* 0x0266 */ Vec3s unk_266;
/* 0x026C */ Vec3f pos;
/* 0x0278 */ f32 height;
/* 0x027C */ s16 unk_27C;
/* 0x027E */ s16 unk_27E;
/* 0x0280 */ s16 type;
/* 0x0282 */ s16 unk_282;
/* 0x0284 */ s16 unk_284;
/* 0x0288 */ f32 unk_288;
/* 0x028C */ struct_80034A14_arg1 unk_28C;
/* 0x02B4 */ u8 unk_2B4;
/* 0x02B6 */ char unk_2B6[7];
/* 0x02BC */ ColliderCylinder collider;
} EnHeishi4; // size = 0x0308
extern const ActorInit En_Heishi4_InitVars;