En_Snowwd documentation (#1387)

* documentation

* improvements

* improvements
This commit is contained in:
Nuss 2023-09-24 04:42:11 +02:00 committed by GitHub
parent 17e7f470e2
commit 20f8470ea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 34 deletions

View File

@ -16,7 +16,7 @@ void EnSnowwd_Destroy(Actor* thisx, PlayState* play);
void EnSnowwd_Update(Actor* thisx, PlayState* play);
void EnSnowwd_Draw(Actor* thisx, PlayState* play);
void func_80AF76F0(EnSnowwd* this, PlayState* play);
void EnSnowwd_Idle(EnSnowwd* this, PlayState* play);
ActorInit En_Snowwd_InitVars = {
ACTOR_EN_SNOWWD,
@ -50,26 +50,18 @@ static ColliderCylinderInit sCylinderInit = {
{ 18, 60, 0, { 0, 0, 0 } },
};
Vec3f D_80AF7ABC = { 0.0f, 0.0f, 0.0f };
Vec3f D_80AF7AC8 = { 0.0f, -4.0f, 0.0f };
Color_RGBA8 D_80AF7AD4 = { 255, 255, 255, 255 };
Color_RGBA8 D_80AF7AD8 = { 200, 200, 220, 0 };
void EnSnowwd_Init(Actor* thisx, PlayState* play) {
EnSnowwd* this = THIS;
this->actor.home.rot.z = 0;
SNOWWD_DROPPED_COLLECTIBLE(thisx) = false;
this->actor.home.rot.y = 0;
this->unk190 = 0;
this->timer = 0;
this->actor.uncullZoneForward = 4000.0f;
this->actor.uncullZoneScale = 2000.0f;
this->actor.uncullZoneDownward = 2400.0f;
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
Actor_SetScale(&this->actor, 1.0f);
this->actionFunc = func_80AF76F0;
this->actionFunc = EnSnowwd_Idle;
}
void EnSnowwd_Destroy(Actor* thisx, PlayState* play) {
@ -78,26 +70,30 @@ void EnSnowwd_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->collider);
}
void func_80AF76F0(EnSnowwd* this, PlayState* play) {
void EnSnowwd_Idle(EnSnowwd* this, PlayState* play) {
static Vec3f sAccel = { 0.0f, 0.0f, 0.0f };
static Vec3f sVelocity = { 0.0f, -4.0f, 0.0f };
static Color_RGBA8 sPrimColor = { 255, 255, 255, 255 };
static Color_RGBA8 sEnvColor = { 200, 200, 220, 0 };
s32 pad;
Actor* thisx = &this->actor;
f32 sp54;
Vec3f sp48;
f32 wobbleAmplitude;
Vec3f pos;
if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
Actor_PlaySfx(thisx, NA_SE_IT_REFLECTION_WOOD);
}
if (thisx->home.rot.y != 0) {
this->unk190 = 0x15;
this->timer = 21;
thisx->home.rot.y = 0;
if (thisx->home.rot.z == 0) {
if (SNOWWD_GET_PARAM_F80(&this->actor) < 0x10) {
sp48 = thisx->world.pos;
sp48.y += 200.0f;
Item_DropCollectibleRandom(play, NULL, &sp48, SNOWWD_GET_PARAM_F80(&this->actor) * 0x10);
if (!SNOWWD_DROPPED_COLLECTIBLE(&this->actor)) {
if (SNOWWD_GET_DROP_TABLE(&this->actor) < 16) {
pos = thisx->world.pos;
pos.y += 200.0f;
Item_DropCollectibleRandom(play, NULL, &pos, SNOWWD_GET_DROP_TABLE(&this->actor) * DROP_TABLE_SIZE);
}
thisx->home.rot.z = 1;
SNOWWD_DROPPED_COLLECTIBLE(&this->actor) = true;
}
}
if (thisx->xzDistToPlayer < 600.0f) {
@ -105,16 +101,18 @@ void func_80AF76F0(EnSnowwd* this, PlayState* play) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
}
if (this->unk190 > 0) {
this->unk190--;
sp54 = Math_SinS((s16)((this->unk190 ^ 0xFFFF) * 0x3332)) * 250.0f;
thisx->shape.rot.x = (s16)(Math_CosS(thisx->yawTowardsPlayer - thisx->shape.rot.y) * sp54);
thisx->shape.rot.z = (s16)(Math_SinS(thisx->yawTowardsPlayer - thisx->shape.rot.y) * sp54);
sp48 = thisx->world.pos;
sp48.x += Rand_CenteredFloat(80.0f);
sp48.y += 100.0f + Rand_ZeroFloat(30.0f);
sp48.z += Rand_CenteredFloat(80.0f);
func_800B0EB0(play, &sp48, &D_80AF7AC8, &D_80AF7ABC, &D_80AF7AD4, &D_80AF7AD8, 200, 10, 20);
// Wobble from impact and dust particles
if (this->timer > 0) {
this->timer--;
wobbleAmplitude = Math_SinS((this->timer ^ 0xFFFF) * 0x3332) * 250.0f;
thisx->shape.rot.x = Math_CosS(thisx->yawTowardsPlayer - thisx->shape.rot.y) * wobbleAmplitude;
thisx->shape.rot.z = Math_SinS(thisx->yawTowardsPlayer - thisx->shape.rot.y) * wobbleAmplitude;
pos = thisx->world.pos;
pos.x += Rand_CenteredFloat(80.0f);
pos.y += 100.0f + Rand_ZeroFloat(30.0f);
pos.z += Rand_CenteredFloat(80.0f);
func_800B0EB0(play, &pos, &sVelocity, &sAccel, &sPrimColor, &sEnvColor, 200, 10, 20);
}
}

View File

@ -3,7 +3,8 @@
#include "global.h"
#define SNOWWD_GET_PARAM_F80(thisx) (((thisx)->params & 0xF80) >> 7)
#define SNOWWD_GET_DROP_TABLE(thisx) (((thisx)->params & 0xF80) >> 7)
#define SNOWWD_DROPPED_COLLECTIBLE(thisx) ((thisx)->home.rot.z)
struct EnSnowwd;
@ -12,7 +13,7 @@ typedef void (*EnSnowwdActionFunc)(struct EnSnowwd*, PlayState*);
typedef struct EnSnowwd {
/* 0x000 */ Actor actor;
/* 0x144 */ ColliderCylinder collider;
/* 0x190 */ s16 unk190;
/* 0x190 */ s16 timer;
/* 0x194 */ EnSnowwdActionFunc actionFunc;
} EnSnowwd; // size = 0x198