mirror of https://github.com/zeldaret/mm.git
EnHeishi OK and documented (#597)
* EnHeishi first pass * fixed references to updated function names * fixed references to updated function names part 2 * removed unnecessary externs * pr fixes * fix header * fix object files to match demoheishi changes * cleanup * PR comments addressed * merge master * use actors flags with change for demoheishi too
This commit is contained in:
parent
aa6c316102
commit
5f9e906727
3
spec
3
spec
|
|
@ -4908,8 +4908,7 @@ beginseg
|
|||
name "ovl_En_Heishi"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_En_Heishi/z_en_heishi.o"
|
||||
include "build/data/ovl_En_Heishi/ovl_En_Heishi.data.o"
|
||||
include "build/data/ovl_En_Heishi/ovl_En_Heishi.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_En_Heishi/ovl_En_Heishi_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "z_en_heishi.h"
|
||||
#include "objects/object_sdn/object_sdn.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8)
|
||||
|
||||
|
|
@ -15,9 +16,19 @@ void EnHeishi_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void EnHeishi_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnHeishi_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
void func_80BE9214(EnHeishi* this, GlobalContext* globalCtx);
|
||||
void EnHeishi_ChangeAnimation(EnHeishi* this, s32 animIndex);
|
||||
void EnHeishi_SetHeadRotation(EnHeishi* this);
|
||||
void EnHeishi_SetupIdle(EnHeishi* this);
|
||||
void EnHeishi_Idle(EnHeishi* this, GlobalContext* globalCtx);
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ HEISHI_ANIMATION_STAND_HAND_ON_HIP,
|
||||
/* 1 */ HEISHI_ANIMATION_CHEER_WITH_SPEAR,
|
||||
/* 2 */ HEISHI_ANIMATION_WAVE,
|
||||
/* 3 */ HEISHI_ANIMATION_SIT_AND_REACH,
|
||||
/* 4 */ HEISHI_ANIMATION_STAND_UP
|
||||
} EnHeishiAnimationIndex;
|
||||
|
||||
#if 0
|
||||
const ActorInit En_Heishi_InitVars = {
|
||||
ACTOR_EN_HEISHI,
|
||||
ACTORCAT_NPC,
|
||||
|
|
@ -30,33 +41,151 @@ const ActorInit En_Heishi_InitVars = {
|
|||
(ActorFunc)EnHeishi_Draw,
|
||||
};
|
||||
|
||||
// static ColliderCylinderInit sCylinderInit = {
|
||||
static ColliderCylinderInit D_80BE9450 = {
|
||||
{ COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_PLAYER, 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_PLAYER,
|
||||
OC2_TYPE_2,
|
||||
COLSHAPE_CYLINDER,
|
||||
},
|
||||
{
|
||||
ELEMTYPE_UNK0,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0xF7CFFFFF, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_NONE,
|
||||
OCELEM_ON,
|
||||
},
|
||||
{ 20, 60, 0, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
#endif
|
||||
void EnHeishi_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnHeishi* this = THIS;
|
||||
|
||||
extern ColliderCylinderInit D_80BE9450;
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f);
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSoldierSkeleton, &gSoldierWave, this->jointTable,
|
||||
this->morphTable, HEISHI_LIMB_MAX);
|
||||
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
|
||||
this->paramsCopy = this->actor.params;
|
||||
this->yawTowardsPlayer = this->actor.world.rot.y;
|
||||
|
||||
extern UNK_TYPE D_06003BFC;
|
||||
if (this->paramsCopy == 0) {
|
||||
this->shouldSetHeadRotation = 1;
|
||||
if (!(gSaveContext.weekEventReg[63] & 0x80) && !((gSaveContext.day == 3) && gSaveContext.isNight)) {
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
}
|
||||
} else {
|
||||
this->colliderCylinder.dim.radius = 30;
|
||||
this->colliderCylinder.dim.height = 60;
|
||||
this->colliderCylinder.dim.yShift = 0;
|
||||
if ((gSaveContext.weekEventReg[63] & 0x80) || ((gSaveContext.day == 3) && gSaveContext.isNight)) {
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Heishi/EnHeishi_Init.s")
|
||||
this->actor.targetMode = 6;
|
||||
this->actor.gravity = -3.0f;
|
||||
Collider_InitAndSetCylinder(globalCtx, &this->colliderCylinder, &this->actor, &sCylinderInit);
|
||||
this->actor.flags |= ACTOR_FLAG_8000000;
|
||||
EnHeishi_SetupIdle(this);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Heishi/EnHeishi_Destroy.s")
|
||||
void EnHeishi_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnHeishi* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Heishi/func_80BE90BC.s")
|
||||
Collider_DestroyCylinder(globalCtx, &this->colliderCylinder);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Heishi/func_80BE9148.s")
|
||||
void EnHeishi_ChangeAnimation(EnHeishi* 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,
|
||||
ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Heishi/func_80BE91DC.s")
|
||||
this->animIndex = animIndex;
|
||||
this->frameCount = Animation_GetLastFrame(sAnimations[this->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_Heishi/func_80BE9214.s")
|
||||
void EnHeishi_SetHeadRotation(EnHeishi* this) {
|
||||
s16 yawDiff = this->yawTowardsPlayer - this->actor.world.rot.y;
|
||||
s32 absYawDiff = ABS_ALT(yawDiff);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Heishi/EnHeishi_Update.s")
|
||||
this->headRotXTarget = 0;
|
||||
if ((this->actor.xzDistToPlayer < 200.0f) && (absYawDiff < 0x4E20)) {
|
||||
this->headRotXTarget = this->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_Heishi/func_80BE9380.s")
|
||||
void EnHeishi_SetupIdle(EnHeishi* this) {
|
||||
s8 animIndex = HEISHI_ANIMATION_STAND_HAND_ON_HIP;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Heishi/EnHeishi_Draw.s")
|
||||
EnHeishi_ChangeAnimation(this, animIndex);
|
||||
this->unk278 = animIndex;
|
||||
this->actionFunc = EnHeishi_Idle;
|
||||
}
|
||||
|
||||
void EnHeishi_Idle(EnHeishi* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
void EnHeishi_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
EnHeishi* this = THIS;
|
||||
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
if (this->timer != 0) {
|
||||
this->timer--;
|
||||
}
|
||||
|
||||
this->actor.shape.rot.y = this->actor.world.rot.y;
|
||||
if ((this->paramsCopy != 0) && (gSaveContext.day == 3) && gSaveContext.isNight) {
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
} else {
|
||||
this->actionFunc(this, globalCtx);
|
||||
Actor_MoveWithGravity(&this->actor);
|
||||
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 29);
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
if (this->shouldSetHeadRotation) {
|
||||
EnHeishi_SetHeadRotation(this);
|
||||
}
|
||||
|
||||
Actor_SetFocus(&this->actor, 60.0f);
|
||||
Math_SmoothStepToS(&this->headRotX, this->headRotXTarget, 1, 3000, 0);
|
||||
Math_SmoothStepToS(&this->headRotY, this->headRotYTarget, 1, 1000, 0);
|
||||
Collider_UpdateCylinder(&this->actor, &this->colliderCylinder);
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base);
|
||||
}
|
||||
}
|
||||
|
||||
s32 EnHeishi_OverrideLimbDraw(GlobalContext* globalctx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
||||
Actor* thisx) {
|
||||
EnHeishi* this = THIS;
|
||||
|
||||
if (limbIndex == HEISHI_LIMB_HEAD) {
|
||||
rot->x += this->headRotX;
|
||||
rot->y += this->headRotY;
|
||||
rot->z += this->headRotZ;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void EnHeishi_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnHeishi* this = THIS;
|
||||
|
||||
func_8012C28C(globalCtx->state.gfxCtx);
|
||||
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
|
||||
EnHeishi_OverrideLimbDraw, NULL, &this->actor);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,48 @@ struct EnHeishi;
|
|||
|
||||
typedef void (*EnHeishiActionFunc)(struct EnHeishi*, GlobalContext*);
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ HEISHI_LIMB_NONE,
|
||||
/* 1 */ HEISHI_LIMB_ROOT,
|
||||
/* 2 */ HEISHI_LIMB_PELVIS,
|
||||
/* 3 */ HEISHI_LIMB_LEFT_THIGH,
|
||||
/* 4 */ HEISHI_LIMB_LEFT_CALF,
|
||||
/* 5 */ HEISHI_LIMB_LEFT_FOOT,
|
||||
/* 6 */ HEISHI_LIMB_RIGHT_THIGH,
|
||||
/* 7 */ HEISHI_LIMB_RIGHT_CALF,
|
||||
/* 8 */ HEISHI_LIMB_RIGHT_FOOT,
|
||||
/* 9 */ HEISHI_LIMB_TORSO,
|
||||
/* 10 */ HEISHI_LIMB_LEFT_SHOULDER,
|
||||
/* 11 */ HEISHI_LIMB_LEFT_FOREARM,
|
||||
/* 12 */ HEISHI_LIMB_LEFT_HAND,
|
||||
/* 13 */ HEISHI_LIMB_RIGHT_SHOULDER,
|
||||
/* 14 */ HEISHI_LIMB_RIGHT_FOREARM,
|
||||
/* 15 */ HEISHI_LIMB_RIGHT_HAND_WITH_SPEAR,
|
||||
/* 16 */ HEISHI_LIMB_HEAD,
|
||||
/* 17 */ HEISHI_LIMB_MAX
|
||||
} EnHeishiLimbs;
|
||||
|
||||
typedef struct EnHeishi {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x0144 */ char unk_144[0x110];
|
||||
/* 0x0144 */ SkelAnime skelAnime;
|
||||
/* 0x0188 */ Vec3s jointTable[HEISHI_LIMB_MAX];
|
||||
/* 0x01EE */ Vec3s morphTable[HEISHI_LIMB_MAX];
|
||||
/* 0x0254 */ EnHeishiActionFunc actionFunc;
|
||||
/* 0x0258 */ char unk_258[0x78];
|
||||
/* 0x0258 */ s16 headRotY;
|
||||
/* 0x025A */ s16 headRotX;
|
||||
/* 0x025C */ s16 headRotZ;
|
||||
/* 0x025E */ s16 headRotYTarget;
|
||||
/* 0x0260 */ s16 headRotXTarget;
|
||||
/* 0x0262 */ s16 headRotZTarget;
|
||||
/* 0x0264 */ s32 animIndex;
|
||||
/* 0x0268 */ s32 paramsCopy;
|
||||
/* 0x026C */ s32 shouldSetHeadRotation;
|
||||
/* 0x0270 */ s16 timer;
|
||||
/* 0x0272 */ s16 yawTowardsPlayer;
|
||||
/* 0x0274 */ f32 frameCount;
|
||||
/* 0x0278 */ s16 unk278; // set and not used
|
||||
/* 0x027C */ UNK_TYPE1 unk_27C[0x8];
|
||||
/* 0x0284 */ ColliderCylinder colliderCylinder;
|
||||
} EnHeishi; // size = 0x2D0
|
||||
|
||||
extern const ActorInit En_Heishi_InitVars;
|
||||
|
||||
#endif // Z_EN_HEISHI_H
|
||||
|
|
|
|||
|
|
@ -16161,12 +16161,12 @@
|
|||
0x80BE8D94:("EnBaisen_Draw",),
|
||||
0x80BE8F20:("EnHeishi_Init",),
|
||||
0x80BE9090:("EnHeishi_Destroy",),
|
||||
0x80BE90BC:("func_80BE90BC",),
|
||||
0x80BE9148:("func_80BE9148",),
|
||||
0x80BE91DC:("func_80BE91DC",),
|
||||
0x80BE9214:("func_80BE9214",),
|
||||
0x80BE90BC:("EnHeishi_ChangeAnimation",),
|
||||
0x80BE9148:("EnHeishi_SetHeadRotation",),
|
||||
0x80BE91DC:("EnHeishi_SetupIdle",),
|
||||
0x80BE9214:("EnHeishi_Idle",),
|
||||
0x80BE9224:("EnHeishi_Update",),
|
||||
0x80BE9380:("func_80BE9380",),
|
||||
0x80BE9380:("EnHeishi_OverrideLimbDraw",),
|
||||
0x80BE93D8:("EnHeishi_Draw",),
|
||||
0x80BE9510:("EnDemoheishi_Init",),
|
||||
0x80BE95C0:("EnDemoheishi_Destroy",),
|
||||
|
|
|
|||
|
|
@ -16173,9 +16173,9 @@
|
|||
0x80BE8E4C:("D_80BE8E4C","UNK_TYPE1","",0x1),
|
||||
0x80BE8E58:("D_80BE8E58","UNK_TYPE1","",0x1),
|
||||
0x80BE9430:("En_Heishi_InitVars","UNK_TYPE1","",0x1),
|
||||
0x80BE9450:("D_80BE9450","UNK_TYPE1","",0x1),
|
||||
0x80BE947C:("D_80BE947C","UNK_TYPE1","",0x1),
|
||||
0x80BE9490:("D_80BE9490","UNK_TYPE1","",0x1),
|
||||
0x80BE9450:("sCylinderInit","UNK_TYPE1","",0x1),
|
||||
0x80BE947C:("sAnimations","UNK_TYPE1","",0x1),
|
||||
0x80BE9490:("sAnimModes","UNK_TYPE1","",0x1),
|
||||
0x80BE9A30:("En_Demo_heishi_InitVars","UNK_TYPE1","",0x1),
|
||||
0x80BE9A50:("sCylinderInit","UNK_TYPE1","",0x1),
|
||||
0x80BE9A7C:("sTextIds","UNK_TYPE1","",0x1),
|
||||
|
|
|
|||
|
|
@ -1388,11 +1388,6 @@ D_060000C0 = 0x060000C0;
|
|||
D_06000444 = 0x06000444;
|
||||
D_06002FD0 = 0x06002FD0;
|
||||
|
||||
// ovl_En_Heishi
|
||||
|
||||
D_06003BFC = 0x06003BFC;
|
||||
D_0600D640 = 0x0600D640;
|
||||
|
||||
// ovl_En_Hgo
|
||||
|
||||
D_0600B644 = 0x0600B644;
|
||||
|
|
|
|||
Loading…
Reference in New Issue