mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-06 06:10:21 +00:00
z_en_fd, z_en_fd_fire, and z_en_fw (#415)
* EnFd OK * decompile En_Fd_Fire, document some of En_Fd * fw wip * match a few more of ovl_en_fw, properly organize data * Ovl_En_Fw OK * Documentation, formatting. * change Color_RGBA8_n to Color_RGBA8 * PR updates * fix errors with merge * review * dunno why jenkins failed * review Co-authored-by: fig <fig02srl@gmail.com>
This commit is contained in:
parent
4beeedd116
commit
e983d2b72b
73 changed files with 1540 additions and 5451 deletions
|
@ -4,12 +4,32 @@
|
|||
|
||||
#define THIS ((EnFd*)thisx)
|
||||
|
||||
#define FLG_COREDEAD (0x4000)
|
||||
#define FLG_COREDONE (0x8000)
|
||||
|
||||
void EnFd_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFd_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFd_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFd_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFd_Run(EnFd* this, GlobalContext* globalCtx);
|
||||
void EnFd_SpinAndSpawnFire(EnFd* this, GlobalContext* globalCtx);
|
||||
void EnFd_Reappear(EnFd* this, GlobalContext* globalCtx);
|
||||
void EnFd_SpinAndGrow(EnFd* this, GlobalContext* globalCtx);
|
||||
void EnFd_JumpToGround(EnFd* this, GlobalContext* globalCtx);
|
||||
void EnFd_WaitForCore(EnFd* this, GlobalContext* globalCtx);
|
||||
void EnFd_UpdateFlames(EnFd* this);
|
||||
void EnFd_UpdateDots(EnFd* this);
|
||||
void EnFd_AddEffect(EnFd*, u8, Vec3f*, Vec3f*, Vec3f*, u8, f32, f32);
|
||||
void EnFd_DrawDots(EnFd* this, GlobalContext* globalCtx);
|
||||
void EnFd_DrawFlames(EnFd* this, GlobalContext* globalCtx);
|
||||
void EnFd_Land(EnFd* this, GlobalContext* globalCtx);
|
||||
|
||||
extern Gfx D_060079F8[];
|
||||
extern Gfx D_06007A78[];
|
||||
extern Gfx D_06007928[];
|
||||
extern Gfx D_06007938[];
|
||||
extern FlexSkeletonHeader D_06005810;
|
||||
|
||||
/*
|
||||
const ActorInit En_Fd_InitVars = {
|
||||
ACTOR_EN_FD,
|
||||
ACTORTYPE_ENEMY,
|
||||
|
@ -21,61 +41,802 @@ const ActorInit En_Fd_InitVars = {
|
|||
(ActorFunc)EnFd_Update,
|
||||
(ActorFunc)EnFd_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0B6C0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0B7B8.s")
|
||||
static ColliderJntSphItemInit sJntSphItemsInit[12] = {
|
||||
{
|
||||
{ 0x00, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040088, 0x00, 0x00 }, 0x01, 0x05, 0x01 },
|
||||
{ 21, { { 1600, 0, 0 }, 5 }, 300 },
|
||||
},
|
||||
{
|
||||
{ 0x00, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, 0x01, 0x01, 0x01 },
|
||||
{ 12, { { 1600, 0, 0 }, 5 }, 400 },
|
||||
},
|
||||
{
|
||||
{ 0x00, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, 0x01, 0x01, 0x01 },
|
||||
{ 14, { { 800, 0, 0 }, 4 }, 300 },
|
||||
},
|
||||
{
|
||||
{ 0x00, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, 0x01, 0x01, 0x01 },
|
||||
{ 15, { { 1600, 0, 0 }, 4 }, 300 },
|
||||
},
|
||||
{
|
||||
{ 0x00, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, 0x01, 0x01, 0x01 },
|
||||
{ 16, { { 2000, 0, 0 }, 4 }, 300 },
|
||||
},
|
||||
{
|
||||
{ 0x00, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, 0x01, 0x01, 0x01 },
|
||||
{ 17, { { 800, 0, 0 }, 4 }, 300 },
|
||||
},
|
||||
{
|
||||
{ 0x00, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, 0x01, 0x01, 0x01 },
|
||||
{ 18, { { 1600, 0, 0 }, 4 }, 300 },
|
||||
},
|
||||
{
|
||||
{ 0x00, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, 0x01, 0x01, 0x01 },
|
||||
{ 19, { { 2000, 0, 0 }, 4 }, 300 },
|
||||
},
|
||||
{
|
||||
{ 0x00, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, 0x01, 0x01, 0x01 },
|
||||
{ 4, { { 2200, 0, 0 }, 4 }, 400 },
|
||||
},
|
||||
{
|
||||
{ 0x00, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, 0x01, 0x01, 0x01 },
|
||||
{ 4, { { 5000, 0, 0 }, 4 }, 300 },
|
||||
},
|
||||
{
|
||||
{ 0x00, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, 0x01, 0x01, 0x01 },
|
||||
{ 8, { { 2200, 0, 0 }, 4 }, 400 },
|
||||
},
|
||||
{
|
||||
{ 0x00, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, 0x01, 0x01, 0x01 },
|
||||
{ 8, { { 5000, 0, 0 }, 4 }, 300 },
|
||||
},
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0B8D8.s")
|
||||
static ColliderJntSphInit sJntSphInit = {
|
||||
{ COLTYPE_UNK10, 0x11, 0x09, 0x39, 0x10, COLSHAPE_JNTSPH },
|
||||
12,
|
||||
sJntSphItemsInit,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0BA44.s")
|
||||
static CollisionCheckInfoInit2 sColChkInit = { 24, 2, 25, 25, 0xFF };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0BAE0.s")
|
||||
static struct_80034EC0_Entry sAnimations[] = {
|
||||
{ 0x060010B4, 1.0f, 0.0f, -1.0f, 0x03, 0.0f }, { 0x06005C64, 1.0f, 0.0f, -1.0f, 0x03, -10.0f },
|
||||
{ 0x06006044, 0.0f, 0.0f, -1.0f, 0x03, -10.0f }, { 0x06006A18, 1.0f, 0.0f, -1.0f, 0x01, -10.0f },
|
||||
{ 0x06006B64, 0.0f, 0.0f, -1.0f, 0x03, -10.0f },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0BC70.s")
|
||||
s32 EnFd_SpawnCore(EnFd* this, GlobalContext* globalCtx) {
|
||||
if (this->invincibilityTimer != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0BD78.s")
|
||||
if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FW, this->corePos.x, this->corePos.y,
|
||||
this->corePos.z, 0, this->actor.shape.rot.y, 0, this->runDir) == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0BE34.s")
|
||||
this->actor.child->colChkInfo.health = this->actor.colChkInfo.health % 8;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0BEA0.s")
|
||||
if (this->actor.child->colChkInfo.health == 0) {
|
||||
this->actor.child->colChkInfo.health = 8;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0BF6C.s")
|
||||
if ((this->actor.flags & 0x2000) == 0x2000) {
|
||||
func_8002DE04(globalCtx, &this->actor, this->actor.child);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0C0A0.s")
|
||||
this->coreActive = true;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/EnFd_Init.s")
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/EnFd_Destroy.s")
|
||||
void EnFd_SpawnChildFire(EnFd* this, GlobalContext* globalCtx, s16 fireCnt, s16 color) {
|
||||
s32 i;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0C310.s")
|
||||
for (i = 0; i < fireCnt; i++) {
|
||||
s16 angle = (s16)((((i * 360.0f) / fireCnt) * (0x10000 / 360.0f))) + this->actor.yawTowardsLink;
|
||||
Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_FD_FIRE, this->actor.posRot.pos.x,
|
||||
this->actor.posRot.pos.y, this->actor.posRot.pos.z, 0, angle, 0, (color << 0xF) | i);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0C3A0.s")
|
||||
void EnFd_SpawnDot(EnFd* this, GlobalContext* globalCtx) {
|
||||
Vec3f pos = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f accel = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0C474.s")
|
||||
if (this->actionFunc == EnFd_Run || this->actionFunc == EnFd_SpinAndSpawnFire) {
|
||||
pos.x = this->actor.posRot.pos.x;
|
||||
pos.y = this->actor.groundY + 4.0f;
|
||||
pos.z = this->actor.posRot.pos.z;
|
||||
accel.x = (Math_Rand_ZeroOne() - 0.5f) * 2.0f;
|
||||
accel.y = ((Math_Rand_ZeroOne() - 0.5f) * 0.2f) + 0.3f;
|
||||
accel.z = (Math_Rand_ZeroOne() - 0.5f) * 2.0f;
|
||||
EnFd_AddEffect(this, FD_EFFECT_FLAME, &pos, &velocity, &accel, 8, 0.6f, 0.2f);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0C4F0.s")
|
||||
/**
|
||||
* Checks to see if the hammer effect is active, and if it should be applied
|
||||
*/
|
||||
s32 EnFd_CheckHammer(EnFd* this, GlobalContext* globalCtx) {
|
||||
if (this->actionFunc == EnFd_Reappear || this->actionFunc == EnFd_SpinAndGrow ||
|
||||
this->actionFunc == EnFd_JumpToGround || this->actionFunc == EnFd_WaitForCore) {
|
||||
return false;
|
||||
} else if (globalCtx->actorCtx.unk_02 != 0 && this->actor.xzDistFromLink < 300.0f &&
|
||||
this->actor.yDistFromLink < 60.0f) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0C5D0.s")
|
||||
s32 EnFd_ColliderCheck(EnFd* this, GlobalContext* globalCtx) {
|
||||
Player* player = PLAYER;
|
||||
ColliderBody* body;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0C7EC.s")
|
||||
if (this->collider.base.acFlags & 2 || EnFd_CheckHammer(this, globalCtx)) {
|
||||
this->collider.base.acFlags &= ~2;
|
||||
if (this->invincibilityTimer != 0) {
|
||||
return false;
|
||||
}
|
||||
body = &this->collider.list[0].body;
|
||||
if (body->acHitItem != NULL && (body->acHitItem->toucher.flags & 0x80)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0CA44.s")
|
||||
if (!EnFd_SpawnCore(this, globalCtx)) {
|
||||
return false;
|
||||
}
|
||||
this->invincibilityTimer = 30;
|
||||
this->actor.flags &= ~1;
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_DAMAGE);
|
||||
func_80032C7C(globalCtx, &this->actor);
|
||||
return true;
|
||||
} else if (DECR(this->attackTimer) == 0 && this->collider.base.atFlags & 2) {
|
||||
this->collider.base.atFlags &= ~2;
|
||||
if (this->invincibilityTimer != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/EnFd_Update.s")
|
||||
if (this->collider.base.atFlags & 4) {
|
||||
return false;
|
||||
}
|
||||
this->attackTimer = 30;
|
||||
Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT);
|
||||
func_8002F71C(globalCtx, &this->actor, this->actor.speedXZ + 2.0f, this->actor.yawTowardsLink, 6.0f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0CCB8.s")
|
||||
/**
|
||||
* Determines if `actor` is within an acceptable range for `this` to be able to "see" `actor`
|
||||
* `actor` must be within 400 units of `this`, `actor` must be within +/- 40 degrees facing angle
|
||||
* towards `actor`, and there must not be a collision poly between `this` and `actor`
|
||||
*/
|
||||
s32 EnFd_CanSeeActor(EnFd* this, Actor* actor, GlobalContext* globalCtx) {
|
||||
CollisionPoly** colPoly;
|
||||
u32 bgId;
|
||||
Vec3f colPoint;
|
||||
s16 angle;
|
||||
s32 pad;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0CCF0.s")
|
||||
// Check to see if `actor` is within 400 units of `this`
|
||||
if (Math_Vec3f_DistXYZ(&this->actor.posRot.pos, &actor->posRot.pos) > 400.0f) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/EnFd_Draw.s")
|
||||
// Check to see if the angle between this facing angle and `actor` is withing ~40 degrees
|
||||
angle = (f32)Math_Vec3f_Yaw(&this->actor.posRot.pos, &actor->posRot.pos) - this->actor.shape.rot.y;
|
||||
if (ABS(angle) >= 0x1C71) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0D40C.s")
|
||||
// check to see if the line between `this` and `actor` does not intersect a collision poly
|
||||
if (func_8003DE84(&globalCtx->colCtx, &this->actor.posRot.pos, &actor->posRot.pos, &colPoint, &colPoly, 1, 0, 0, 1,
|
||||
&bgId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0D4FC.s")
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0D614.s")
|
||||
Actor* EnFd_FindBomb(EnFd* this, GlobalContext* globalCtx) {
|
||||
Actor* actor = globalCtx->actorCtx.actorList[ACTORTYPE_EXPLOSIVES].first;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0D730.s")
|
||||
while (actor != NULL) {
|
||||
if (actor->params != 0 || actor->parent != NULL) {
|
||||
actor = actor->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd/func_80A0DB44.s")
|
||||
if (actor->id != ACTOR_EN_BOM) {
|
||||
actor = actor->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (EnFd_CanSeeActor(this, actor, globalCtx) != 1) {
|
||||
actor = actor->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
return actor;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Actor* EnFd_FindPotentialTheat(EnFd* this, GlobalContext* globalCtx) {
|
||||
Player* player;
|
||||
Actor* bomb = EnFd_FindBomb(this, globalCtx);
|
||||
|
||||
if (bomb != NULL) {
|
||||
return bomb;
|
||||
}
|
||||
|
||||
if (this->attackTimer != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
player = PLAYER;
|
||||
if (!EnFd_CanSeeActor(this, &player->actor, globalCtx)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &player->actor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a delta in `dst` for the position from `this`'s current position to the next
|
||||
* position in a circle formed by `radius` with center at `this`'s initial position.
|
||||
*/
|
||||
Vec3f* EnFd_GetPosAdjAroundCircle(Vec3f* dst, EnFd* this, f32 radius, s16 dir) {
|
||||
s16 angle;
|
||||
Vec3f newPos;
|
||||
|
||||
angle = Math_Vec3f_Yaw(&this->actor.initPosRot.pos, &this->actor.posRot.pos) + (dir * 0x1554); // ~30 degrees
|
||||
newPos.x = (Math_Sins(angle) * radius) + this->actor.initPosRot.pos.x;
|
||||
newPos.z = (Math_Coss(angle) * radius) + this->actor.initPosRot.pos.z;
|
||||
newPos.x -= this->actor.posRot.pos.x;
|
||||
newPos.z -= this->actor.posRot.pos.z;
|
||||
*dst = newPos;
|
||||
return dst;
|
||||
}
|
||||
|
||||
s32 EnFd_ShouldStopRunning(EnFd* this, GlobalContext* globalCtx, f32 radius, s16* runDir) {
|
||||
CollisionPoly* poly;
|
||||
u32 bgId;
|
||||
Vec3f colPoint;
|
||||
Vec3f pos;
|
||||
|
||||
// Check to see if the next position on the rotation around the circle
|
||||
// will result in a background collision
|
||||
EnFd_GetPosAdjAroundCircle(&pos, this, radius, *runDir);
|
||||
|
||||
pos.x += this->actor.posRot.pos.x;
|
||||
pos.y = this->actor.posRot.pos.y;
|
||||
pos.z += this->actor.posRot.pos.z;
|
||||
|
||||
if (func_8003DE84(&globalCtx->colCtx, &this->actor.posRot.pos, &pos, &colPoint, &poly, 1, 0, 0, 1, &bgId)) {
|
||||
*runDir = -*runDir;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this->circlesToComplete != 0 || DECR(this->spinTimer) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Math_Rand_ZeroOne() > 0.5f) {
|
||||
*runDir = -*runDir;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void EnFd_Fade(EnFd* this, GlobalContext* globalCtx) {
|
||||
if (this->invincibilityTimer != 0) {
|
||||
Math_SmoothScaleMaxMinF(&this->fadeAlpha, 0.0f, 0.3f, 10.0f, 0.0f);
|
||||
this->actor.shape.unk_14 = this->fadeAlpha;
|
||||
if (!(this->fadeAlpha >= 0.9f)) {
|
||||
this->invincibilityTimer = 0;
|
||||
this->spinTimer = 0;
|
||||
this->actionFunc = EnFd_WaitForCore;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnFd_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnFd* this = THIS;
|
||||
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06005810, NULL, this->limbDrawTable, this->transitionDrawTable,
|
||||
27);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 32.0f);
|
||||
Collider_InitJntSph(globalCtx, &this->collider);
|
||||
Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colSphs);
|
||||
func_80061EFC(&this->actor.colChkInfo, DamageTable_Get(0xF), &sColChkInit);
|
||||
this->actor.flags &= ~1;
|
||||
this->actor.flags |= 0x1000000;
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
this->firstUpdateFlag = true;
|
||||
this->actor.gravity = -1.0f;
|
||||
this->runDir = Math_Rand_ZeroOne() < 0.5f ? -1 : 1;
|
||||
this->actor.naviEnemyId = 0x22;
|
||||
this->actionFunc = EnFd_Reappear;
|
||||
}
|
||||
|
||||
void EnFd_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnFd* this = THIS;
|
||||
|
||||
Collider_DestroyJntSph(globalCtx, &this->collider);
|
||||
}
|
||||
|
||||
void EnFd_Reappear(EnFd* this, GlobalContext* globalCtx) {
|
||||
this->actor.posRot.pos = this->actor.initPosRot.pos;
|
||||
this->actor.params = 0;
|
||||
this->actor.shape.unk_14 = 0xFF;
|
||||
this->coreActive = false;
|
||||
this->actor.scale.y = 0.0f;
|
||||
this->fadeAlpha = 255.0f;
|
||||
func_80034EC0(&this->skelAnime, sAnimations, 0);
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_LAUGH);
|
||||
this->actionFunc = EnFd_SpinAndGrow;
|
||||
}
|
||||
|
||||
void EnFd_SpinAndGrow(EnFd* this, GlobalContext* globalCtx) {
|
||||
if (func_800A56C8(&this->skelAnime, this->skelAnime.animFrameCount)) {
|
||||
this->actor.velocity.y = 6.0f;
|
||||
this->actor.scale.y = 0.01f;
|
||||
this->actor.posRot.rot.y ^= 0x8000;
|
||||
this->actor.flags |= 1;
|
||||
this->actor.speedXZ = 8.0f;
|
||||
func_80034EC0(&this->skelAnime, sAnimations, 1);
|
||||
this->actionFunc = EnFd_JumpToGround;
|
||||
} else {
|
||||
this->actor.scale.y = this->skelAnime.animCurrentFrame * (0.01f / this->skelAnime.totalFrames);
|
||||
this->actor.shape.rot.y += 0x2000;
|
||||
this->actor.posRot.rot.y = this->actor.shape.rot.y;
|
||||
}
|
||||
}
|
||||
|
||||
void EnFd_JumpToGround(EnFd* this, GlobalContext* globalCtx) {
|
||||
if ((this->actor.bgCheckFlags & 1) && !(this->actor.velocity.y > 0.0f)) {
|
||||
this->actor.velocity.y = 0.0f;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
this->actor.posRot.rot.y = this->actor.shape.rot.y;
|
||||
func_80034EC0(&this->skelAnime, sAnimations, 2);
|
||||
this->actionFunc = EnFd_Land;
|
||||
}
|
||||
}
|
||||
|
||||
void EnFd_Land(EnFd* this, GlobalContext* globalCtx) {
|
||||
Vec3f adjPos;
|
||||
|
||||
Math_SmoothScaleMaxMinF(&this->skelAnime.animPlaybackSpeed, 1.0f, 0.1f, 1.0f, 0.0f);
|
||||
if (func_800A56C8(&this->skelAnime, this->skelAnime.animFrameCount)) {
|
||||
this->spinTimer = Math_Rand_S16Offset(60, 90);
|
||||
this->runRadius = Math_Vec3f_DistXYZ(&this->actor.posRot.pos, &this->actor.initPosRot.pos);
|
||||
EnFd_GetPosAdjAroundCircle(&adjPos, this, this->runRadius, this->runDir);
|
||||
this->actor.posRot.rot.y = Math_atan2f(adjPos.x, adjPos.z) * (0x8000 / M_PI);
|
||||
func_80034EC0(&this->skelAnime, sAnimations, 4);
|
||||
this->actionFunc = EnFd_SpinAndSpawnFire;
|
||||
}
|
||||
}
|
||||
|
||||
void EnFd_SpinAndSpawnFire(EnFd* this, GlobalContext* globalCtx) {
|
||||
f32 deceleration;
|
||||
f32 tgtSpeed;
|
||||
f32 rotSpeed;
|
||||
|
||||
if ((this->spinTimer < 31) && (this->invincibilityTimer == 0)) {
|
||||
func_8002F974(&this->actor, NA_SE_EN_FLAME_FIRE_ATTACK - SFX_FLAG);
|
||||
} else {
|
||||
func_8002F974(&this->actor, NA_SE_EN_FLAME_ROLL - SFX_FLAG);
|
||||
}
|
||||
|
||||
if (DECR(this->spinTimer) != 0) {
|
||||
this->actor.shape.rot.y += (this->runDir * 0x2000);
|
||||
if (this->spinTimer == 30 && this->invincibilityTimer == 0) {
|
||||
if (this->actor.xzDistFromLink > 160.0f) {
|
||||
// orange flames
|
||||
EnFd_SpawnChildFire(this, globalCtx, 8, 0);
|
||||
} else {
|
||||
// blue flames
|
||||
EnFd_SpawnChildFire(this, globalCtx, 8, 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// slow shape rotation down to meet `this` rotation within ~1.66 degrees
|
||||
deceleration = this->actor.posRot.rot.y;
|
||||
deceleration -= this->actor.shape.rot.y;
|
||||
rotSpeed = 0.0f;
|
||||
tgtSpeed = fabsf(deceleration);
|
||||
deceleration /= tgtSpeed;
|
||||
Math_SmoothScaleMaxF(&rotSpeed, tgtSpeed, 0.6f, 0x2000);
|
||||
rotSpeed *= deceleration;
|
||||
this->actor.shape.rot.y += (s16)rotSpeed;
|
||||
rotSpeed = fabsf(rotSpeed);
|
||||
if ((s32)rotSpeed <= 300) {
|
||||
// ~1.6 degrees
|
||||
this->actor.shape.rot.y = this->actor.posRot.rot.y;
|
||||
}
|
||||
|
||||
if (this->actor.shape.rot.y == this->actor.posRot.rot.y) {
|
||||
this->initYawToInitPos = Math_Vec3f_Yaw(&this->actor.initPosRot.pos, &this->actor.posRot.pos);
|
||||
this->curYawToInitPos = this->runDir < 0 ? 0xFFFF : 0;
|
||||
this->circlesToComplete = (globalCtx->state.frames & 7) + 2;
|
||||
this->spinTimer = Math_Rand_S16Offset(30, 120);
|
||||
func_80034EC0(&this->skelAnime, sAnimations, 3);
|
||||
this->actionFunc = EnFd_Run;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run around in a circle with the center being the initial position, and
|
||||
* the radius being the distance from the initial postion to the nearest
|
||||
* threat (bomb or player).
|
||||
*/
|
||||
void EnFd_Run(EnFd* this, GlobalContext* globalCtx) {
|
||||
Actor* potentialThreat;
|
||||
s16 yawToYawTarget;
|
||||
f32 runRadiusTarget;
|
||||
Vec3f adjPos;
|
||||
|
||||
if (EnFd_ShouldStopRunning(this, globalCtx, this->runRadius, &this->runDir)) {
|
||||
if (this->invincibilityTimer == 0) {
|
||||
this->actor.posRot.rot.y ^= 0x8000;
|
||||
this->actor.velocity.y = 6.0f;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
func_80034EC0(&this->skelAnime, sAnimations, 1);
|
||||
this->actionFunc = EnFd_JumpToGround;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
yawToYawTarget = Math_Vec3f_Yaw(&this->actor.initPosRot.pos, &this->actor.posRot.pos) - this->initYawToInitPos;
|
||||
if (this->runDir > 0) {
|
||||
if ((u16)this->curYawToInitPos > (u16)(yawToYawTarget)) {
|
||||
this->circlesToComplete--;
|
||||
}
|
||||
} else if ((u16)this->curYawToInitPos < (u16)(yawToYawTarget)) {
|
||||
this->circlesToComplete--;
|
||||
}
|
||||
|
||||
if (this->circlesToComplete < 0) {
|
||||
this->circlesToComplete = 0;
|
||||
}
|
||||
this->curYawToInitPos = yawToYawTarget;
|
||||
|
||||
// If there is a bomb out, or if the player exists, set radius to
|
||||
// the distance to that threat, otherwise default to 200.
|
||||
potentialThreat = EnFd_FindPotentialTheat(this, globalCtx);
|
||||
if ((potentialThreat != NULL) && (this->invincibilityTimer == 0)) {
|
||||
runRadiusTarget = Math_Vec3f_DistXYZ(&this->actor.initPosRot.pos, &potentialThreat->posRot.pos);
|
||||
} else {
|
||||
runRadiusTarget = 200.0f;
|
||||
}
|
||||
Math_SmoothScaleMaxMinF(&this->runRadius, runRadiusTarget, 0.3f, 100.0f, 0.0f);
|
||||
EnFd_GetPosAdjAroundCircle(&adjPos, this, this->runRadius, this->runDir);
|
||||
Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, Math_atan2f(adjPos.x, adjPos.z) * (0x8000 / M_PI), 4, 0xFA0, 1);
|
||||
this->actor.posRot.rot = this->actor.shape.rot;
|
||||
func_8002F974(&this->actor, NA_SE_EN_FLAME_RUN - SFX_FLAG);
|
||||
if (this->skelAnime.animCurrentFrame == 6.0f || this->skelAnime.animCurrentFrame == 13.0f ||
|
||||
this->skelAnime.animCurrentFrame == 28.0f) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_KICK);
|
||||
}
|
||||
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 8.0f, 0.1f, 1.0f, 0.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
* En_Fw will set `this` params when it is done with it's action.
|
||||
* It will set FLG_COREDONE when the core has returned to `this`'s initial
|
||||
* position, and FLG_COREDEAD when there is no health left
|
||||
*/
|
||||
void EnFd_WaitForCore(EnFd* this, GlobalContext* globalCtx) {
|
||||
if (this->spinTimer != 0) {
|
||||
this->spinTimer--;
|
||||
if (this->spinTimer == 0) {
|
||||
Actor_Kill(&this->actor);
|
||||
}
|
||||
} else if (this->actor.params & FLG_COREDONE) {
|
||||
this->actionFunc = EnFd_Reappear;
|
||||
} else if (this->actor.params & FLG_COREDEAD) {
|
||||
this->actor.params = 0;
|
||||
this->spinTimer = 30;
|
||||
}
|
||||
}
|
||||
|
||||
void EnFd_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnFd* this = THIS;
|
||||
s32 pad;
|
||||
|
||||
if (this->firstUpdateFlag) {
|
||||
func_800F5ACC(0x38);
|
||||
this->firstUpdateFlag = false;
|
||||
}
|
||||
|
||||
if (this->actionFunc != EnFd_Reappear) {
|
||||
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
|
||||
EnFd_SpawnDot(this, globalCtx);
|
||||
}
|
||||
|
||||
if ((this->actor.flags & 0x2000) == 0x2000) {
|
||||
// has been hookshoted
|
||||
if (EnFd_SpawnCore(this, globalCtx)) {
|
||||
this->actor.flags &= ~1;
|
||||
this->invincibilityTimer = 30;
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_DAMAGE);
|
||||
func_80032C7C(globalCtx, &this->actor);
|
||||
} else {
|
||||
this->actor.flags &= ~0x2000;
|
||||
}
|
||||
} else if (this->actionFunc != EnFd_WaitForCore) {
|
||||
EnFd_ColliderCheck(this, globalCtx);
|
||||
}
|
||||
Actor_MoveForward(&this->actor);
|
||||
func_8002E4B4(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
|
||||
EnFd_Fade(this, globalCtx);
|
||||
this->actionFunc(this, globalCtx);
|
||||
EnFd_UpdateDots(this);
|
||||
EnFd_UpdateFlames(this);
|
||||
if (this->actionFunc != EnFd_Reappear && this->actionFunc != EnFd_SpinAndGrow &&
|
||||
this->actionFunc != EnFd_WaitForCore) {
|
||||
if (this->attackTimer == 0 && this->invincibilityTimer == 0) {
|
||||
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
|
||||
if ((this->actionFunc == EnFd_Run) || (this->actionFunc == EnFd_SpinAndSpawnFire)) {
|
||||
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
}
|
||||
|
||||
s32 EnFd_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx,
|
||||
Gfx** gfxP) {
|
||||
EnFd* this = THIS;
|
||||
|
||||
if (this->invincibilityTimer != 0) {
|
||||
switch (limbIndex) {
|
||||
case 13:
|
||||
case 21:
|
||||
*dList = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EnFd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) {
|
||||
EnFd* this = THIS;
|
||||
Vec3f unused0 = { 6800.0f, 0.0f, 0.0f };
|
||||
Vec3f unused1 = { 6800.0f, 0.0f, 0.0f };
|
||||
Vec3f initialPos = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f pos = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f accel = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
|
||||
s32 i;
|
||||
|
||||
if (limbIndex == 21) {
|
||||
Matrix_MultVec3f(&initialPos, &this->corePos);
|
||||
}
|
||||
|
||||
if (limbIndex == 13) {
|
||||
Matrix_MultVec3f(&initialPos, &this->actor.posRot2.pos);
|
||||
}
|
||||
|
||||
if (limbIndex == 3 || limbIndex == 6 || limbIndex == 7 || limbIndex == 10 || limbIndex == 14 || limbIndex == 15 ||
|
||||
limbIndex == 17 || limbIndex == 18 || limbIndex == 20 || limbIndex == 22 || limbIndex == 23 ||
|
||||
limbIndex == 24 || limbIndex == 25 || limbIndex == 26) {
|
||||
if ((globalCtx->state.frames % 2) != 0) {
|
||||
for (i = 0; i < 1; i++) {
|
||||
Matrix_MultVec3f(&initialPos, &pos);
|
||||
pos.x += (Math_Rand_ZeroOne() - 0.5f) * 20.0f;
|
||||
pos.y += (Math_Rand_ZeroOne() - 0.5f) * 40.0f;
|
||||
pos.z += (Math_Rand_ZeroOne() - 0.5f) * 20.0f;
|
||||
accel.x = (Math_Rand_ZeroOne() - 0.5f) * 0.4f;
|
||||
accel.y = ((Math_Rand_ZeroOne() - 0.5f) * 0.2f) + 0.6f;
|
||||
accel.z = (Math_Rand_ZeroOne() - 0.5f) * 0.4f;
|
||||
EnFd_AddEffect(this, FD_EFFECT_DOT, &pos, &velocity, &accel, 0, 0.006f, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func_800628A4(limbIndex, &this->collider);
|
||||
}
|
||||
|
||||
void EnFd_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnFd* this = THIS;
|
||||
s32 clampedHealth;
|
||||
Color_RGBA8 primColors[] = {
|
||||
{ 255, 255, 200, 255 },
|
||||
{ 200, 200, 200, 255 },
|
||||
{ 255, 255, 0, 255 },
|
||||
};
|
||||
Color_RGBA8 envColors[] = {
|
||||
{ 0, 255, 0, 255 },
|
||||
{ 0, 0, 255, 255 },
|
||||
{ 255, 0, 0, 255 },
|
||||
};
|
||||
u32 frames;
|
||||
s32 pad;
|
||||
|
||||
frames = globalCtx->state.frames;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 1751);
|
||||
|
||||
Matrix_Push();
|
||||
EnFd_DrawDots(this, globalCtx);
|
||||
EnFd_DrawFlames(this, globalCtx);
|
||||
Matrix_Pull();
|
||||
if (this->actionFunc != EnFd_Reappear && !(this->fadeAlpha < 0.9f)) {
|
||||
if (1) {}
|
||||
func_80093D84(globalCtx->state.gfxCtx);
|
||||
clampedHealth = CLAMP(thisx->colChkInfo.health - 1, 0, 23);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, primColors[clampedHealth / 8].r, primColors[clampedHealth / 8].g,
|
||||
primColors[clampedHealth / 8].b, (u8)this->fadeAlpha);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, envColors[clampedHealth / 8].r, envColors[clampedHealth / 8].g,
|
||||
envColors[clampedHealth / 8].b, (u8)this->fadeAlpha);
|
||||
gSPSegment(
|
||||
POLY_XLU_DISP++, 0x8,
|
||||
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, 0xFF - (u8)(frames * 6), 8, 0x40));
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x9, D_80116280);
|
||||
|
||||
POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl,
|
||||
this->skelAnime.dListCount, EnFd_OverrideLimbDraw, EnFd_PostLimbDraw, this,
|
||||
POLY_XLU_DISP);
|
||||
}
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 1822);
|
||||
}
|
||||
|
||||
void EnFd_AddEffect(EnFd* this, u8 type, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 timer, f32 scale,
|
||||
f32 scaleStep) {
|
||||
EnFdEffect* eff = this->effects;
|
||||
s16 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) {
|
||||
if (eff->type != FD_EFFECT_NONE) {
|
||||
continue;
|
||||
}
|
||||
eff->scale = scale;
|
||||
eff->scaleStep = scaleStep;
|
||||
eff->initialTimer = eff->timer = timer;
|
||||
eff->type = type;
|
||||
eff->pos = *pos;
|
||||
eff->accel = *accel;
|
||||
eff->velocity = *velocity;
|
||||
if (eff->type == FD_EFFECT_DOT) {
|
||||
eff->color.a = 255;
|
||||
eff->timer = (s16)(Math_Rand_ZeroOne() * 10.0f);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void EnFd_UpdateFlames(EnFd* this) {
|
||||
s16 i;
|
||||
EnFdEffect* eff = this->effects;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) {
|
||||
if (eff->type == FD_EFFECT_FLAME) {
|
||||
eff->timer--;
|
||||
if (eff->timer == 0) {
|
||||
eff->type = FD_EFFECT_NONE;
|
||||
}
|
||||
eff->accel.x = (Math_Rand_ZeroOne() * 0.4f) - 0.2f;
|
||||
eff->accel.z = (Math_Rand_ZeroOne() * 0.4f) - 0.2f;
|
||||
eff->pos.x += eff->velocity.x;
|
||||
eff->pos.y += eff->velocity.y;
|
||||
eff->pos.z += eff->velocity.z;
|
||||
eff->velocity.x += eff->accel.x;
|
||||
eff->velocity.y += eff->accel.y;
|
||||
eff->velocity.z += eff->accel.z;
|
||||
eff->scale += eff->scaleStep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnFd_UpdateDots(EnFd* this) {
|
||||
EnFdEffect* eff = this->effects;
|
||||
s16 i;
|
||||
Color_RGBA8 dotColors[] = {
|
||||
{ 255, 128, 0, 0 },
|
||||
{ 255, 0, 0, 0 },
|
||||
{ 255, 255, 0, 0 },
|
||||
{ 255, 0, 0, 0 },
|
||||
};
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) {
|
||||
if (eff->type == FD_EFFECT_DOT) {
|
||||
eff->pos.x += eff->velocity.x;
|
||||
eff->pos.y += eff->velocity.y;
|
||||
eff->pos.z += eff->velocity.z;
|
||||
eff->timer++;
|
||||
eff->velocity.x += eff->accel.x;
|
||||
eff->velocity.y += eff->accel.y;
|
||||
eff->velocity.z += eff->accel.z;
|
||||
|
||||
eff->color.r = dotColors[eff->timer % 4].r;
|
||||
eff->color.g = dotColors[eff->timer % 4].g;
|
||||
eff->color.b = dotColors[eff->timer % 4].b;
|
||||
if (eff->color.a > 30) {
|
||||
eff->color.a -= 30;
|
||||
} else {
|
||||
eff->color.a = 0;
|
||||
eff->type = FD_EFFECT_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnFd_DrawFlames(EnFd* this, GlobalContext* globalCtx) {
|
||||
static Gfx* D_80A0E0F8[] = {
|
||||
0x040539B0, 0x040535B0, 0x040531B0, 0x04052DB0, 0x040529B0, 0x040525B0, 0x040521B0, 0x04051DB0,
|
||||
};
|
||||
s32 firstDone;
|
||||
s16 i;
|
||||
s16 idx;
|
||||
EnFdEffect* eff = this->effects;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 1969);
|
||||
firstDone = false;
|
||||
if (1) {}
|
||||
func_80093D84(globalCtx->state.gfxCtx);
|
||||
for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) {
|
||||
if (eff->type == FD_EFFECT_FLAME) {
|
||||
if (!firstDone) {
|
||||
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0);
|
||||
gSPDisplayList(POLY_XLU_DISP++, D_06007928);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 255, 10, 0, (u8)((this->fadeAlpha / 255.0f) * 255));
|
||||
firstDone = true;
|
||||
}
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, (u8)((this->fadeAlpha / 255.0f) * 255));
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW);
|
||||
func_800D1FD4(&globalCtx->mf_11DA0);
|
||||
Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fd.c", 2006),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
idx = eff->timer * (8.0f / eff->initialTimer);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(D_80A0E0F8[idx]));
|
||||
gSPDisplayList(POLY_XLU_DISP++, D_06007938);
|
||||
}
|
||||
}
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 2020);
|
||||
}
|
||||
|
||||
void EnFd_DrawDots(EnFd* this, GlobalContext* globalCtx) {
|
||||
s16 i;
|
||||
s16 firstDone;
|
||||
EnFdEffect* eff = this->effects;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 2034);
|
||||
|
||||
firstDone = false;
|
||||
func_80093D84(globalCtx->state.gfxCtx);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) {
|
||||
if (eff->type == FD_EFFECT_DOT) {
|
||||
if (!firstDone) {
|
||||
func_80093D84(globalCtx->state.gfxCtx);
|
||||
gSPDisplayList(POLY_XLU_DISP++, D_060079F8);
|
||||
firstDone = true;
|
||||
}
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, eff->color.r, eff->color.g, eff->color.b,
|
||||
(u8)(eff->color.a * (this->fadeAlpha / 255.0f)));
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
if (1) {}
|
||||
Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW);
|
||||
func_800D1FD4(&globalCtx->mf_11DA0);
|
||||
Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fd.c", 2064),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, D_06007A78);
|
||||
}
|
||||
}
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 2071);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,48 @@
|
|||
|
||||
struct EnFd;
|
||||
|
||||
typedef void (*EnFdActionFunc)(struct EnFd* this, GlobalContext* globalCtx);
|
||||
|
||||
typedef enum {
|
||||
FD_EFFECT_NONE,
|
||||
FD_EFFECT_FLAME,
|
||||
FD_EFFECT_DOT
|
||||
} FDEffectType;
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ u8 type;
|
||||
/* 0x0001 */ u8 timer;
|
||||
/* 0x0002 */ u8 initialTimer;
|
||||
/* 0x0004 */ f32 scale;
|
||||
/* 0x0008 */ f32 scaleStep;
|
||||
/* 0x000C */ Color_RGBA8 color;
|
||||
/* 0x0010 */ char unk_10[4];
|
||||
/* 0x0014 */ Vec3f pos;
|
||||
/* 0x0020 */ Vec3f velocity;
|
||||
/* 0x002C */ Vec3f accel;
|
||||
} EnFdEffect; // size = 0x38
|
||||
|
||||
typedef struct EnFd {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x3094];
|
||||
/* 0x014C */ SkelAnime skelAnime;
|
||||
/* 0x0190 */ EnFdActionFunc actionFunc;
|
||||
/* 0x0194 */ ColliderJntSph collider;
|
||||
/* 0x01B4 */ ColliderJntSphItem colSphs[12];
|
||||
/* 0x04B4 */ u8 coreActive;
|
||||
/* 0x04B6 */ s16 initYawToInitPos;
|
||||
/* 0x04B8 */ s16 curYawToInitPos;
|
||||
/* 0x04BA */ s16 runDir;
|
||||
/* 0x04BC */ s16 firstUpdateFlag;
|
||||
/* 0x04BE */ s16 spinTimer;
|
||||
/* 0x04C0 */ s16 circlesToComplete;
|
||||
/* 0x04C2 */ s16 invincibilityTimer;
|
||||
/* 0x04C4 */ s16 attackTimer;
|
||||
/* 0x04C8 */ f32 runRadius;
|
||||
/* 0x04CC */ f32 fadeAlpha;
|
||||
/* 0x04D0 */ Vec3f corePos;
|
||||
/* 0x04DC */ Vec3s limbDrawTable[27];
|
||||
/* 0x057E */ Vec3s transitionDrawTable[27];
|
||||
/* 0x0620 */ EnFdEffect effects[200];
|
||||
} EnFd; // size = 0x31E0
|
||||
|
||||
extern const ActorInit En_Fd_InitVars;
|
||||
|
|
|
@ -8,8 +8,13 @@ void EnFdFire_Init(Actor* thisx, GlobalContext* globalCtx);
|
|||
void EnFdFire_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFdFire_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFdFire_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFdFire_Disappear(EnFdFire* this, GlobalContext* globalCtx);
|
||||
void func_80A0E70C(EnFdFire* this, GlobalContext* globalCtx);
|
||||
void EnFdFire_DanceTowardsPlayer(EnFdFire* this, GlobalContext* globalCtx);
|
||||
void EnFdFire_WaitToDie(EnFdFire* this, GlobalContext* globalCtx);
|
||||
|
||||
extern Gfx D_0404D4E0[];
|
||||
|
||||
/*
|
||||
const ActorInit En_Fd_Fire_InitVars = {
|
||||
ACTOR_EN_FD_FIRE,
|
||||
ACTORTYPE_ENEMY,
|
||||
|
@ -21,23 +26,220 @@ const ActorInit En_Fd_Fire_InitVars = {
|
|||
(ActorFunc)EnFdFire_Update,
|
||||
(ActorFunc)EnFdFire_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd_Fire/func_80A0E4B0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd_Fire/func_80A0E578.s")
|
||||
static ColliderCylinderInit sCylinderInit = {
|
||||
{ COLTYPE_UNK10, 0x11, 0x09, 0x39, 0x10, COLSHAPE_CYLINDER },
|
||||
{ 0x00, { 0xFFCFFFFF, 0x01, 0x08 }, { 0x0D840008, 0x00, 0x00 }, 0x01, 0x01, 0x01 },
|
||||
{ 12, 46, 0, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd_Fire/EnFdFire_Init.s")
|
||||
static CollisionCheckInfoInit2 sColChkInit = { 1, 0, 0, 0, 0xFF };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd_Fire/EnFdFire_Destroy.s")
|
||||
static DamageTable sDamageTable = { {
|
||||
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
} };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd_Fire/func_80A0E70C.s")
|
||||
void EnFdFire_UpdatePos(EnFdFire* this, Vec3f* targetPos) {
|
||||
f32 dist;
|
||||
f32 xDiff = targetPos->x - this->actor.posRot.pos.x;
|
||||
f32 yDiff = targetPos->y - this->actor.posRot.pos.y;
|
||||
f32 zDiff = targetPos->z - this->actor.posRot.pos.z;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd_Fire/func_80A0E848.s")
|
||||
dist = sqrtf(SQ(xDiff) + SQ(yDiff) + SQ(zDiff));
|
||||
if (fabsf(dist) > fabsf(this->actor.speedXZ)) {
|
||||
this->actor.velocity.x = (xDiff / dist) * this->actor.speedXZ;
|
||||
this->actor.velocity.z = (zDiff / dist) * this->actor.speedXZ;
|
||||
} else {
|
||||
this->actor.velocity.x = 0.0f;
|
||||
this->actor.velocity.z = 0.0f;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd_Fire/func_80A0E884.s")
|
||||
this->actor.velocity.y += this->actor.gravity;
|
||||
if (!(this->actor.minVelocityY <= this->actor.velocity.y)) {
|
||||
this->actor.velocity.y = this->actor.minVelocityY;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd_Fire/func_80A0EA34.s")
|
||||
s32 EnFdFire_CheckCollider(EnFdFire* this, GlobalContext* globalCtx) {
|
||||
if (this->actionFunc == EnFdFire_Disappear) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd_Fire/EnFdFire_Update.s")
|
||||
if (this->collider.base.acFlags & 2) {
|
||||
this->collider.base.acFlags &= ~2;
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fd_Fire/EnFdFire_Draw.s")
|
||||
if (this->collider.base.maskB & 1) {
|
||||
this->collider.base.maskB &= ~1;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void EnFdFire_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnFdFire* this = THIS;
|
||||
s32 pad;
|
||||
Player* player = PLAYER;
|
||||
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 20.0f);
|
||||
Collider_InitCylinder(globalCtx, &this->collider);
|
||||
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
|
||||
func_80061EFC(&this->actor.colChkInfo, &sDamageTable, &sColChkInit);
|
||||
this->actor.flags &= ~1;
|
||||
this->actor.gravity = -0.6f;
|
||||
this->actor.speedXZ = 5.0f;
|
||||
this->actor.velocity.y = 12.0f;
|
||||
this->spawnRadius = Math_Vec3f_DistXYZ(&this->actor.posRot.pos, &player->actor.posRot.pos);
|
||||
this->scale = 3.0f;
|
||||
this->tile2Y = (s16)Math_Rand_ZeroFloat(5.0f) - 25;
|
||||
this->actionFunc = func_80A0E70C;
|
||||
}
|
||||
|
||||
void EnFdFire_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnFdFire* this = THIS;
|
||||
|
||||
Collider_DestroyCylinder(globalCtx, &this->collider);
|
||||
}
|
||||
|
||||
void func_80A0E70C(EnFdFire* this, GlobalContext* globalCtx) {
|
||||
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f targetPos = this->actor.parent->posRot.pos;
|
||||
|
||||
targetPos.x += this->spawnRadius * Math_Sins(this->actor.posRot.rot.y);
|
||||
targetPos.z += this->spawnRadius * Math_Coss(this->actor.posRot.rot.y);
|
||||
EnFdFire_UpdatePos(this, &targetPos);
|
||||
if (this->actor.bgCheckFlags & 1 && (!(this->actor.velocity.y > 0.0f))) {
|
||||
this->actor.velocity = velocity;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
this->actor.bgCheckFlags &= ~1;
|
||||
if (this->actor.params & 0x8000) {
|
||||
this->deathTimer = 200;
|
||||
this->actionFunc = EnFdFire_DanceTowardsPlayer;
|
||||
} else {
|
||||
this->deathTimer = 300;
|
||||
this->actionFunc = EnFdFire_WaitToDie;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnFdFire_WaitToDie(EnFdFire* this, GlobalContext* globalCtx) {
|
||||
if (DECR(this->deathTimer) == 0) {
|
||||
this->actionFunc = EnFdFire_Disappear;
|
||||
}
|
||||
}
|
||||
|
||||
void EnFdFire_DanceTowardsPlayer(EnFdFire* this, GlobalContext* globalCtx) {
|
||||
Player* player = PLAYER;
|
||||
f32 angles[] = {
|
||||
0.0f, 210.0f, 60.0f, 270.0f, 120.0f, 330.0f, 180.0f, 30.0f, 240.0f, 90.0f, 300.0f, 150.0f,
|
||||
};
|
||||
Vec3f pos;
|
||||
s16 idx;
|
||||
|
||||
idx = ((globalCtx->state.frames / 10) + (this->actor.params & 0x7FFF)) % ARRAY_COUNT(angles);
|
||||
pos = player->actor.posRot.pos;
|
||||
pos.x += 120.0f * sinf(angles[idx]);
|
||||
pos.z += 120.0f * cosf(angles[idx]);
|
||||
|
||||
if (DECR(this->deathTimer) == 0) {
|
||||
this->actionFunc = EnFdFire_Disappear;
|
||||
} else {
|
||||
Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, Math_Vec3f_Yaw(&this->actor.posRot.pos, &pos), 8, 0xFA0, 1);
|
||||
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 0.0f, 0.4f, 1.0f, 0.0f);
|
||||
if (this->actor.speedXZ < 0.1f) {
|
||||
this->actor.speedXZ = 5.0f;
|
||||
}
|
||||
func_8002D868(&this->actor);
|
||||
}
|
||||
}
|
||||
|
||||
void EnFdFire_Disappear(EnFdFire* this, GlobalContext* globalCtx) {
|
||||
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 0.0f, 0.6f, 9.0f, 0.0f);
|
||||
func_8002D868(&this->actor);
|
||||
Math_SmoothScaleMaxMinF(&this->scale, 0.0f, 0.3f, 0.1f, 0.0f);
|
||||
this->actor.shape.unk_10 = 20.0f;
|
||||
this->actor.shape.unk_10 *= (this->scale / 3.0f);
|
||||
if (!(this->scale > 0.01f)) {
|
||||
Actor_Kill(&this->actor);
|
||||
}
|
||||
}
|
||||
|
||||
void EnFdFire_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnFdFire* this = THIS;
|
||||
s32 pad;
|
||||
|
||||
if (this->actionFunc != EnFdFire_Disappear) {
|
||||
if ((this->actor.parent->update == NULL) || EnFdFire_CheckCollider(this, globalCtx)) {
|
||||
this->actionFunc = EnFdFire_Disappear;
|
||||
}
|
||||
}
|
||||
|
||||
func_8002D7EC(&this->actor);
|
||||
this->actionFunc(this, globalCtx);
|
||||
func_8002E4B4(globalCtx, &this->actor, 12.0f, 10.0f, 0.0f, 5);
|
||||
|
||||
if (this->actionFunc != EnFdFire_Disappear) {
|
||||
Collider_CylinderUpdate(&this->actor, &this->collider);
|
||||
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
}
|
||||
|
||||
void EnFdFire_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Color_RGBA8 primColors[] = {
|
||||
{ 255, 255, 0, 255 },
|
||||
{ 255, 255, 255, 255 },
|
||||
};
|
||||
Color_RGBA8 envColors[] = {
|
||||
{ 255, 10, 0, 255 },
|
||||
{ 0, 10, 255, 255 },
|
||||
};
|
||||
s32 pad;
|
||||
EnFdFire* this = THIS;
|
||||
Vec3f scale = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f sp90 = { 0.0f, 0.0f, 0.0f };
|
||||
s16 sp8E;
|
||||
f32 sp88;
|
||||
f32 sp84;
|
||||
f32 sp80;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fd_fire.c", 572);
|
||||
|
||||
Matrix_Translate(this->actor.posRot.pos.x, this->actor.posRot.pos.y, this->actor.posRot.pos.z, MTXMODE_NEW);
|
||||
sp8E = Math_Vec3f_Yaw(&scale, &this->actor.velocity) - func_8005A9F4(ACTIVE_CAM);
|
||||
sp84 = fabsf(Math_Coss(sp8E));
|
||||
sp88 = Math_Sins(sp8E);
|
||||
sp80 = Math_Vec3f_DistXZ(&scale, &this->actor.velocity) / 1.5f;
|
||||
if (1) {}
|
||||
if (1) {}
|
||||
if (1) {}
|
||||
Matrix_RotateY((s16)(func_8005A9F4(ACTIVE_CAM) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY);
|
||||
Matrix_RotateZ(((sp88 * -10.0f) * sp80) * (M_PI / 180.0f), MTXMODE_APPLY);
|
||||
scale.x = scale.y = scale.z = this->scale * 0.001f;
|
||||
Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY);
|
||||
sp84 = sp80 * ((0.01f * -15.0f) * sp84) + 1.0f;
|
||||
if (sp84 < 0.1f) {
|
||||
sp84 = 0.1f;
|
||||
}
|
||||
Matrix_Scale(1.0f, sp84, 1.0f / sp84, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fd_fire.c", 623),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
func_80093D84(globalCtx->state.gfxCtx);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x8,
|
||||
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0,
|
||||
globalCtx->state.frames * this->tile2Y, 0x20, 0x80));
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, primColors[((this->actor.params & 0x8000) >> 0xF)].r,
|
||||
primColors[((this->actor.params & 0x8000) >> 0xF)].g,
|
||||
primColors[((this->actor.params & 0x8000) >> 0xF)].b,
|
||||
primColors[((this->actor.params & 0x8000) >> 0xF)].a);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, envColors[((this->actor.params & 0x8000) >> 0xF)].r,
|
||||
envColors[((this->actor.params & 0x8000) >> 0xF)].g,
|
||||
envColors[((this->actor.params & 0x8000) >> 0xF)].b,
|
||||
envColors[((this->actor.params & 0x8000) >> 0xF)].a);
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
gSPDisplayList(POLY_XLU_DISP++, &D_0404D4E0);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fd_fire.c", 672);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,17 @@
|
|||
|
||||
struct EnFdFire;
|
||||
|
||||
typedef void (*EnFdFireActionFunc)(struct EnFdFire* this, GlobalContext* globalCtx);
|
||||
|
||||
typedef struct EnFdFire {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x60];
|
||||
/* 0x014C */ EnFdFireActionFunc actionFunc;
|
||||
/* 0x0150 */ ColliderCylinder collider;
|
||||
/* 0x019C */ f32 spawnRadius;
|
||||
/* 0x01A0 */ f32 scale;
|
||||
/* 0x01A4 */ char unk_1A4[0x2];
|
||||
/* 0x01A6 */ s16 deathTimer;
|
||||
/* 0x01A8 */ s16 tile2Y;
|
||||
} EnFdFire; // size = 0x01AC
|
||||
|
||||
extern const ActorInit En_Fd_Fire_InitVars;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "z_en_fw.h"
|
||||
#include "overlays/actors/ovl_En_Bom/z_en_bom.h"
|
||||
|
||||
#define FLAGS 0x00000215
|
||||
|
||||
|
@ -8,8 +9,15 @@ void EnFw_Init(Actor* thisx, GlobalContext* globalCtx);
|
|||
void EnFw_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFw_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFw_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFw_UpdateDust(EnFw* this);
|
||||
void EnFw_DrawDust(EnFw* this, GlobalContext* globalCtx);
|
||||
void EnFw_AddDust(EnFw* this, Vec3f* initialPos, Vec3f* initialSpeed, Vec3f* accel, u8 initialTimer, f32 scale,
|
||||
f32 scaleStep);
|
||||
void EnFw_Bounce(EnFw* this, GlobalContext* globalCtx);
|
||||
void EnFw_Run(EnFw* this, GlobalContext* globalCtx);
|
||||
void EnFw_JumpToParentInitPos(EnFw* this, GlobalContext* globalCtx);
|
||||
void EnFw_TurnToParentInitPos(EnFw* this, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
const ActorInit En_Fw_InitVars = {
|
||||
ACTOR_EN_FW,
|
||||
ACTORTYPE_ENEMY,
|
||||
|
@ -21,39 +29,442 @@ const ActorInit En_Fw_InitVars = {
|
|||
(ActorFunc)EnFw_Update,
|
||||
(ActorFunc)EnFw_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/func_80A1E5A0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/func_80A1E668.s")
|
||||
static ColliderJntSphItemInit sJntSphItemsInit[1] = {
|
||||
{
|
||||
{ 0x00, { 0x00000000, 0x00, 0x04 }, { 0xFFCFFFFE, 0x00, 0x00 }, 0x00, 0x05, 0x01 },
|
||||
{ 2, { { 1200, 0, 0 }, 16 }, 100 },
|
||||
},
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/func_80A1E760.s")
|
||||
static ColliderJntSphInit sJntSphInit = {
|
||||
{ COLTYPE_UNK6, 0x11, 0x09, 0x39, 0x10, COLSHAPE_JNTSPH },
|
||||
1,
|
||||
sJntSphItemsInit,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/func_80A1E838.s")
|
||||
static CollisionCheckInfoInit2 D_80A1FB94 = { 8, 2, 25, 25, 0xFF };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/func_80A1E8F8.s")
|
||||
static struct_80034EC0_Entry D_80A1FBA0[] = {
|
||||
{ 0x06006CF8, 0.0f, 0.0f, -1.0f, 0x03, 0.0f },
|
||||
{ 0x06007CD0, 1.0f, 0.0f, -1.0f, 0x03, -8.0f },
|
||||
{ 0x06007DC8, 1.0f, 0.0f, -1.0f, 0x01, -8.0f },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/EnFw_Init.s")
|
||||
extern FlexSkeletonHeader D_06007C30;
|
||||
extern Gfx D_06007928[];
|
||||
extern Gfx D_06007938[];
|
||||
extern AnimationHeader D_06006CF8;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/EnFw_Destroy.s")
|
||||
s32 EnFw_DoBounce(EnFw* this, s32 totalBounces, f32 yVelocity) {
|
||||
s16 temp_v1;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/func_80A1EC70.s")
|
||||
if (!(this->actor.bgCheckFlags & 1) || (this->actor.velocity.y > 0.0f)) {
|
||||
// not on the ground or moving upwards.
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/func_80A1ECD4.s")
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND);
|
||||
this->bounceCnt--;
|
||||
if (this->bounceCnt <= 0) {
|
||||
if (this->bounceCnt == 0) {
|
||||
this->bounceCnt = 0;
|
||||
this->actor.velocity.y = 0.0f;
|
||||
return true;
|
||||
}
|
||||
this->bounceCnt = totalBounces;
|
||||
}
|
||||
this->actor.velocity.y = yVelocity;
|
||||
this->actor.velocity.y *= ((f32)this->bounceCnt / totalBounces);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/func_80A1F2A8.s")
|
||||
s32 EnFw_PlayerInRange(EnFw* this, GlobalContext* globalCtx) {
|
||||
Player* player = PLAYER;
|
||||
CollisionPoly* poly;
|
||||
u32 bgId;
|
||||
Vec3f collisionPos;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/func_80A1F39C.s")
|
||||
if (this->actor.xzDistFromLink > 300.0f) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/EnFw_Update.s")
|
||||
if (ABS((s16)((f32)this->actor.yawTowardsLink - (f32)this->actor.shape.rot.y)) > 0x1C70) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/func_80A1F52C.s")
|
||||
if (func_8003DE84(&globalCtx->colCtx, &this->actor.posRot.pos, &player->actor.posRot.pos, &collisionPos, &poly, 1,
|
||||
0, 0, 1, &bgId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/func_80A1F544.s")
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/EnFw_Draw.s")
|
||||
Vec3f* EnFw_GetPosAdjAroundCircle(Vec3f* dst, EnFw* this, f32 radius, s16 dir) {
|
||||
s16 angle;
|
||||
Vec3f posAdj;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/func_80A1F664.s")
|
||||
// increase rotation around circle ~30 degrees.
|
||||
angle = Math_Vec3f_Yaw(&this->actor.parent->initPosRot.pos, &this->actor.posRot.pos) + (dir * 0x1554);
|
||||
posAdj.x = (Math_Sins(angle) * radius) + this->actor.parent->initPosRot.pos.x;
|
||||
posAdj.z = (Math_Coss(angle) * radius) + this->actor.parent->initPosRot.pos.z;
|
||||
posAdj.x -= this->actor.posRot.pos.x;
|
||||
posAdj.z -= this->actor.posRot.pos.z;
|
||||
*dst = posAdj;
|
||||
return dst;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/func_80A1F708.s")
|
||||
s32 EnFw_CheckCollider(EnFw* this, GlobalContext* globalCtx) {
|
||||
ColliderBody* body;
|
||||
s32 phi_return;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fw/func_80A1F814.s")
|
||||
if (this->collider.base.acFlags & 2) {
|
||||
body = &this->collider.list[0].body;
|
||||
if (body->acHitItem->toucher.flags & 0x80) {
|
||||
this->lastDmgHook = true;
|
||||
} else {
|
||||
this->lastDmgHook = false;
|
||||
}
|
||||
this->collider.base.acFlags &= ~2;
|
||||
if (Actor_ApplyDamage(&this->actor) <= 0) {
|
||||
if (this->actor.parent->colChkInfo.health <= 8) {
|
||||
func_80032C7C(globalCtx, &this->actor);
|
||||
this->actor.parent->colChkInfo.health = 0;
|
||||
} else {
|
||||
this->actor.parent->colChkInfo.health -= 8;
|
||||
}
|
||||
this->returnToParentTimer = 0;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
s32 EnFw_SpawnDust(EnFw* this, u8 timer, f32 scale, f32 scaleStep, s32 dustCnt, f32 radius, f32 xzAccel, f32 yAccel) {
|
||||
Vec3f pos = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f accel = { 0.0f, 0.0f, 0.0f };
|
||||
s16 angle;
|
||||
s32 i;
|
||||
|
||||
pos = this->actor.posRot.pos;
|
||||
pos.y = this->actor.groundY + 2.0f;
|
||||
angle = ((Math_Rand_ZeroOne() - 0.5f) * 0x10000);
|
||||
i = dustCnt;
|
||||
while (i >= 0) {
|
||||
accel.x = (Math_Rand_ZeroOne() - 0.5f) * xzAccel;
|
||||
accel.y = yAccel;
|
||||
accel.z = (Math_Rand_ZeroOne() - 0.5f) * xzAccel;
|
||||
pos.x = (Math_Sins(angle) * radius) + this->actor.posRot.pos.x;
|
||||
pos.z = (Math_Coss(angle) * radius) + this->actor.posRot.pos.z;
|
||||
EnFw_AddDust(this, &pos, &velocity, &accel, timer, scale, scaleStep);
|
||||
angle += (s16)(0x10000 / dustCnt);
|
||||
i--;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EnFw_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnFw* this = THIS;
|
||||
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06007C30, NULL, this->limbDrawTable, this->transitionDrawTable,
|
||||
11);
|
||||
func_80034EC0(&this->skelAnime, D_80A1FBA0, 0);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 20.0f);
|
||||
Collider_InitJntSph(globalCtx, &this->collider);
|
||||
Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->sphs);
|
||||
func_80061EFC(&this->actor.colChkInfo, DamageTable_Get(0x10), &D_80A1FB94);
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
this->runDirection = -this->actor.params;
|
||||
this->actionFunc = EnFw_Bounce;
|
||||
this->actor.gravity = -1.0f;
|
||||
}
|
||||
|
||||
void EnFw_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnFw* this = THIS;
|
||||
Collider_DestroyJntSph(globalCtx, &this->collider);
|
||||
}
|
||||
|
||||
void EnFw_Bounce(EnFw* this, GlobalContext* globalCtx) {
|
||||
if (EnFw_DoBounce(this, 3, 8.0f) && this->bounceCnt == 0) {
|
||||
this->returnToParentTimer = Math_Rand_S16Offset(300, 150);
|
||||
this->actionFunc = EnFw_Run;
|
||||
}
|
||||
}
|
||||
|
||||
void EnFw_Run(EnFw* this, GlobalContext* globalCtx) {
|
||||
f32 tmpAngle;
|
||||
s16 phi_v0;
|
||||
f32 facingDir;
|
||||
EnBom* bomb;
|
||||
Actor* flareDancer;
|
||||
|
||||
Math_SmoothScaleMaxMinF(&this->skelAnime.animPlaybackSpeed, 1.0f, 0.1f, 1.0f, 0.0f);
|
||||
if (this->skelAnime.animation == &D_06006CF8) {
|
||||
if (func_800A56C8(&this->skelAnime, this->skelAnime.animFrameCount) == 0) {
|
||||
this->runRadius = Math_Vec3f_DistXYZ(&this->actor.posRot.pos, &this->actor.parent->posRot.pos);
|
||||
func_80034EC0(&this->skelAnime, D_80A1FBA0, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->damageTimer == 0 && this->explosionTimer == 0 && EnFw_CheckCollider(this, globalCtx)) {
|
||||
if (this->actor.parent->colChkInfo.health > 0) {
|
||||
if (!this->lastDmgHook) {
|
||||
this->actor.velocity.y = 6.0f;
|
||||
}
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_MAN_DAMAGE);
|
||||
this->damageTimer = 20;
|
||||
} else {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_MAN_DAMAGE);
|
||||
this->explosionTimer = 6;
|
||||
}
|
||||
this->actor.speedXZ = 0.0f;
|
||||
}
|
||||
|
||||
if (this->explosionTimer != 0) {
|
||||
this->skelAnime.animPlaybackSpeed = 0.0f;
|
||||
Math_SmoothScaleMaxMinF(&this->actor.scale.x, 0.024999999f, 0.08f, 0.6f, 0.0f);
|
||||
Actor_SetScale(&this->actor, this->actor.scale.x);
|
||||
if (this->actor.dmgEffectTimer == 0) {
|
||||
func_8003426C(&this->actor, 0x4000, 0xC8, 0, this->explosionTimer);
|
||||
this->explosionTimer--;
|
||||
}
|
||||
|
||||
if (this->explosionTimer == 0) {
|
||||
bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->bompPos.x, this->bompPos.y,
|
||||
this->bompPos.z, 0, 0, 0x600, 0);
|
||||
if (bomb != NULL) {
|
||||
bomb->timer = 0;
|
||||
}
|
||||
flareDancer = this->actor.parent;
|
||||
flareDancer->params |= 0x4000;
|
||||
Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.posRot.pos, 0xA0);
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!(this->actor.bgCheckFlags & 1) || this->actor.velocity.y > 0.0f) {
|
||||
func_8003426C(&this->actor, 0x4000, 0xC8, 0, this->damageTimer);
|
||||
return;
|
||||
}
|
||||
DECR(this->damageTimer);
|
||||
if ((200.0f - this->runRadius) < 0.9f) {
|
||||
if (DECR(this->returnToParentTimer) == 0) {
|
||||
this->actor.speedXZ = 0.0f;
|
||||
this->actionFunc = EnFw_TurnToParentInitPos;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Run outwards until the radius of the run circle is 200
|
||||
Math_SmoothScaleMaxMinF(&this->runRadius, 200.0f, 0.3f, 100.0f, 0.0f);
|
||||
|
||||
if (this->turnAround) {
|
||||
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 0.0f, 0.1f, 1.0f, 0.0f);
|
||||
tmpAngle = (s16)(this->actor.posRot.rot.y ^ 0x8000);
|
||||
facingDir = this->actor.shape.rot.y;
|
||||
tmpAngle = Math_SmoothScaleMaxMinF(&facingDir, tmpAngle, 0.1f, 10000.0f, 0.0f);
|
||||
this->actor.shape.rot.y = facingDir;
|
||||
if (tmpAngle > 0x1554) {
|
||||
return;
|
||||
}
|
||||
this->turnAround = false;
|
||||
} else {
|
||||
Vec3f sp48;
|
||||
EnFw_GetPosAdjAroundCircle(&sp48, this, this->runRadius, this->runDirection);
|
||||
Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, (Math_atan2f(sp48.x, sp48.z) * (0x8000 / M_PI)), 4, 0xFA0,
|
||||
1);
|
||||
}
|
||||
|
||||
this->actor.posRot.rot = this->actor.shape.rot;
|
||||
|
||||
if (this->slideTimer == 0 && EnFw_PlayerInRange(this, globalCtx)) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_MAN_SURP);
|
||||
this->slideSfxTimer = 8;
|
||||
this->slideTimer = 8;
|
||||
}
|
||||
|
||||
if (this->slideTimer != 0) {
|
||||
if (DECR(this->slideSfxTimer) == 0) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_MAN_SLIDE);
|
||||
this->slideSfxTimer = 4;
|
||||
}
|
||||
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 0.0f, 0.1f, 1.0f, 0.0f);
|
||||
this->skelAnime.animPlaybackSpeed = 0.0f;
|
||||
EnFw_SpawnDust(this, 8, 0.16f, 0.2f, 3, 8.0f, 20.0f, ((Math_Rand_ZeroOne() - 0.5f) * 0.2f) + 0.3f);
|
||||
this->slideTimer--;
|
||||
if (this->slideTimer == 0) {
|
||||
this->turnAround = true;
|
||||
this->runDirection = -this->runDirection;
|
||||
}
|
||||
} else {
|
||||
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 6.0f, 0.1f, 1.0f, 0.0f);
|
||||
phi_v0 = this->skelAnime.animCurrentFrame;
|
||||
if (phi_v0 == 1 || phi_v0 == 4) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_MAN_RUN);
|
||||
EnFw_SpawnDust(this, 8, 0.16f, 0.1f, 1, 0.0f, 20.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnFw_TurnToParentInitPos(EnFw* this, GlobalContext* globalCtx) {
|
||||
s16 angleToParentInit;
|
||||
|
||||
angleToParentInit = Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->actor.parent->initPosRot.pos);
|
||||
Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, angleToParentInit, 4, 0xFA0, 1);
|
||||
if (ABS(angleToParentInit - this->actor.shape.rot.y) < 0x65) {
|
||||
// angle to parent init pos is ~0.5 degrees
|
||||
this->actor.posRot.rot = this->actor.shape.rot;
|
||||
this->actor.velocity.y = 14.0f;
|
||||
this->actor.initPosRot.pos = this->actor.posRot.pos;
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_JUMP);
|
||||
func_80034EC0(&this->skelAnime, D_80A1FBA0, 1);
|
||||
this->actionFunc = EnFw_JumpToParentInitPos;
|
||||
}
|
||||
}
|
||||
|
||||
void EnFw_JumpToParentInitPos(EnFw* this, GlobalContext* globalCtx) {
|
||||
if (this->actor.bgCheckFlags & 1 && this->actor.velocity.y <= 0.0f) {
|
||||
this->actor.parent->params |= 0x8000;
|
||||
Actor_Kill(&this->actor);
|
||||
} else {
|
||||
Math_SmoothScaleMaxMinF(&this->actor.posRot.pos.x, this->actor.parent->initPosRot.pos.x, 0.6f, 8.0f, 0.0f);
|
||||
Math_SmoothScaleMaxMinF(&this->actor.posRot.pos.z, this->actor.parent->initPosRot.pos.z, 0.6f, 8.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void EnFw_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnFw* this = THIS;
|
||||
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
|
||||
if ((this->actor.flags & 0x2000) != 0x2000) {
|
||||
// not attached to hookshot.
|
||||
Actor_MoveForward(&this->actor);
|
||||
func_8002E4B4(globalCtx, &this->actor, 10.0f, 20.0f, 0.0f, 5);
|
||||
this->actionFunc(this, globalCtx);
|
||||
if (this->damageTimer == 0 && this->explosionTimer == 0 && this->actionFunc == EnFw_Run) {
|
||||
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
}
|
||||
|
||||
s32 EnFw_OverrideLimbDraw(GlobalContext* globalContext, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
||||
void* thisx) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EnFw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
|
||||
EnFw* this = THIS;
|
||||
Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
if (limbIndex == 2) {
|
||||
// body
|
||||
Matrix_MultVec3f(&zeroVec, &this->bompPos);
|
||||
}
|
||||
|
||||
if (limbIndex == 3) {
|
||||
// head
|
||||
Matrix_MultVec3f(&zeroVec, &this->actor.posRot2.pos);
|
||||
}
|
||||
|
||||
func_800628A4(limbIndex, &this->collider);
|
||||
}
|
||||
|
||||
void EnFw_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnFw* this = THIS;
|
||||
|
||||
EnFw_UpdateDust(this);
|
||||
Matrix_Push();
|
||||
EnFw_DrawDust(this, globalCtx);
|
||||
Matrix_Pull();
|
||||
func_80093D18(globalCtx->state.gfxCtx);
|
||||
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
|
||||
EnFw_OverrideLimbDraw, EnFw_PostLimbDraw, this);
|
||||
}
|
||||
|
||||
void EnFw_AddDust(EnFw* this, Vec3f* initialPos, Vec3f* initialSpeed, Vec3f* accel, u8 initialTimer, f32 scale,
|
||||
f32 scaleStep) {
|
||||
EnFwEffect* eff = this->effects;
|
||||
s16 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) {
|
||||
if (eff->type != 1) {
|
||||
eff->scale = scale;
|
||||
eff->scaleStep = scaleStep;
|
||||
eff->initialTimer = eff->timer = initialTimer;
|
||||
eff->type = 1;
|
||||
eff->pos = *initialPos;
|
||||
eff->accel = *accel;
|
||||
eff->velocity = *initialSpeed;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnFw_UpdateDust(EnFw* this) {
|
||||
EnFwEffect* eff = this->effects;
|
||||
s16 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) {
|
||||
if (eff->type != 0) {
|
||||
if ((--eff->timer) == 0) {
|
||||
eff->type = 0;
|
||||
}
|
||||
eff->accel.x = (Math_Rand_ZeroOne() * 0.4f) - 0.2f;
|
||||
eff->accel.z = (Math_Rand_ZeroOne() * 0.4f) - 0.2f;
|
||||
eff->pos.x += eff->velocity.x;
|
||||
eff->pos.y += eff->velocity.y;
|
||||
eff->pos.z += eff->velocity.z;
|
||||
eff->velocity.x += eff->accel.x;
|
||||
eff->velocity.y += eff->accel.y;
|
||||
eff->velocity.z += eff->accel.z;
|
||||
eff->scale += eff->scaleStep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnFw_DrawDust(EnFw* this, GlobalContext* globalCtx) {
|
||||
static Gfx* D_80A1FC18[] = {
|
||||
0x040539B0, 0x040535B0, 0x040531B0, 0x04052DB0, 0x040529B0, 0x040525B0, 0x040521B0, 0x04051DB0,
|
||||
};
|
||||
EnFwEffect* eff = this->effects;
|
||||
s16 firstDone;
|
||||
s16 alpha;
|
||||
s16 i;
|
||||
s16 idx;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fw.c", 1191);
|
||||
|
||||
firstDone = false;
|
||||
func_80093D84(globalCtx->state.gfxCtx);
|
||||
if (1) {}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) {
|
||||
if (eff->type != 0) {
|
||||
if (!firstDone) {
|
||||
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0U);
|
||||
gSPDisplayList(POLY_XLU_DISP++, D_06007928);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0);
|
||||
firstDone = true;
|
||||
}
|
||||
|
||||
alpha = eff->timer * (255.0f / eff->initialTimer);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha);
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW);
|
||||
func_800D1FD4(&globalCtx->mf_11DA0);
|
||||
Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fw.c", 1229),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
idx = eff->timer * (8.0f / eff->initialTimer);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(D_80A1FC18[idx]));
|
||||
gSPDisplayList(POLY_XLU_DISP++, &D_06007938);
|
||||
}
|
||||
}
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fw.c", 1243);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,43 @@
|
|||
|
||||
struct EnFw;
|
||||
|
||||
typedef void (*EnFwActionFunc)(struct EnFw* this, GlobalContext* globalCtx);
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ u8 type;
|
||||
/* 0x0001 */ u8 timer;
|
||||
/* 0x0002 */ u8 initialTimer;
|
||||
/* 0x0004 */ f32 scale;
|
||||
/* 0x0008 */ f32 scaleStep;
|
||||
/* 0x000C */ Color_RGBA8 color;
|
||||
/* 0x0010 */ char unk_10[4];
|
||||
/* 0x0014 */ Vec3f pos;
|
||||
/* 0x0020 */ Vec3f velocity;
|
||||
/* 0x002C */ Vec3f accel;
|
||||
} EnFwEffect;
|
||||
|
||||
typedef struct EnFw {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x5B4];
|
||||
/* 0x014C */ SkelAnime skelAnime;
|
||||
/* 0x0190 */ EnFwActionFunc actionFunc;
|
||||
/* 0x0194 */ ColliderJntSph collider;
|
||||
/* 0x01B4 */ ColliderJntSphItem sphs[1];
|
||||
/* 0x01F4 */ Vec3f bompPos;
|
||||
/* 0x0200 */ u8 lastDmgHook;
|
||||
/* 0x0202 */ s16 runDirection;
|
||||
/* 0x0204 */ s16 bounceCnt;
|
||||
/* 0x0206 */ char unk_206[0x2];
|
||||
/* 0x0208 */ s16 damageTimer;
|
||||
/* 0x020A */ s16 explosionTimer;
|
||||
/* 0x020C */ char unk_20C[0x2];
|
||||
/* 0x020E */ s16 slideTimer;
|
||||
/* 0x0210 */ s16 slideSfxTimer;
|
||||
/* 0x0212 */ s16 returnToParentTimer;
|
||||
/* 0x0214 */ s16 turnAround;
|
||||
/* 0x0218 */ f32 runRadius;
|
||||
/* 0x021C */ Vec3s limbDrawTable[11];
|
||||
/* 0x025E */ Vec3s transitionDrawTable[11];
|
||||
/* 0x02A0 */ EnFwEffect effects[20];
|
||||
} EnFw; // size = 0x0700
|
||||
|
||||
extern const ActorInit En_Fw_InitVars;
|
||||
|
|
|
@ -741,7 +741,7 @@ void EnSt_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
s32 pad;
|
||||
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 14.0f);
|
||||
SkelAnime_Init(globalCtx, &this->skelAnime, &D_06005298, NULL, this->limbDrawTable, this->transDrawTable, 30);
|
||||
SkelAnime_Init(globalCtx, &this->skelAnime, &D_06005298, NULL, this->limbDrawTable, this->transitionDrawTable, 30);
|
||||
func_80034EC0(&this->skelAnime, sAnimations, 0);
|
||||
this->blureIdx = EnSt_CreateBlureEffect(globalCtx);
|
||||
EnSt_InitColliders(this, globalCtx);
|
||||
|
|
|
@ -44,7 +44,7 @@ typedef struct EnSt {
|
|||
/* 0x040C */ f32 groundYOffset;
|
||||
/* 0x0410 */ s16 swayAngle;
|
||||
/* 0x0412 */ Vec3s limbDrawTable[30];
|
||||
/* 0x04C6 */ Vec3s transDrawTable[30];
|
||||
/* 0x04C6 */ Vec3s transitionDrawTable[30];
|
||||
} EnSt; // size = 0x057C
|
||||
|
||||
extern const ActorInit En_St_InitVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue