mirror of
https://github.com/zeldaret/mm.git
synced 2026-08-17 21:03:30 -04:00
EnDemoheishi OK and documented (#584)
* EnDemoheishi decomp first pass * object decomp * whitespace between declarations and statements added * various PR fixes * format for CI * various PR fixes 2 + format * missed one texture output name * fix texture docs in unrelated files * fix demoheishi shared texture naming * made object sdn properties generic for soldiers * missed outName modifications * fixed references to updated function names * reverting some texture changes to unrelated objects & use object specific names for lips and fingers textures * added textId comment * various PR comments addressed * added enum for animations * reverting halt animation naming * moved animation enum to actor class * fixed enum names * fix typo * more PR fixes * format * fix for broken build after other PR merge * format * merge fixes * isTalking * Enum - Calf to shin Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Object - Calf to shin Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * DList - Calf to Shin Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "z_en_demo_heishi.h"
|
||||
#include "objects/object_sdn/object_sdn.h"
|
||||
|
||||
#define FLAGS 0x00000009
|
||||
|
||||
@@ -15,10 +16,22 @@ void EnDemoheishi_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnDemoheishi_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnDemoheishi_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
void func_80BE975C(EnDemoheishi* this, GlobalContext* globalCtx);
|
||||
void func_80BE980C(EnDemoheishi* this, GlobalContext* globalCtx);
|
||||
void EnDemoheishi_ChangeAnimation(EnDemoheishi* this, s32 animIndex);
|
||||
void EnDemoheishi_SetupIdle(EnDemoheishi* this);
|
||||
void EnDemoheishi_Idle(EnDemoheishi* this, GlobalContext* globalCtx);
|
||||
void EnDemoheishi_SetupTalk(EnDemoheishi* this);
|
||||
void EnDemoheishi_Talk(EnDemoheishi* this, GlobalContext* globalCtx);
|
||||
s32 EnDemoheishi_OverrideLimbDraw(GlobalContext* globalctx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
||||
Actor* thisx);
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ DEMOHEISHI_ANIMATION_STAND_HAND_ON_HIP,
|
||||
/* 1 */ DEMOHEISHI_ANIMATION_CHEER_WITH_SPEAR,
|
||||
/* 2 */ DEMOHEISHI_ANIMATION_WAVE,
|
||||
/* 3 */ DEMOHEISHI_ANIMATION_SIT_AND_REACH,
|
||||
/* 4 */ DEMOHEISHI_ANIMATION_STAND_UP
|
||||
} EnDemoheishiAnimationIndex;
|
||||
|
||||
#if 0
|
||||
const ActorInit En_Demo_heishi_InitVars = {
|
||||
ACTOR_EN_DEMO_HEISHI,
|
||||
ACTORCAT_NPC,
|
||||
@@ -31,37 +44,152 @@ const ActorInit En_Demo_heishi_InitVars = {
|
||||
(ActorFunc)EnDemoheishi_Draw,
|
||||
};
|
||||
|
||||
// static ColliderCylinderInit sCylinderInit = {
|
||||
static ColliderCylinderInit D_80BE9A50 = {
|
||||
{ COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_2, COLSHAPE_CYLINDER, },
|
||||
{ ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, },
|
||||
static ColliderCylinderInit sCylinderInit = {
|
||||
{
|
||||
COLTYPE_NONE,
|
||||
AT_NONE,
|
||||
AC_NONE,
|
||||
OC1_ON | OC1_TYPE_ALL,
|
||||
OC2_TYPE_2,
|
||||
COLSHAPE_CYLINDER,
|
||||
},
|
||||
{
|
||||
ELEMTYPE_UNK0,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0xF7CFFFFF, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_NONE,
|
||||
OCELEM_ON,
|
||||
},
|
||||
{ 40, 40, 0, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
#endif
|
||||
static u16 sTextIds[] = { 0x1473 }; // Shiro initial intro text
|
||||
|
||||
extern ColliderCylinderInit D_80BE9A50;
|
||||
void EnDemoheishi_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnDemoheishi* this = THIS;
|
||||
|
||||
extern UNK_TYPE D_06003BFC;
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f);
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSoldierSkeleton, &gSoldierWave, this->jointTable,
|
||||
this->morphTable, 17);
|
||||
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
|
||||
this->actor.targetMode = 6;
|
||||
this->actor.gravity = -3.0f;
|
||||
Collider_InitAndSetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit);
|
||||
EnDemoheishi_SetupIdle(this);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Demo_heishi/EnDemoheishi_Init.s")
|
||||
void EnDemoheishi_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnDemoheishi* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Demo_heishi/EnDemoheishi_Destroy.s")
|
||||
Collider_DestroyCylinder(globalCtx, &this->colliderCylinder);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Demo_heishi/func_80BE95EC.s")
|
||||
void EnDemoheishi_ChangeAnimation(EnDemoheishi* this, s32 animIndex) {
|
||||
static AnimationHeader* sAnimations[] = {
|
||||
&gSoldierStandHandOnHip, &gSoldierCheerWithSpear, &gSoldierWave, &gSoldierSitAndReach, &gSoldierStandUp,
|
||||
};
|
||||
static u8 sAnimModes[] = {
|
||||
ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP,
|
||||
ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Demo_heishi/func_80BE9678.s")
|
||||
this->animIndex = animIndex;
|
||||
this->frameCount = Animation_GetLastFrame(sAnimations[animIndex]);
|
||||
Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->frameCount,
|
||||
sAnimModes[this->animIndex], -10.0f);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Demo_heishi/func_80BE970C.s")
|
||||
void EnDemoheishi_SetHeadRotation(EnDemoheishi* this) {
|
||||
s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y;
|
||||
s32 absYawDiff = ABS_ALT(yawDiff);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Demo_heishi/func_80BE975C.s")
|
||||
this->headRotXTarget = 0;
|
||||
if ((this->actor.xzDistToPlayer < 200.0f) && (absYawDiff < 0x4E20)) {
|
||||
this->headRotXTarget = this->actor.yawTowardsPlayer - this->actor.world.rot.y;
|
||||
if (this->headRotXTarget > 0x2710) {
|
||||
this->headRotXTarget = 0x2710;
|
||||
} else if (this->headRotXTarget < -0x2710) {
|
||||
this->headRotXTarget = -0x2710;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Demo_heishi/func_80BE97F0.s")
|
||||
void EnDemoheishi_SetupIdle(EnDemoheishi* this) {
|
||||
EnDemoheishi_ChangeAnimation(this, DEMOHEISHI_ANIMATION_STAND_HAND_ON_HIP);
|
||||
this->textIdIndex = 0;
|
||||
this->actor.textId = sTextIds[this->textIdIndex];
|
||||
this->isTalking = false;
|
||||
this->actionFunc = EnDemoheishi_Idle;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Demo_heishi/func_80BE980C.s")
|
||||
void EnDemoheishi_Idle(EnDemoheishi* this, GlobalContext* globalCtx) {
|
||||
s32 absYawDiff;
|
||||
s16 yawDiff;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Demo_heishi/EnDemoheishi_Update.s")
|
||||
this->actor.flags &= ~ACTOR_FLAG_8000000;
|
||||
yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y;
|
||||
absYawDiff = ABS_ALT(yawDiff);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Demo_heishi/func_80BE9974.s")
|
||||
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) {
|
||||
EnDemoheishi_SetupTalk(this);
|
||||
} else if (absYawDiff <= 0x4BB8) {
|
||||
func_800B8614(&this->actor, globalCtx, 70.0f);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Demo_heishi/EnDemoheishi_Draw.s")
|
||||
void EnDemoheishi_SetupTalk(EnDemoheishi* this) {
|
||||
this->isTalking = true;
|
||||
this->actionFunc = EnDemoheishi_Talk;
|
||||
}
|
||||
|
||||
void EnDemoheishi_Talk(EnDemoheishi* this, GlobalContext* globalCtx) {
|
||||
if ((Message_GetState(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) {
|
||||
func_801477B4(globalCtx);
|
||||
EnDemoheishi_SetupIdle(this);
|
||||
}
|
||||
}
|
||||
|
||||
void EnDemoheishi_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
EnDemoheishi* this = THIS;
|
||||
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
if (this->timer != 0) {
|
||||
this->timer--;
|
||||
}
|
||||
|
||||
this->actor.shape.rot.y = this->actor.world.rot.y;
|
||||
this->actionFunc(this, globalCtx);
|
||||
Actor_MoveWithGravity(&this->actor);
|
||||
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D);
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
EnDemoheishi_SetHeadRotation(this);
|
||||
|
||||
Actor_SetFocus(&this->actor, 60.0f);
|
||||
Math_SmoothStepToS(&this->headRotX, this->headRotXTarget, 1, 0xBB8, 0);
|
||||
Math_SmoothStepToS(&this->headRotY, this->headRotYTarget, 1, 0x3E8, 0);
|
||||
Collider_UpdateCylinder(&this->actor, &this->colliderCylinder);
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base);
|
||||
}
|
||||
|
||||
s32 EnDemoheishi_OverrideLimbDraw(GlobalContext* globalctx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
||||
Actor* thisx) {
|
||||
EnDemoheishi* this = THIS;
|
||||
|
||||
if (limbIndex == DEMOHEISHI_LIMB_HEAD) {
|
||||
rot->x += this->headRotX;
|
||||
rot->y += this->headRotY;
|
||||
rot->z += this->headRotZ;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void EnDemoheishi_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnDemoheishi* this = THIS;
|
||||
|
||||
func_8012C28C(globalCtx->state.gfxCtx);
|
||||
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
|
||||
EnDemoheishi_OverrideLimbDraw, NULL, &this->actor);
|
||||
}
|
||||
|
||||
@@ -7,12 +7,46 @@ struct EnDemoheishi;
|
||||
|
||||
typedef void (*EnDemoheishiActionFunc)(struct EnDemoheishi*, GlobalContext*);
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ DEMOHEISHI_LIMB_NONE,
|
||||
/* 1 */ DEMOHEISHI_LIMB_ROOT,
|
||||
/* 2 */ DEMOHEISHI_LIMB_PELVIS,
|
||||
/* 3 */ DEMOHEISHI_LIMB_LEFT_THIGH,
|
||||
/* 4 */ DEMOHEISHI_LIMB_LEFT_SHIN,
|
||||
/* 5 */ DEMOHEISHI_LIMB_LEFT_FOOT,
|
||||
/* 6 */ DEMOHEISHI_LIMB_RIGHT_THIGH,
|
||||
/* 7 */ DEMOHEISHI_LIMB_RIGHT_SHIN,
|
||||
/* 8 */ DEMOHEISHI_LIMB_RIGHT_FOOT,
|
||||
/* 9 */ DEMOHEISHI_LIMB_TORSO,
|
||||
/* 10 */ DEMOHEISHI_LIMB_LEFT_SHOULDER,
|
||||
/* 11 */ DEMOHEISHI_LIMB_LEFT_FOREARM,
|
||||
/* 12 */ DEMOHEISHI_LIMB_LEFT_HAND,
|
||||
/* 13 */ DEMOHEISHI_LIMB_RIGHT_SHOULDER,
|
||||
/* 14 */ DEMOHEISHI_LIMB_RIGHT_FOREARM,
|
||||
/* 15 */ DEMOHEISHI_LIMB_RIGHT_HAND_WITH_SPEAR,
|
||||
/* 16 */ DEMOHEISHI_LIMB_HEAD,
|
||||
/* 17 */ DEMOHEISHI_LIMB_MAX
|
||||
} EnDemoheishiLimbs;
|
||||
|
||||
typedef struct EnDemoheishi {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x0144 */ char unk_144[0x110];
|
||||
/* 0x0254 */ EnDemoheishiActionFunc actionFunc;
|
||||
/* 0x0258 */ char unk_258[0x68];
|
||||
} EnDemoheishi; // size = 0x2C0
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ SkelAnime skelAnime;
|
||||
/* 0x188 */ Vec3s jointTable[DEMOHEISHI_LIMB_MAX];
|
||||
/* 0x1EE */ Vec3s morphTable[DEMOHEISHI_LIMB_MAX];
|
||||
/* 0x254 */ EnDemoheishiActionFunc actionFunc;
|
||||
/* 0x258 */ s16 headRotY;
|
||||
/* 0x25A */ s16 headRotX;
|
||||
/* 0x25C */ s16 headRotZ;
|
||||
/* 0x25E */ s16 headRotYTarget;
|
||||
/* 0x260 */ s16 headRotXTarget;
|
||||
/* 0x262 */ s16 headRotZTarget;
|
||||
/* 0x264 */ s32 animIndex;
|
||||
/* 0x268 */ s16 timer;
|
||||
/* 0x26C */ f32 frameCount;
|
||||
/* 0x270 */ s16 isTalking;
|
||||
/* 0x272 */ s16 textIdIndex;
|
||||
/* 0x274 */ ColliderCylinder colliderCylinder;
|
||||
} EnDemoheishi; //size = 0x2C0
|
||||
|
||||
extern const ActorInit En_Demo_heishi_InitVars;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ void EnEndingHero4_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
this->actor.targetMode = 6;
|
||||
this->actor.gravity = -3.0f;
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_sdn_Skel_00D640, &object_sdn_Anim_002A84, this->jointTable,
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSoldierSkeleton, &gSoldierCheerWithSpear, this->jointTable,
|
||||
this->morphTable, 17);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f);
|
||||
func_80C23748(this);
|
||||
|
||||
@@ -38,13 +38,13 @@ const ActorInit En_Ending_Hero6_InitVars = {
|
||||
|
||||
static FlexSkeletonHeader* sSkeletons[] = {
|
||||
&object_dt_Skel_00B0CC, &object_bai_Skel_007908, &object_toryo_Skel_007150,
|
||||
&object_sdn_Skel_00D640, &object_daiku_Skel_00A850, &object_daiku_Skel_00A850,
|
||||
&gSoldierSkeleton, &object_daiku_Skel_00A850, &object_daiku_Skel_00A850,
|
||||
&object_daiku_Skel_00A850, &object_daiku_Skel_00A850, &object_daiku_Skel_00A850,
|
||||
};
|
||||
|
||||
static AnimationHeader* sAnimations[] = {
|
||||
&object_dt_Anim_000BE0, &object_bai_Anim_0011C0, &object_toryo_Anim_000E50,
|
||||
&object_sdn_Anim_002A84, &object_daiku_Anim_002FA0, &object_daiku_Anim_002FA0,
|
||||
&gSoldierCheerWithSpear, &object_daiku_Anim_002FA0, &object_daiku_Anim_002FA0,
|
||||
&object_daiku_Anim_002FA0, &object_daiku_Anim_002FA0, &object_daiku_Anim_002FA0,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user