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

ovl_En_Weiyer (#650)

* ovl_En_Weiyer

* PR review

* PR review
This commit is contained in:
maekclena 2021-02-08 00:31:24 +01:00 committed by GitHub
parent 088e8c09bc
commit b029225000
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 589 additions and 1830 deletions

View file

@ -15,12 +15,23 @@ void EnWeiyer_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnWeiyer_Update(Actor* thisx, GlobalContext* globalCtx);
void EnWeiyer_Draw(Actor* thisx, GlobalContext* globalCtx);
extern UNK_TYPE D_06000288;
extern UNK_TYPE D_06000FC0;
extern UNK_TYPE D_060012AC;
extern UNK_TYPE D_06003410;
void func_80B32804(EnWeiyer* this, GlobalContext* globalCtx);
void func_80B328E8(EnWeiyer* this, GlobalContext* globalCtx);
void func_80B32C2C(EnWeiyer* this, GlobalContext* globalCtx);
void func_80B32D30(EnWeiyer* this, GlobalContext* globalCtx);
void func_80B32E34(EnWeiyer* this, GlobalContext* globalCtx);
void func_80B33018(EnWeiyer* this, GlobalContext* globalCtx);
void func_80B331CC(EnWeiyer* this, GlobalContext* globalCtx);
void func_80B333B8(EnWeiyer* this, GlobalContext* globalCtx);
void func_80B332B4(EnWeiyer* this, GlobalContext* globalCtx);
void func_80B33338(EnWeiyer* this, GlobalContext* globalCtx);
void func_80B3349C(EnWeiyer* this, GlobalContext* globalCtx);
extern AnimationHeader D_06000288;
extern AnimationHeader D_06000FC0;
extern AnimationHeader D_060012AC;
extern SkeletonHeader D_06003410;
/*
const ActorInit En_Weiyer_InitVars = {
ACTOR_EN_WEIYER,
ACTORCAT_ENEMY,
@ -33,7 +44,7 @@ const ActorInit En_Weiyer_InitVars = {
(ActorFunc)EnWeiyer_Draw,
};
static ColliderCylinderInit D_80B33A90 = {
static ColliderCylinderInit sCylinderInit = {
{
COLTYPE_HIT0,
AT_TYPE_ENEMY,
@ -52,59 +63,590 @@ static ColliderCylinderInit D_80B33A90 = {
},
{ 16, 10, -6, { 0, 0, 0 } },
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/EnWeiyer_Init.s")
static CollisionCheckInfoInit sColChkInfoInit = { 2, 45, 15, 100 };
static DamageTable sDamageTable = {
/* Deku nut */ DMG_ENTRY(0, 0x1),
/* Deku stick */ DMG_ENTRY(2, 0x0),
/* Slingshot */ DMG_ENTRY(1, 0x0),
/* Explosive */ DMG_ENTRY(2, 0x0),
/* Boomerang */ DMG_ENTRY(0, 0x1),
/* Normal arrow */ DMG_ENTRY(2, 0x0),
/* Hammer swing */ DMG_ENTRY(2, 0x0),
/* Hookshot */ DMG_ENTRY(2, 0x0),
/* Kokiri sword */ DMG_ENTRY(1, 0x0),
/* Master sword */ DMG_ENTRY(2, 0x0),
/* Giant's Knife */ DMG_ENTRY(4, 0x0),
/* Fire arrow */ DMG_ENTRY(2, 0x0),
/* Ice arrow */ DMG_ENTRY(2, 0x0),
/* Light arrow */ DMG_ENTRY(2, 0x0),
/* Unk arrow 1 */ DMG_ENTRY(2, 0x0),
/* Unk arrow 2 */ DMG_ENTRY(0, 0x0),
/* Unk arrow 3 */ DMG_ENTRY(0, 0x0),
/* Fire magic */ DMG_ENTRY(0, 0x0),
/* Ice magic */ DMG_ENTRY(0, 0x0),
/* Light magic */ DMG_ENTRY(0, 0x0),
/* Shield */ DMG_ENTRY(0, 0x0),
/* Mirror Ray */ DMG_ENTRY(0, 0x0),
/* Kokiri spin */ DMG_ENTRY(1, 0x0),
/* Giant spin */ DMG_ENTRY(4, 0x0),
/* Master spin */ DMG_ENTRY(2, 0x0),
/* Kokiri jump */ DMG_ENTRY(2, 0x0),
/* Giant jump */ DMG_ENTRY(8, 0x0),
/* Master jump */ DMG_ENTRY(4, 0x0),
/* Unknown 1 */ DMG_ENTRY(0, 0x0),
/* Unblockable */ DMG_ENTRY(0, 0x0),
/* Hammer jump */ DMG_ENTRY(4, 0x0),
/* Unknown 2 */ DMG_ENTRY(0, 0x0),
};
static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, 25, ICHAIN_CONTINUE),
ICHAIN_VEC3F_DIV1000(scale, 3, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 2500, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/EnWeiyer_Destroy.s")
void EnWeiyer_Init(Actor* thisx, GlobalContext* globalCtx) {
EnWeiyer* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B32384.s")
Actor_ProcessInitChain(thisx, sInitChain);
ActorShape_Init(&this->actor.shape, 1000.0f, ActorShadow_DrawCircle, 65.0f);
SkelAnime_Init(globalCtx, &this->skelAnime, &D_06003410, &D_060012AC, this->jointTable, this->morphTable, 19);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
this->actionFunc = func_80B32804;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B32434.s")
void EnWeiyer_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnWeiyer* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B32494.s")
Collider_DestroyCylinder(globalCtx, &this->collider);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B32508.s")
void func_80B32384(EnWeiyer* this) {
this->unk_196 = this->actor.shape.rot.y;
this->unk_27C = (cosf(-M_PI / 8) * 3.0f) + this->actor.world.pos.y;
Animation_MorphToLoop(&this->skelAnime, &D_06000FC0, -5.0f);
this->unk_194 = 30;
this->actor.speedXZ = CLAMP_MAX(this->actor.speedXZ, 2.5f);
this->collider.base.atFlags &= ~AT_ON;
this->unk_280 = this->actor.floorHeight;
this->actionFunc = func_80B328E8;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B32538.s")
void func_80B32434(EnWeiyer* this) {
Animation_MorphToLoop(&this->skelAnime, &D_06000FC0, -5.0f);
this->collider.base.atFlags |= AT_ON;
this->unk_194 = 0;
this->actor.speedXZ = 5.0f;
this->actionFunc = func_80B32C2C;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B325A0.s")
void func_80B32494(EnWeiyer* this) {
Animation_Change(&this->skelAnime, &D_06000288, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f);
this->unk_194 = 40;
this->collider.base.atFlags |= AT_ON;
this->actionFunc = func_80B32D30;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B32660.s")
void func_80B32508(EnWeiyer* this) {
this->unk_194 = 200;
this->collider.base.atFlags |= AT_ON;
this->skelAnime.playSpeed = 3.0f;
this->actionFunc = func_80B32E34;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B32724.s")
void func_80B32538(EnWeiyer* this) {
this->unk_194 = 200;
this->unk_196 = this->actor.yawTowardsPlayer + 0x8000;
this->unk_27C = this->actor.world.pos.y;
this->actor.speedXZ = CLAMP_MAX(this->actor.speedXZ, 4.0f);
this->collider.base.atFlags &= ~AT_ON;
this->skelAnime.playSpeed = 1.0f;
this->actionFunc = func_80B33018;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B327B0.s")
void func_80B325A0(EnWeiyer* this) {
Animation_Change(&this->skelAnime, &D_06000FC0, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -3.0f);
this->unk_194 = 40;
this->collider.base.atFlags &= ~AT_ON;
this->collider.base.acFlags &= ~AC_ON;
this->actor.gravity = 0.0f;
this->actor.velocity.y = 0.0f;
this->actor.speedXZ = 3.0f;
func_8003426C(&this->actor, 0x4000, 0xC8, 0, 0x28);
this->collider.dim.height = sCylinderInit.dim.height;
this->actionFunc = func_80B331CC;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B327D8.s")
void func_80B32660(EnWeiyer* this) {
Animation_Change(&this->skelAnime, &D_06000288, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f);
this->unk_194 = 80;
this->actor.speedXZ = 0.0f;
this->actor.velocity.y = 0.0f;
this->actor.gravity = -1.0f;
this->collider.dim.height = sCylinderInit.dim.height + 0xF;
func_8003426C(&this->actor, 0, 0xC8, 0, 0x50);
this->collider.base.atFlags &= ~AT_ON;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE);
this->actionFunc = func_80B333B8;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B32804.s")
void func_80B32724(EnWeiyer* this) {
Animation_MorphToLoop(&this->skelAnime, &D_06000FC0, -5.0f);
this->unk_194 = 20;
func_8003426C(&this->actor, 0x4000, 0xC8, 0, 0x28);
this->collider.base.atFlags &= ~AT_ON;
this->collider.base.acFlags &= ~AC_ON;
this->actor.speedXZ = 3.0f;
this->actionFunc = func_80B332B4;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B328E8.s")
void func_80B327B0(EnWeiyer* this) {
this->actor.colorFilterParams |= 0x2000;
this->actor.speedXZ = 0.0f;
this->actor.velocity.y = 0.0f;
this->actionFunc = func_80B33338;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B32C2C.s")
void func_80B327D8(EnWeiyer* this) {
this->actor.shape.rot.x = -0x2000;
this->unk_194 = -1;
this->actor.speedXZ = 5.0f;
this->actionFunc = func_80B3349C;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B32D30.s")
void func_80B32804(EnWeiyer* this, GlobalContext* globalCtx) {
WaterBox* waterBox;
s32 bgId;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B32DEC.s")
this->actor.world.pos.y += 0.5f;
this->actor.floorHeight = BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &bgId,
&this->actor, &this->actor.world.pos);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B32E34.s")
if (!WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z,
&this->actor.home.pos.y, &waterBox) ||
((this->actor.home.pos.y - 5.0f) <= this->actor.floorHeight)) {
Actor_Kill(&this->actor);
} else {
this->actor.home.pos.y -= 5.0f;
this->actor.world.pos.y = (this->actor.home.pos.y + this->actor.floorHeight) / 2.0f;
func_80B32384(this);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B33018.s")
void func_80B328E8(EnWeiyer* this, GlobalContext* globalCtx) {
s32 sp34;
f32 curFrame;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B331CC.s")
SkelAnime_Update(&this->skelAnime);
Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x800);
sp34 = Animation_OnFrame(&this->skelAnime, 0.0f);
curFrame = this->skelAnime.curFrame;
Math_StepToF(&this->unk_27C, this->unk_280, 0.5f);
this->actor.world.pos.y = this->unk_27C - cosf((curFrame - 5.0f) * (M_PI / 40)) * 3.0f;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B332B4.s")
if (curFrame <= 45.0f) {
Math_StepToF(&this->actor.speedXZ, 1.0f, 0.03f);
} else {
Math_StepToF(&this->actor.speedXZ, 1.3f, 0.03f);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B33338.s")
if (this->actor.bgCheckFlags & 8) {
this->unk_196 = this->actor.wallYaw;
this->unk_194 = 30;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B333B8.s")
if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->unk_196, 182)) {
if (this->unk_194 != 0) {
this->unk_194--;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B3349C.s")
if (this->unk_194 == 0) {
this->unk_196 =
Rand_S16Offset(0x2000, 0x2000) * ((Rand_ZeroOne() < 0.5f) ? -1 : 1) + this->actor.shape.rot.y;
this->unk_194 = 30;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B3368C.s")
if (Rand_ZeroOne() < 0.3333f) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_EIER_CRY);
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/EnWeiyer_Update.s")
if (this->actor.home.pos.y < this->actor.world.pos.y) {
if (this->actor.home.pos.y < this->actor.floorHeight) {
func_80B32434(this);
} else {
this->actor.world.pos.y = this->actor.home.pos.y;
this->unk_280 =
Rand_ZeroOne() * ((this->actor.home.pos.y - this->actor.floorHeight) / 2.0f) + this->actor.floorHeight;
}
} else {
Player* player = PLAYER;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/func_80B338D4.s")
if (this->actor.bgCheckFlags & 1) {
this->unk_280 =
this->actor.home.pos.y - Rand_ZeroOne() * ((this->actor.home.pos.y - this->actor.floorHeight) / 2.0f);
} else if (sp34 && (Rand_ZeroOne() < 0.1f)) {
this->unk_280 =
Rand_ZeroOne() * (this->actor.home.pos.y - this->actor.floorHeight) + this->actor.floorHeight;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Weiyer/EnWeiyer_Draw.s")
if ((this->actor.xzDistToPlayer < 400.0f) && (fabsf(this->actor.yDistToPlayer) < 250.0f) &&
(player->actor.world.pos.y < (this->actor.home.pos.y + 20.0f))) {
func_80B32508(this);
}
}
}
void func_80B32C2C(EnWeiyer* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
if (this->unk_194 == 0) {
if (Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0x800)) {
this->actor.shape.rot.z = 0;
this->actor.shape.rot.y += 0x8000;
this->unk_194 = 1;
} else {
this->actor.shape.rot.z = this->actor.shape.rot.x * 2;
}
} else {
Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1800, 0x800);
if (this->actor.world.pos.y < this->actor.home.pos.y) {
if (this->actor.shape.rot.x > 0) {
EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 1, 400);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_SINK);
}
func_80B32538(this);
} else if (this->actor.bgCheckFlags & 1) {
func_80B32494(this);
}
}
}
void func_80B32D30(EnWeiyer* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_EIER_FLUTTER);
}
Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x800);
Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f);
if (this->unk_194 != 0) {
this->unk_194--;
}
if (this->unk_194 == 0) {
func_80B32434(this);
} else if (this->actor.world.pos.y < this->actor.home.pos.y) {
func_80B32384(this);
}
}
s16 func_80B32DEC(EnWeiyer* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
Vec3f vec;
vec.x = player->actor.world.pos.x;
vec.y = player->actor.world.pos.y + 20.0f;
vec.z = player->actor.world.pos.z;
return Actor_WorldPitchTowardPoint(&this->actor, &vec);
}
void func_80B32E34(EnWeiyer* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
SkelAnime_Update(&this->skelAnime);
if (this->unk_194 != 0) {
this->unk_194--;
}
if ((this->unk_194 == 0) || ((this->actor.home.pos.y + 20.0f) <= player->actor.world.pos.y) ||
(this->collider.base.atFlags & AT_HIT)) {
func_80B32538(this);
} else {
if (func_8002E084(&this->actor, 0x2800)) {
Math_StepToF(&this->actor.speedXZ, 4.0f, 0.2f);
} else {
Math_StepToF(&this->actor.speedXZ, 1.3f, 0.2f);
}
if (this->actor.home.pos.y < this->actor.world.pos.y) {
if (this->actor.home.pos.y < this->actor.floorHeight) {
this->actor.shape.rot.x = 0;
func_80B32434(this);
return;
}
this->actor.world.pos.y = this->actor.home.pos.y;
Math_SmoothStepToS(&this->actor.shape.rot.x, 0x1000, 2, 0x100, 0x40);
} else {
Math_SmoothStepToS(&this->actor.shape.rot.x, func_80B32DEC(this, globalCtx), 2, 0x100, 0x40);
}
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x200, 0x80);
if ((player->actor.yDistToWater < 50.0f) && (this->actor.yDistToWater < 20.0f) &&
func_8002E084(&this->actor, 0x2000)) {
func_80B327D8(this);
}
}
}
void func_80B33018(EnWeiyer* this, GlobalContext* globalCtx) {
f32 curFrame;
SkelAnime_Update(&this->skelAnime);
Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x800);
curFrame = this->skelAnime.curFrame;
Math_StepToF(&this->unk_27C, (this->actor.home.pos.y - this->actor.floorHeight) / 4.0f + this->actor.floorHeight,
1.0f);
this->actor.world.pos.y = this->unk_27C - cosf((curFrame - 5.0f) * (M_PI / 40)) * 3.0f;
if (curFrame <= 45.0f) {
Math_StepToF(&this->actor.speedXZ, 1.0f, 0.03f);
} else {
Math_StepToF(&this->actor.speedXZ, 1.3f, 0.03f);
}
if (this->unk_194 != 0) {
this->unk_194--;
}
if (this->actor.bgCheckFlags & 8) {
this->unk_196 = this->actor.wallYaw;
}
if (Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_196, 2, 0x200, 0x80) == 0) {
this->unk_196 = this->actor.yawTowardsPlayer + 0x8000;
}
if (this->actor.home.pos.y < this->actor.world.pos.y) {
if (this->actor.home.pos.y < this->actor.floorHeight) {
func_80B32434(this);
} else {
this->actor.world.pos.y = this->actor.home.pos.y;
}
}
if (this->unk_194 == 0) {
func_80B32384(this);
}
}
void func_80B331CC(EnWeiyer* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
if (this->unk_194 != 0) {
this->unk_194--;
}
if (this->actor.bgCheckFlags & 8) {
this->unk_196 = this->actor.wallYaw;
} else {
this->unk_196 = this->actor.yawTowardsPlayer + 0x8000;
}
Math_ScaledStepToS(&this->actor.world.rot.y, this->unk_196, 0x38E);
Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x200);
this->actor.shape.rot.z = sinf(this->unk_194 * (M_PI / 5)) * 5120.0f;
if (this->unk_194 == 0) {
this->actor.shape.rot.z = 0;
this->collider.base.acFlags |= AC_ON;
func_80B32384(this);
}
}
void func_80B332B4(EnWeiyer* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0x400);
this->actor.shape.rot.z += 0x1000;
if (this->unk_194 != 0) {
this->unk_194--;
}
if ((this->unk_194 == 0) || (this->actor.bgCheckFlags & 0x10)) {
func_80B327B0(this);
}
}
void func_80B33338(EnWeiyer* this, GlobalContext* globalCtx) {
this->actor.shape.shadowAlpha = CLAMP_MIN((s16)(this->actor.shape.shadowAlpha - 5), 0);
this->actor.world.pos.y -= 2.0f;
if (this->actor.shape.shadowAlpha == 0) {
Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xE0);
Actor_Kill(&this->actor);
}
}
void func_80B333B8(EnWeiyer* this, GlobalContext* globalCtx) {
if (this->unk_194 != 0) {
this->unk_194--;
}
Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x200);
Math_ScaledStepToS(&this->actor.shape.rot.z, 0, 0x200);
SkelAnime_Update(&this->skelAnime);
if (this->actor.home.pos.y < this->actor.floorHeight) {
if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_EIER_FLUTTER);
}
if (this->actor.bgCheckFlags & 2) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND);
}
}
if (this->unk_194 == 0) {
this->actor.gravity = 0.0f;
this->actor.velocity.y = 0.0f;
this->collider.dim.height = sCylinderInit.dim.height;
func_80B32384(this);
}
}
void func_80B3349C(EnWeiyer* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
s16 phi_a1;
s32 phi_a0;
SkelAnime_Update(&this->skelAnime);
phi_a0 = ((this->actor.home.pos.y + 20.0f) <= player->actor.world.pos.y);
if (this->unk_194 == -1) {
if (phi_a0 || (this->collider.base.atFlags & AT_HIT)) {
func_80B32538(this);
} else if (this->actor.yDistToWater < 0.0f) {
this->unk_194 = 10;
EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 1, 400);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_JUMP);
}
} else {
if (phi_a0 || (this->collider.base.atFlags & AT_HIT)) {
this->unk_194 = 0;
} else if (this->unk_194 != 0) {
this->unk_194--;
}
if (this->unk_194 == 0) {
phi_a1 = 0x1800;
} else {
phi_a1 = func_80B32DEC(this, globalCtx);
phi_a1 = CLAMP_MIN(phi_a1, 0);
}
if (this->actor.shape.rot.x < phi_a1) {
Math_ScaledStepToS(&this->actor.shape.rot.x, phi_a1, 0x400);
}
if (this->actor.bgCheckFlags & 1) {
func_80B32434(this);
} else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.shape.rot.x > 0)) {
EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 1, 400);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_SINK);
func_80B32538(this);
} else {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 8, 0x100, 0x80);
}
}
}
void func_80B3368C(EnWeiyer* this, GlobalContext* globalCtx) {
if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
func_80035650(&this->actor, &this->collider.info, 1);
if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) {
if (this->actor.colChkInfo.damageEffect == 1) {
if (this->actionFunc != func_80B333B8) {
func_80B32660(this);
}
} else if (Actor_ApplyDamage(&this->actor) == 0) {
func_80032C7C(globalCtx, &this->actor);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_EIER_DEAD);
this->actor.flags &= ~1;
func_80B32724(this);
} else {
func_80B325A0(this);
}
}
}
}
void EnWeiyer_Update(Actor* thisx, GlobalContext* globalCtx) {
EnWeiyer* this = THIS;
s32 pad;
this->actor.home.pos.y = this->actor.yDistToWater + this->actor.world.pos.y - 5.0f;
func_80B3368C(this, globalCtx);
this->actionFunc(this, globalCtx);
this->actor.world.rot.y = this->actor.shape.rot.y;
this->actor.world.rot.x = -this->actor.shape.rot.x;
if ((this->actor.world.rot.x == 0) || (this->actionFunc == func_80B333B8)) {
Actor_MoveForward(&this->actor);
} else {
func_8002D97C(&this->actor);
}
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 30.0f, 45.0f, 7);
Actor_SetFocus(&this->actor, 0.0f);
if (this->collider.base.atFlags & AT_HIT) {
this->collider.base.atFlags &= ~(AT_ON | AT_HIT);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_EIER_ATTACK);
}
Collider_UpdateCylinder(&this->actor, &this->collider);
if (this->collider.base.atFlags & AT_ON) {
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
if (this->collider.base.acFlags & AT_ON) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
s32 EnWeiyer_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx,
Gfx** gfx) {
if (limbIndex == 1) {
pos->z += 2000.0f;
}
return 0;
}
void EnWeiyer_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnWeiyer* this = THIS;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_weiyer.c", 1193);
if (this->actionFunc != func_80B33338) {
func_80093D18(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]);
gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255);
POLY_OPA_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
EnWeiyer_OverrideLimbDraw, NULL, &this->actor, POLY_OPA_DISP);
} else {
func_80093D84(globalCtx->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08, &D_80116280[0]);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->actor.shape.shadowAlpha);
POLY_XLU_DISP = SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
EnWeiyer_OverrideLimbDraw, NULL, &this->actor, POLY_XLU_DISP);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_weiyer.c", 1240);
}

View file

@ -6,9 +6,19 @@
struct EnWeiyer;
typedef void (*EnWeiyerActionFunc)(struct EnWeiyer*, GlobalContext*);
typedef struct EnWeiyer {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x184];
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnWeiyerActionFunc actionFunc;
/* 0x0194 */ s16 unk_194;
/* 0x0196 */ s16 unk_196;
/* 0x0198 */ Vec3s jointTable[19];
/* 0x020A */ Vec3s morphTable[19];
/* 0x027C */ f32 unk_27C;
/* 0x0280 */ f32 unk_280;
/* 0x0284 */ ColliderCylinder collider;
} EnWeiyer; // size = 0x02D0
extern const ActorInit En_Weiyer_InitVars;