1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-16 12:54:40 +00:00

En_Dodojr (Baby Dodongo) OK (#609)

* some functions finished

* some more progress

* a bit more progress

* more functions done, one wip

* 2 functions remain

* one function remains

* actor mostly done, still one function left

* some progress, still not equivalent

* dodojr OK

* dodojr ready

* correct actor struct

* Update src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c

Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>

* Update src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c

Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>

* Update src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c

Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>

* builds OK now

Co-authored-by: Zelllll <elijah@DESKTOP-NMP1I89.localdomain>
Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>
This commit is contained in:
Zelllll 2021-01-31 13:59:50 -06:00 committed by GitHub
parent 3e322f5d35
commit dde70e3c66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 594 additions and 2056 deletions

View file

@ -1,4 +1,11 @@
/*
* File: z_en_dodojr.c
* Overlay: ovl_En_Dodojr
* Description: Baby Dodongo
*/
#include "z_en_dodojr.h"
#include "overlays/actors/ovl_En_Bom/z_en_bom.h"
#define FLAGS 0x00000005
@ -9,14 +16,29 @@ void EnDodojr_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnDodojr_Update(Actor* thisx, GlobalContext* globalCtx);
void EnDodojr_Draw(Actor* thisx, GlobalContext* globalCtx);
extern UNK_TYPE D_060004A0;
extern UNK_TYPE D_060005F0;
extern UNK_TYPE D_06000724;
extern UNK_TYPE D_06000860;
extern UNK_TYPE D_060009D4;
extern UNK_TYPE D_060020E0;
void func_809F73AC(EnDodojr* this, GlobalContext* globalCtx);
void func_809F7BE4(EnDodojr* this, GlobalContext* globalCtx);
void func_809F74C4(EnDodojr* this, GlobalContext* globalCtx);
void func_809F758C(EnDodojr* this, GlobalContext* globalCtx);
void func_809F786C(EnDodojr* this, GlobalContext* globalCtx);
void func_809F799C(EnDodojr* this, GlobalContext* globalCtx);
void func_809F78EC(EnDodojr* this, GlobalContext* globalCtx);
void func_809F773C(EnDodojr* this, GlobalContext* globalCtx);
void func_809F77AC(EnDodojr* this, GlobalContext* globalCtx);
void func_809F784C(EnDodojr* this, GlobalContext* globalCtx);
void func_809F7AB8(EnDodojr* this, GlobalContext* globalCtx);
void func_809F7A00(EnDodojr* this, GlobalContext* globalCtx);
void func_809F7B3C(EnDodojr* this, GlobalContext* globalCtx);
void func_809F7C48(EnDodojr* this, GlobalContext* globalCtx);
void func_809F768C(EnDodojr* this, GlobalContext* globalCtx);
extern AnimationHeader D_060004A0;
extern AnimationHeader D_060005F0;
extern AnimationHeader D_06000724;
extern AnimationHeader D_06000860;
extern AnimationHeader D_060009D4;
extern SkeletonHeader D_060020E0;
/*
const ActorInit En_Dodojr_InitVars = {
ACTOR_EN_DODOJR,
ACTORCAT_ENEMY,
@ -29,7 +51,7 @@ const ActorInit En_Dodojr_InitVars = {
(ActorFunc)EnDodojr_Draw,
};
static ColliderCylinderInit D_809F7EB0 = {
static ColliderCylinderInit sCylinderInit = {
{
COLTYPE_HIT6,
AT_ON | AT_TYPE_ENEMY,
@ -48,79 +70,585 @@ static ColliderCylinderInit D_809F7EB0 = {
},
{ 18, 20, 0, { 0, 0, 0 } },
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/EnDodojr_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/EnDodojr_Destroy.s")
static CollisionCheckInfoInit2 sColChkInit = { 1, 2, 25, 25, 0xFF };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F64D0.s")
void EnDodojr_Init(Actor* thisx, GlobalContext* globalCtx) {
EnDodojr* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F6510.s")
ActorShape_Init(&this->actor.shape.rot.x, 0.0f, NULL, 18.0f);
SkelAnime_Init(globalCtx, &this->skelAnime, &D_060020E0, &D_060009D4, &this->jointTable, &this->morphTable, 15);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(4), &sColChkInit);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F6730.s")
this->actor.naviEnemyId = 0xE;
this->actor.flags &= ~1;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F68B0.s")
Actor_SetScale(&this->actor, 0.02f);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F6994.s")
this->actionFunc = func_809F73AC;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F6A20.s")
void EnDodojr_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnDodojr* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F6AC4.s")
Collider_DestroyCylinder(globalCtx, &this->collider);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F6B38.s")
void func_809F64D0(EnDodojr* this) {
Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_EXPLOSION);
func_8003426C(&this->actor, 0x4000, 200, 0, 8);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F6BBC.s")
void func_809F6510(EnDodojr* this, GlobalContext* globalCtx, s32 count) {
Color_RGBA8 prim = { 170, 130, 90, 255 };
Color_RGBA8 env = { 100, 60, 20, 0 };
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
Vec3f accel = { 0.0f, 0.3f, 0.0f };
Vec3f pos;
s16 angle = ((Rand_ZeroOne() - 0.5f) * 65536.0f);
s32 i;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F6C24.s")
pos.y = this->dustPos.y;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F6CA4.s")
for (i = count; i >= 0; i--, angle += (s16)(0x10000 / count)) {
accel.x = (Rand_ZeroOne() - 0.5f) * 4.0f;
accel.z = (Rand_ZeroOne() - 0.5f) * 4.0f;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F6DD0.s")
pos.x = (Math_SinS(angle) * 22.0f) + this->dustPos.x;
pos.z = (Math_CosS(angle) * 22.0f) + this->dustPos.z;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F6E54.s")
func_8002836C(globalCtx, &pos, &velocity, &accel, &prim, &env, 120, 40, 10);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F706C.s")
void func_809F6730(EnDodojr* this, GlobalContext* globalCtx, Vec3f* arg2) {
Color_RGBA8 prim = { 170, 130, 90, 255 };
Color_RGBA8 env = { 100, 60, 20, 0 };
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
Vec3f accel = { 0.0f, 0.3f, 0.0f };
Vec3f pos;
s16 angle = ((Rand_ZeroOne() - 0.5f) * 65536.0f);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F709C.s")
pos.y = this->actor.floorHeight;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F70E8.s")
accel.x = (Rand_ZeroOne() - 0.5f) * 2;
accel.z = (Rand_ZeroOne() - 0.5f) * 2;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F72A4.s")
pos.x = (Math_SinS(angle) * 11.0f) + arg2->x;
pos.z = (Math_CosS(angle) * 11.0f) + arg2->z;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F73AC.s")
func_8002836C(globalCtx, &pos, &velocity, &accel, &prim, &env, 100, 60, 8);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F74C4.s")
s32 func_809F68B0(EnDodojr* this, GlobalContext* globalCtx) {
if (this->actor.velocity.y >= 0.0f) {
return 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F758C.s")
if (this->unk_1FC == 0) {
return 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F768C.s")
if (this->actor.bgCheckFlags & 1) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND);
this->dustPos = this->actor.world.pos;
func_809F6510(this, globalCtx, 10);
this->actor.velocity.y = 10.0f / (4 - this->unk_1FC);
this->unk_1FC--;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F773C.s")
if (this->unk_1FC == 0) {
this->actor.velocity.y = 0.0f;
return 1;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F77AC.s")
return 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F784C.s")
void func_809F6994(EnDodojr* this) {
f32 lastFrame = Animation_GetLastFrame(&D_06000860);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F786C.s")
Animation_Change(&this->skelAnime, &D_06000860, 1.8f, 0.0f, lastFrame, 1, -10.0f);
this->actor.velocity.y = 0.0f;
this->actor.speedXZ = 2.6f;
this->actor.gravity = -0.8f;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F78EC.s")
void func_809F6A20(EnDodojr* this) {
f32 lastFrame = Animation_GetLastFrame(&D_060004A0);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F799C.s")
Animation_Change(&this->skelAnime, &D_060004A0, 1.0f, 0.0f, lastFrame, 2, -10.0f);
this->actor.speedXZ = 0.0f;
this->actor.velocity.x = 0.0f;
this->actor.velocity.z = 0.0f;
this->actor.gravity = -0.8f;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F7A00.s")
if (this->unk_1FC == 0) {
this->unk_1FC = 3;
this->actor.velocity.y = 10.0f;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F7AB8.s")
void func_809F6AC4(EnDodojr* this) {
f32 lastFrame = Animation_GetLastFrame(&D_060005F0);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F7B3C.s")
Animation_Change(&this->skelAnime, &D_060005F0, 1.0f, 0.0f, lastFrame, 0, 0.0f);
this->actor.velocity.y = 0.0f;
this->actor.gravity = -0.8f;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F7BE4.s")
void func_809F6B38(EnDodojr* this) {
f32 lastFrame = Animation_GetLastFrame(&D_06000724);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F7C48.s")
Animation_Change(&this->skelAnime, &D_06000724, 1.0f, 0.0f, lastFrame, 0, -10.0f);
this->actor.gravity = -0.8f;
this->unk_1FC = 3;
this->actor.velocity.y = 10.0f;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/EnDodojr_Update.s")
void func_809F6BBC(EnDodojr* this) {
this->actor.shape.shadowDraw = NULL;
this->actor.flags &= ~1;
this->actor.home.pos = this->actor.world.pos;
this->actor.speedXZ = 0.0f;
this->actor.gravity = -0.8f;
this->timer3 = 30;
this->dustPos = this->actor.world.pos;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F7D50.s")
void func_809F6C24(EnDodojr* this) {
Animation_Change(&this->skelAnime, &D_06000724, 1.0f, 8.0f, 12.0f, 2, 0.0f);
Audio_PlayActorSound2(this, NA_SE_EN_DODO_M_EAT);
this->actor.speedXZ = 0.0f;
this->actor.velocity.x = 0.0f;
this->actor.velocity.z = 0.0f;
this->actor.gravity = -0.8f;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/func_809F7DFC.s")
s32 func_809F6CA4(EnDodojr* this, GlobalContext* globalCtx) {
Actor* bomb;
Vec3f unkVec = { 99999.0f, 99999.0f, 99999.0f };
s32 retVar = 0;
f32 xDist;
f32 yDist;
f32 zDist;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dodojr/EnDodojr_Draw.s")
bomb = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head;
this->bomb = NULL;
while (bomb != NULL) {
if ((bomb->params != 0) || (bomb->parent != NULL) || (bomb->update == NULL)) {
bomb = bomb->next;
continue;
}
if (bomb->id != ACTOR_EN_BOM) {
bomb = bomb->next;
continue;
}
xDist = bomb->world.pos.x - this->actor.world.pos.x;
yDist = bomb->world.pos.y - this->actor.world.pos.y;
zDist = bomb->world.pos.z - this->actor.world.pos.z;
if ((fabsf(xDist) >= fabsf(unkVec.x)) || (fabsf(yDist) >= fabsf(unkVec.y)) ||
(fabsf(zDist) >= fabsf(unkVec.z))) {
bomb = bomb->next;
continue;
}
this->bomb = bomb;
unkVec = bomb->world.pos;
retVar = 1;
bomb = bomb->next;
}
return retVar;
}
s32 func_809F6DD0(EnDodojr* this) {
if (this->bomb == NULL) {
return 0;
} else if (this->bomb->parent != NULL) {
return 0;
} else if (Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->bomb->world.pos) > 30.0f) {
return 0;
} else {
this->bomb->parent = this;
return 1;
}
}
void func_809F6E54(EnDodojr* this, GlobalContext* globalCtx) {
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 };
s32 pad;
Player* player = PLAYER;
Vec3f pos;
s16 angleIndex;
if ((this->bomb == NULL) || (this->bomb->update == NULL) ||
((this->bomb != NULL) && (this->bomb->parent != NULL))) {
func_809F6CA4(this, globalCtx);
}
if (this->bomb != NULL) {
pos = this->bomb->world.pos;
} else {
pos = player->actor.world.pos;
}
if (Math_Vec3f_DistXYZ(&this->actor.world.pos, &pos) > 80.0f) {
angleIndex = (s16)(this->actor.home.pos.x + this->actor.home.pos.y + this->actor.home.pos.z +
globalCtx->state.frames / 30) %
12;
angleIndex = ABS(angleIndex);
pos.x += 80.0f * sinf(angles[angleIndex]);
pos.z += 80.0f * cosf(angles[angleIndex]);
}
Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &pos), 10, 1000, 1);
this->actor.shape.rot.y = this->actor.world.rot.y;
}
s32 func_809F706C(EnDodojr* this) {
if (this->actor.xzDistToPlayer > 40.0f) {
return 0;
} else {
return 1;
}
}
void func_809F709C(EnDodojr* this) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_DEAD);
this->actor.flags &= ~1;
func_809F6A20(this);
this->actionFunc = func_809F7AB8;
}
s32 func_809F70E8(EnDodojr* this, GlobalContext* globalCtx) {
if ((this->actionFunc == func_809F773C) || (this->actionFunc == func_809F77AC) ||
(this->actionFunc == func_809F784C) || (this->actionFunc == func_809F7A00) ||
(this->actionFunc == func_809F7AB8) || (this->actionFunc == func_809F7B3C) ||
(this->actionFunc == func_809F7BE4)) {
return 0;
}
if (globalCtx->actorCtx.unk_02 != 0) {
if (this->actionFunc != func_809F73AC) {
if (this->actionFunc == func_809F74C4) {
this->actor.shape.shadowDraw = ActorShadow_DrawCircle;
}
func_809F709C(this);
}
return 0;
}
if (!(this->collider.base.acFlags & 2)) {
return 0;
} else {
this->collider.base.acFlags &= ~2;
if ((this->actionFunc == func_809F73AC) || (this->actionFunc == func_809F74C4)) {
this->actor.shape.shadowDraw = ActorShadow_DrawCircle;
}
if ((this->actor.colChkInfo.damageEffect == 0) && (this->actor.colChkInfo.damage != 0)) {
func_80032C7C(globalCtx, &this->actor);
this->timer2 = 2;
this->actionFunc = func_809F7C48;
return 1;
}
if ((this->actor.colChkInfo.damageEffect == 1) && (this->actionFunc != func_809F78EC) &&
(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);
func_809F6A20(this);
this->actionFunc = func_809F786C;
}
return 0;
}
}
void func_809F72A4(EnDodojr* this, GlobalContext* globalCtx) {
Collider_UpdateCylinder(&this->actor, &this->collider);
if ((this->actionFunc != func_809F73AC) && (this->actionFunc != func_809F7BE4)) {
if ((this->actionFunc == func_809F74C4) || (this->actionFunc == func_809F758C) ||
(this->actionFunc == func_809F799C)) {
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
if ((this->actionFunc == func_809F74C4) || (this->actionFunc == func_809F758C) ||
(this->actionFunc == func_809F786C) || (this->actionFunc == func_809F78EC) ||
(this->actionFunc == func_809F799C)) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
}
void func_809F73AC(EnDodojr* this, GlobalContext* globalCtx) {
f32 lastFrame = Animation_GetLastFrame(&D_06000860);
Player* player = PLAYER;
f32 dist;
if (!(this->actor.xzDistToPlayer >= 320.0f)) {
dist = this->actor.world.pos.y - player->actor.world.pos.y;
if (!(dist >= 40.0f)) {
Animation_Change(&this->skelAnime, &D_06000860, 1.8f, 0.0f, lastFrame, 1, -10.0f);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_UP);
this->actor.world.pos.y -= 60.0f;
this->actor.flags |= 1;
this->actor.world.rot.x -= 0x4000;
this->actor.shape.rot.x = this->actor.world.rot.x;
this->dustPos = this->actor.world.pos;
this->dustPos.y = this->actor.floorHeight;
this->actionFunc = func_809F74C4;
}
}
}
void func_809F74C4(EnDodojr* this, GlobalContext* globalCtx) {
f32 sp2C;
Math_SmoothStepToS(&this->actor.shape, 0, 4, 0x3E8, 0x64);
sp2C = this->actor.shape.rot.x;
sp2C /= 16384.0f;
this->actor.world.pos.y = this->actor.home.pos.y + (60.0f * sp2C);
func_809F6510(this, globalCtx, 3);
if (sp2C == 0.0f) {
this->actor.shape.shadowDraw = ActorShadow_DrawCircle;
this->actor.world.rot.x = this->actor.shape.rot.x;
this->actor.speedXZ = 2.6f;
this->actionFunc = func_809F758C;
}
}
void func_809F758C(EnDodojr* this, GlobalContext* globalCtx) {
func_8002D868(&this->actor);
func_809F6730(this, globalCtx, &this->actor.world.pos);
if (DECR(this->timer4) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_MOVE);
this->timer4 = 5;
}
if (func_809F6DD0(this) != 0) {
func_809F6C24(this);
this->actionFunc = func_809F768C;
return;
}
func_809F6E54(this, globalCtx);
if (func_809F706C(this) != 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_CRY);
func_809F6B38(this);
this->actionFunc = func_809F799C;
}
if (this->actor.bgCheckFlags & 8) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_DOWN);
func_809F6BBC(this);
this->actionFunc = func_809F7A00;
}
}
void func_809F768C(EnDodojr* this, GlobalContext* globalCtx) {
EnBom* bomb;
if (((s16)this->skelAnime.curFrame - 8) < 4) {
bomb = (EnBom*)this->bomb;
bomb->timer++;
this->bomb->world.pos = this->headPos;
} else {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_DRINK);
Actor_Kill(this->bomb);
this->timer3 = 24;
this->unk_1FC = 0;
this->actionFunc = func_809F773C;
}
}
void func_809F773C(EnDodojr* this, GlobalContext* globalCtx) {
if (DECR(this->timer3) == 0) {
func_809F64D0(this);
this->actor.flags &= ~1;
func_809F6A20(this);
this->actionFunc = func_809F77AC;
}
}
void func_809F77AC(EnDodojr* this, GlobalContext* globalCtx) {
this->rootScale = 1.2f;
this->rootScale *= ((f32)this->actor.colorFilterTimer / 8);
func_8002D868(&this->actor);
if (func_809F68B0(this, globalCtx) != 0) {
this->timer3 = 60;
func_809F6AC4(this);
this->unk_1FC = 7;
this->actionFunc = func_809F784C;
}
}
void func_809F784C(EnDodojr* this, GlobalContext* globalCtx) {
func_809F7B3C(this, globalCtx);
}
void func_809F786C(EnDodojr* this, GlobalContext* globalCtx) {
func_8002D868(&this->actor);
if (func_809F68B0(this, globalCtx) != 0) {
func_809F6AC4(this);
this->actionFunc = func_809F78EC;
}
Math_SmoothStepToS(&this->actor.shape.rot.y, 0, 4, 1000, 10);
this->actor.world.rot.x = this->actor.shape.rot.x;
this->actor.colorFilterTimer = this->timer1;
}
void func_809F78EC(EnDodojr* this, GlobalContext* globalCtx) {
if (DECR(this->timer1) != 0) {
if (this->timer1 < 30) {
if ((this->timer1 & 1) != 0) {
this->actor.world.pos.x += 1.5f;
this->actor.world.pos.z += 1.5f;
} else {
this->actor.world.pos.x -= 1.5f;
this->actor.world.pos.z -= 1.5f;
}
return;
}
} else {
func_809F6994(this);
this->actionFunc = func_809F758C;
}
}
void func_809F799C(EnDodojr* this, GlobalContext* globalCtx) {
this->actor.flags |= 0x1000000;
func_8002D868(&this->actor);
if (func_809F68B0(this, globalCtx) != 0) {
func_809F6994(this);
this->actionFunc = func_809F758C;
}
}
void func_809F7A00(EnDodojr* this, GlobalContext* globalCtx) {
f32 tmp;
Math_SmoothStepToS(&this->actor.shape.rot.x, 0x4000, 4, 1000, 100);
if (DECR(this->timer3) != 0) {
tmp = (30 - this->timer3) / 30.0f;
this->actor.world.pos.y = this->actor.home.pos.y - (60.0f * tmp);
} else {
Actor_Kill(&this->actor);
}
func_809F6510(this, globalCtx, 3);
}
void func_809F7AB8(EnDodojr* this, GlobalContext* globalCtx) {
func_8002D868(this);
Math_SmoothStepToS(&this->actor.shape.rot.y, 0, 4, 1000, 10);
this->actor.world.rot.x = this->actor.shape.rot.x;
if (func_809F68B0(this, globalCtx) != 0) {
this->timer3 = 60;
func_809F6AC4(this);
this->unk_1FC = 7;
this->actionFunc = func_809F7B3C;
}
}
void func_809F7B3C(EnDodojr* this, GlobalContext* globalCtx) {
EnBom* bomb;
if (this->unk_1FC != 0) {
if (this->actor.colorFilterTimer == 0) {
func_8003426C(&this->actor, 0x4000, 200, 0, this->unk_1FC);
this->unk_1FC--;
}
} else {
bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, BOMB_BODY);
if (bomb != NULL) {
bomb->timer = 0;
}
this->timer3 = 8;
this->actionFunc = func_809F7BE4;
}
}
void func_809F7BE4(EnDodojr* this, GlobalContext* globalCtx) {
if (DECR(this->timer3) == 0) {
Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0x40);
Actor_Kill(&this->actor);
}
}
void func_809F7C48(EnDodojr* this, GlobalContext* globalCtx) {
if (DECR(this->timer2) == 0) {
func_809F709C(this);
}
}
void EnDodojr_Update(Actor* thisx, GlobalContext* globalCtx) {
EnDodojr* this = THIS;
SkelAnime_Update(&this->skelAnime);
Actor_MoveForward(&this->actor);
func_809F70E8(this, globalCtx);
if (this->actionFunc != func_809F73AC) {
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, this->collider.dim.radius, this->collider.dim.height, 0.0f, 5);
}
this->actionFunc(this, globalCtx);
Actor_SetFocus(&this->actor, 10.0f);
func_809F72A4(this, globalCtx);
}
s32 func_809F7D50(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnDodojr* this = THIS;
Vec3f D_809F7F64 = { 480.0f, 620.0f, 0.0f };
if (limbIndex == 1) {
Matrix_Scale((this->rootScale * 0.5f) + 1.0f, this->rootScale + 1.0f, (this->rootScale * 0.5f) + 1.0f, 1);
}
if (limbIndex == 4) {
Matrix_MultVec3f(&D_809F7F64, &this->headPos);
}
return 0;
}
void func_809F7DFC(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
}
void EnDodojr_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnDodojr* this = THIS;
if ((this->actionFunc != func_809F73AC) && (this->actionFunc != func_809F7BE4)) {
func_80093D18(globalCtx->state.gfxCtx);
SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, func_809F7D50, func_809F7DFC,
&this->actor);
}
}

View file

@ -6,9 +6,24 @@
struct EnDodojr;
typedef void (*EnDodojrActionFunc)(struct EnDodojr*, GlobalContext*);
typedef struct EnDodojr {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x174];
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnDodojrActionFunc actionFunc;
/* 0x0194 */ ColliderCylinder collider;
/* 0x01E0 */ Actor* bomb;
/* 0x01E4 */ Vec3f headPos;
/* 0x01F0 */ Vec3f dustPos;
/* 0x01FC */ s16 unk_1FC;
/* 0x01FE */ s16 timer1;
/* 0x0200 */ s16 timer2;
/* 0x0202 */ s16 timer3;
/* 0x0204 */ s16 timer4;
/* 0x0208 */ f32 rootScale; // scale used with the root limb
/* 0x020C */ Vec3s jointTable[15];
/* 0x0266 */ Vec3s morphTable[15];
} EnDodojr; // size = 0x02C0
extern const ActorInit En_Dodojr_InitVars;

View file

@ -618,7 +618,8 @@ void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) {
phi_v0 = this->unk_20C;
}
if (phi_v0 == 0) {
Audio_PlaySoundGeneral(NA_SE_PL_WALK_GROUND, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
Audio_PlaySoundGeneral(NA_SE_PL_WALK_GROUND, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
this->unk_20C = 8;
}
}