1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 22:44:30 +00:00

z_en skb, 1 non-matching, with some documentation (#669)

* breathing new life into these skeletons

* StalZone Progress StalZone

* another match

* matched override

* some progress

* one down, one to go

* naming and prepping for pr

* removing asm and prepping for PR

* fixing damage table and asm issues

* hopefully this fixes it (thank you louis)

* fixing some suggested changes

* inlining data into EnSkb_SpawnDebris

* Fixing suggestions and adding a note

* fixing the asm and function name

* fix

* whoops

Co-authored-by: Fig02 <fig02srl@gmail.com>
This commit is contained in:
Parker Burnett 2021-02-15 17:52:22 -05:00 committed by GitHub
parent 88b05cd9a2
commit 2c56a6e99a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 511 additions and 1683 deletions

View file

@ -1,4 +1,5 @@
#include "z_en_skb.h"
#include "overlays/actors/ovl_En_Encount1/z_en_encount1.h"
#define FLAGS 0x00000015
@ -9,27 +10,32 @@ void EnSkb_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnSkb_Update(Actor* thisx, GlobalContext* globalCtx);
void EnSkb_Draw(Actor* thisx, GlobalContext* globalCtx);
extern UNK_TYPE D_06000460;
extern UNK_TYPE D_060009DC;
extern UNK_TYPE D_06000D98;
extern UNK_TYPE D_06001854;
extern UNK_TYPE D_060041F8;
extern UNK_TYPE D_060047E0;
void func_80AFCD60(EnSkb* this);
void func_80AFCDF8(EnSkb* this);
void func_80AFCE5C(EnSkb* this, GlobalContext* globalCtx);
void func_80AFCF48(EnSkb* this);
void func_80AFCFF0(EnSkb* this, GlobalContext* globalCtx);
void func_80AFD0A4(EnSkb* this);
void EnSkb_Advance(EnSkb* this, GlobalContext* globalCtx);
void func_80AFD33C(EnSkb* this);
void EnSkb_SetupAttack(EnSkb* this, GlobalContext* globalCtx);
void func_80AFD47C(EnSkb* this);
void func_80AFD508(EnSkb* this, GlobalContext* globalCtx);
void EnSkb_SetupStunned(EnSkb* this);
void func_80AFD59C(EnSkb* this, GlobalContext* globalCtx);
void func_80AFD6CC(EnSkb* this, GlobalContext* globalCtx);
void func_80AFD7B4(EnSkb* this, GlobalContext* globalCtx);
void func_80AFD880(EnSkb* this, GlobalContext* globalCtx);
void func_80AFD968(EnSkb* this, GlobalContext* globalCtx);
/*
const ActorInit En_Skb_InitVars = {
ACTOR_EN_SKB,
ACTORCAT_ENEMY,
FLAGS,
OBJECT_SKB,
sizeof(EnSkb),
(ActorFunc)EnSkb_Init,
(ActorFunc)EnSkb_Destroy,
(ActorFunc)EnSkb_Update,
(ActorFunc)EnSkb_Draw,
};
extern SkeletonHeader D_060041F8;
extern AnimationHeader D_06001854;
extern AnimationHeader D_060009DC;
extern AnimationHeader D_06000D98;
extern AnimationHeader D_060047E0;
extern AnimationHeader D_06000460;
static ColliderJntSphElementInit D_80AFE020[2] = {
static ColliderJntSphElementInit sJntSphElementsInit[2] = {
{
{
ELEMTYPE_UNK0,
@ -54,7 +60,7 @@ static ColliderJntSphElementInit D_80AFE020[2] = {
},
};
static ColliderJntSphInit D_80AFE068 = {
static ColliderJntSphInit sJntSphInit = {
{
COLTYPE_HIT6,
AT_ON | AT_TYPE_ENEMY,
@ -64,57 +70,495 @@ static ColliderJntSphInit D_80AFE068 = {
COLSHAPE_JNTSPH,
},
2,
D_80AFE020,
sJntSphElementsInit,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFC9A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFC9A8.s")
static DamageTable sDamageTable = {
/* Deku nut */ DMG_ENTRY(0, 0x1),
/* Deku stick */ DMG_ENTRY(2, 0xF),
/* Slingshot */ DMG_ENTRY(1, 0xF),
/* Explosive */ DMG_ENTRY(2, 0xF),
/* Boomerang */ DMG_ENTRY(0, 0x1),
/* Normal arrow */ DMG_ENTRY(2, 0xF),
/* Hammer swing */ DMG_ENTRY(2, 0xF),
/* Hookshot */ DMG_ENTRY(0, 0x1),
/* Kokiri sword */ DMG_ENTRY(1, 0xE),
/* Master sword */ DMG_ENTRY(2, 0xF),
/* Giant's Knife */ DMG_ENTRY(4, 0xF),
/* Fire arrow */ DMG_ENTRY(4, 0x7),
/* Ice arrow */ DMG_ENTRY(2, 0xF),
/* Light arrow */ DMG_ENTRY(2, 0xF),
/* Unk arrow 1 */ DMG_ENTRY(2, 0xF),
/* Unk arrow 2 */ DMG_ENTRY(0, 0x0),
/* Unk arrow 3 */ DMG_ENTRY(0, 0x0),
/* Fire magic */ DMG_ENTRY(4, 0x7),
/* Ice magic */ DMG_ENTRY(0, 0x6),
/* Light magic */ DMG_ENTRY(3, 0xD),
/* Shield */ DMG_ENTRY(0, 0x0),
/* Mirror Ray */ DMG_ENTRY(0, 0x0),
/* Kokiri spin */ DMG_ENTRY(1, 0xD),
/* Giant spin */ DMG_ENTRY(4, 0xF),
/* Master spin */ DMG_ENTRY(2, 0xF),
/* Kokiri jump */ DMG_ENTRY(2, 0xF),
/* Giant jump */ DMG_ENTRY(8, 0xF),
/* Master jump */ DMG_ENTRY(4, 0xF),
/* Unknown 1 */ DMG_ENTRY(0, 0x0),
/* Unblockable */ DMG_ENTRY(0, 0x0),
/* Hammer jump */ DMG_ENTRY(4, 0xF),
/* Unknown 2 */ DMG_ENTRY(0, 0x0),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/EnSkb_Init.s")
const ActorInit En_Skb_InitVars = {
ACTOR_EN_SKB,
ACTORCAT_ENEMY,
FLAGS,
OBJECT_SKB,
sizeof(EnSkb),
(ActorFunc)EnSkb_Init,
(ActorFunc)EnSkb_Destroy,
(ActorFunc)EnSkb_Update,
(ActorFunc)EnSkb_Draw,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/EnSkb_Destroy.s")
void EnSkb_SetupAction(EnSkb* this, EnSkbActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFCD60.s")
void EnSkb_SpawnDebris(GlobalContext* globalCtx, EnSkb* this, Vec3f* spawnPos) {
Vec3f pos;
Vec3f vel = { 0.0f, 8.0f, 0.0f };
Vec3f accel = { 0.0f, -1.5f, 0.0f };
f32 spreadAngle;
f32 scale;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFCDF8.s")
spreadAngle = (Rand_ZeroOne() - 0.5f) * 6.28f;
pos.y = this->actor.floorHeight;
pos.x = (Math_SinF(spreadAngle) * 15.0f) + spawnPos->x;
pos.z = (Math_CosF(spreadAngle) * 15.0f) + spawnPos->z;
accel.x = Rand_CenteredFloat(1.0f);
accel.z = Rand_CenteredFloat(1.0f);
vel.y += (Rand_ZeroOne() - 0.5f) * 4.0f;
scale = (Rand_ZeroOne() * 5.0f) + 12.0f;
EffectSsHahen_Spawn(globalCtx, &pos, &vel, &accel, 2, scale * 0.8f, -1, 10, 0);
func_80033480(globalCtx, &pos, 10.0f, 1, 150, 0, 1);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFCE5C.s")
static InitChainEntry sInitChain[] = {
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFCF48.s")
void EnSkb_Init(Actor* thisx, GlobalContext* globalCtx) {
EnSkb* this = THIS;
s16 paramOffsetBody;
s16 paramOffsetArm;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFCFF0.s")
Actor_ProcessInitChain(&this->actor, sInitChain);
this->actor.colChkInfo.damageTable = &sDamageTable;
ActorShape_Init(&this->actor.shape, 0.0f, &ActorShadow_DrawCircle, 0.0f);
this->actor.focus.pos = this->actor.world.pos;
this->actor.colChkInfo.mass = 0xFE;
this->actor.colChkInfo.health = 2;
this->actor.shape.yOffset = -8000.0f;
SkelAnime_Init(globalCtx, &this->skelAnime, &D_060041F8, &D_06001854, this->limbDrawTable,
this->transitionDrawTable, 20);
this->actor.naviEnemyId = 0x55;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFD0A4.s")
Collider_InitJntSph(globalCtx, &this->collider);
Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItem);
Actor_SetScale(&this->actor, ((this->actor.params * 0.1f) + 1.0f) * 0.01f);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFD13C.s")
paramOffsetBody = this->actor.params + 0xA;
this->collider.elements[0].dim.worldSphere.radius = paramOffsetBody;
this->collider.elements[0].dim.modelSphere.radius = paramOffsetBody;
if (1) {};
paramOffsetArm = (this->actor.params * 2) + 0x14;
this->collider.elements[1].dim.worldSphere.radius = paramOffsetArm;
this->collider.elements[1].dim.modelSphere.radius = paramOffsetArm;
this->actor.home.pos = this->actor.world.pos;
this->actor.floorHeight = this->actor.world.pos.y;
func_80AFCDF8(this);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFD33C.s")
void EnSkb_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnSkb* this = THIS;
if (this->actor.parent != NULL) {
EnEncount1* spawner = (EnEncount1*)this->actor.parent;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFD3D4.s")
if (spawner->actor.update != NULL) {
if (spawner->curNumSpawn > 0) {
spawner->curNumSpawn--;
}
}
}
Collider_DestroyJntSph(globalCtx, &this->collider);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFD47C.s")
void func_80AFCD60(EnSkb* this) {
if (gSaveContext.nightFlag == 0) {
func_80AFCF48(this);
} else if ((func_8002E084(&this->actor, 0x11C7) != 0) &&
(this->actor.xzDistToPlayer < (60.0f + (this->actor.params * 6.0f)))) {
func_80AFD33C(this);
} else {
func_80AFD0A4(this);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFD508.s")
void func_80AFCDF8(EnSkb* this) {
Animation_PlayOnceSetSpeed(&this->skelAnime, &D_06001854, 1.0f);
this->unk_280 = 0;
this->actor.flags &= ~1;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIVA_APPEAR);
EnSkb_SetupAction(this, func_80AFCE5C);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFD540.s")
void func_80AFCE5C(EnSkb* this, GlobalContext* globalCtx) {
if (this->skelAnime.curFrame < 4.0f) {
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
} else {
this->actor.flags |= 1;
}
Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 800.0f, 0.0f);
Math_SmoothStepToF(&this->actor.shape.shadowScale, 25.0f, 1.0f, 2.5f, 0.0f);
if ((globalCtx->gameplayFrames & 1) != 0) {
EnSkb_SpawnDebris(globalCtx, this, &this->actor.world.pos);
}
if ((SkelAnime_Update(&this->skelAnime) != 0) && (0.0f == this->actor.shape.yOffset)) {
func_80AFCD60(this);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFD59C.s")
void func_80AFCF48(EnSkb* this) {
Animation_Change(&this->skelAnime, &D_06001854, -1.0f, Animation_GetLastFrame(&D_06001854), 0.0f, 2, -4.0f);
this->unk_280 = 0;
this->unk_281 = 0;
this->actor.flags &= ~1;
this->actor.speedXZ = 0.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_AKINDONUTS_HIDE);
EnSkb_SetupAction(this, func_80AFCFF0);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFD644.s")
void func_80AFCFF0(EnSkb* this, GlobalContext* globalCtx) {
if ((Math_SmoothStepToF(&this->actor.shape.yOffset, -8000.0f, 1.0f, 500.0f, 0.0f) != 0.0f) &&
(globalCtx->gameplayFrames & 1)) {
EnSkb_SpawnDebris(globalCtx, this, &this->actor.world.pos);
}
Math_SmoothStepToF(&this->actor.shape.shadowScale, 0.0f, 1.0f, 2.5f, 0.0f);
if (SkelAnime_Update(&this->skelAnime) != 0) {
Actor_Kill(&this->actor);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFD6CC.s")
void func_80AFD0A4(EnSkb* this) {
Animation_Change(&this->skelAnime, &D_060047E0, 0.96000004f, 0.0f, Animation_GetLastFrame(&D_060047E0), 0, -4.0f);
this->unk_280 = 4;
this->unk_288 = 0;
this->actor.speedXZ = this->actor.scale.y * 160.0f;
EnSkb_SetupAction(this, EnSkb_Advance);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFD7B4.s")
void EnSkb_Advance(EnSkb* this, GlobalContext* globalCtx) {
s32 thisKeyFrame;
s32 prevKeyFrame;
f32 playSpeed;
Player* player = PLAYER;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFD880.s")
if ((this->unk_283 != 0) && ((globalCtx->gameplayFrames & 0xF) == 0)) {
this->unk_288 = Rand_CenteredFloat(50000.0f);
}
Math_SmoothStepToS(&this->actor.shape.rot.y, (this->actor.yawTowardsPlayer + this->unk_288), 1, 0x2EE, 0);
this->actor.world.rot.y = this->actor.shape.rot.y;
thisKeyFrame = this->skelAnime.curFrame;
SkelAnime_Update(&this->skelAnime);
if (this->skelAnime.playSpeed >= 0.0f) {
playSpeed = this->skelAnime.playSpeed;
} else {
playSpeed = -this->skelAnime.playSpeed;
}
prevKeyFrame = (this->skelAnime.curFrame - playSpeed);
if (this->skelAnime.playSpeed >= 0.0f) {
playSpeed = this->skelAnime.playSpeed;
} else {
playSpeed = -this->skelAnime.playSpeed;
}
if (thisKeyFrame != (s32)this->skelAnime.curFrame) {
if (((prevKeyFrame < 9) && (((s32)playSpeed + thisKeyFrame) >= 8)) ||
!((prevKeyFrame >= 16) || (((s32)playSpeed + thisKeyFrame) < 15))) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFD968.s")
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKID_WALK);
}
}
if (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) > 800.0f || gSaveContext.nightFlag == 0) {
func_80AFCF48(this);
} else if ((func_8002E084(&this->actor, 0x11C7) != 0) &&
(this->actor.xzDistToPlayer < (60.0f + (this->actor.params * 6.0f)))) {
func_80AFD33C(this);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/EnSkb_Update.s")
void func_80AFD33C(EnSkb* this) {
Animation_Change(&this->skelAnime, &D_06000460, 0.6f, 0.0f, Animation_GetLastFrame(&D_06000460), 3, 4.0f);
this->collider.base.atFlags &= ~4;
this->unk_280 = 3;
this->actor.speedXZ = 0.0f;
EnSkb_SetupAction(this, EnSkb_SetupAttack);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFDD30.s")
void EnSkb_SetupAttack(EnSkb* this, GlobalContext* globalCtx) {
s32 frameData;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/func_80AFDF24.s")
frameData = this->skelAnime.curFrame;
if (frameData == 3) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKID_ATTACK);
this->unk_281 = 1;
} else if (frameData == 6) {
this->unk_281 = 0;
}
if (this->collider.base.atFlags & 4) {
this->collider.base.atFlags &= ~6;
func_80AFD47C(this);
} else if (SkelAnime_Update(&this->skelAnime) != 0) {
func_80AFCD60(this);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/EnSkb_Draw.s")
void func_80AFD47C(EnSkb* this) {
Animation_Change(&this->skelAnime, &D_06000460, -0.4f, this->skelAnime.curFrame - 1.0f, 0.0f, 3, 0.0f);
this->collider.base.atFlags &= ~4;
this->unk_280 = 5;
this->unk_281 = 0;
EnSkb_SetupAction(this, func_80AFD508);
}
void func_80AFD508(EnSkb* this, GlobalContext* globalCtx) {
if (SkelAnime_Update(&this->skelAnime) != 0) {
func_80AFCD60(this);
}
}
void EnSkb_SetupStunned(EnSkb* this) {
if (this->actor.bgCheckFlags & 1) {
this->actor.speedXZ = 0.0f;
}
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE);
this->unk_281 = 0;
this->unk_280 = 6;
EnSkb_SetupAction(this, func_80AFD59C);
}
void func_80AFD59C(EnSkb* this, GlobalContext* globalCtx) {
if (this->actor.bgCheckFlags & 2) {
this->actor.speedXZ = 0.0f;
}
if (this->actor.bgCheckFlags & 1) {
if (this->actor.speedXZ < 0.0f) {
this->actor.speedXZ += 0.05f;
}
}
if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & 1)) {
if (this->actor.colChkInfo.health == 0) {
func_80AFD7B4(this, globalCtx);
} else {
func_80AFCD60(this);
}
}
}
void func_80AFD644(EnSkb* this) {
Animation_MorphToPlayOnce(&this->skelAnime, &D_06000D98, -4.0f);
if (this->actor.bgCheckFlags & 1) {
this->actor.speedXZ = -4.0f;
}
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALKID_DAMAGE);
this->unk_280 = 2;
EnSkb_SetupAction(this, func_80AFD6CC);
}
void func_80AFD6CC(EnSkb* this, GlobalContext* globalCtx) {
// this cast is likely not real, but allows for a match
u8* new_var;
new_var = &this->unk_283;
if ((this->unk_283 != 1) || func_8003305C(&this->actor, &this->unk_28C, globalCtx, 1)) {
if ((*new_var) != 0) {
this->unk_283 = (*new_var) | 2;
}
if (this->actor.bgCheckFlags & 2) {
this->actor.speedXZ = 0;
}
if (this->actor.bgCheckFlags & 1) {
if (this->actor.speedXZ < 0.0f) {
this->actor.speedXZ += 0.05f;
}
}
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0);
if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & 1)) {
func_80AFCD60(this);
}
}
}
void func_80AFD7B4(EnSkb* this, GlobalContext* globalCtx) {
Animation_MorphToPlayOnce(&this->skelAnime, &D_060009DC, -4.0f);
this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
if (this->actor.bgCheckFlags & 1) {
this->actor.speedXZ = -6.0f;
}
this->unk_280 = 1;
this->actor.flags &= ~1;
func_80032E24(&this->unk_28C, 18, globalCtx);
this->unk_283 |= 4;
EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_STALKID_DEAD, 1, 1, 0x28);
EnSkb_SetupAction(this, func_80AFD880);
}
void func_80AFD880(EnSkb* this, GlobalContext* globalCtx) {
if (func_8003305C(&this->actor, &this->unk_28C, globalCtx, 1) != 0) {
if (this->actor.scale.x == 0.01f) {
Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x10);
} else {
if (this->actor.scale.x <= 0.015f) {
Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_BLUE);
} else {
Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED);
Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED);
Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED);
}
}
this->unk_283 |= 8;
Actor_Kill(&this->actor);
}
}
void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) {
s16 pad;
s32 i;
Vec3f flamePos;
s16 scale;
s16 phi_v1;
Player* player;
if ((this->unk_280 != 1) && (this->actor.bgCheckFlags & 0x60) && (this->actor.yDistToWater >= 40.0f)) {
this->actor.colChkInfo.health = 0;
this->unk_281 = 0;
func_80AFD7B4(this, globalCtx);
} else if (this->unk_280 >= 3) {
if ((this->collider.base.acFlags & 2) != 0) {
this->collider.base.acFlags &= ~2;
if (this->actor.colChkInfo.damageEffect != 6) {
this->unk_282 = this->actor.colChkInfo.damageEffect;
func_80035650(&this->actor, &this->collider.elements[1].info, 1);
this->unk_281 = 0;
if (this->actor.colChkInfo.damageEffect == 1) {
if (this->unk_280 != 6) {
Actor_SetColorFilter(&this->actor, 0, 0x78, 0, 0x50);
Actor_ApplyDamage(&this->actor);
EnSkb_SetupStunned(this);
}
} else {
phi_v1 = 8;
if (this->actor.colChkInfo.damageEffect == 7) {
scale = this->actor.scale.y * 7500.0f;
for (i = 4; i >= 0; i--) {
flamePos = this->actor.world.pos;
flamePos.x += Rand_CenteredFloat(20.0f);
flamePos.z += Rand_CenteredFloat(20.0f);
flamePos.y += (Rand_ZeroOne() * 25.0f);
EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &flamePos, scale, 0, 0, -1);
}
phi_v1 = 25;
}
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, phi_v1);
if (!Actor_ApplyDamage(&this->actor)) {
func_80AFD7B4(this, globalCtx);
return;
}
player = PLAYER;
if (this->unk_283 == 0) {
if ((this->actor.colChkInfo.damageEffect == 0xD) ||
((this->actor.colChkInfo.damageEffect == 0xE) &&
((player->swordAnimation >= 4 && player->swordAnimation <= 11) ||
(player->swordAnimation == 20 || player->swordAnimation == 21)))) {
func_80032E24(&this->unk_28C, 2, globalCtx);
this->unk_283 = 1;
}
}
func_80AFD644(this);
}
}
}
}
}
void EnSkb_Update(Actor* thisx, GlobalContext* globalCtx) {
EnSkb* this = THIS;
s32 pad;
func_80AFD968(this, globalCtx);
Actor_MoveForward(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 60.0f, 0x1D);
this->actionFunc(this, globalCtx);
this->actor.focus.pos = this->actor.world.pos;
this->actor.focus.pos.y += (3000.0f * this->actor.scale.y);
if (this->unk_281 != 0) {
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
if (this->unk_280 >= 3) {
if ((this->actor.colorFilterTimer == 0) || ((this->actor.colorFilterParams & 0x4000) == 0)) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
}
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
s32 EnSkb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnSkb* this = THIS;
s16 color;
s16 pad[2];
if (limbIndex == 11) {
if ((this->unk_283 & 2) == 0) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_skb.c", 972);
color = ABS((s16)(Math_SinS((globalCtx->gameplayFrames * 0x1770)) * 95.0f)) + 160;
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, color, color, color, 255);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_skb.c", 978);
} else {
*dList = NULL;
}
} else if ((limbIndex == 12) && ((this->unk_283 & 2) != 0)) {
*dList = NULL;
}
return 0;
}
#ifdef NON_MATCHING
// t1 needs to be skipped when storing the args for the second function call
void EnSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
EnSkb* this = THIS;
Collider_UpdateSpheres(limbIndex, &this->collider);
if ((this->unk_283 ^ 1) == 0) {
func_80032F54(&this->unk_28C, limbIndex, 0xB, 0xC, 0x12, dList, -1);
} else if ((this->unk_283 | 4) == this->unk_283) {
func_80032F54(&this->unk_28C, limbIndex, 0, 0x12, 0x12, dList, -1);
}
}
#else
void EnSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skb/EnSkb_PostLimbDraw.s")
#endif
void EnSkb_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnSkb* this = THIS;
func_80093D18(globalCtx->state.gfxCtx);
SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSkb_OverrideLimbDraw,
EnSkb_PostLimbDraw, &this->actor);
}

View file

@ -6,9 +6,22 @@
struct EnSkb;
typedef void (*EnSkbActionFunc)(struct EnSkb*, GlobalContext*);
typedef struct EnSkb {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x1F8];
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ Vec3s limbDrawTable[20];
/* 0x0208 */ Vec3s transitionDrawTable[20];
/* 0x0280 */ u8 unk_280;
/* 0x0281 */ u8 unk_281;
/* 0x0282 */ u8 unk_282;
/* 0x0283 */ u8 unk_283;
/* 0x0284 */ EnSkbActionFunc actionFunc;
/* 0x0288 */ s16 unk_288;
/* 0x028C */ struct_80032E24 unk_28C;
/* 0x02A4 */ ColliderJntSph collider;
/* 0x02C4 */ ColliderJntSphElement colliderItem[2];
} EnSkb; // size = 0x0344
extern const ActorInit En_Skb_InitVars;