1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-06 06:10:21 +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:
petrie911 2020-11-19 13:27:32 -06:00 committed by GitHub
parent 0b9b2edf1b
commit 930cee3061
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 421 additions and 1202 deletions

View file

@ -1,4 +1,5 @@
#include "z_en_encount1.h"
#include "vt.h"
#define FLAGS 0x08000010
@ -7,7 +8,13 @@
void EnEncount1_Init(Actor* thisx, GlobalContext* globalCtx);
void EnEncount1_Update(Actor* thisx, GlobalContext* globalCtx);
/*
void EnEncount1_SpawnLeevers(EnEncount1* this, GlobalContext* globalCtx);
void EnEncount1_SpawnTektites(EnEncount1* this, GlobalContext* globalCtx);
void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCtx);
s16 sLeeverAngles[] = { 0x0000, 0x2710, 0x7148, 0x8EB8, 0xD8F0 };
f32 sLeeverDists[] = { 200.0f, 170.0f, 120.0f, 120.0f, 170.0f };
const ActorInit En_Encount1_InitVars = {
ACTOR_EN_ENCOUNT1,
ACTORTYPE_PROP,
@ -19,13 +26,313 @@ const ActorInit En_Encount1_InitVars = {
(ActorFunc)EnEncount1_Update,
NULL,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Encount1/EnEncount1_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Encount1/func_80A0693C.s")
void EnEncount1_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnEncount1* this = THIS;
f32 spawnRange;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Encount1/func_80A06CD0.s")
if (this->actor.params <= 0) {
osSyncPrintf("\n\n");
// Input error death!
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 入力エラーデッス! ☆☆☆☆☆ \n" VT_RST);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 入力エラーデッス! ☆☆☆☆☆ \n" VT_RST);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 入力エラーデッス! ☆☆☆☆☆ \n" VT_RST);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 入力エラーデッス! ☆☆☆☆☆ \n" VT_RST);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 入力エラーデッス! ☆☆☆☆☆ \n" VT_RST);
osSyncPrintf("\n\n");
Actor_Kill(&this->actor);
return;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Encount1/func_80A06E88.s")
this->spawnType = (this->actor.params >> 0xB) & 0x1F;
this->maxCurSpawns = (this->actor.params >> 6) & 0x1F;
this->maxTotalSpawns = this->actor.params & 0x3F;
this->curNumSpawn = this->totalNumSpawn = 0;
spawnRange = 120.0f + (40.0f * this->actor.posRot.rot.z);
this->spawnRange = spawnRange;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Encount1/EnEncount1_Update.s")
osSyncPrintf("\n\n");
// It's an enemy spawner!
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 敵発生ゾーンでた! ☆☆☆☆☆ %x\n" VT_RST, this->actor.params);
// Type
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 種類\t\t ☆☆☆☆☆ %d\n" VT_RST, this->spawnType);
// Maximum number of simultaneous spawns
osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ 最大同時発生数 ☆☆☆☆☆ %d\n" VT_RST, this->maxCurSpawns);
// Maximum number of spawns
osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ 最大発生数 \t ☆☆☆☆☆ %d\n" VT_RST, this->maxTotalSpawns);
// Spawn check range
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発生チェック範囲 ☆☆☆☆☆ %f\n" VT_RST, this->spawnRange);
osSyncPrintf("\n\n");
this->actor.flags &= ~1;
switch (this->spawnType) {
case SPAWNER_LEEVER:
this->timer = 30;
this->maxCurSpawns = 5;
if (globalCtx->sceneNum == SCENE_SPOT13) { // Haunted Wasteland
this->reduceLeevers = true;
this->maxCurSpawns = 3;
}
this->updateFunc = EnEncount1_SpawnLeevers;
break;
case SPAWNER_TEKTITE:
this->maxCurSpawns = 2;
this->updateFunc = EnEncount1_SpawnTektites;
break;
case SPAWNER_STALCHILDREN:
case SPAWNER_WOLFOS:
if (globalCtx->sceneNum == SCENE_SPOT00) { // Hyrule Field
this->maxTotalSpawns = 10000;
}
this->updateFunc = EnEncount1_SpawnStalchildOrWolfos;
break;
}
}
void EnEncount1_SpawnLeevers(EnEncount1* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
s32 floorType;
f32 spawnDist;
s32 spawnParams;
s16 spawnLimit;
s16 spawnAngle;
Vec3f spawnPos;
CollisionPoly* floorPoly;
s32 bgId;
f32 floorY;
EnReeba* leever;
this->outOfRangeTimer = 0;
spawnPos = this->actor.posRot.pos;
if ((this->timer == 0) && (globalCtx->csCtx.state == 0) && (this->curNumSpawn <= this->maxCurSpawns) &&
(this->curNumSpawn < 5)) {
floorType = func_80041D4C(&globalCtx->colCtx, player->actor.floorPoly, player->actor.floorPolySource);
if ((floorType != 4) && (floorType != 7) && (floorType != 12)) {
this->numLeeverSpawns = 0;
} else if (!(this->reduceLeevers && (this->actor.xzDistFromLink > 1300.0f))) {
spawnLimit = 5;
if (this->reduceLeevers) {
spawnLimit = 3;
}
while ((this->curNumSpawn < this->maxCurSpawns) && (this->curNumSpawn < spawnLimit) && (this->timer == 0)) {
spawnDist = sLeeverDists[this->leeverIndex];
spawnAngle = sLeeverAngles[this->leeverIndex] + player->actor.shape.rot.y;
spawnParams = LEEVER_SMALL;
if ((this->killCount >= 10) && (this->bigLeever == NULL)) {
this->killCount = this->numLeeverSpawns = 0;
spawnAngle = sLeeverAngles[0];
spawnDist = sLeeverDists[2];
spawnParams = LEEVER_BIG;
}
spawnPos.x = player->actor.posRot.pos.x + Math_Sins(spawnAngle) * spawnDist;
spawnPos.y = player->actor.groundY + 120.0f;
spawnPos.z = player->actor.posRot.pos.z + Math_Coss(spawnAngle) * spawnDist;
floorY = func_8003C9A4(&globalCtx->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos);
if (floorY <= -32000.0f) {
break;
}
spawnPos.y = floorY;
leever = (EnReeba*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_REEBA,
spawnPos.x, spawnPos.y, spawnPos.z, 0, 0, 0, spawnParams);
if (1) {} if (1) {}
if (leever != NULL) {
this->curNumSpawn++;
leever->unk_280 = this->leeverIndex++;
if (this->leeverIndex >= 5) {
this->leeverIndex = 0;
}
this->numLeeverSpawns++;
if (this->numLeeverSpawns >= 12) {
this->timer = 150;
this->numLeeverSpawns = 0;
}
if (spawnParams != LEEVER_SMALL) {
this->timer = 300;
this->bigLeever = leever;
}
if (!this->reduceLeevers) {
this->maxCurSpawns = (s16)Math_Rand_ZeroFloat(3.99f) + 2;
} else {
this->maxCurSpawns = (s16)Math_Rand_ZeroFloat(2.99f) + 1;
}
} else {
// Cannot spawn!
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発生できません! ☆☆☆☆☆\n" VT_RST);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発生できません! ☆☆☆☆☆\n" VT_RST);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発生できません! ☆☆☆☆☆\n" VT_RST);
break;
}
}
}
}
}
void EnEncount1_SpawnTektites(EnEncount1* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
s32 bgId;
CollisionPoly* floorPoly;
Vec3f spawnPos;
f32 floorY;
if (this->timer == 0) {
this->timer = 10;
if ((fabsf(player->actor.posRot.pos.y - this->actor.posRot.pos.y) > 100.0f) ||
(this->actor.xzDistFromLink > this->spawnRange)) {
this->outOfRangeTimer++;
} else {
this->outOfRangeTimer = 0;
if ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) {
spawnPos.x = this->actor.posRot.pos.x + Math_Rand_CenteredFloat(50.0f);
spawnPos.y = this->actor.posRot.pos.y + 120.0f;
spawnPos.z = this->actor.posRot.pos.z + Math_Rand_CenteredFloat(50.0f);
floorY = func_8003C9A4(&globalCtx->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos);
if (floorY <= -32000.0f) {
return;
}
spawnPos.y = floorY;
if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_TITE, spawnPos.x,
spawnPos.y, spawnPos.z, 0, 0, 0, -1) != NULL) { // Red tektite
this->curNumSpawn++;
this->totalNumSpawn++;
} else {
// Cannot spawn!
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発生できません! ☆☆☆☆☆\n" VT_RST);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発生できません! ☆☆☆☆☆\n" VT_RST);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発生できません! ☆☆☆☆☆\n" VT_RST);
}
}
}
}
}
void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
f32 spawnDist;
s16 spawnAngle;
s16 spawnId;
s16 spawnParams;
s16 kcOver10;
s16 tempmod;
Vec3f spawnPos;
CollisionPoly* floorPoly;
s32 bgId;
f32 floorY;
if (globalCtx->sceneNum != SCENE_SPOT00) {
if ((fabsf(player->actor.posRot.pos.y - this->actor.posRot.pos.y) > 100.0f) ||
(this->actor.xzDistFromLink > this->spawnRange)) {
this->outOfRangeTimer++;
return;
}
} else if (!gSaveContext.nightFlag || (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY)) {
this->killCount = 0;
return;
}
this->outOfRangeTimer = 0;
spawnPos = this->actor.posRot.pos;
if ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) {
while ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) {
if (globalCtx->sceneNum == SCENE_SPOT00) {
if ((player->unk_89E == 0) || (player->actor.floorPolySource != 0x32) ||
!(player->actor.bgCheckFlags & 1) || (player->stateFlags1 & 0x08000000)) {
this->fieldSpawnTimer = 60;
break;
}
if (this->fieldSpawnTimer == 60) {
this->maxCurSpawns = 2;
}
if (this->fieldSpawnTimer != 0) {
this->fieldSpawnTimer--;
break;
}
spawnDist = Math_Rand_CenteredFloat(40.0f) + 200.0f;
spawnAngle = player->actor.shape.rot.y;
if (this->curNumSpawn != 0) {
spawnAngle = -spawnAngle;
spawnDist = Math_Rand_CenteredFloat(40.0f) + 100.0f;
}
spawnPos.x =
player->actor.posRot.pos.x + (Math_Sins(spawnAngle) * spawnDist) + Math_Rand_CenteredFloat(40.0f);
spawnPos.y = player->actor.groundY + 120.0f;
spawnPos.z =
player->actor.posRot.pos.z + (Math_Coss(spawnAngle) * spawnDist) + Math_Rand_CenteredFloat(40.0f);
floorY = func_8003C9A4(&globalCtx->colCtx, &floorPoly, &bgId, &this->actor, &spawnPos);
if (floorY <= -32000.0f) {
break;
}
if ((player->actor.waterY != -32000.0f) &&
(floorY < (player->actor.posRot.pos.y - player->actor.waterY))) {
break;
}
spawnPos.y = floorY;
}
if (this->spawnType == SPAWNER_WOLFOS) {
spawnId = ACTOR_EN_WF;
spawnParams = (0xFF << 8) | 0x00;
} else {
spawnId = ACTOR_EN_SKB;
spawnParams = 0;
kcOver10 = this->killCount / 10;
if (kcOver10 > 0) {
tempmod = this->killCount % 10;
if (tempmod == 0) {
spawnParams = kcOver10 * 5;
}
}
this->killCount++;
}
if (Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, spawnId, spawnPos.x, spawnPos.y,
spawnPos.z, 0, 0, 0, spawnParams) != NULL) {
this->curNumSpawn++;
if (this->curNumSpawn >= this->maxCurSpawns) {
this->fieldSpawnTimer = 100;
}
if (globalCtx->sceneNum != SCENE_SPOT00) {
this->totalNumSpawn++;
}
} else {
// Cannot spawn!
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発生できません! ☆☆☆☆☆\n" VT_RST);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発生できません! ☆☆☆☆☆\n" VT_RST);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発生できません! ☆☆☆☆☆\n" VT_RST);
break;
}
}
}
}
void EnEncount1_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnEncount1* this = THIS;
if (this->timer != 0) {
this->timer--;
}
this->updateFunc(this, globalCtx);
if (BREG(0) != 0) {
if (this->outOfRangeTimer != 0) {
if ((this->outOfRangeTimer & 1) == 0) {
DebugDisplay_AddObject(this->actor.posRot.pos.x, this->actor.posRot.pos.y, this->actor.posRot.pos.z,
this->actor.posRot.rot.x, this->actor.posRot.rot.y, this->actor.posRot.rot.z,
1.0f, 1.0f, 1.0f, 120, 120, 120, 255, 4, globalCtx->state.gfxCtx);
}
} else {
DebugDisplay_AddObject(this->actor.posRot.pos.x, this->actor.posRot.pos.y, this->actor.posRot.pos.z,
this->actor.posRot.rot.x, this->actor.posRot.rot.y, this->actor.posRot.rot.z, 1.0f,
1.0f, 1.0f, 255, 0, 255, 255, 4, globalCtx->state.gfxCtx);
}
}
}

View file

@ -3,21 +3,40 @@
#include "ultra64.h"
#include "global.h"
#include "overlays/actors/ovl_En_Reeba/z_en_reeba.h"
#define SPAWNER_PARAMS(type, number, total) ((type << 0xB) | (number << 0x6) | total)
struct EnEncount1;
typedef void (*EnEncount1UpdateFunc)(struct EnEncount1*, GlobalContext*);
typedef struct EnEncount1 {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x6];
/* 0x0152 */ s16 unk_152;
/* 0x0154 */ char unk_154[0xA];
/* 0x015E */ s16 numLeeversDead;
/* 0x0160 */ char unk_160[0x4];
/* 0x0164 */ s16 unk_164;
/* 0x0166 */ char unk_166[0x6];
/* 0x016C */ UNK_TYPE unk_16C;
/* 0x014C */ EnEncount1UpdateFunc updateFunc;
/* 0x0150 */ s16 maxCurSpawns;
/* 0x0152 */ s16 curNumSpawn;
/* 0x0154 */ s16 spawnType;
/* 0x0156 */ s16 maxTotalSpawns;
/* 0x0158 */ s16 totalNumSpawn;
/* 0x015A */ s16 outOfRangeTimer;
/* 0x015C */ s16 fieldSpawnTimer;
/* 0x015E */ s16 killCount;
/* 0x0160 */ s16 numLeeverSpawns;
/* 0x0162 */ s16 leeverIndex;
/* 0x0164 */ s16 timer;
/* 0x0166 */ u8 reduceLeevers;
/* 0x0168 */ f32 spawnRange;
/* 0x016C */ EnReeba* bigLeever;
} EnEncount1; // size = 0x0170
typedef enum {
/* 0 */ SPAWNER_LEEVER,
/* 1 */ SPAWNER_TEKTITE,
/* 2 */ SPAWNER_STALCHILDREN,
/* 3 */ SPAWNER_WOLFOS
} EnEncount1type;
extern const ActorInit En_Encount1_InitVars;
#endif

View file

@ -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);

View file

@ -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