mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-06 14:20:11 +00:00
EnEncount1 (#457)
* Darkmeiro decompilation Bg_Gnd_Darkmeiro decompiled, matched, and documented. * give this a shot * fix conflict * one more try * could be useful * whoops * Leevers and Tektites and Wolfos, ohmy! * changes and cleanup * the need for speed
This commit is contained in:
parent
0b9b2edf1b
commit
930cee3061
12 changed files with 421 additions and 1202 deletions
|
@ -58,10 +58,9 @@ extern AnimationHeader D_060001E4;
|
|||
extern SkeletonHeader D_06001EE8;
|
||||
|
||||
void EnReeba_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnReeba* this = THIS;
|
||||
f32 temp_f0;
|
||||
s32 surfaceType;
|
||||
s32 pad;
|
||||
EnReeba* this = THIS;
|
||||
s32 surfaceType;
|
||||
|
||||
this->actor.naviEnemyId = 0x47;
|
||||
this->actor.unk_1F = 3;
|
||||
|
@ -87,10 +86,8 @@ void EnReeba_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
Actor_ChangeType(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORTYPE_ENEMY);
|
||||
}
|
||||
|
||||
temp_f0 = this->scale * -27500.0f;
|
||||
this->unk_284 = temp_f0;
|
||||
this->actor.shape.unk_08 = temp_f0;
|
||||
ActorShape_Init(&this->actor.shape, temp_f0, ActorShadow_DrawFunc_Circle, 0.0f);
|
||||
this->actor.shape.unk_08 = this->unk_284 = this->scale * -27500.0f;
|
||||
ActorShape_Init(&this->actor.shape, this->actor.shape.unk_08, ActorShadow_DrawFunc_Circle, 0.0f);
|
||||
this->actor.colChkInfo.damageTable = &sDamageTable;
|
||||
func_8002E4B4(globalCtx, &this->actor, 35.0f, 60.0f, 60.0f, 0x1D);
|
||||
|
||||
|
@ -105,23 +102,21 @@ void EnReeba_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void EnReeba_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
EnReeba* this = THIS;
|
||||
EnEncount1* spawner;
|
||||
|
||||
Collider_DestroyCylinder(globalCtx, &this->collider);
|
||||
|
||||
if (this->actor.parent != NULL) {
|
||||
spawner = (EnEncount1*)this->actor.parent;
|
||||
EnEncount1* spawner = (EnEncount1*)this->actor.parent;
|
||||
|
||||
if (spawner->actor.update != NULL) {
|
||||
|
||||
if (spawner->unk_152 > 0) {
|
||||
spawner->unk_152--;
|
||||
if (spawner->curNumSpawn > 0) {
|
||||
spawner->curNumSpawn--;
|
||||
}
|
||||
|
||||
if (this->isBig) {
|
||||
spawner->unk_16C = 0;
|
||||
spawner->unk_164 = 0x258;
|
||||
spawner->bigLeever = NULL;
|
||||
spawner->timer = 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,17 +125,15 @@ void EnReeba_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
|||
void func_80AE4F40(EnReeba* this, GlobalContext* globalCtx) {
|
||||
f32 frames = SkelAnime_GetFrameCount(&D_060001E4.genericHeader);
|
||||
Player* player = PLAYER;
|
||||
s16 absPlayerVel;
|
||||
s16 playerSpeed;
|
||||
|
||||
SkelAnime_ChangeAnim(&this->skelanime, &D_060001E4, 2.0f, 0.0f, frames, 0, -10.0f);
|
||||
|
||||
absPlayerVel = fabsf(player->linearVelocity);
|
||||
this->unk_278 = (20 - (absPlayerVel * 2));
|
||||
|
||||
playerSpeed = fabsf(player->linearVelocity);
|
||||
this->unk_278 = 20 - playerSpeed * 2;
|
||||
if (this->unk_278 < 0) {
|
||||
this->unk_278 = 2;
|
||||
}
|
||||
|
||||
if (this->unk_278 > 20) {
|
||||
this->unk_278 = 20;
|
||||
}
|
||||
|
@ -164,8 +157,7 @@ void func_80AE5054(EnReeba* this, GlobalContext* globalCtx) {
|
|||
SkelAnime_FrameUpdateMatrix(&this->skelanime);
|
||||
|
||||
if ((globalCtx->gameplayFrames % 4) == 0) {
|
||||
func_80033260(globalCtx, &this->actor, &this->actor.posRot.pos, this->actor.shape.unk_10, 1, 8.0f, 0x1F4, 0xA,
|
||||
1);
|
||||
func_80033260(globalCtx, &this->actor, &this->actor.posRot.pos, this->actor.shape.unk_10, 1, 8.0f, 500, 10, 1);
|
||||
}
|
||||
|
||||
if (this->unk_278 == 0) {
|
||||
|
@ -173,7 +165,6 @@ void func_80AE5054(EnReeba* this, GlobalContext* globalCtx) {
|
|||
if (this->actor.shape.unk_08 < 0.0f) {
|
||||
Math_SmoothDownscaleMaxF(&this->actor.shape.unk_08, 1.0f, this->unk_288);
|
||||
Math_SmoothScaleMaxF(&this->unk_288, 300.0f, 1.0f, 5.0f);
|
||||
|
||||
} else {
|
||||
this->unk_288 = 0.0f;
|
||||
this->actor.shape.unk_08 = 0.0f;
|
||||
|
@ -194,6 +185,7 @@ void func_80AE5054(EnReeba* this, GlobalContext* globalCtx) {
|
|||
break;
|
||||
case 4:
|
||||
this->actor.posRot.rot.y = this->actor.yawTowardsLink - (800.0f * playerLinearVel);
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->isBig) {
|
||||
|
@ -221,16 +213,10 @@ void func_80AE5270(EnReeba* this, GlobalContext* globalCtx) {
|
|||
if ((surfaceType != 4) && (surfaceType != 7)) {
|
||||
this->actor.speedXZ = 0.0f;
|
||||
this->actionfunc = func_80AE5688;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((this->unk_272 == 0) || (this->actor.xzDistFromLink < 30.0f) || (this->actor.xzDistFromLink > 400.0f) ||
|
||||
(this->actor.bgCheckFlags & 8)) {
|
||||
} else if ((this->unk_272 == 0) || (this->actor.xzDistFromLink < 30.0f) || (this->actor.xzDistFromLink > 400.0f) ||
|
||||
(this->actor.bgCheckFlags & 8)) {
|
||||
this->actionfunc = func_80AE5688;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->unk_274 == 0) {
|
||||
} else if (this->unk_274 == 0) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIVA_MOVE);
|
||||
this->unk_274 = 10;
|
||||
}
|
||||
|
@ -258,32 +244,29 @@ void func_80AE53AC(EnReeba* this, GlobalContext* globalCtx) {
|
|||
if (((surfaceType != 4) && (surfaceType != 7)) || (this->actor.xzDistFromLink > 400.0f) ||
|
||||
(this->actor.bgCheckFlags & 8)) {
|
||||
this->actionfunc = func_80AE5688;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if ((this->actor.xzDistFromLink < 70.0f) && (this->unk_270 == 0)) {
|
||||
this->unk_270 = 30;
|
||||
}
|
||||
|
||||
if ((this->actor.xzDistFromLink < 70.0f) && (this->unk_270 == 0)) {
|
||||
this->unk_270 = 30;
|
||||
}
|
||||
speed = (this->actor.xzDistFromLink - 20.0f) / ((Math_Rand_ZeroOne() * 50.0f) + 150.0f);
|
||||
this->actor.speedXZ += speed * 1.8f;
|
||||
if (this->actor.speedXZ >= 3.0f) {
|
||||
this->actor.speedXZ = 3.0f;
|
||||
}
|
||||
if (this->actor.speedXZ < -3.0f) {
|
||||
this->actor.speedXZ = -3.0f;
|
||||
}
|
||||
|
||||
speed = (this->actor.xzDistFromLink - 20.0f) / ((Math_Rand_ZeroOne() * 50.0f) + 150.0f);
|
||||
this->actor.speedXZ += speed * 1.8f;
|
||||
yawDiff = (this->unk_270 == 0) ? this->actor.yawTowardsLink : -this->actor.yawTowardsLink;
|
||||
yawDiff -= this->actor.posRot.rot.y;
|
||||
yaw = (yawDiff > 0) ? ((yawDiff / 31.0f) + 10.0f) : ((yawDiff / 31.0f) - 10.0f);
|
||||
this->actor.posRot.rot.y += yaw * 2.0f;
|
||||
|
||||
if (this->actor.speedXZ >= 3.0f) {
|
||||
this->actor.speedXZ = 3.0f;
|
||||
}
|
||||
|
||||
if (this->actor.speedXZ < -3.0f) {
|
||||
this->actor.speedXZ = -3.0f;
|
||||
}
|
||||
|
||||
yawDiff = (this->unk_270 == 0) ? this->actor.yawTowardsLink : -this->actor.yawTowardsLink;
|
||||
yawDiff = yawDiff - this->actor.posRot.rot.y;
|
||||
yaw = (yawDiff > 0) ? ((yawDiff / 31.0f) + 10.0f) : ((yawDiff / 31.0f) - 10.0f);
|
||||
this->actor.posRot.rot.y += (yaw * 2.0f);
|
||||
|
||||
if (this->unk_274 == 0) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIVA_MOVE);
|
||||
this->unk_274 = 20;
|
||||
if (this->unk_274 == 0) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIVA_MOVE);
|
||||
this->unk_274 = 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,7 +296,7 @@ void func_80AE56E0(EnReeba* this, GlobalContext* globalCtx) {
|
|||
SkelAnime_FrameUpdateMatrix(&this->skelanime);
|
||||
|
||||
if ((this->unk_284 + 10.0f) <= this->actor.shape.unk_08) {
|
||||
if ((globalCtx->gameplayFrames & 3) == 0) {
|
||||
if ((globalCtx->gameplayFrames % 4) == 0) {
|
||||
func_80033260(globalCtx, &this->actor, &this->actor.posRot.pos, this->actor.shape.unk_10, 1, 8.0f, 500, 10,
|
||||
1);
|
||||
}
|
||||
|
@ -337,7 +320,7 @@ void func_80AE5854(EnReeba* this, GlobalContext* globalCtx) {
|
|||
SkelAnime_FrameUpdateMatrix(&this->skelanime);
|
||||
|
||||
if (this->actor.speedXZ < 0.0f) {
|
||||
this->actor.speedXZ++;
|
||||
this->actor.speedXZ += 1.0f;
|
||||
}
|
||||
|
||||
if (this->unk_276 == 0) {
|
||||
|
@ -394,21 +377,21 @@ void func_80AE5938(EnReeba* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void func_80AE5A9C(EnReeba* this, GlobalContext* globalCtx) {
|
||||
Vec3f randPos;
|
||||
Vec3f pos;
|
||||
f32 scale;
|
||||
|
||||
if (this->unk_278 != 0) {
|
||||
if ((this->unk_27E == 2) && ((this->unk_278 & 0xF) == 0)) {
|
||||
randPos.x = this->actor.posRot.pos.x + Math_Rand_CenteredFloat(20.0f);
|
||||
randPos.y = this->actor.posRot.pos.y + Math_Rand_CenteredFloat(20.0f);
|
||||
randPos.z = this->actor.posRot.pos.z + Math_Rand_CenteredFloat(20.0f);
|
||||
scale = 3.0f;
|
||||
pos.x = this->actor.posRot.pos.x + Math_Rand_CenteredFloat(20.0f);
|
||||
pos.y = this->actor.posRot.pos.y + Math_Rand_CenteredFloat(20.0f);
|
||||
pos.z = this->actor.posRot.pos.z + Math_Rand_CenteredFloat(20.0f);
|
||||
|
||||
scale = 3.0f;
|
||||
if (this->isBig) {
|
||||
scale = 6.0f;
|
||||
}
|
||||
|
||||
EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &randPos, 150, 150, 150, 250, 235, 245, 255, scale);
|
||||
EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, scale);
|
||||
}
|
||||
} else {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIVA_DEAD);
|
||||
|
@ -430,11 +413,10 @@ void func_80AE5C38(EnReeba* this, GlobalContext* globalCtx) {
|
|||
Vec3f pos;
|
||||
Vec3f accel = { 0.0f, 0.0f, 0.0f };
|
||||
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
|
||||
EnEncount1* spawner;
|
||||
|
||||
if (this->unk_278 != 0) {
|
||||
if (this->actor.speedXZ < 0.0f) {
|
||||
this->actor.speedXZ++;
|
||||
this->actor.speedXZ += 1.0f;
|
||||
}
|
||||
} else {
|
||||
this->actor.speedXZ = 0.0f;
|
||||
|
@ -444,7 +426,9 @@ void func_80AE5C38(EnReeba* this, GlobalContext* globalCtx) {
|
|||
pos.x = this->actor.posRot.pos.x;
|
||||
pos.y = this->actor.posRot.pos.y;
|
||||
pos.z = this->actor.posRot.pos.z;
|
||||
|
||||
velocity.y = 4.0f;
|
||||
|
||||
EffectSsDeadDb_Spawn(globalCtx, &pos, &velocity, &accel, 120, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true);
|
||||
|
||||
if (!this->isBig) {
|
||||
|
@ -454,18 +438,16 @@ void func_80AE5C38(EnReeba* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
if (this->actor.parent != NULL) {
|
||||
spawner = (EnEncount1*)this->actor.parent;
|
||||
EnEncount1* spawner = (EnEncount1*)this->actor.parent;
|
||||
|
||||
if (spawner->actor.update != NULL) {
|
||||
if (!this->isBig) {
|
||||
if (spawner->numLeeversDead < 10) {
|
||||
spawner->numLeeversDead++;
|
||||
}
|
||||
// How many are dead?
|
||||
osSyncPrintf("\n\n");
|
||||
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 何匹DEAD? ☆☆☆☆☆%d\n" VT_RST, spawner->numLeeversDead);
|
||||
osSyncPrintf("\n\n");
|
||||
if ((spawner->actor.update != NULL) && !this->isBig) {
|
||||
if (spawner->killCount < 10) {
|
||||
spawner->killCount++;
|
||||
}
|
||||
// How many are dead?
|
||||
osSyncPrintf("\n\n");
|
||||
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 何匹DEAD? ☆☆☆☆☆%d\n" VT_RST, spawner->killCount);
|
||||
osSyncPrintf("\n\n");
|
||||
}
|
||||
|
||||
Actor_Kill(&this->actor);
|
||||
|
@ -494,9 +476,8 @@ void func_80AE5EDC(EnReeba* this, GlobalContext* globalCtx) {
|
|||
this->collider.base.acFlags &= ~2;
|
||||
|
||||
if ((this->actionfunc != func_80AE5C38) && (this->actionfunc != func_80AE5854)) {
|
||||
this->actor.shape.rot.z = 0;
|
||||
this->actor.shape.rot.x = this->actor.shape.rot.z = 0;
|
||||
this->unk_27E = 0;
|
||||
this->actor.shape.rot.x = this->actor.shape.rot.z;
|
||||
|
||||
switch (this->actor.colChkInfo.damageEffect) {
|
||||
case 11: // none
|
||||
|
@ -523,26 +504,25 @@ void func_80AE5EDC(EnReeba* this, GlobalContext* globalCtx) {
|
|||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIVA_DEAD);
|
||||
func_80032C7C(globalCtx, &this->actor);
|
||||
this->actionfunc = func_80AE5BC4;
|
||||
break;
|
||||
} else {
|
||||
if (this->actionfunc == func_80AE5E48) {
|
||||
this->actor.shape.rot.x = this->actor.shape.rot.z = 0;
|
||||
}
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIVA_DAMAGE);
|
||||
this->actionfunc = func_80AE57F0;
|
||||
}
|
||||
if (this->actionfunc == func_80AE5E48) {
|
||||
this->actor.shape.rot.z = 0;
|
||||
this->actor.shape.rot.x = this->actor.shape.rot.z;
|
||||
}
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIVA_DAMAGE);
|
||||
this->actionfunc = func_80AE57F0;
|
||||
break;
|
||||
case 3: // ice arrows/ice magic
|
||||
Actor_ApplyDamage(&this->actor);
|
||||
this->unk_27C = 2;
|
||||
this->unk_27E = 2;
|
||||
func_8003426C(&this->actor, 0, 0xFF, 0, 0x50);
|
||||
func_8003426C(&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, 0x50);
|
||||
func_8003426C(&this->actor, 0, 0xFF, 0, 80);
|
||||
this->actionfunc = func_80AE58EC;
|
||||
}
|
||||
break;
|
||||
|
@ -551,13 +531,13 @@ void func_80AE5EDC(EnReeba* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
void EnReeba_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
GlobalContext* globalCtx2 = globalCtx;
|
||||
void EnReeba_Update(Actor* thisx, GlobalContext* globalCtx2) {
|
||||
GlobalContext* globalCtx = globalCtx2;
|
||||
EnReeba* this = THIS;
|
||||
Player* player = PLAYER;
|
||||
|
||||
func_80AE5EDC(this, globalCtx);
|
||||
this->actionfunc(this, globalCtx2);
|
||||
this->actionfunc(this, globalCtx);
|
||||
Actor_SetScale(&this->actor, this->scale);
|
||||
|
||||
if (this->unk_270 != 0) {
|
||||
|
@ -581,7 +561,7 @@ void EnReeba_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
Actor_MoveForward(&this->actor);
|
||||
func_8002E4B4(globalCtx2, &this->actor, 35.0f, 60.0f, 60.0f, 0x1D);
|
||||
func_8002E4B4(globalCtx, &this->actor, 35.0f, 60.0f, 60.0f, 0x1D);
|
||||
|
||||
if (this->collider.base.atFlags & 4) {
|
||||
this->collider.base.atFlags &= ~4;
|
||||
|
@ -614,21 +594,21 @@ void EnReeba_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
|
||||
if ((this->actor.shape.unk_08 >= -700.0f) && (this->actor.colChkInfo.health > 0) &&
|
||||
(this->actionfunc != func_80AE56E0)) {
|
||||
CollisionCheck_SetOC(globalCtx2, &globalCtx2->colChkCtx, &this->collider.base);
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
|
||||
if (!(this->actor.shape.unk_08 < 0.0f)) {
|
||||
CollisionCheck_SetAC(globalCtx2, &globalCtx2->colChkCtx, &this->collider.base);
|
||||
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
|
||||
if ((this->actionfunc == func_80AE5270) || (this->actionfunc == func_80AE53AC)) {
|
||||
CollisionCheck_SetAT(globalCtx2, &globalCtx2->colChkCtx, &this->collider.base);
|
||||
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnReeba_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnReeba* this = THIS;
|
||||
s32 pad;
|
||||
EnReeba* this = THIS;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_reeba.c", 1062);
|
||||
|
||||
|
|
|
@ -30,6 +30,11 @@ typedef struct EnReeba {
|
|||
/* 0x0290 */ ColliderCylinder collider;
|
||||
} EnReeba; // size = 0x02DC
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ LEEVER_SMALL,
|
||||
/* 1 */ LEEVER_BIG
|
||||
} LeeverParam;
|
||||
|
||||
extern const ActorInit En_Reeba_InitVars;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue