mirror of
https://github.com/zeldaret/oot
synced 2026-10-27 20:32:36 -04:00
@@ -1,9 +1,3 @@
|
||||
/*
|
||||
* File: z_en_kusa.c
|
||||
* Overlay: ovl_en_kusa
|
||||
* Description: Bush
|
||||
*/
|
||||
|
||||
#include "z_en_kusa.h"
|
||||
#include "src/overlays/actors/ovl_En_Insect/z_en_insect.h"
|
||||
#include "src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h"
|
||||
@@ -14,13 +8,12 @@
|
||||
#include "printf.h"
|
||||
#include "rand.h"
|
||||
#include "sfx.h"
|
||||
#include "stack_pad.h"
|
||||
#include "terminal.h"
|
||||
#include "translation.h"
|
||||
#include "z_en_item00.h"
|
||||
#include "z_lib.h"
|
||||
#include "effect.h"
|
||||
#include "play_state.h"
|
||||
#include "stack_pad.h"
|
||||
#include "translation.h"
|
||||
|
||||
#include "assets/objects/gameplay_keep/cuttable_shrub.h"
|
||||
#include "assets/objects/gameplay_field_keep/gameplay_field_keep.h"
|
||||
@@ -31,30 +24,28 @@
|
||||
void EnKusa_Init(Actor* thisx, PlayState* play);
|
||||
void EnKusa_Destroy(Actor* thisx, PlayState* play2);
|
||||
void EnKusa_Update(Actor* thisx, PlayState* play);
|
||||
void EnKusa_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void EnKusa_SetupLiftedUp(EnKusa* this);
|
||||
void EnKusa_SetupWaitForObject(EnKusa* this);
|
||||
void EnKusa_SetupMain(EnKusa* this);
|
||||
void EnKusa_SetupFall(EnKusa* this);
|
||||
void EnKusa_SetupCut(EnKusa* this);
|
||||
void EnKusa_SetupUprootedWaitRegrow(EnKusa* this);
|
||||
void EnKusa_SetupRegrow(EnKusa* this);
|
||||
|
||||
void EnKusa_Fall(EnKusa* this, PlayState* play);
|
||||
void EnKusa_WaitForObject(EnKusa* this, PlayState* play);
|
||||
void EnKusa_SetupMain(EnKusa* this);
|
||||
void EnKusa_Main(EnKusa* this, PlayState* play);
|
||||
void EnKusa_LiftedUp(EnKusa* this, PlayState* play);
|
||||
void EnKusa_SetupCarried(EnKusa* this);
|
||||
void EnKusa_Carried(EnKusa* this, PlayState* play);
|
||||
void EnKusa_SetupFall(EnKusa* this);
|
||||
void EnKusa_Fall(EnKusa* this, PlayState* play);
|
||||
void EnKusa_SetupCut(EnKusa* this);
|
||||
void EnKusa_CutWaitRegrow(EnKusa* this, PlayState* play);
|
||||
void EnKusa_DoNothing(EnKusa* this, PlayState* play);
|
||||
void EnKusa_SetupUprootedWaitRegrow(EnKusa* this);
|
||||
void EnKusa_UprootedWaitRegrow(EnKusa* this, PlayState* play);
|
||||
void EnKusa_SetupRegrow(EnKusa* this);
|
||||
void EnKusa_Regrow(EnKusa* this, PlayState* play);
|
||||
void EnKusa_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
static s16 rotSpeedXtarget = 0;
|
||||
static s16 rotSpeedX = 0;
|
||||
static s16 rotSpeedYtarget = 0;
|
||||
static s16 rotSpeedY = 0;
|
||||
|
||||
ActorProfile En_Kusa_Profile = {
|
||||
/**/ ACTOR_EN_KUSA,
|
||||
/**/ ACTORCAT_PROP,
|
||||
@@ -67,7 +58,11 @@ ActorProfile En_Kusa_Profile = {
|
||||
/**/ NULL,
|
||||
};
|
||||
|
||||
static s16 sObjectIds[] = { OBJECT_GAMEPLAY_FIELD_KEEP, OBJECT_KUSA, OBJECT_KUSA };
|
||||
static s16 sRequiredObjectIds[] = {
|
||||
OBJECT_GAMEPLAY_FIELD_KEEP,
|
||||
OBJECT_KUSA,
|
||||
OBJECT_KUSA,
|
||||
};
|
||||
|
||||
static ColliderCylinderInit sCylinderInit = {
|
||||
{
|
||||
@@ -91,14 +86,16 @@ static ColliderCylinderInit sCylinderInit = {
|
||||
|
||||
static CollisionCheckInfoInit sColChkInfoInit = { 0, 12, 30, MASS_IMMOVABLE };
|
||||
|
||||
static Vec3f sUnitDirections[] = {
|
||||
static Vec3f sUnitDirections[4] = {
|
||||
{ 0.0f, 0.7071f, 0.7071f },
|
||||
{ 0.7071f, 0.7071f, 0.0f },
|
||||
{ 0.0f, 0.7071f, -0.7071f },
|
||||
{ -0.7071f, 0.7071f, 0.0f },
|
||||
};
|
||||
|
||||
static s16 sFragmentScales[] = { 108, 102, 96, 84, 66, 55, 42, 38 };
|
||||
static s16 sFragmentScales[8] = {
|
||||
108, 102, 96, 84, 66, 55, 42, 38,
|
||||
};
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_VEC3F_DIV1000(scale, 400, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -3200, ICHAIN_CONTINUE),
|
||||
@@ -106,26 +103,30 @@ static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_F32(cullingVolumeScale, 100, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDownward, 120, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
static Gfx* sDLists[3] = {
|
||||
gFieldBushDL,
|
||||
object_kusa_DL_000140,
|
||||
object_kusa_DL_000140,
|
||||
};
|
||||
|
||||
void EnKusa_SetupAction(EnKusa* this, EnKusaActionFunc actionFunc) {
|
||||
this->timer = 0;
|
||||
this->actionFunc = actionFunc;
|
||||
}
|
||||
|
||||
s32 EnKusa_SnapToFloor(EnKusa* this, PlayState* play, f32 yOffset) {
|
||||
s32 EnKusa_SnapToGround(EnKusa* this, PlayState* play, f32 offsetY) {
|
||||
STACK_PAD(s32);
|
||||
CollisionPoly* groundPoly;
|
||||
Vec3f pos;
|
||||
s32 bgId;
|
||||
f32 floorY;
|
||||
f32 groundY;
|
||||
|
||||
pos.x = this->actor.world.pos.x;
|
||||
pos.y = this->actor.world.pos.y + 30.0f;
|
||||
pos.z = this->actor.world.pos.z;
|
||||
|
||||
floorY = BgCheck_EntityRaycastDown4(&play->colCtx, &groundPoly, &bgId, &this->actor, &pos);
|
||||
|
||||
if (floorY > BGCHECK_Y_MIN) {
|
||||
this->actor.world.pos.y = floorY + yOffset;
|
||||
groundY = BgCheck_EntityRaycastDown4(&play->colCtx, &groundPoly, &bgId, &this->actor, &pos);
|
||||
if (groundY > BGCHECK_Y_MIN) {
|
||||
this->actor.world.pos.y = groundY + offsetY;
|
||||
Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos);
|
||||
return true;
|
||||
} else {
|
||||
@@ -137,18 +138,18 @@ s32 EnKusa_SnapToFloor(EnKusa* this, PlayState* play, f32 yOffset) {
|
||||
}
|
||||
|
||||
void EnKusa_DropCollectible(EnKusa* this, PlayState* play) {
|
||||
s16 dropParams;
|
||||
s16 dropTable;
|
||||
STACK_PAD(s32);
|
||||
|
||||
switch (PARAMS_GET_U(this->actor.params, 0, 2)) {
|
||||
case ENKUSA_TYPE_0:
|
||||
case ENKUSA_TYPE_2:
|
||||
dropParams = PARAMS_GET_U(this->actor.params, 8, 4);
|
||||
|
||||
if (dropParams >= COLLECTIBLE_DROP_TABLE_13) {
|
||||
dropParams = COLLECTIBLE_DROP_TABLE_0;
|
||||
dropTable = PARAMS_GET_U(this->actor.params, 8, 4);
|
||||
if (dropTable >= COLLECTIBLE_DROP_TABLE_13) {
|
||||
dropTable = COLLECTIBLE_DROP_TABLE_0;
|
||||
}
|
||||
Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos,
|
||||
COLLECTIBLE_DROP_RANDOM_PARAMS(dropParams, false));
|
||||
COLLECTIBLE_DROP_RANDOM_PARAMS(dropTable, false));
|
||||
break;
|
||||
case ENKUSA_TYPE_1:
|
||||
if (Rand_ZeroOne() < 0.5f) {
|
||||
@@ -162,7 +163,6 @@ void EnKusa_DropCollectible(EnKusa* this, PlayState* play) {
|
||||
|
||||
void EnKusa_UpdateVelY(EnKusa* this) {
|
||||
this->actor.velocity.y += this->actor.gravity;
|
||||
|
||||
if (this->actor.velocity.y < this->actor.minVelocityY) {
|
||||
this->actor.velocity.y = this->actor.minVelocityY;
|
||||
}
|
||||
@@ -181,42 +181,35 @@ void EnKusa_SetScaleSmall(EnKusa* this) {
|
||||
this->actor.scale.z = 0.120000005f;
|
||||
}
|
||||
|
||||
void EnKusa_SpawnFragments(EnKusa* this, PlayState* play) {
|
||||
Vec3f velocity;
|
||||
Vec3f pos;
|
||||
s32 i;
|
||||
s32 scaleIndex;
|
||||
void EnKusa_SpawnFragmentsEffects(EnKusa* this, PlayState* play) {
|
||||
Vec3f effVel;
|
||||
Vec3f effPos;
|
||||
Vec3f* dir;
|
||||
s32 scaleIndex;
|
||||
s32 i;
|
||||
STACK_PAD(s32);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sUnitDirections); i++) {
|
||||
dir = &sUnitDirections[i];
|
||||
|
||||
pos.x = this->actor.world.pos.x + (dir->x * this->actor.scale.x * 20.0f);
|
||||
pos.y = this->actor.world.pos.y + (dir->y * this->actor.scale.y * 20.0f) + 10.0f;
|
||||
pos.z = this->actor.world.pos.z + (dir->z * this->actor.scale.z * 20.0f);
|
||||
|
||||
velocity.x = (Rand_ZeroOne() - 0.5f) * 8.0f;
|
||||
velocity.y = Rand_ZeroOne() * 10.0f;
|
||||
velocity.z = (Rand_ZeroOne() - 0.5f) * 8.0f;
|
||||
|
||||
effPos.x = this->actor.world.pos.x + (dir->x * this->actor.scale.x * 20.0f);
|
||||
effPos.y = this->actor.world.pos.y + (dir->y * this->actor.scale.y * 20.0f) + 10.0f;
|
||||
effPos.z = this->actor.world.pos.z + (dir->z * this->actor.scale.z * 20.0f);
|
||||
effVel.x = (Rand_ZeroOne() - 0.5f) * 8.0f;
|
||||
effVel.y = Rand_ZeroOne() * 10.0f;
|
||||
effVel.z = (Rand_ZeroOne() - 0.5f) * 8.0f;
|
||||
scaleIndex = (s32)(Rand_ZeroOne() * 111.1f) & 7;
|
||||
EffectSsKakera_Spawn(play, &effPos, &effVel, &effPos, -100, 0x40, 0x28, 3, 0, sFragmentScales[scaleIndex], 0, 0,
|
||||
80, -1, 1, gCuttableShrubStalkDL);
|
||||
|
||||
EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -100, 64, 40, 3, 0, sFragmentScales[scaleIndex], 0, 0, 80,
|
||||
KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_KEEP, gCuttableShrubStalkDL);
|
||||
|
||||
pos.x = this->actor.world.pos.x + (dir->x * this->actor.scale.x * 40.0f);
|
||||
pos.y = this->actor.world.pos.y + (dir->y * this->actor.scale.y * 40.0f) + 10.0f;
|
||||
pos.z = this->actor.world.pos.z + (dir->z * this->actor.scale.z * 40.0f);
|
||||
|
||||
velocity.x = (Rand_ZeroOne() - 0.5f) * 6.0f;
|
||||
velocity.y = Rand_ZeroOne() * 10.0f;
|
||||
velocity.z = (Rand_ZeroOne() - 0.5f) * 6.0f;
|
||||
|
||||
effPos.x = this->actor.world.pos.x + (dir->x * this->actor.scale.x * 40.0f);
|
||||
effPos.y = this->actor.world.pos.y + (dir->y * this->actor.scale.y * 40.0f) + 10.0f;
|
||||
effPos.z = this->actor.world.pos.z + (dir->z * this->actor.scale.z * 40.0f);
|
||||
effVel.x = (Rand_ZeroOne() - 0.5f) * 6.0f;
|
||||
effVel.y = Rand_ZeroOne() * 10.0f;
|
||||
effVel.z = (Rand_ZeroOne() - 0.5f) * 6.0f;
|
||||
scaleIndex = (s32)(Rand_ZeroOne() * 111.1f) % 7;
|
||||
|
||||
EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -100, 64, 40, 3, 0, sFragmentScales[scaleIndex], 0, 0, 80,
|
||||
KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_KEEP, gCuttableShrubTipDL);
|
||||
EffectSsKakera_Spawn(play, &effPos, &effVel, &effPos, -100, 0x40, 0x28, 3, 0, sFragmentScales[scaleIndex], 0, 0,
|
||||
80, -1, 1, gCuttableShrubTipDL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,11 +217,9 @@ void EnKusa_SpawnBugs(EnKusa* this, PlayState* play) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
Actor* bug =
|
||||
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y,
|
||||
this->actor.world.pos.z, 0, Rand_ZeroOne() * 0xFFFF, 0, INSECT_TYPE_SPAWNED);
|
||||
|
||||
if (bug == NULL) {
|
||||
if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y,
|
||||
this->actor.world.pos.z, 0, TRUNCF_BINANG(Rand_ZeroOne() * 0xFFFF), 0,
|
||||
INSECT_TYPE_SPAWNED) == NULL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -246,36 +237,26 @@ void EnKusa_Init(Actor* thisx, PlayState* play) {
|
||||
EnKusa* this = (EnKusa*)thisx;
|
||||
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
|
||||
if (play->csCtx.state != CS_STATE_IDLE) {
|
||||
this->actor.cullingVolumeDistance += 1000.0f;
|
||||
}
|
||||
|
||||
EnKusa_InitCollider(thisx, play);
|
||||
EnKusa_InitCollider(&this->actor, play);
|
||||
CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
|
||||
|
||||
if (this->actor.shape.rot.y == 0) {
|
||||
s16 rand = Rand_ZeroFloat(0x10000);
|
||||
|
||||
this->actor.world.rot.y = rand;
|
||||
this->actor.home.rot.y = rand;
|
||||
this->actor.shape.rot.y = rand;
|
||||
this->actor.shape.rot.y = this->actor.home.rot.y = this->actor.world.rot.y = (s16)(s32)Rand_ZeroFloat(65536.0f);
|
||||
}
|
||||
|
||||
if (!EnKusa_SnapToFloor(this, play, 0.0f)) {
|
||||
if (!EnKusa_SnapToGround(this, play, 0.0f)) {
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
|
||||
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[PARAMS_GET_U(thisx->params, 0, 2)]);
|
||||
|
||||
this->requiredObjectSlot =
|
||||
Object_GetSlot(&play->objectCtx, sRequiredObjectIds[PARAMS_GET_U(this->actor.params, 0, 2)]);
|
||||
if (this->requiredObjectSlot < 0) {
|
||||
PRINTF(T("Error : バンク危険! (arg_data 0x%04x)(%s %d)\n", "Error : Bank danger! (arg_data 0x%04x)(%s %d)\n"),
|
||||
thisx->params, "../z_en_kusa.c", 561);
|
||||
this->actor.params, "../z_en_kusa.c", 561);
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
|
||||
EnKusa_SetupWaitForObject(this);
|
||||
}
|
||||
|
||||
@@ -297,7 +278,6 @@ void EnKusa_WaitForObject(EnKusa* this, PlayState* play) {
|
||||
} else {
|
||||
EnKusa_SetupMain(this);
|
||||
}
|
||||
|
||||
this->actor.draw = EnKusa_Draw;
|
||||
this->actor.objectSlot = this->requiredObjectSlot;
|
||||
this->actor.flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED;
|
||||
@@ -313,34 +293,29 @@ void EnKusa_Main(EnKusa* this, PlayState* play) {
|
||||
STACK_PAD(s32);
|
||||
|
||||
if (Actor_HasParent(&this->actor, play)) {
|
||||
EnKusa_SetupLiftedUp(this);
|
||||
EnKusa_SetupCarried(this);
|
||||
SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_PL_PULL_UP_PLANT);
|
||||
} else if (this->collider.base.acFlags & AC_HIT) {
|
||||
this->collider.base.acFlags &= ~AC_HIT;
|
||||
EnKusa_SpawnFragments(this, play);
|
||||
EnKusa_SpawnFragmentsEffects(this, play);
|
||||
EnKusa_DropCollectible(this, play);
|
||||
SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN);
|
||||
|
||||
if (PARAMS_GET_U(this->actor.params, 4, 1)) {
|
||||
EnKusa_SpawnBugs(this, play);
|
||||
}
|
||||
|
||||
if (PARAMS_GET_U(this->actor.params, 0, 2) == ENKUSA_TYPE_0) {
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
|
||||
EnKusa_SetupCut(this);
|
||||
this->actor.flags |= ACTOR_FLAG_GRASS_DESTROYED;
|
||||
} else {
|
||||
if (!(this->collider.base.ocFlags1 & OC1_TYPE_PLAYER) && (this->actor.xzDistToPlayer > 12.0f)) {
|
||||
this->collider.base.ocFlags1 |= OC1_TYPE_PLAYER;
|
||||
}
|
||||
|
||||
if (this->actor.xzDistToPlayer < 600.0f) {
|
||||
Collider_UpdateCylinder(&this->actor, &this->collider);
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
|
||||
|
||||
if (this->actor.xzDistToPlayer < 400.0f) {
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
|
||||
if (this->actor.xzDistToPlayer < 100.0f) {
|
||||
@@ -351,18 +326,18 @@ void EnKusa_Main(EnKusa* this, PlayState* play) {
|
||||
}
|
||||
}
|
||||
|
||||
void EnKusa_SetupLiftedUp(EnKusa* this) {
|
||||
EnKusa_SetupAction(this, EnKusa_LiftedUp);
|
||||
void EnKusa_SetupCarried(EnKusa* this) {
|
||||
EnKusa_SetupAction(this, EnKusa_Carried);
|
||||
this->actor.room = -1;
|
||||
this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED;
|
||||
}
|
||||
|
||||
void EnKusa_LiftedUp(EnKusa* this, PlayState* play) {
|
||||
void EnKusa_Carried(EnKusa* this, PlayState* play) {
|
||||
if (Actor_HasNoParent(&this->actor, play)) {
|
||||
this->actor.room = play->roomCtx.curRoom.num;
|
||||
EnKusa_SetupFall(this);
|
||||
this->actor.velocity.x = this->actor.speed * Math_SinS(this->actor.world.rot.y);
|
||||
this->actor.velocity.z = this->actor.speed * Math_CosS(this->actor.world.rot.y);
|
||||
this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * this->actor.speed;
|
||||
this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * this->actor.speed;
|
||||
this->actor.colChkInfo.mass = 240;
|
||||
this->actor.gravity = -0.1f;
|
||||
EnKusa_UpdateVelY(this);
|
||||
@@ -385,44 +360,41 @@ void EnKusa_SetupFall(EnKusa* this) {
|
||||
|
||||
void EnKusa_Fall(EnKusa* this, PlayState* play) {
|
||||
STACK_PAD(s32);
|
||||
Vec3f contactPos;
|
||||
Vec3f waterSurfacePos;
|
||||
|
||||
if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) {
|
||||
if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) {
|
||||
SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN);
|
||||
}
|
||||
EnKusa_SpawnFragments(this, play);
|
||||
EnKusa_SpawnFragmentsEffects(this, play);
|
||||
EnKusa_DropCollectible(this, play);
|
||||
switch (PARAMS_GET_U(this->actor.params, 0, 2)) {
|
||||
case ENKUSA_TYPE_0:
|
||||
case ENKUSA_TYPE_2:
|
||||
Actor_Kill(&this->actor);
|
||||
break;
|
||||
|
||||
case ENKUSA_TYPE_1:
|
||||
EnKusa_SetupUprootedWaitRegrow(this);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) {
|
||||
contactPos.x = this->actor.world.pos.x;
|
||||
contactPos.y = this->actor.world.pos.y + this->actor.depthInWater;
|
||||
contactPos.z = this->actor.world.pos.z;
|
||||
EffectSsGSplash_Spawn(play, &contactPos, NULL, NULL, 0, 400);
|
||||
EffectSsGRipple_Spawn(play, &contactPos, 150, 650, 0);
|
||||
EffectSsGRipple_Spawn(play, &contactPos, 400, 800, 4);
|
||||
EffectSsGRipple_Spawn(play, &contactPos, 500, 1100, 8);
|
||||
waterSurfacePos.x = this->actor.world.pos.x;
|
||||
waterSurfacePos.y = this->actor.world.pos.y + this->actor.depthInWater;
|
||||
waterSurfacePos.z = this->actor.world.pos.z;
|
||||
EffectSsGSplash_Spawn(play, &waterSurfacePos, NULL, NULL, 0, 400);
|
||||
EffectSsGRipple_Spawn(play, &waterSurfacePos, 150, 650, 0);
|
||||
EffectSsGRipple_Spawn(play, &waterSurfacePos, 400, 800, 4);
|
||||
EffectSsGRipple_Spawn(play, &waterSurfacePos, 500, 1100, 8);
|
||||
this->actor.minVelocityY = -3.0f;
|
||||
rotSpeedX >>= 1;
|
||||
rotSpeedXtarget >>= 1;
|
||||
rotSpeedY >>= 1;
|
||||
rotSpeedYtarget >>= 1;
|
||||
rotSpeedX = rotSpeedX >> 1;
|
||||
rotSpeedXtarget = rotSpeedXtarget >> 1;
|
||||
rotSpeedY = rotSpeedY >> 1;
|
||||
rotSpeedYtarget = rotSpeedYtarget >> 1;
|
||||
this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH;
|
||||
SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L);
|
||||
}
|
||||
|
||||
EnKusa_UpdateVelY(this);
|
||||
Math_StepToS(&rotSpeedX, rotSpeedXtarget, 0x1F4);
|
||||
Math_StepToS(&rotSpeedY, rotSpeedYtarget, 0xAA);
|
||||
@@ -467,12 +439,9 @@ void EnKusa_SetupUprootedWaitRegrow(EnKusa* this) {
|
||||
}
|
||||
|
||||
void EnKusa_UprootedWaitRegrow(EnKusa* this, PlayState* play) {
|
||||
if (this->timer > 120) {
|
||||
if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.6f)) {
|
||||
if (this->timer >= 170) {
|
||||
EnKusa_SetupRegrow(this);
|
||||
}
|
||||
}
|
||||
if ((this->timer > 120) && Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.6f) &&
|
||||
(this->timer >= 170)) {
|
||||
EnKusa_SetupRegrow(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,7 +458,6 @@ void EnKusa_Regrow(EnKusa* this, PlayState* play) {
|
||||
isFullyGrown &= Math_StepToF(&this->actor.scale.y, 0.4f, 0.014f);
|
||||
isFullyGrown &= Math_StepToF(&this->actor.scale.x, 0.4f, 0.011f);
|
||||
this->actor.scale.z = this->actor.scale.x;
|
||||
|
||||
if (isFullyGrown) {
|
||||
Actor_SetScale(&this->actor, 0.4f);
|
||||
EnKusa_SetupMain(this);
|
||||
@@ -501,9 +469,7 @@ void EnKusa_Update(Actor* thisx, PlayState* play) {
|
||||
EnKusa* this = (EnKusa*)thisx;
|
||||
|
||||
this->timer++;
|
||||
|
||||
this->actionFunc(this, play);
|
||||
|
||||
if (this->actor.flags & ACTOR_FLAG_GRASS_DESTROYED) {
|
||||
this->actor.shape.yOffset = -6.25f;
|
||||
} else {
|
||||
@@ -512,12 +478,9 @@ void EnKusa_Update(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
void EnKusa_Draw(Actor* thisx, PlayState* play) {
|
||||
static Gfx* dLists[] = { gFieldBushDL, object_kusa_DL_000140, object_kusa_DL_000140 };
|
||||
EnKusa* this = (EnKusa*)thisx;
|
||||
|
||||
if (this->actor.flags & ACTOR_FLAG_GRASS_DESTROYED) {
|
||||
if (thisx->flags & ACTOR_FLAG_GRASS_DESTROYED) {
|
||||
Gfx_DrawDListOpa(play, object_kusa_DL_0002E0);
|
||||
} else {
|
||||
Gfx_DrawDListOpa(play, dLists[PARAMS_GET_U(thisx->params, 0, 2)]);
|
||||
Gfx_DrawDListOpa(play, sDLists[PARAMS_GET_U(thisx->params, 0, 2)]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,11 +15,11 @@ typedef enum EnKusaType {
|
||||
} EnKusaType;
|
||||
|
||||
typedef struct EnKusa {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ EnKusaActionFunc actionFunc;
|
||||
/* 0x0150 */ ColliderCylinder collider;
|
||||
/* 0x019C */ s16 timer;
|
||||
/* 0x019E */ s8 requiredObjectSlot;
|
||||
} EnKusa; // size = 0x01A0
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x14C */ EnKusaActionFunc actionFunc;
|
||||
/* 0x150 */ ColliderCylinder collider;
|
||||
/* 0x19C */ s16 timer;
|
||||
/* 0x19E */ s8 requiredObjectSlot;
|
||||
} EnKusa; // size = 0x1A0
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user