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

En_Mk OK (lakeside lab dude) (#616)

* en_mk OK

* ready for pr

* ok now

* anim mode enums

* fixed dodojr

Co-authored-by: Zelllll <elijah@DESKTOP-NMP1I89.localdomain>
This commit is contained in:
Zelllll 2021-01-31 14:26:34 -06:00 committed by GitHub
parent 9b91229422
commit a25ae3a584
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 328 additions and 995 deletions

View file

@ -15,13 +15,14 @@ void EnMk_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnMk_Update(Actor* thisx, GlobalContext* globalCtx);
void EnMk_Draw(Actor* thisx, GlobalContext* globalCtx);
extern UNK_TYPE D_06000368;
extern UNK_TYPE D_06000724;
extern UNK_TYPE D_06000AC0;
extern UNK_TYPE D_06000D88;
extern UNK_TYPE D_06005DF0;
void EnMk_Wait(EnMk* this, GlobalContext* globalCtx);
extern AnimationHeader D_06000368;
extern AnimationHeader D_06000724;
extern AnimationHeader D_06000AC0;
extern AnimationHeader D_06000D88;
extern FlexSkeletonHeader D_06005DF0;
/*
const ActorInit En_Mk_InitVars = {
ACTOR_EN_MK,
ACTORCAT_NPC,
@ -34,7 +35,7 @@ const ActorInit En_Mk_InitVars = {
(ActorFunc)EnMk_Draw,
};
static ColliderCylinderInit D_80AAD620 = {
static ColliderCylinderInit sCylinderInit = {
{
COLTYPE_NONE,
AT_NONE,
@ -53,41 +54,323 @@ static ColliderCylinderInit D_80AAD620 = {
},
{ 30, 40, 0, { 0, 0, 0 } },
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/EnMk_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/EnMk_Destroy.s")
void EnMk_Init(Actor* thisx, GlobalContext* globalCtx) {
EnMk* this = THIS;
s32 swimFlag;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/func_80AACA40.s")
this->actor.minVelocityY = -4.0f;
this->actor.gravity = -1.0f;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06005DF0, &D_06000D88, &this->jointTable, &this->morphTable, 13);
Animation_PlayLoop(&this->skelAnime, &D_06000D88);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
this->actor.colChkInfo.mass = 0xFF;
Actor_SetScale(&this->actor, 0.01f);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/func_80AACA94.s")
this->actionFunc = EnMk_Wait;
this->flags = 0;
this->swimFlag = 0;
this->actor.targetMode = 6;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/func_80AACB14.s")
if (gSaveContext.itemGetInf[1] & 1) {
this->flags |= 4;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/func_80AACB6C.s")
void EnMk_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnMk* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/func_80AACBAC.s")
Collider_DestroyCylinder(globalCtx, &this->collider);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/func_80AACC04.s")
void func_80AACA40(EnMk* this, GlobalContext* globalCtx) {
if (func_8002F334(&this->actor, globalCtx)) {
this->actor.flags &= 0xFFFEFFFF;
this->actionFunc = EnMk_Wait;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/func_80AACCA0.s")
this->flags |= 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/func_80AACD48.s")
void func_80AACA94(EnMk* this, GlobalContext* globalCtx) {
if (Actor_HasParent(this, globalCtx) != 0) {
this->actor.parent = NULL;
this->actionFunc = func_80AACA40;
func_80088AA0(240);
gSaveContext.eventInf[1] &= ~1;
} else {
func_8002F434(&this->actor, globalCtx, GI_EYEDROPS, 10000.0f, 50.0f);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/func_80AACE2C.s")
void func_80AACB14(EnMk* this, GlobalContext* globalCtx) {
if (func_8002F334(&this->actor, globalCtx)) {
this->actionFunc = func_80AACA94;
func_8002F434(&this->actor, globalCtx, GI_EYEDROPS, 10000.0f, 50.0f);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/func_80AACEE8.s")
void func_80AACB6C(EnMk* this, GlobalContext* globalCtx) {
if (func_8002F194(&this->actor, globalCtx)) {
this->actionFunc = func_80AACB14;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/func_80AACFA0.s")
this->flags |= 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/func_80AAD014.s")
void func_80AACBAC(EnMk* this, GlobalContext* globalCtx) {
if (this->timer > 0) {
this->timer--;
this->actor.shape.rot.y -= 0x800;
} else {
this->actionFunc = func_80AACB6C;
func_8010B720(globalCtx, 0x4030);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/func_80AAD080.s")
void func_80AACC04(EnMk* this, GlobalContext* globalCtx) {
if (this->timer > 0) {
this->timer--;
} else {
this->timer = 16;
this->actionFunc = func_80AACBAC;
Animation_Change(&this->skelAnime, &D_06000D88, 1.0f, 0.0f, Animation_GetLastFrame(&D_06000D88), ANIMMODE_LOOP,
-4.0f);
this->flags &= ~2;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/EnMk_Update.s")
void func_80AACCA0(EnMk* this, GlobalContext* globalCtx) {
if (this->timer > 0) {
this->timer--;
this->actor.shape.rot.y += 0x800;
} else {
this->timer = 120;
this->actionFunc = func_80AACC04;
Animation_Change(&this->skelAnime, &D_06000724, 1.0f, 0.0f, Animation_GetLastFrame(&D_06000724), ANIMMODE_LOOP,
-4.0f);
this->flags &= ~2;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/func_80AAD518.s")
void func_80AACD48(EnMk* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/func_80AAD55C.s")
if ((func_8010BDBC(&globalCtx->msgCtx) == 5) && (func_80106BC8(globalCtx) != 0)) {
func_80106CCC(globalCtx);
this->actionFunc = func_80AACCA0;
globalCtx->msgCtx.msgMode = 0x37;
player->exchangeItemId = EXCH_ITEM_NONE;
this->timer = 16;
Animation_Change(&this->skelAnime, &D_06000D88, 1.0f, 0.0f, Animation_GetLastFrame(&D_06000D88), ANIMMODE_LOOP,
-4.0f);
this->flags &= ~2;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Mk/EnMk_Draw.s")
this->flags |= 1;
}
void func_80AACE2C(EnMk* this, GlobalContext* globalCtx) {
if ((func_8010BDBC(&globalCtx->msgCtx) == 5) && (func_80106BC8(globalCtx) != 0)) {
func_8010B720(globalCtx, 0x4001);
Animation_Change(&this->skelAnime, &D_06000AC0, 1.0f, 0.0f, Animation_GetLastFrame(&D_06000AC0), ANIMMODE_ONCE,
-4.0f);
this->flags &= ~2;
this->actionFunc = func_80AACD48;
}
this->flags |= 1;
}
void func_80AACEE8(EnMk* this, GlobalContext* globalCtx) {
if ((func_8010BDBC(&globalCtx->msgCtx) == 5) && (func_80106BC8(globalCtx) != 0)) {
func_8010B720(globalCtx, 0x4000);
Animation_Change(&this->skelAnime, &D_06000AC0, 1.0f, 0.0f, Animation_GetLastFrame(&D_06000AC0), ANIMMODE_LOOP,
-4.0f);
this->flags &= ~2;
this->actionFunc = func_80AACE2C;
}
this->flags |= 1;
}
void func_80AACFA0(EnMk* this, GlobalContext* globalCtx) {
if (Actor_HasParent(&this->actor, globalCtx)) {
this->actor.parent = NULL;
this->actionFunc = func_80AACA40;
gSaveContext.itemGetInf[1] |= 1;
} else {
func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 50.0f);
}
}
void func_80AAD014(EnMk* this, GlobalContext* globalCtx) {
if (func_8002F334(&this->actor, globalCtx) != 0) {
this->actionFunc = func_80AACFA0;
func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 50.0f);
}
this->flags |= 1;
}
void EnMk_Wait(EnMk* this, GlobalContext* globalCtx) {
s16 angle;
s32 swimFlag;
Player* player = PLAYER;
s32 playerExchangeItem;
if (func_8002F194(&this->actor, globalCtx) != 0) {
playerExchangeItem = func_8002F368(globalCtx);
if (this->actor.textId != 0x4018) {
player->actor.textId = this->actor.textId;
this->actionFunc = func_80AACA40;
} else {
if (INV_CONTENT(ITEM_ODD_MUSHROOM) == ITEM_EYEDROPS) {
player->actor.textId = 0x4032;
this->actionFunc = func_80AACA40;
} else {
switch (playerExchangeItem) {
case EXCH_ITEM_NONE:
if (this->swimFlag >= 8) {
if (gSaveContext.itemGetInf[1] & 1) {
player->actor.textId = 0x4075;
this->actionFunc = func_80AACA40;
} else {
player->actor.textId = 0x4074;
this->actionFunc = func_80AAD014;
this->swimFlag = 0;
}
} else {
if (this->swimFlag == 0) {
player->actor.textId = 0x4018;
this->actionFunc = func_80AACA40;
} else {
player->actor.textId = 0x406C + this->swimFlag;
this->actionFunc = func_80AACA40;
}
}
break;
case EXCH_ITEM_FROG:
player->actor.textId = 0x4019;
this->actionFunc = func_80AACEE8;
Animation_Change(&this->skelAnime, &D_06000368, 1.0f, 0.0f, Animation_GetLastFrame(&D_06000368),
ANIMMODE_ONCE, -4.0f);
this->flags &= ~2;
gSaveContext.timer2State = 0;
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
break;
default:
player->actor.textId = 0x4018;
this->actionFunc = func_80AACA40;
break;
}
}
}
} else {
this->actor.textId = Text_GetFaceReaction(globalCtx, 0x1A);
if (this->actor.textId == 0) {
this->actor.textId = 0x4018;
}
angle = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if ((ABS(angle) < 0x2151) && (this->actor.xzDistToPlayer < 100.0f)) {
func_8002F298(&this->actor, globalCtx, 100.0f, EXCH_ITEM_FROG);
this->flags |= 1;
}
}
}
void EnMk_Update(Actor* thisx, GlobalContext* globalCtx) {
EnMk* this = THIS;
s32 pad;
Vec3s vec;
Player* player;
s16 swimFlag;
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
Actor_MoveForward(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
if ((!(this->flags & 2)) && (SkelAnime_Update(&this->skelAnime))) {
this->flags |= 2;
}
this->actionFunc(this, globalCtx);
if (this->flags & 1) {
func_80038290(globalCtx, &this->actor, &this->headRotation, &vec, this->actor.focus.pos);
} else {
Math_SmoothStepToS(&this->headRotation.x, 0, 6, 6200, 100);
Math_SmoothStepToS(&this->headRotation.y, 0, 6, 6200, 100);
}
player = PLAYER;
if (this->flags & 8) {
if (!(player->stateFlags2 & 0x400)) {
this->flags &= ~8;
}
} else {
if (player->currentBoots == PLAYER_BOOTS_IRON) {
this->flags |= 8;
} else if (player->stateFlags2 & 0x400) {
swimFlag = player->actor.yDistToWater;
if (swimFlag > 0) {
if (swimFlag >= 320) {
if (swimFlag >= 355) {
swimFlag = 8;
} else {
swimFlag = 7;
}
} else if (swimFlag < 80) {
swimFlag = 1;
} else {
swimFlag *= 0.025f;
}
if (this->swimFlag < swimFlag) {
this->swimFlag = swimFlag;
if ((!(this->flags & 4)) && (this->swimFlag >= 8)) {
this->flags |= 4;
func_80078884(NA_SE_SY_CORRECT_CHIME);
}
}
}
}
}
}
s32 EnMk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnMk* this = THIS;
if (limbIndex == 11) {
rot->y -= this->headRotation.y;
rot->z += this->headRotation.x;
}
return 0;
}
void EnMk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
static Vec3f D_80AAD64C = { 1000.0f, -100.0f, 0.0f };
if (limbIndex == 11) {
Matrix_MultVec3f(&D_80AAD64C, &thisx->focus);
}
}
void EnMk_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnMk* this = THIS;
func_800943C8(globalCtx->state.gfxCtx);
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnMk_OverrideLimbDraw, EnMk_PostLimbDraw, &this->actor);
}

View file

@ -6,9 +6,19 @@
struct EnMk;
typedef void (*EnMkActionFunc)(struct EnMk*, GlobalContext*);
typedef struct EnMk {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x13C];
/* 0x014C */ ColliderCylinder collider;
/* 0x0198 */ SkelAnime skelAnime;
/* 0x01DC */ Vec3s jointTable[13];
/* 0x022A */ Vec3s morphTable[13];
/* 0x0278 */ Vec3s headRotation; // Used to rotate the man's head towards Link
/* 0x027E */ u16 flags;
/* 0x0280 */ s16 swimFlag;
/* 0x0282 */ u16 timer;
/* 0x0284 */ EnMkActionFunc actionFunc;
} EnMk; // size = 0x0288
extern const ActorInit En_Mk_InitVars;