Armos and object_am OK (#652)

* started

* all but 2

* OK

* docs progress

* lots of docs

* add gitkeep back

* all funcs named

* small fix

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "0305ec2c2"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "0305ec2c2"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* object_am

* change

* ready i think

* last thing

* asm

* progress
This commit is contained in:
fig02
2021-02-15 13:41:55 -05:00
committed by GitHub
parent 79c8accfab
commit 982c645167
131 changed files with 1077 additions and 2585 deletions
+4 -4
View File
@@ -3566,13 +3566,13 @@ void func_8003424C(GlobalContext* globalCtx, Vec3f* arg1) {
CollisionCheck_SpawnShieldParticlesMetal(globalCtx, arg1);
}
void func_8003426C(Actor* actor, s16 arg1, s16 arg2, s16 arg3, s16 arg4) {
if ((arg1 == 0x8000) && !(arg2 & 0x8000)) {
void Actor_SetColorFilter(Actor* actor, s16 colorFlag, s16 colorIntensityMax, s16 xluFlag, s16 duration) {
if ((colorFlag == 0x8000) && !(colorIntensityMax & 0x8000)) {
Audio_PlayActorSound2(actor, NA_SE_EN_LIGHT_ARROW_HIT);
}
actor->colorFilterParams = arg1 | arg3 | ((arg2 & 0xF8) << 5) | arg4;
actor->colorFilterTimer = arg4;
actor->colorFilterParams = colorFlag | xluFlag | ((colorIntensityMax & 0xF8) << 5) | duration;
actor->colorFilterTimer = duration;
}
Hilite* func_800342EC(Vec3f* object, GlobalContext* globalCtx) {
@@ -458,7 +458,7 @@ void BgPoEvent_AmyWait(BgPoEvent* this, GlobalContext* globalCtx) {
if (this->collider.base.acFlags & AC_HIT) {
sPuzzleState |= 0x20;
this->timer = 5;
func_8003426C(&this->dyna.actor, 0x4000, 0xFF, 0, 5);
Actor_SetColorFilter(&this->dyna.actor, 0x4000, 0xFF, 0, 5);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_PO_LAUGH2);
this->actionFunc = BgPoEvent_AmyPuzzle;
}
+862 -41
View File
@@ -1,10 +1,12 @@
/*
* File: z_en_am.c
* Overlay: ovl_En_Am
* Description: Armos Statue
* Description: Armos
*/
#include "z_en_am.h"
#include "objects/object_am/object_am.h"
#include "overlays/actors/ovl_En_Bom/z_en_bom.h"
#define FLAGS 0x04000015
@@ -15,13 +17,30 @@ void EnAm_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnAm_Update(Actor* thisx, GlobalContext* globalCtx);
void EnAm_Draw(Actor* thisx, GlobalContext* globalCtx);
extern UNK_TYPE D_06000118;
extern UNK_TYPE D_06000238;
extern UNK_TYPE D_0600033C;
extern UNK_TYPE D_06005948;
extern UNK_TYPE D_06005B3C;
void EnAm_SetupStatue(EnAm* this);
void EnAm_SetupSleep(EnAm* this);
void EnAm_Statue(EnAm* this, GlobalContext* globalCtx);
void EnAm_Sleep(EnAm* this, GlobalContext* globalCtx);
void EnAm_Lunge(EnAm* this, GlobalContext* globalCtx);
void EnAm_RotateToHome(EnAm* this, GlobalContext* globalCtx);
void EnAm_MoveToHome(EnAm* this, GlobalContext* globalCtx);
void EnAm_RotateToInit(EnAm* this, GlobalContext* globalCtx);
void EnAm_Cooldown(EnAm* this, GlobalContext* globalCtx);
void EnAm_Ricochet(EnAm* this, GlobalContext* globalCtx);
void EnAm_Stunned(EnAm* this, GlobalContext* globalCtx);
void EnAm_RecoilFromDamage(EnAm* this, GlobalContext* globalCtx);
typedef enum {
/* 00 */ AM_BEHAVIOR_NONE,
/* 01 */ AM_BEHAVIOR_DAMAGED,
/* 03 */ AM_BEHAVIOR_DO_NOTHING = 3,
/* 05 */ AM_BEHAVIOR_5 = 5, // checked but never set
/* 06 */ AM_BEHAVIOR_STUNNED,
/* 07 */ AM_BEHAVIOR_GO_HOME,
/* 08 */ AM_BEHAVIOR_RICOCHET,
/* 10 */ AM_BEHAVIOR_AGGRO = 10
} ArmosBehavior;
/*
const ActorInit En_Am_InitVars = {
ACTOR_EN_AM,
ACTORCAT_ENEMY,
@@ -34,7 +53,7 @@ const ActorInit En_Am_InitVars = {
(ActorFunc)EnAm_Draw,
};
static ColliderCylinderInit D_809AFF80 = {
static ColliderCylinderInit sHurtCylinderInit = {
{
COLTYPE_HIT5,
AT_NONE,
@@ -54,7 +73,7 @@ static ColliderCylinderInit D_809AFF80 = {
{ 15, 70, 0, { 0, 0, 0 } },
};
static ColliderCylinderInit D_809AFFAC = {
static ColliderCylinderInit sBlockCylinderInit = {
{
COLTYPE_METAL,
AT_NONE,
@@ -74,7 +93,7 @@ static ColliderCylinderInit D_809AFFAC = {
{ 15, 70, 0, { 0, 0, 0 } },
};
static ColliderQuadInit D_809AFFD8 = {
static ColliderQuadInit sQuadInit = {
{
COLTYPE_NONE,
AT_ON | AT_TYPE_ENEMY,
@@ -93,63 +112,865 @@ static ColliderQuadInit D_809AFFD8 = {
},
{ { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } },
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809ADF20.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809ADF28.s")
typedef enum {
/* 00 */ AM_DMGEFF_NONE, // used by anything that cant kill the armos
/* 01 */ AM_DMGEFF_NUT,
/* 06 */ AM_DMGEFF_STUN = 6, // doesnt include deku nuts
/* 13 */ AM_DMGEFF_ICE = 13,
/* 14 */ AM_DMGEFF_MAGIC_FIRE_LIGHT,
/* 15 */ AM_DMGEFF_KILL // any damage source that can kill the armos (and isnt a special case)
} ArmosDamageEffect;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/EnAm_Init.s")
static DamageTable sDamageTable = {
/* Deku nut */ DMG_ENTRY(0, AM_DMGEFF_NUT),
/* Deku stick */ DMG_ENTRY(2, AM_DMGEFF_NONE),
/* Slingshot */ DMG_ENTRY(1, AM_DMGEFF_NONE),
/* Explosive */ DMG_ENTRY(2, AM_DMGEFF_KILL),
/* Boomerang */ DMG_ENTRY(0, AM_DMGEFF_STUN),
/* Normal arrow */ DMG_ENTRY(2, AM_DMGEFF_KILL),
/* Hammer swing */ DMG_ENTRY(2, AM_DMGEFF_KILL),
/* Hookshot */ DMG_ENTRY(0, AM_DMGEFF_STUN),
/* Kokiri sword */ DMG_ENTRY(1, AM_DMGEFF_NONE),
/* Master sword */ DMG_ENTRY(2, AM_DMGEFF_KILL),
/* Giant's Knife */ DMG_ENTRY(4, AM_DMGEFF_KILL),
/* Fire arrow */ DMG_ENTRY(2, AM_DMGEFF_KILL),
/* Ice arrow */ DMG_ENTRY(4, AM_DMGEFF_ICE),
/* Light arrow */ DMG_ENTRY(2, AM_DMGEFF_KILL),
/* Unk arrow 1 */ DMG_ENTRY(2, AM_DMGEFF_NONE),
/* Unk arrow 2 */ DMG_ENTRY(2, AM_DMGEFF_NONE),
/* Unk arrow 3 */ DMG_ENTRY(2, AM_DMGEFF_NONE),
/* Fire magic */ DMG_ENTRY(0, AM_DMGEFF_MAGIC_FIRE_LIGHT),
/* Ice magic */ DMG_ENTRY(3, AM_DMGEFF_ICE),
/* Light magic */ DMG_ENTRY(0, AM_DMGEFF_MAGIC_FIRE_LIGHT),
/* Shield */ DMG_ENTRY(0, AM_DMGEFF_NONE),
/* Mirror Ray */ DMG_ENTRY(0, AM_DMGEFF_NONE),
/* Kokiri spin */ DMG_ENTRY(1, AM_DMGEFF_NONE),
/* Giant spin */ DMG_ENTRY(4, AM_DMGEFF_KILL),
/* Master spin */ DMG_ENTRY(2, AM_DMGEFF_KILL),
/* Kokiri jump */ DMG_ENTRY(2, AM_DMGEFF_NONE),
/* Giant jump */ DMG_ENTRY(8, AM_DMGEFF_KILL),
/* Master jump */ DMG_ENTRY(4, AM_DMGEFF_KILL),
/* Unknown 1 */ DMG_ENTRY(0, AM_DMGEFF_NONE),
/* Unblockable */ DMG_ENTRY(0, AM_DMGEFF_NONE),
/* Hammer jump */ DMG_ENTRY(4, AM_DMGEFF_KILL),
/* Unknown 2 */ DMG_ENTRY(0, AM_DMGEFF_NONE),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/EnAm_Destroy.s")
static InitChainEntry sInitChain[] = {
ICHAIN_S8(naviEnemyId, 19, ICHAIN_CONTINUE),
ICHAIN_F32_DIV1000(gravity, -4000, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 5300, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AE270.s")
void EnAm_SetupAction(EnAm* this, EnAmActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AE40C.s")
/**
* Checks bgCheckFlags in the direction of current yaw at the specified distance.
*
* Returns true if the armos would land on the ground in the resulting position.
*
* If it won't land on the ground, it will return true anyway if the floor the armos will be on
* is no more than 20 units lower than the home position. This prevents the armos from going down steep slopes.
*/
s32 EnAm_CanMove(EnAm* this, GlobalContext* globalCtx, f32 distance, s16 yaw) {
s16 ret;
s16 curBgCheckFlags;
f32 sin;
f32 cos;
Vec3f curPos;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AE4A8.s")
// save current position and bgCheckFlags to restore later
curPos = this->dyna.actor.world.pos;
curBgCheckFlags = this->dyna.actor.bgCheckFlags;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AE538.s")
sin = Math_SinS(yaw) * distance;
cos = Math_CosS(yaw) * distance;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AE59C.s")
this->dyna.actor.world.pos.x += sin;
this->dyna.actor.world.pos.z += cos;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AE608.s")
Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4);
this->dyna.actor.world.pos = curPos;
ret = this->dyna.actor.bgCheckFlags & 1;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AE664.s")
if (!ret && (this->dyna.actor.floorHeight >= (this->dyna.actor.home.pos.y - 20.0f))) {
ret = true;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AE6C0.s")
this->dyna.actor.bgCheckFlags = curBgCheckFlags;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AE71C.s")
return ret;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AE7F4.s")
void EnAm_Init(Actor* thisx, GlobalContext* globalCtx) {
CollisionHeader* colHeader = NULL;
s32 pad;
EnAm* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AE8A8.s")
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 48.0f);
SkelAnime_Init(globalCtx, &this->skelAnime, &gArmosSkel, &gArmosRicochetAnim, this->jointTable, this->morphTable,
14);
Actor_SetScale(&this->dyna.actor, 0.01f);
DynaPolyActor_Init(&this->dyna, DPM_UNK);
Collider_InitCylinder(globalCtx, &this->hurtCollider);
Collider_InitCylinder(globalCtx, &this->blockCollider);
Collider_SetCylinder(globalCtx, &this->hurtCollider, &this->dyna.actor, &sHurtCylinderInit);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AEB14.s")
if (this->dyna.actor.params == ARMOS_STATUE) {
this->dyna.actor.colChkInfo.health = 1;
Collider_SetCylinder(globalCtx, &this->blockCollider, &this->dyna.actor, &sHurtCylinderInit);
this->hurtCollider.base.ocFlags1 = (OC1_ON | OC1_NO_PUSH | OC1_TYPE_1 | OC1_TYPE_2);
this->blockCollider.base.ocFlags1 = (OC1_ON | OC1_NO_PUSH | OC1_TYPE_PLAYER);
CollisionHeader_GetVirtual(&gArmosCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, &this->dyna.actor, ACTORCAT_BG);
EnAm_SetupStatue(this);
} else {
Collider_SetCylinder(globalCtx, &this->blockCollider, &this->dyna.actor, &sBlockCylinderInit);
Collider_InitQuad(globalCtx, &this->hitCollider);
Collider_SetQuad(globalCtx, &this->hitCollider, &this->dyna.actor, &sQuadInit);
this->dyna.actor.colChkInfo.health = 1;
this->dyna.actor.colChkInfo.damageTable = &sDamageTable;
EnAm_SetupSleep(this);
this->unk_258 = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AEC1C.s")
this->dyna.actor.colChkInfo.mass = MASS_HEAVY;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AED8C.s")
void EnAm_Destroy(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnAm* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AEF00.s")
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
Collider_DestroyCylinder(globalCtx, &this->hurtCollider);
Collider_DestroyCylinder(globalCtx, &this->blockCollider);
//! @bug Quad collider is not destroyed (though destroy doesnt really do anything anyway)
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AEFA4.s")
void EnAm_SpawnEffects(EnAm* this, GlobalContext* globalCtx) {
static Vec3f velocity = { 0.0f, -1.5f, 0.0f };
static Vec3f accel = { 0.0f, -0.2f, 0.0f };
s32 i;
Vec3f pos;
Color_RGBA8 primColor = { 100, 100, 100, 0 };
Color_RGBA8 envColor = { 40, 40, 40, 0 };
s32 pad;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AF0DC.s")
for (i = 4; i > 0; i--) {
pos.x = this->dyna.actor.world.pos.x + ((Rand_ZeroOne() - 0.5f) * 65.0f);
pos.y = (this->dyna.actor.world.pos.y + 40.0f) + ((Rand_ZeroOne() - 0.5f) * 10.0f);
pos.z = this->dyna.actor.world.pos.z + ((Rand_ZeroOne() - 0.5f) * 65.0f);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AF30C.s")
EffectSsKiraKira_SpawnSmall(globalCtx, &pos, &velocity, &accel, &primColor, &envColor);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AF558.s")
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_AMOS_WALK);
func_80033260(globalCtx, &this->dyna.actor, &this->dyna.actor.world.pos, 4.0f, 3, 8.0f, 0x12C, 0xF, 0);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AF644.s")
void EnAm_SetupSleep(EnAm* this) {
f32 lastFrame = Animation_GetLastFrame(&gArmosRicochetAnim);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AF718.s")
Animation_Change(&this->skelAnime, &gArmosRicochetAnim, 0.0f, lastFrame, lastFrame, ANIMMODE_LOOP, 0.0f);
this->behavior = AM_BEHAVIOR_DO_NOTHING;
this->dyna.actor.speedXZ = 0.0f;
this->unk_258 = (this->textureBlend == 255) ? 0 : 1;
EnAm_SetupAction(this, EnAm_Sleep);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AF7CC.s")
void EnAm_SetupStatue(EnAm* this) {
f32 lastFrame = Animation_GetLastFrame(&gArmosRicochetAnim);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AF864.s")
Animation_Change(&this->skelAnime, &gArmosRicochetAnim, 0.0f, lastFrame, lastFrame, ANIMMODE_LOOP, 0.0f);
this->dyna.actor.flags &= ~1;
this->behavior = AM_BEHAVIOR_DO_NOTHING;
this->dyna.actor.speedXZ = 0.0f;
EnAm_SetupAction(this, EnAm_Statue);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/EnAm_Update.s")
void EnAm_SetupLunge(EnAm* this) {
Animation_PlayLoopSetSpeed(&this->skelAnime, &gArmosHopAnim, 4.0f);
this->unk_258 = 3;
this->behavior = AM_BEHAVIOR_AGGRO;
this->dyna.actor.speedXZ = 0.0f;
this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y;
EnAm_SetupAction(this, EnAm_Lunge);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/func_809AFD9C.s")
void EnAm_SetupCooldown(EnAm* this) {
Animation_PlayLoopSetSpeed(&this->skelAnime, &gArmosHopAnim, 4.0f);
this->unk_258 = 3;
this->cooldownTimer = 40;
this->behavior = AM_BEHAVIOR_AGGRO;
this->dyna.actor.speedXZ = 0.0f;
this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y;
EnAm_SetupAction(this, EnAm_Cooldown);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Am/EnAm_Draw.s")
void EnAm_SetupMoveToHome(EnAm* this) {
Animation_PlayLoopSetSpeed(&this->skelAnime, &gArmosHopAnim, 4.0f);
this->behavior = AM_BEHAVIOR_GO_HOME;
this->unk_258 = 1;
this->dyna.actor.speedXZ = 0.0f;
EnAm_SetupAction(this, EnAm_MoveToHome);
}
void EnAm_SetupRotateToInit(EnAm* this) {
Animation_PlayLoopSetSpeed(&this->skelAnime, &gArmosHopAnim, 4.0f);
this->behavior = AM_BEHAVIOR_GO_HOME;
this->unk_258 = 1;
this->dyna.actor.speedXZ = 0.0f;
EnAm_SetupAction(this, EnAm_RotateToInit);
}
void EnAm_SetupRotateToHome(EnAm* this) {
Animation_PlayLoopSetSpeed(&this->skelAnime, &gArmosHopAnim, 4.0f);
this->behavior = AM_BEHAVIOR_GO_HOME;
this->dyna.actor.speedXZ = 0.0f;
this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y;
EnAm_SetupAction(this, EnAm_RotateToHome);
}
void EnAm_SetupRecoilFromDamage(EnAm* this, GlobalContext* globalCtx) {
Animation_Change(&this->skelAnime, &gArmosDamagedAnim, 1.0f, 4.0f,
Animation_GetLastFrame(&gArmosDamagedAnim) - 6.0f, ANIMMODE_ONCE, 0.0f);
this->behavior = AM_BEHAVIOR_DAMAGED;
this->dyna.actor.world.rot.y = this->dyna.actor.yawTowardsPlayer;
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_AMOS_DAMAGE);
if (EnAm_CanMove(this, globalCtx, -6.0f, this->dyna.actor.world.rot.y)) {
this->dyna.actor.speedXZ = -6.0f;
}
this->dyna.actor.colorFilterTimer = 0;
func_80032C7C(globalCtx, &this->dyna.actor);
EnAm_SetupAction(this, EnAm_RecoilFromDamage);
}
void EnAm_SetupRicochet(EnAm* this, GlobalContext* globalCtx) {
Animation_Change(&this->skelAnime, &gArmosRicochetAnim, 1.0f, 0.0f, 8.0f, ANIMMODE_ONCE, 0.0f);
this->dyna.actor.world.rot.y = this->dyna.actor.yawTowardsPlayer;
if (EnAm_CanMove(this, globalCtx, -6.0f, this->dyna.actor.world.rot.y)) {
this->dyna.actor.speedXZ = -6.0f;
}
this->unk_264 = 0;
this->unk_258 = 0;
this->cooldownTimer = 5;
this->behavior = AM_BEHAVIOR_RICOCHET;
EnAm_SetupAction(this, EnAm_Ricochet);
}
void EnAm_Sleep(EnAm* this, GlobalContext* globalCtx) {
f32 cos;
s32 pad;
f32 rand;
f32 sin;
Player* player = PLAYER;
if ((this->unk_258 != 0) ||
((this->hurtCollider.base.ocFlags1 & OC1_HIT) && (this->hurtCollider.base.oc == &player->actor)) ||
(this->hurtCollider.base.acFlags & AC_HIT)) {
this->hurtCollider.base.acFlags &= ~AC_HIT;
if (this->textureBlend == 0) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_AMOS_WAVE);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_AMOS_VOICE);
Actor_SetColorFilter(&this->dyna.actor, 0x4000, 255, 0, 8);
}
if (this->textureBlend >= 240) {
this->attackTimer = 200;
this->textureBlend = 255;
this->dyna.actor.flags |= 1;
this->dyna.actor.shape.yOffset = 0.0f;
EnAm_SetupLunge(this);
} else {
// shake randomly about the origin while waking up
rand = (Rand_ZeroOne() - 0.5f) * 10.0f;
cos = Math_CosS(this->dyna.actor.shape.rot.y) * rand;
sin = Math_SinS(this->dyna.actor.shape.rot.y) * rand;
this->dyna.actor.world.pos.x = this->shakeOrigin.x + cos;
this->dyna.actor.world.pos.z = this->shakeOrigin.z + sin;
this->textureBlend += 20;
this->unk_258 = 1;
}
} else {
if (this->textureBlend > 10) {
this->textureBlend -= 10;
} else {
this->textureBlend = 0;
this->dyna.actor.flags &= ~1;
if (this->dyna.bgId < 0) {
this->unk_264 = 0;
}
this->dyna.actor.speedXZ += this->dyna.unk_150;
this->shakeOrigin = this->dyna.actor.world.pos;
this->dyna.actor.world.rot.y = this->dyna.unk_158;
this->dyna.actor.speedXZ = CLAMP(this->dyna.actor.speedXZ, -2.5f, 2.5f);
Math_SmoothStepToF(&this->dyna.actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f);
if (this->dyna.actor.speedXZ != 0.0f) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG);
}
this->dyna.unk_154 = 0.0f;
this->dyna.unk_150 = 0.0f;
}
}
}
/**
* Spin toward the direction of the home position to start moving back to it.
*/
void EnAm_RotateToHome(EnAm* this, GlobalContext* globalCtx) {
s16 yawToHome = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &this->dyna.actor.home.pos);
if (this->skelAnime.curFrame == 8.0f) {
Math_SmoothStepToS(&this->dyna.actor.world.rot.y, yawToHome, 1, 0x1F40, 0);
this->dyna.actor.velocity.y = 12.0f;
} else if (this->skelAnime.curFrame > 11.0f) {
if (!(this->dyna.actor.bgCheckFlags & 1)) {
this->skelAnime.curFrame = 11;
} else {
EnAm_SpawnEffects(this, globalCtx);
if (this->dyna.actor.world.rot.y == yawToHome) {
this->unk_258 = 0;
}
this->dyna.actor.velocity.y = 0.0f;
this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight;
}
}
SkelAnime_Update(&this->skelAnime);
if (this->unk_258 == 0) {
EnAm_SetupMoveToHome(this);
}
this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y;
}
/**
* After reaching the home position, spin back to the starting rotation.
*/
void EnAm_RotateToInit(EnAm* this, GlobalContext* globalCtx) {
if (this->skelAnime.curFrame == 8.0f) {
if ((this->dyna.actor.world.pos.x == this->dyna.actor.home.pos.x) &&
(this->dyna.actor.world.pos.z == this->dyna.actor.home.pos.z)) {
Math_SmoothStepToS(&this->dyna.actor.world.rot.y, this->dyna.actor.home.rot.y, 1, 0x1F40, 0);
}
this->unk_258 = 2;
this->dyna.actor.velocity.y = 12.0f;
} else if (this->skelAnime.curFrame > 11.0f) {
if (!(this->dyna.actor.bgCheckFlags & 1)) {
this->skelAnime.curFrame = 11;
} else {
this->unk_258 = 1;
EnAm_SpawnEffects(this, globalCtx);
if (this->dyna.actor.home.rot.y == this->dyna.actor.world.rot.y) {
this->unk_258 = 0;
}
this->dyna.actor.velocity.y = 0.0f;
this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight;
}
}
if (this->unk_258 == 2) {
Math_SmoothStepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x, 1.0f, 8.0f, 0.0f);
Math_SmoothStepToF(&this->dyna.actor.world.pos.z, this->dyna.actor.home.pos.z, 1.0f, 8.0f, 0.0f);
}
SkelAnime_Update(&this->skelAnime);
if (this->unk_258 == 0) {
EnAm_SetupSleep(this);
}
this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y;
}
void EnAm_MoveToHome(EnAm* this, GlobalContext* globalCtx) {
s16 yawToHome = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &this->dyna.actor.home.pos);
if (this->skelAnime.curFrame == 8.0f) {
this->dyna.actor.velocity.y = 12.0f;
this->dyna.actor.speedXZ = 6.0f;
} else if (this->skelAnime.curFrame > 11.0f) {
if (!(this->dyna.actor.bgCheckFlags & 1)) {
this->skelAnime.curFrame = 11;
} else {
Math_SmoothStepToS(&this->dyna.actor.world.rot.y, yawToHome, 1, 0xBB8, 0);
if (this->dyna.actor.bgCheckFlags & 2) {
this->unk_258--;
}
this->dyna.actor.velocity.y = 0.0f;
this->dyna.actor.speedXZ = 0.0f;
this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight;
EnAm_SpawnEffects(this, globalCtx);
if (Actor_WorldDistXYZToPoint(&this->dyna.actor, &this->dyna.actor.home.pos) < 80.0f) {
EnAm_SetupRotateToInit(this);
}
}
}
// turn away from a wall if touching one
if ((this->dyna.actor.speedXZ != 0.0f) && (this->dyna.actor.bgCheckFlags & 8)) {
this->dyna.actor.world.rot.y = this->dyna.actor.wallYaw;
Actor_MoveForward(&this->dyna.actor);
}
SkelAnime_Update(&this->skelAnime);
this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y;
}
void EnAm_RecoilFromDamage(EnAm* this, GlobalContext* globalCtx) {
if (this->dyna.actor.speedXZ < 0.0f) {
this->dyna.actor.speedXZ += 0.5f;
}
if ((this->dyna.actor.velocity.y <= 0.0f) && !EnAm_CanMove(this, globalCtx, -8.0f, this->dyna.actor.world.rot.y)) {
this->dyna.actor.speedXZ = 0.0f;
}
if (SkelAnime_Update(&this->skelAnime)) {
EnAm_SetupLunge(this);
this->deathTimer = 64;
this->panicSpinRot = 0;
}
}
/**
* After doing 3 lunges, wait for 2 seconds before attacking again.
* Turn toward the player before lunging again.
*/
void EnAm_Cooldown(EnAm* this, GlobalContext* globalCtx) {
s16 yawDiff = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.world.rot.y;
yawDiff = ABS(yawDiff);
if (this->cooldownTimer != 0) {
this->cooldownTimer--;
} else {
if (this->skelAnime.curFrame == 8.0f) {
Math_SmoothStepToS(&this->dyna.actor.world.rot.y, this->dyna.actor.yawTowardsPlayer, 1, 0x1F40, 0);
this->dyna.actor.velocity.y = 12.0f;
} else if (this->skelAnime.curFrame > 11.0f) {
if (!(this->dyna.actor.bgCheckFlags & 1)) {
this->skelAnime.curFrame = 11;
} else {
if (yawDiff < 3500) {
this->unk_258 = 0;
}
this->dyna.actor.velocity.y = 0.0f;
this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight;
EnAm_SpawnEffects(this, globalCtx);
}
}
SkelAnime_Update(&this->skelAnime);
if (this->unk_258 == 0) {
EnAm_SetupLunge(this);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_AMOS_VOICE);
}
this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y;
}
}
/**
* Lunge toward the player in an attempt to deal damage. Hop 3 times.
* Used for both normal attacks and the death sequence.
*/
void EnAm_Lunge(EnAm* this, GlobalContext* globalCtx) {
if (this->deathTimer < 52) {
if (this->skelAnime.curFrame == 8.0f) {
this->dyna.actor.velocity.y = 12.0f;
if (EnAm_CanMove(this, globalCtx, 80.0f, this->dyna.actor.world.rot.y)) {
this->dyna.actor.speedXZ = 6.0f;
} else {
this->dyna.actor.speedXZ = 0.0f;
}
this->unk_264 = 1;
this->hitCollider.base.atFlags &= ~(AT_HIT | AT_BOUNCED);
} else if (this->skelAnime.curFrame > 11.0f) {
if (!(this->dyna.actor.bgCheckFlags & 1)) {
this->skelAnime.curFrame = 11;
} else {
Math_SmoothStepToS(&this->dyna.actor.world.rot.y, this->dyna.actor.yawTowardsPlayer, 1, 0x1770, 0);
if (this->dyna.actor.bgCheckFlags & 2) {
this->unk_258--;
}
this->dyna.actor.velocity.y = 0.0f;
this->dyna.actor.speedXZ = 0.0f;
this->unk_264 = 0;
this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight;
EnAm_SpawnEffects(this, globalCtx);
if (((Actor_WorldDistXZToPoint(&this->dyna.actor, &this->dyna.actor.home.pos) > 240.0f) ||
(this->attackTimer == 0)) &&
(this->deathTimer == 0)) {
EnAm_SetupRotateToHome(this);
}
}
}
// turn and move away from a wall if contact is made with one
if ((this->dyna.actor.speedXZ != 0.0f) && (this->dyna.actor.bgCheckFlags & 8)) {
this->dyna.actor.world.rot.y =
(this->dyna.actor.wallYaw - this->dyna.actor.world.rot.y) + this->dyna.actor.wallYaw;
Actor_MoveForward(&this->dyna.actor);
this->dyna.actor.bgCheckFlags &= ~8;
}
SkelAnime_Update(&this->skelAnime);
if ((this->unk_258 == 0) && (this->deathTimer == 0)) {
EnAm_SetupCooldown(this);
}
if (this->deathTimer == 0) {
this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y;
} else {
if (this->panicSpinRot < 8000) {
this->panicSpinRot += 800;
}
this->dyna.actor.shape.rot.y += this->panicSpinRot;
}
}
}
void EnAm_Statue(EnAm* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
f32 temp158f = this->dyna.unk_158;
s16 moveDir = 0;
if (this->unk_258 == 0) {
if (this->dyna.unk_150 != 0.0f) {
this->unk_258 = 0x8000;
}
} else {
this->unk_258 -= 0x800;
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG);
if (this->dyna.unk_150 < 0.0f) {
temp158f = this->dyna.unk_158 + 0x8000;
}
if (this->hurtCollider.base.ocFlags1 & OC1_HIT) {
moveDir = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &this->hurtCollider.base.oc->world.pos) - temp158f;
}
if ((this->dyna.unk_150 == 0.0f) || (this->unk_258 == 0) || !(this->dyna.actor.bgCheckFlags & 1) ||
!func_800435D8(globalCtx, &this->dyna, 0x14,
(Math_SinS(this->unk_258) * (this->dyna.unk_150 * 0.5f)) + 40.0f, 0xA) ||
((this->hurtCollider.base.ocFlags1 & OC1_HIT) && (ABS(moveDir) <= 0x2000))) {
this->unk_258 = 0;
player->stateFlags2 &= ~0x151;
player->actor.speedXZ = 0.0f;
this->dyna.unk_150 = this->dyna.unk_154 = 0.0f;
}
this->dyna.actor.world.rot.y = this->dyna.unk_158;
this->dyna.actor.speedXZ = Math_SinS(this->unk_258) * (this->dyna.unk_150 * 0.5f);
}
if (this->dyna.actor.bgCheckFlags & 2) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
}
this->dyna.unk_150 = this->dyna.unk_154 = 0.0f;
}
void EnAm_SetupStunned(EnAm* this, GlobalContext* globalCtx) {
// animation is set but SkelAnime_Update is not called in the action
// likely copy pasted from EnAm_SetupRecoilFromDamage
Animation_Change(&this->skelAnime, &gArmosDamagedAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gArmosDamagedAnim),
ANIMMODE_ONCE, 0.0f);
this->dyna.actor.world.rot.y = this->dyna.actor.yawTowardsPlayer;
if (EnAm_CanMove(this, globalCtx, -6.0f, this->dyna.actor.world.rot.y)) {
this->dyna.actor.speedXZ = -6.0f;
}
Actor_SetColorFilter(&this->dyna.actor, 0, 120, 0, 100);
if (this->damageEffect == AM_DMGEFF_ICE) {
this->iceTimer = 48;
}
this->behavior = AM_BEHAVIOR_STUNNED;
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_GOMA_JR_FREEZE);
EnAm_SetupAction(this, EnAm_Stunned);
}
void EnAm_Stunned(EnAm* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&this->dyna.actor.shape.rot.y, this->dyna.actor.world.rot.y, 1, 0xFA0, 0);
if (this->dyna.actor.speedXZ < 0.0f) {
this->dyna.actor.speedXZ += 0.5f;
}
if ((this->dyna.actor.velocity.y <= 0.0f) && !EnAm_CanMove(this, globalCtx, -9.0f, this->dyna.actor.world.rot.y)) {
this->dyna.actor.speedXZ = 0.0f;
}
if (this->dyna.actor.colorFilterTimer == 0) {
if (this->dyna.actor.colChkInfo.health != 0) {
EnAm_SetupLunge(this);
} else {
EnAm_SetupRecoilFromDamage(this, globalCtx);
}
}
}
void EnAm_Ricochet(EnAm* this, GlobalContext* globalCtx) {
if (this->dyna.actor.speedXZ < 0.0f) {
this->dyna.actor.speedXZ += 0.5f;
}
if ((this->dyna.actor.velocity.y <= 0.0f) &&
!EnAm_CanMove(this, globalCtx, this->dyna.actor.speedXZ * 1.5f, this->dyna.actor.world.rot.y)) {
this->dyna.actor.speedXZ = 0.0f;
}
if (SkelAnime_Update(&this->skelAnime)) {
this->dyna.actor.speedXZ = 0.0f;
EnAm_SetupLunge(this);
}
}
void EnAm_TransformSwordHitbox(Actor* thisx, GlobalContext* globalCtx) {
static Vec3f D_809B0074 = { 2500.0f, 7000.0f, 0.0f };
static Vec3f D_809B0080 = { -2500.0f, 0.0f, 0.0f };
static Vec3f D_809B008C = { 2500.0f, 7000.0f, 4000.0f };
static Vec3f D_809B0098 = { -2500.0f, 0.0f, 4000.0f };
EnAm* this = THIS;
Matrix_MultVec3f(&D_809B0074, &this->hitCollider.dim.quad[1]);
Matrix_MultVec3f(&D_809B0080, &this->hitCollider.dim.quad[0]);
Matrix_MultVec3f(&D_809B008C, &this->hitCollider.dim.quad[3]);
Matrix_MultVec3f(&D_809B0098, &this->hitCollider.dim.quad[2]);
Collider_SetQuadVertices(&this->hitCollider, &this->hitCollider.dim.quad[0], &this->hitCollider.dim.quad[1],
&this->hitCollider.dim.quad[2], &this->hitCollider.dim.quad[3]);
}
void EnAm_UpdateDamage(EnAm* this, GlobalContext* globalCtx) {
s32 pad;
Vec3f sparkPos;
if (this->deathTimer == 0) {
if (this->blockCollider.base.acFlags & AC_BOUNCED) {
this->blockCollider.base.acFlags &= ~(AC_HIT | AC_BOUNCED);
this->hurtCollider.base.acFlags &= ~AC_HIT;
if (this->behavior >= AM_BEHAVIOR_5) {
EnAm_SetupRicochet(this, globalCtx);
}
} else if ((this->hurtCollider.base.acFlags & AC_HIT) && (this->behavior >= AM_BEHAVIOR_5)) {
this->hurtCollider.base.acFlags &= ~AC_HIT;
if (this->dyna.actor.colChkInfo.damageEffect != AM_DMGEFF_MAGIC_FIRE_LIGHT) {
this->unk_264 = 0;
this->damageEffect = this->dyna.actor.colChkInfo.damageEffect;
func_80035650(&this->dyna.actor, &this->hurtCollider.info, 0);
if ((this->dyna.actor.colChkInfo.damageEffect == AM_DMGEFF_NUT) ||
(this->dyna.actor.colChkInfo.damageEffect == AM_DMGEFF_STUN) ||
(this->dyna.actor.colChkInfo.damageEffect == AM_DMGEFF_ICE)) {
if (this->behavior != AM_BEHAVIOR_STUNNED) {
EnAm_SetupStunned(this, globalCtx);
if (this->dyna.actor.colChkInfo.damage != 0) {
this->dyna.actor.colChkInfo.health = 0;
}
} else if (this->dyna.actor.colChkInfo.damageEffect == AM_DMGEFF_STUN) {
sparkPos = this->dyna.actor.world.pos;
sparkPos.y += 50.0f;
CollisionCheck_SpawnShieldParticlesMetal(globalCtx, &sparkPos);
}
} else if ((this->dyna.actor.colChkInfo.damageEffect == AM_DMGEFF_KILL) ||
(this->behavior == AM_BEHAVIOR_STUNNED)) {
this->dyna.actor.colChkInfo.health = 0;
EnAm_SetupRecoilFromDamage(this, globalCtx);
} else {
EnAm_SetupRicochet(this, globalCtx);
}
}
}
}
}
void EnAm_Update(Actor* thisx, GlobalContext* globalCtx) {
static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
static Color_RGBA8 dustPrimColor = { 150, 150, 150, 255 };
static Color_RGBA8 dustEnvColor = { 100, 100, 100, 150 };
s32 pad;
EnAm* this = THIS;
EnBom* bomb;
Vec3f dustPos;
s32 i;
f32 dustPosScale;
s32 pad1;
if (this->dyna.actor.params != ARMOS_STATUE) {
EnAm_UpdateDamage(this, globalCtx);
}
if (this->dyna.actor.colChkInfo.damageEffect != AM_DMGEFF_MAGIC_FIRE_LIGHT) {
if (this->attackTimer != 0) {
this->attackTimer--;
}
this->actionFunc(this, globalCtx);
if (this->deathTimer != 0) {
this->deathTimer--;
if (this->deathTimer == 0) {
dustPosScale = globalCtx->gameplayFrames * 10;
EnAm_SpawnEffects(this, globalCtx);
bomb =
(EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->dyna.actor.world.pos.x,
this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, 0, 2, BOMB_BODY);
if (bomb != NULL) {
bomb->timer = 0;
}
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_AMOS_DEAD);
Item_DropCollectibleRandom(globalCtx, &this->dyna.actor, &this->dyna.actor.world.pos, 0xA0);
for (i = 9; i >= 0; i--) {
dustPos.x = (sinf(dustPosScale) * 7.0f) + this->dyna.actor.world.pos.x;
dustPos.y = (Rand_CenteredFloat(10.0f) * 6.0f) + (this->dyna.actor.world.pos.y + 40.0f);
dustPos.z = (cosf(dustPosScale) * 7.0f) + this->dyna.actor.world.pos.z;
func_8002836C(globalCtx, &dustPos, &zeroVec, &zeroVec, &dustPrimColor, &dustEnvColor, 200, 45, 12);
dustPosScale += 60.0f;
}
Actor_Kill(&this->dyna.actor);
return;
}
if ((this->deathTimer % 4) == 0) {
Actor_SetColorFilter(&this->dyna.actor, 0x4000, 255, 0, 4);
}
}
Actor_MoveForward(&this->dyna.actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 20.0f, 28.0f, 80.0f, 0x1D);
}
Collider_UpdateCylinder(&this->dyna.actor, &this->hurtCollider);
Collider_UpdateCylinder(&this->dyna.actor, &this->blockCollider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->hurtCollider.base);
if (this->dyna.actor.params != ARMOS_STATUE) {
Actor_SetFocus(&this->dyna.actor, this->dyna.actor.scale.x * 4500.0f);
if (this->dyna.actor.colorFilterTimer == 0) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->blockCollider.base);
}
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->hurtCollider.base);
if ((this->behavior >= 4) && (this->unk_264 > 0)) {
if (!(this->hitCollider.base.atFlags & AT_BOUNCED)) {
if (this->hitCollider.base.atFlags & AT_HIT) {
Player* player = PLAYER;
if (this->hitCollider.base.at == &player->actor) {
Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT);
}
}
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->hitCollider.base);
} else {
this->hitCollider.base.atFlags &= ~(AT_HIT | AT_BOUNCED);
this->hitCollider.base.at = NULL;
EnAm_SetupRicochet(this, globalCtx);
}
}
} else {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->blockCollider.base);
}
}
static Vec3f sUnused1 = { 1100.0f, -700.0f, 0.0f };
static Vec3f sUnused2 = { 0.0f, 0.0f, 0.0f };
void EnAm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
EnAm* this = THIS;
if ((limbIndex == 1) && (this->unk_264 != 0)) {
EnAm_TransformSwordHitbox(&this->dyna.actor, globalCtx);
}
}
Vec3f sIcePosOffsets[] = {
{ 20.0f, 40.0f, 0.0f }, { 10.0f, 60.0f, 10.0f }, { -10.0f, 60.0f, 10.0f }, { -20.0f, 40.0f, 0.0f },
{ 10.0f, 60.0f, -10.0f }, { -10.0f, 60.0f, -10.0f }, { 0.0f, 40.0f, -20.0f }, { 10.0f, 20.0f, 10.0f },
{ 10.0f, 20.0f, -10.0f }, { 0.0f, 40.0f, 20.0f }, { -10.0f, 20.0f, 10.0f }, { -10.0f, 20.0f, -10.0f },
};
void EnAm_Draw(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
Vec3f sp68;
EnAm* this = THIS;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_am.c", 1580);
func_80093D18(globalCtx->state.gfxCtx);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->textureBlend);
SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnAm_PostLimbDraw, this);
if (this->iceTimer != 0) {
this->dyna.actor.colorFilterTimer++;
if (1) {};
this->iceTimer--;
if ((this->iceTimer % 4) == 0) {
s32 index;
index = this->iceTimer >> 2;
sp68.x = this->dyna.actor.world.pos.x + sIcePosOffsets[index].x;
sp68.y = this->dyna.actor.world.pos.y + sIcePosOffsets[index].y;
sp68.z = this->dyna.actor.world.pos.z + sIcePosOffsets[index].z;
EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->dyna.actor, &sp68, 150, 150, 150, 250, 235, 245, 255,
1.4f);
}
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_am.c", 1605);
}
+26 -2
View File
@@ -6,11 +6,35 @@
struct EnAm;
typedef void (*EnAmActionFunc)(struct EnAm*, GlobalContext*);
typedef struct EnAm {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x240];
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ SkelAnime skelAnime;
/* 0x01A8 */ s32 behavior;
/* 0x01AC */ Vec3s jointTable[14];
/* 0x0200 */ Vec3s morphTable[14];
/* 0x0254 */ EnAmActionFunc actionFunc;
/* 0x0258 */ s16 unk_258;
/* 0x025A */ s16 cooldownTimer;
/* 0x025C */ s16 attackTimer; // start going back home after reaching 0
/* 0x025E */ s16 iceTimer;
/* 0x0260 */ s16 deathTimer; // explode after reaching 0
/* 0x0262 */ s16 panicSpinRot; // used when panicking before death
/* 0x0264 */ s16 unk_264;
/* 0x0266 */ u8 textureBlend; // 0 = statue textures; 255 = enemy textures
/* 0x0267 */ u8 damageEffect;
/* 0x0267 */ Vec3f shakeOrigin; // center point to shake around when waking up
/* 0x0274 */ ColliderCylinder hurtCollider;
/* 0x02C0 */ ColliderCylinder blockCollider;
/* 0x030C */ ColliderQuad hitCollider;
} EnAm; // size = 0x038C
typedef enum {
/* 0 */ ARMOS_STATUE,
/* 1 */ ARMOS_ENEMY
} ArmosType;
extern const ActorInit En_Am_InitVars;
#endif
+7 -7
View File
@@ -516,7 +516,7 @@ void EnBb_SetupDamage(EnBb* this) {
if (this->actor.params == ENBB_RED) {
EnBb_KillFlameTrail(this);
}
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 0xC);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0xC);
this->timer = 5;
EnBb_SetupAction(this, EnBb_Damage);
}
@@ -1083,13 +1083,13 @@ void EnBb_SetupStunned(EnBb* this) {
}
switch (this->dmgEffect) {
case 8:
func_8003426C(&this->actor, -0x8000, 0xC8, 0, 0x50);
Actor_SetColorFilter(&this->actor, -0x8000, 0xC8, 0, 0x50);
break;
case 9:
this->fireIceTimer = 0x30;
case 15:
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE);
func_8003426C(&this->actor, 0, 0xB4, 0, 0x50);
Actor_SetColorFilter(&this->actor, 0, 0xB4, 0, 0x50);
break;
}
this->actor.bgCheckFlags &= ~1;
@@ -1157,8 +1157,8 @@ void EnBb_CollisionCheck(EnBb* this, GlobalContext* globalCtx) {
case 5:
this->fireIceTimer = 0x30;
//! @bug
//! Setting fireIceTimer here without calling func_8003426C causes a crash if the bubble is killed
//! in a single hit by an attack with damage effect 5 or 7 while actor updating is halted. Using
//! Setting fireIceTimer here without calling Actor_SetColorFilter causes a crash if the bubble is
//! killed in a single hit by an attack with damage effect 5 or 7 while actor updating is halted. Using
//! Din's Fire on a white bubble will do just that. The mechanism is complex and described below.
goto block_15;
case 6:
@@ -1197,13 +1197,13 @@ void EnBb_CollisionCheck(EnBb* this, GlobalContext* globalCtx) {
}
EnBb_SetupDeath(this, globalCtx);
//! @bug
//! Because Din's Fire kills the bubble in a single hit, func_8003426C is never called and
//! Because Din's Fire kills the bubble in a single hit, Actor_SetColorFilter is never called and
//! colorFilterParams is never set. And because Din's Fire halts updating during its cutscene,
//! EnBb_Death doesn't kill the bubble on the next frame like it should. This combines with
//! the bug in EnBb_Draw below to crash the game.
} else if ((this->actor.params == ENBB_WHITE) &&
((this->action == BB_WHITE) || (this->action == BB_STUNNED))) {
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 0xC);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0xC);
this->actor.speedXZ = -8.0f;
this->maxSpeed = 0.0f;
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
+4 -4
View File
@@ -226,7 +226,7 @@ void EnBili_SetupBurnt(EnBili* this) {
this->collider.base.acFlags &= ~AC_ON;
this->actor.flags |= 0x10;
this->actor.speedXZ = 0.0f;
func_8003426C(&this->actor, 0x4000, 0xC8, 0x2000, 0x14);
Actor_SetColorFilter(&this->actor, 0x4000, 0xC8, 0x2000, 0x14);
this->actionFunc = EnBili_Burnt;
}
@@ -245,7 +245,7 @@ void EnBili_SetupStunned(EnBili* this) {
this->collider.info.bumper.effect = 0;
this->actor.gravity = -1.0f;
this->actor.speedXZ = 0.0f;
func_8003426C(&this->actor, 0, 0x96, 0x2000, 0x50);
Actor_SetColorFilter(&this->actor, 0, 0x96, 0x2000, 0x50);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE);
this->collider.base.atFlags &= ~AT_ON;
this->actionFunc = EnBili_Stunned;
@@ -273,7 +273,7 @@ void EnBili_SetupFrozen(EnBili* this, GlobalContext* globalCtx) {
}
this->actor.speedXZ = 0.0f;
func_8003426C(&this->actor, 0, 0x96, 0x2000, 0xA);
Actor_SetColorFilter(&this->actor, 0, 0x96, 0x2000, 0xA);
this->collider.base.atFlags &= ~AT_ON;
this->collider.base.acFlags &= ~AC_ON;
this->timer = 300;
@@ -563,7 +563,7 @@ void EnBili_UpdateDamage(EnBili* this, GlobalContext* globalCtx) {
}
} else if (damageEffect == BIRI_DMGEFF_SWORD) {
if (this->actionFunc != EnBili_Stunned) {
func_8003426C(&this->actor, 0x4000, 0xC8, 0x2000, 0xA);
Actor_SetColorFilter(&this->actor, 0x4000, 0xC8, 0x2000, 0xA);
if (this->actor.colChkInfo.health == 0) {
this->actor.params = EN_BILI_TYPE_DYING;
+3 -3
View File
@@ -694,7 +694,7 @@ void func_809D0584(EnBw* this, GlobalContext* globalCtx) {
if ((this->damageEffect == 1) || (this->damageEffect == 0xE)) {
if (this->unk_23C == 0) {
Actor_ApplyDamage(&this->actor);
func_8003426C(&this->actor, 0, 0x78, 0, 0x50);
Actor_SetColorFilter(&this->actor, 0, 0x78, 0, 0x50);
func_809D03CC(this);
this->unk_248 = 0.0f;
}
@@ -705,7 +705,7 @@ void func_809D0584(EnBw* this, GlobalContext* globalCtx) {
}
if (((this->unk_221 == 1) || (this->unk_221 == 4)) && (this->actor.colChkInfo.health == 0)) {
if (this->unk_220 != 0) {
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 8);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8);
if (func_800355E4(globalCtx, &this->collider2.base)) {
this->unk_230 = 0;
this->actor.scale.y -= 0.009f;
@@ -718,7 +718,7 @@ void func_809D0584(EnBw* this, GlobalContext* globalCtx) {
}
} else if ((this->unk_220 != 1) && (this->unk_220 != 6)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_BUBLEWALK_DAMAGE);
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 8);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8);
if (this->unk_220 != 5) {
func_809D01CC(this);
}
+4 -4
View File
@@ -161,7 +161,7 @@ void EnCrow_SetupDamaged(EnCrow* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_DEAD);
if (this->actor.colChkInfo.damageEffect == 3) { // Ice arrows
func_8003426C(&this->actor, 0, 255, 0, 40);
Actor_SetColorFilter(&this->actor, 0, 255, 0, 40);
for (i = 0; i < 8; i++) {
iceParticlePos.x = ((i & 1 ? 7.0f : -7.0f) * scale) + this->actor.world.pos.x;
iceParticlePos.y = ((i & 2 ? 7.0f : -7.0f) * scale) + this->actor.world.pos.y;
@@ -170,13 +170,13 @@ void EnCrow_SetupDamaged(EnCrow* this, GlobalContext* globalCtx) {
((Rand_ZeroOne() * 0.15f) + 0.85f) * scale);
}
} else if (this->actor.colChkInfo.damageEffect == 2) { // Fire arrows and Din's Fire
func_8003426C(&this->actor, 0x4000, 255, 0, 40);
Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40);
for (i = 0; i < 4; i++) {
EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &this->actor.world.pos, 50.0f * scale, 0, 0, i);
}
} else {
func_8003426C(&this->actor, 0x4000, 255, 0, 40);
Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 40);
}
if (this->actor.flags & 0x8000) {
@@ -200,7 +200,7 @@ void EnCrow_SetupTurnAway(EnCrow* this) {
this->aimRotX = -0x1000;
this->aimRotY = this->actor.yawTowardsPlayer + 0x8000;
this->skelAnime.playSpeed = 2.0f;
func_8003426C(&this->actor, 0, 255, 0, 5);
Actor_SetColorFilter(&this->actor, 0, 255, 0, 5);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE);
this->actionFunc = EnCrow_TurnAway;
}
@@ -216,7 +216,7 @@ void EnDekunuts_SetupBeDamaged(EnDekunuts* this) {
this->actor.speedXZ = 10.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_DAMAGE);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_CUTBODY);
func_8003426C(&this->actor, 0x4000, 0xFF, 0, Animation_GetLastFrame(&gDekuNutsDamageAnim));
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, Animation_GetLastFrame(&gDekuNutsDamageAnim));
}
void EnDekunuts_SetupBeStunned(EnDekunuts* this) {
@@ -225,7 +225,7 @@ void EnDekunuts_SetupBeStunned(EnDekunuts* this) {
this->actionFunc = EnDekunuts_BeStunned;
this->actor.speedXZ = 0.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE);
func_8003426C(&this->actor, 0, 0xFF, 0, Animation_GetLastFrame(&gDekuNutsDamageAnim) * this->animFlagAndTimer);
Actor_SetColorFilter(&this->actor, 0, 0xFF, 0, Animation_GetLastFrame(&gDekuNutsDamageAnim) * this->animFlagAndTimer);
}
void EnDekunuts_SetupDie(EnDekunuts* this) {
+1 -1
View File
@@ -490,7 +490,7 @@ void EnDh_CollisionCheck(EnDh* this, GlobalContext* globalCtx) {
if (player->unk_844 != 0) {
this->unk_258 = player->unk_845;
}
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 8);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8);
lastHealth = this->actor.colChkInfo.health;
if (Actor_ApplyDamage(&this->actor) == 0) {
EnDh_SetupDeath(this);
+1 -1
View File
@@ -364,7 +364,7 @@ void EnDha_UpdateHealth(EnDha* this, GlobalContext* globalCtx) {
if (this->actor.colChkInfo.damageEffect == 0 || this->actor.colChkInfo.damageEffect == 6) {
return;
} else {
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 8);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8);
if (Actor_ApplyDamage(&this->actor) == 0) {
EnDha_SetupDeath(this);
this->actor.colChkInfo.health = 8;
@@ -98,7 +98,7 @@ void EnDodojr_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void func_809F64D0(EnDodojr* this) {
Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_EXPLOSION);
func_8003426C(&this->actor, 0x4000, 200, 0, 8);
Actor_SetColorFilter(&this->actor, 0x4000, 200, 0, 8);
}
void func_809F6510(EnDodojr* this, GlobalContext* globalCtx, s32 count) {
@@ -366,7 +366,7 @@ s32 func_809F70E8(EnDodojr* this, GlobalContext* globalCtx) {
(this->actionFunc != func_809F786C)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE);
this->timer1 = 120;
func_8003426C(&this->actor, 0, 200, 0, 120);
Actor_SetColorFilter(&this->actor, 0, 200, 0, 120);
func_809F6A20(this);
this->actionFunc = func_809F786C;
}
@@ -580,7 +580,7 @@ void func_809F7B3C(EnDodojr* this, GlobalContext* globalCtx) {
if (this->unk_1FC != 0) {
if (this->actor.colorFilterTimer == 0) {
func_8003426C(&this->actor, 0x4000, 200, 0, this->unk_1FC);
Actor_SetColorFilter(&this->actor, 0x4000, 200, 0, this->unk_1FC);
this->unk_1FC--;
}
} else {
@@ -506,7 +506,7 @@ void EnDodongo_SwallowBomb(EnDodongo* this, GlobalContext* globalCtx) {
&this->bombSmokeEnvColor, 400, 10, 10);
}
Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_EXPLOSION);
func_8003426C(&this->actor, 0x4000, 0x78, 0, 8);
Actor_SetColorFilter(&this->actor, 0x4000, 0x78, 0, 8);
}
}
}
@@ -685,7 +685,7 @@ void EnDodongo_Death(EnDodongo* this, GlobalContext* globalCtx) {
EnDodongo_SpawnBombSmoke(this, globalCtx);
}
} else if (this->actor.colorFilterTimer == 0) {
func_8003426C(&this->actor, 0x4000, 0x78, 0, 4);
Actor_SetColorFilter(&this->actor, 0x4000, 0x78, 0, 4);
}
if (SkelAnime_Update(&this->skelAnime) != 0) {
if (this->timer == 0) {
@@ -730,12 +730,12 @@ void EnDodongo_CollisionCheck(EnDodongo* this, GlobalContext* globalCtx) {
this->damageEffect = this->actor.colChkInfo.damageEffect;
if ((this->actor.colChkInfo.damageEffect == 1) || (this->actor.colChkInfo.damageEffect == 0xF)) {
if (this->actionState != DODONGO_STUNNED) {
func_8003426C(&this->actor, 0, 0x78, 0, 0x50);
Actor_SetColorFilter(&this->actor, 0, 0x78, 0, 0x50);
Actor_ApplyDamage(&this->actor);
EnDodongo_SetupStunned(this);
}
} else {
func_8003426C(&this->actor, 0x4000, 0x78, 0, 8);
Actor_SetColorFilter(&this->actor, 0x4000, 0x78, 0, 8);
if (Actor_ApplyDamage(&this->actor) == 0) {
EnDodongo_SetupDeath(this, globalCtx);
} else {
@@ -219,7 +219,7 @@ void EnFirefly_SetupFall(EnFirefly* this) {
Animation_Change(&this->skelAnime, &D_0600017C, 0.5f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -3.0f);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FFLY_DEAD);
this->actor.flags |= 0x10;
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 40);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 40);
this->actionFunc = EnFirefly_Fall;
}
@@ -253,7 +253,7 @@ void EnFirefly_SetupFlyAway(EnFirefly* this) {
void EnFirefly_SetupStunned(EnFirefly* this) {
this->timer = 80;
func_8003426C(&this->actor, 0, 0xFF, 0, 80);
Actor_SetColorFilter(&this->actor, 0, 0xFF, 0, 80);
this->auraType = KEESE_AURA_NONE;
this->actor.velocity.y = 0.0f;
this->skelAnime.playSpeed = 3.0f;
@@ -268,7 +268,7 @@ void EnFirefly_SetupFrozenFall(EnFirefly* this, GlobalContext* globalCtx) {
this->actor.flags |= 0x10;
this->auraType = KEESE_AURA_NONE;
this->actor.speedXZ = 0.0f;
func_8003426C(&this->actor, 0, 0xFF, 0, 0xFF);
Actor_SetColorFilter(&this->actor, 0, 0xFF, 0, 0xFF);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FFLY_DEAD);
for (i = 0; i <= 7; i++) {
@@ -408,7 +408,7 @@ void EnFloormas_SetupTakeDamage(EnFloormas* this) {
} else {
this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, this->collider.base.ac) + 0x8000;
}
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 0x14);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0x14);
this->actionFunc = EnFloormas_TakeDamage;
this->actor.speedXZ = 5.0f;
this->actor.velocity.y = 5.5f;
@@ -425,9 +425,9 @@ void EnFloormas_SetupFreeze(EnFloormas* this) {
Animation_Change(&this->skelAnime, &D_060019CC, 1.5f, 0, 20.0f, ANIMMODE_ONCE, -3.0f);
this->actor.speedXZ = 0.0f;
if (this->actor.colChkInfo.damageEffect == 4) {
func_8003426C(&this->actor, -0x8000, 0xFF, 0, 0x50);
Actor_SetColorFilter(&this->actor, -0x8000, 0xFF, 0, 0x50);
} else {
func_8003426C(&this->actor, 0, 0xFF, 0, 0x50);
Actor_SetColorFilter(&this->actor, 0, 0xFF, 0, 0x50);
if (this->actor.scale.x > 0.004f) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE);
} else {
+2 -2
View File
@@ -249,7 +249,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) {
Math_SmoothStepToF(&this->actor.scale.x, 0.024999999f, 0.08f, 0.6f, 0.0f);
Actor_SetScale(&this->actor, this->actor.scale.x);
if (this->actor.colorFilterTimer == 0) {
func_8003426C(&this->actor, 0x4000, 0xC8, 0, this->explosionTimer);
Actor_SetColorFilter(&this->actor, 0x4000, 0xC8, 0, this->explosionTimer);
this->explosionTimer--;
}
@@ -267,7 +267,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) {
}
} else {
if (!(this->actor.bgCheckFlags & 1) || this->actor.velocity.y > 0.0f) {
func_8003426C(&this->actor, 0x4000, 0xC8, 0, this->damageTimer);
Actor_SetColorFilter(&this->actor, 0x4000, 0xC8, 0, this->damageTimer);
return;
}
DECR(this->damageTimer);
+2 -2
View File
@@ -349,7 +349,7 @@ void EnFz_ApplyDamage(EnFz* this, GlobalContext* globalCtx) {
if (this->actor.colChkInfo.damageEffect != 2) {
if (this->actor.colChkInfo.damageEffect == 0xF) {
Actor_ApplyDamage(&this->actor);
func_8003426C(&this->actor, 0x4000, 0xFF, 0x2000, 8);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 8);
if (this->actor.colChkInfo.health) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FREEZAD_DAMAGE);
vec.x = this->actor.world.pos.x;
@@ -369,7 +369,7 @@ void EnFz_ApplyDamage(EnFz* this, GlobalContext* globalCtx) {
}
} else {
Actor_ApplyDamage(&this->actor);
func_8003426C(&this->actor, 0x4000, 0xFF, 0x2000, 8);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 8);
if (this->actor.colChkInfo.health == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FREEZAD_DEAD);
EnFz_SetupMelt(this);
+1 -1
View File
@@ -555,7 +555,7 @@ void EnGe2_Update(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc(this, globalCtx);
} else if (this->collider.base.acFlags & 2) {
if ((this->collider.info.acHitInfo != NULL) && (this->collider.info.acHitInfo->toucher.dmgFlags & 0x80)) {
func_8003426C(&this->actor, 0, 120, 0, 400);
Actor_SetColorFilter(&this->actor, 0, 120, 0, 400);
this->actor.update = EnGe2_UpdateStunned;
return;
}
@@ -1363,12 +1363,12 @@ void EnGeldB_CollisionCheck(EnGeldB* this, GlobalContext* globalCtx) {
if ((this->actor.colChkInfo.damageEffect == GELDB_DMG_STUN) ||
(this->actor.colChkInfo.damageEffect == GELDB_DMG_FREEZE)) {
if (this->action != GELDB_STUNNED) {
func_8003426C(&this->actor, 0, 0x78, 0, 0x50);
Actor_SetColorFilter(&this->actor, 0, 0x78, 0, 0x50);
Actor_ApplyDamage(&this->actor);
EnGeldB_SetupStunned(this);
}
} else {
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 8);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8);
if (Actor_ApplyDamage(&this->actor) == 0) {
if (this->keyFlag != 0) {
key = Item_DropCollectible(globalCtx, &this->actor.world.pos, this->keyFlag | ITEM00_SMALL_KEY);
@@ -206,7 +206,7 @@ void EnHintnuts_SetupLeave(EnHintnuts* this, GlobalContext* globalCtx) {
void EnHintnuts_SetupFreeze(EnHintnuts* this) {
Animation_PlayLoop(&this->skelAnime, &gHintNutsFreezeAnim);
this->actor.flags &= ~1;
func_8003426C(&this->actor, 0, 0xFF, 0, 100);
Actor_SetColorFilter(&this->actor, 0, 0xFF, 0, 100);
this->actor.colorFilterTimer = 1;
this->animFlagAndTimer = 0;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_FAINT);
@@ -248,7 +248,7 @@ void EnHonotrap_EyeIdle(EnHonotrap* this, GlobalContext* globalCtx) {
void EnHonotrap_SetupEyeOpen(EnHonotrap* this) {
this->actionFunc = EnHonotrap_EyeOpen;
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 0x28);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0x28);
this->timer = 30;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_RED_EYE);
}
+1 -1
View File
@@ -724,7 +724,7 @@ void func_80A75C38(EnIk* this, GlobalContext* globalCtx) {
}
return;
}
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 0xC);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0xC);
prevHealth = this->actor.colChkInfo.health;
Actor_ApplyDamage(&this->actor);
if (this->actor.params != 0) {
@@ -49,8 +49,18 @@ static ColliderCylinderInit D_80AA0420 = {
static u32 D_80AA044C[] = { 0x01000000, 0x00400000, 0x00800000 };
static u32 D_80AA0458[] = { 0x08000000, 0x02000000, 0x04000000 };
static u16 sSfxIds[] = { NA_SE_IT_ROLLING_CUT_LV2, NA_SE_IT_ROLLING_CUT_LV1, NA_SE_IT_ROLLING_CUT_LV2,
NA_SE_IT_ROLLING_CUT_LV1 };
static u16 sSfxIds[] = {
NA_SE_IT_ROLLING_CUT_LV2,
NA_SE_IT_ROLLING_CUT_LV1,
NA_SE_IT_ROLLING_CUT_LV2,
NA_SE_IT_ROLLING_CUT_LV1,
};
extern Gfx D_04012570[];
extern Gfx D_04012690[];
extern Gfx D_04012AF0[];
extern Gfx D_04012C10[];
extern Gfx D_04013610[];
// Setup action
void func_80A9EFE0(EnMThunder* this, EnMThunderActionFunc actionFunc) {
+2 -2
View File
@@ -571,7 +571,7 @@ void func_80AA6F04(EnMb* this) {
void func_80AA6F8C(EnMb* this) {
this->unk_320 = 5;
this->actor.speedXZ = 0.0f;
func_8003426C(&this->actor, 0, 0x78, 0, 0x50);
Actor_SetColorFilter(&this->actor, 0, 0x78, 0, 0x50);
if (this->unk_188 == 6) {
this->unk_328 = 40;
} else {
@@ -1354,7 +1354,7 @@ void func_80AA94D8(EnMb* this, GlobalContext* globalCtx) {
}
} else {
Actor_ApplyDamage(&this->actor);
func_8003426C(&this->actor, 0x4000, 0xFA, 0, 0xC);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFA, 0, 0xC);
if (this->actor.params == 0) {
if (this->actor.colChkInfo.health == 0) {
func_80AA6F04(this);
+3 -3
View File
@@ -316,16 +316,16 @@ s32 EnNy_CollisionCheck(EnNy* this, GlobalContext* globalCtx) {
sp3F = 1;
case 0xF:
Actor_ApplyDamage(&this->actor);
func_8003426C(&this->actor, 0x4000, 0xFF, 0x2000, 0x50);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 0x50);
break;
case 1:
Actor_ApplyDamage(&this->actor);
func_8003426C(&this->actor, 0x4000, 0xFF, 0x2000, 0x50);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 0x50);
break;
case 2:
this->unk_1CA = 4;
Actor_ApplyDamage(&this->actor);
func_8003426C(&this->actor, 0x4000, 0xFF, 0x2000, 0x50);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 0x50);
break;
}
}
@@ -249,7 +249,7 @@ void EnOkuta_SetupShoot(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_SetupWaitToDie(EnOkuta* this) {
Animation_MorphToPlayOnce(&this->skelAnime, &D_06003910, -5.0f);
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 0xB);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0xB);
this->collider.base.acFlags &= ~AC_HIT;
Actor_SetScale(&this->actor, 0.01f);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_DEAD1);
@@ -264,7 +264,7 @@ void EnOkuta_SetupDie(EnOkuta* this) {
void EnOkuta_SetupFreeze(EnOkuta* this) {
this->timer = 80;
func_8003426C(&this->actor, 0, 0xFF, 0, 0x50);
Actor_SetColorFilter(&this->actor, 0, 0xFF, 0, 0x50);
this->actionFunc = EnOkuta_Freeze;
}
@@ -285,7 +285,7 @@ void EnPoField_SetupDamage(EnPoField* this) {
}
this->collider.base.acFlags &= ~(AC_HIT | AC_ON);
this->actor.speedXZ = 5.0f;
func_8003426C(&this->actor, 0x4000, 255, 0, 16);
Actor_SetColorFilter(&this->actor, 0x4000, 255, 0, 16);
this->actionFunc = EnPoField_Damage;
}
@@ -311,7 +311,7 @@ void func_80AD95D8(EnPoSisters* this) {
this->actor.speedXZ = 10.0f;
}
this->unk_199 &= ~0xB;
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 0x10);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0x10);
this->actionFunc = func_80ADAAA4;
}
+1 -1
View File
@@ -317,7 +317,7 @@ void func_80ADE28C(EnPoh* this) {
}
this->colliderCyl.base.acFlags &= ~AC_ON;
this->actor.speedXZ = 5.0f;
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 0x10);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0x10);
this->actionFunc = func_80ADEECC;
}
+6 -6
View File
@@ -692,12 +692,12 @@ void func_80AE3DE4(EnRd* this) {
this->unk_318 = 1;
this->unk_316 = 0x258;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LIGHT_ARROW_HIT);
func_8003426C(&this->actor, -0x8000, -0x7F38, 0, 0xFF);
Actor_SetColorFilter(&this->actor, -0x8000, -0x7F38, 0, 0xFF);
} else if (this->unk_31C == 1) {
func_8003426C(&this->actor, 0, 0xC8, 0, 0x50);
Actor_SetColorFilter(&this->actor, 0, 0xC8, 0, 0x50);
} else {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_LIGHT_ARROW_HIT);
func_8003426C(&this->actor, -0x8000, 0xC8, 0, 0x50);
Actor_SetColorFilter(&this->actor, -0x8000, 0xC8, 0, 0x50);
}
EnRd_SetupAction(this, func_80AE3ECC);
}
@@ -706,7 +706,7 @@ void func_80AE3ECC(EnRd* this, GlobalContext* globalCtx) {
if ((this->unk_318 != 0) && (this->unk_316 != 0)) {
this->unk_316--;
if (this->unk_316 >= 0xFF) {
func_8003426C(&this->actor, -0x8000, 0xC8, 0, 0xFF);
Actor_SetColorFilter(&this->actor, -0x8000, 0xC8, 0, 0xFF);
}
if (this->unk_316 == 0) {
this->unk_318 = 0;
@@ -779,10 +779,10 @@ void func_80AE4114(EnRd* this, GlobalContext* globalCtx) {
this->unk_316 = 0;
if (this->unk_31C == 0xE) {
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 0x50);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0x50);
this->unk_31A = 0x28;
} else {
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 8);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8);
}
Actor_ApplyDamage(&this->actor);
@@ -356,7 +356,7 @@ void func_80AE57F0(EnReeba* this, GlobalContext* globalCtx) {
this->unk_276 = 14;
this->actor.speedXZ = -8.0f;
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 8);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8);
this->actionfunc = func_80AE5854;
}
@@ -447,7 +447,7 @@ void func_80AE5A9C(EnReeba* this, GlobalContext* globalCtx) {
void func_80AE5BC4(EnReeba* this, GlobalContext* globalCtx) {
this->actor.speedXZ = -8.0f;
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 8);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8);
this->unk_278 = 14;
this->actor.flags &= ~1;
this->actionfunc = func_80AE5C38;
@@ -529,14 +529,14 @@ void func_80AE5EDC(EnReeba* this, GlobalContext* globalCtx) {
if ((this->actor.colChkInfo.health > 1) && (this->unk_27E != 4)) {
this->unk_27E = 4;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE);
func_8003426C(&this->actor, 0, 0xFF, 0, 0x50);
Actor_SetColorFilter(&this->actor, 0, 0xFF, 0, 0x50);
this->actionfunc = func_80AE58EC;
break;
}
case 13: // hookshot/longshot
if ((this->actor.colChkInfo.health > 2) && (this->unk_27E != 4)) {
this->unk_27E = 4;
func_8003426C(&this->actor, 0, 0xFF, 0, 0x50);
Actor_SetColorFilter(&this->actor, 0, 0xFF, 0, 0x50);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE);
this->actionfunc = func_80AE58EC;
break;
@@ -560,13 +560,13 @@ void func_80AE5EDC(EnReeba* this, GlobalContext* globalCtx) {
Actor_ApplyDamage(&this->actor);
this->unk_27C = 2;
this->unk_27E = 2;
func_8003426C(&this->actor, 0, 0xFF, 0, 80);
Actor_SetColorFilter(&this->actor, 0, 0xFF, 0, 80);
this->actionfunc = func_80AE58EC;
break;
case 1: // unknown
if (this->unk_27E != 4) {
this->unk_27E = 4;
func_8003426C(&this->actor, 0, 0xFF, 0, 80);
Actor_SetColorFilter(&this->actor, 0, 0xFF, 0, 80);
this->actionfunc = func_80AE58EC;
}
break;
+5 -5
View File
@@ -452,7 +452,7 @@ void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) {
this->stopScroll = false;
Actor_ApplyDamage(&this->actor);
this->invincibilityTimer = 40;
func_8003426C(&this->actor, 0x4000, 0xFF, 0x2000, this->invincibilityTimer);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, this->invincibilityTimer);
if (this->hasPlayer) {
EnRr_SetupReleasePlayer(this, globalCtx);
} else if (this->actor.colChkInfo.health != 0) {
@@ -467,7 +467,7 @@ void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) {
if (this->actor.colChkInfo.health == 0) {
this->dropType = RR_DROP_RANDOM_RUPEE;
}
func_8003426C(&this->actor, 0x4000, 0xFF, 0x2000, 0x50);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 0x50);
this->effectTimer = 20;
EnRr_SetupStunned(this);
return;
@@ -478,7 +478,7 @@ void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) {
}
if (this->actor.colorFilterTimer == 0) {
this->effectTimer = 20;
func_8003426C(&this->actor, 0, 0xFF, 0x2000, 0x50);
Actor_SetColorFilter(&this->actor, 0, 0xFF, 0x2000, 0x50);
}
EnRr_SetupStunned(this);
return;
@@ -487,12 +487,12 @@ void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) {
if (this->actor.colChkInfo.health == 0) {
this->dropType = RR_DROP_RUPEE_RED;
}
func_8003426C(&this->actor, -0x8000, 0xFF, 0x2000, 0x50);
Actor_SetColorFilter(&this->actor, -0x8000, 0xFF, 0x2000, 0x50);
EnRr_SetupStunned(this);
return;
case RR_DMG_STUN: // Boomerang and Hookshot
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE);
func_8003426C(&this->actor, 0, 0xFF, 0x2000, 0x50);
Actor_SetColorFilter(&this->actor, 0, 0xFF, 0x2000, 0x50);
EnRr_SetupStunned(this);
return;
}
+3 -3
View File
@@ -396,7 +396,7 @@ s32 EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) {
yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if ((hitY < 30.0f) && (hitY > 10.0f) && (yawDiff >= -0x1FFF) && (yawDiff < 0x2000)) {
Actor_ApplyDamage(&this->actor);
func_8003426C(&this->actor, 0x4000, 0xFF, 0x2000, 0x50);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 0x50);
tookDamage = true;
}
}
@@ -404,7 +404,7 @@ s32 EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) {
case 2: // fire arrow, dins fire
this->fire = 4;
Actor_ApplyDamage(&this->actor);
func_8003426C(&this->actor, 0x4000, 0xFF, 0x2000, 0x50);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 0x50);
tookDamage = true;
break;
case 1: // hookshot/longshot
@@ -414,7 +414,7 @@ s32 EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) {
yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if ((hitY < 30.0f) && (hitY > 10.0f) && (yawDiff >= -0x1FFF) && (yawDiff < 0x2000)) {
Actor_ApplyDamage(&this->actor);
func_8003426C(&this->actor, 0x4000, 0xFF, 0x2000, 0x50);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 0x50);
tookDamage = true;
EnSb_SetupCooldown(this, 0);
}
+1 -1
View File
@@ -311,7 +311,7 @@ void EnSsh_SetColliderScale(EnSsh* this, f32 scale, f32 radiusMod) {
s32 EnSsh_Damaged(EnSsh* this) {
if ((this->stunTimer == 120) && (this->stateFlags & SSH_STATE_STUNNED)) {
func_8003426C(&this->actor, 0, 0xC8, 0, this->stunTimer);
Actor_SetColorFilter(&this->actor, 0, 0xC8, 0, this->stunTimer);
}
if (DECR(this->stunTimer) != 0) {
Math_SmoothStepToS(&this->maxTurnRate, 0x2710, 0xA, 0x3E8, 1);
+2 -2
View File
@@ -458,7 +458,7 @@ s32 EnSt_CheckHitBackside(EnSt* this, GlobalContext* globalCtx) {
if (this->stunTimer == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE);
this->stunTimer = 120;
func_8003426C(&this->actor, 0, 0xC8, 0, this->stunTimer);
Actor_SetColorFilter(&this->actor, 0, 0xC8, 0, this->stunTimer);
}
return false;
}
@@ -467,7 +467,7 @@ s32 EnSt_CheckHitBackside(EnSt* this, GlobalContext* globalCtx) {
this->gaveDamageSpinTimer = 1;
func_80034EC0(&this->skelAnime, sAnimations, 3);
this->takeDamageSpinTimer = this->skelAnime.animLength;
func_8003426C(&this->actor, 0x4000, 0xC8, 0, this->takeDamageSpinTimer);
Actor_SetColorFilter(&this->actor, 0x4000, 0xC8, 0, this->takeDamageSpinTimer);
if (Actor_ApplyDamage(&this->actor)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_DAMAGE);
return false;
+1 -1
View File
@@ -336,7 +336,7 @@ s32 func_80B0C9F0(EnSw* this, GlobalContext* globalCtx) {
if ((this->collider.base.acFlags & 2) || phi_v1) {
this->collider.base.acFlags &= ~2;
this->unk_392 = 0x10;
func_8003426C(&this->actor, 0x4000, 0xC8, 0, this->unk_392);
Actor_SetColorFilter(&this->actor, 0x4000, 0xC8, 0, this->unk_392);
if (Actor_ApplyDamage(&this->actor) != 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_DAMAGE);
return true;
+2 -2
View File
@@ -865,14 +865,14 @@ void EnTite_CheckDamage(Actor* thisx, GlobalContext* globalCtx) {
// Stun if Tektite hit by nut, boomerang, hookshot, ice arrow or ice magic
if ((thisx->colChkInfo.damageEffect == 1) || (thisx->colChkInfo.damageEffect == 0xF)) {
if (this->action != TEKTITE_STUNNED) {
func_8003426C(thisx, 0, 0x78, 0, 0x50);
Actor_SetColorFilter(thisx, 0, 0x78, 0, 0x50);
Actor_ApplyDamage(thisx);
EnTite_SetupStunned(this);
}
// Otherwise apply damage and handle death where necessary
} else {
if ((thisx->colorFilterTimer == 0) || ((thisx->colorFilterParams & 0x4000) == 0)) {
func_8003426C(thisx, 0x4000, 0xFF, 0, 8);
Actor_SetColorFilter(thisx, 0x4000, 0xFF, 0, 8);
Actor_ApplyDamage(thisx);
}
if (thisx->colChkInfo.health == 0) {
@@ -625,9 +625,9 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) {
func_800F5ACC(0x38);
if (this->actor.colChkInfo.damageEffect == 1) {
if (sAlpha == 255) {
func_8003426C(&this->actor, 0, 0xFF, 0, 0x50);
Actor_SetColorFilter(&this->actor, 0, 0xFF, 0, 0x50);
} else {
func_8003426C(&this->actor, 0, 0xFF, 0x2000, 0x50);
Actor_SetColorFilter(&this->actor, 0, 0xFF, 0x2000, 0x50);
}
} else {
this->actor.flags &= ~1;
@@ -641,9 +641,9 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) {
this->stateFlags3 |= 1;
sActionState = ENTORCH2_DAMAGE;
if (sAlpha == 255) {
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 0xC);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0xC);
} else {
func_8003426C(&this->actor, 0x4000, 0xFF, 0x2000, 0xC);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 0xC);
}
}
}
+1 -1
View File
@@ -151,7 +151,7 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) {
if ((this->collider.base.acFlags & AC_HIT) != 0) {
icePos = thisx->world.pos;
this->collider.base.acFlags &= ~AC_HIT;
func_8003426C(thisx, 0, 250, 0, 250);
Actor_SetColorFilter(thisx, 0, 250, 0, 250);
icePos.y += 10.0f;
icePos.z += 10.0f;
EffectSsEnIce_SpawnFlyingVec3f(globalCtx, thisx, &icePos, 150, 150, 150, 250, 235, 245, 255, 1.8f);
+1 -1
View File
@@ -406,7 +406,7 @@ void EnVm_CheckHealth(EnVm* this, GlobalContext* globalCtx) {
}
if (this->actor.colChkInfo.health != 0) {
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 8);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8);
EnVm_SetupStun(this);
} else {
bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x,
@@ -239,7 +239,7 @@ void EnWallmas_SetupTakeDamage(EnWallmas* this) {
this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, this->collider.base.ac) + 0x8000;
}
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 0x14);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0x14);
this->actionFunc = EnWallmas_TakeDamage;
this->actor.speedXZ = 5.0f;
this->actor.velocity.y = 10.0f;
@@ -293,9 +293,9 @@ void EnWallmas_SetupStun(EnWallmas* this) {
this->actor.speedXZ = 0.0f;
if (this->actor.colChkInfo.damageEffect == 4) {
func_8003426C(&this->actor, -0x8000, 0xFF, 0, 0x50);
Actor_SetColorFilter(&this->actor, -0x8000, 0xFF, 0, 0x50);
} else {
func_8003426C(&this->actor, 0, 0xFF, 0, 0x50);
Actor_SetColorFilter(&this->actor, 0, 0xFF, 0, 0x50);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE);
}
@@ -173,7 +173,7 @@ void func_80B325A0(EnWeiyer* this) {
this->actor.gravity = 0.0f;
this->actor.velocity.y = 0.0f;
this->actor.speedXZ = 3.0f;
func_8003426C(&this->actor, 0x4000, 0xC8, 0, 0x28);
Actor_SetColorFilter(&this->actor, 0x4000, 0xC8, 0, 0x28);
this->collider.dim.height = sCylinderInit.dim.height;
this->actionFunc = func_80B331CC;
}
@@ -185,7 +185,7 @@ void func_80B32660(EnWeiyer* this) {
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);
Actor_SetColorFilter(&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;
@@ -194,7 +194,7 @@ void func_80B32660(EnWeiyer* this) {
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);
Actor_SetColorFilter(&this->actor, 0x4000, 0xC8, 0, 0x28);
this->collider.base.atFlags &= ~AT_ON;
this->collider.base.acFlags &= ~AC_ON;
this->actor.speedXZ = 3.0f;