summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNuss <67802335+hack-nuss@users.noreply.github.com>2023-06-11 15:35:09 +0200
committerGitHub <noreply@github.com>2023-06-11 09:35:09 -0400
commit21671975ecd1a92e6397eb284db48d07e31ca2ab (patch)
tree841d9b06c7417d3e51f4bd8a1593b6b42464630c /src
parent47be99fb0cde762466ab8dd7d2471dd278a59040 (diff)
ovl_En_Snowwd decompiled (#1276)
* ovl_En_Snowwd decompiled * formatting * improved * improvements * D_80AF7AC8 * params * D_06001AA0 * improvements
Diffstat (limited to 'src')
-rw-r--r--src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.c108
-rw-r--r--src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.h5
2 files changed, 99 insertions, 14 deletions
diff --git a/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.c b/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.c
index 48a1cfea0..73e5ea37f 100644
--- a/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.c
+++ b/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.c
@@ -5,6 +5,7 @@
*/
#include "z_en_snowwd.h"
+#include "objects/object_snowwd/object_snowwd.h"
#define FLAGS 0x00000000
@@ -17,7 +18,6 @@ void EnSnowwd_Draw(Actor* thisx, PlayState* play);
void func_80AF76F0(EnSnowwd* this, PlayState* play);
-#if 0
ActorInit En_Snowwd_InitVars = {
ACTOR_EN_SNOWWD,
ACTORCAT_PROP,
@@ -30,25 +30,107 @@ ActorInit En_Snowwd_InitVars = {
(ActorFunc)EnSnowwd_Draw,
};
-// static ColliderCylinderInit sCylinderInit = {
-static ColliderCylinderInit D_80AF7A90 = {
- { COLTYPE_TREE, AT_NONE, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, },
- { ELEMTYPE_UNK5, { 0x00000000, 0x00, 0x00 }, { 0x0100020A, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
+static ColliderCylinderInit sCylinderInit = {
+ {
+ COLTYPE_TREE,
+ AT_NONE,
+ AC_ON | AC_HARD | AC_TYPE_PLAYER,
+ OC1_ON | OC1_TYPE_ALL,
+ OC2_TYPE_1,
+ COLSHAPE_CYLINDER,
+ },
+ {
+ ELEMTYPE_UNK5,
+ { 0x00000000, 0x00, 0x00 },
+ { 0x0100020A, 0x00, 0x00 },
+ TOUCH_NONE | TOUCH_SFX_NORMAL,
+ BUMP_ON,
+ OCELEM_ON,
+ },
{ 18, 60, 0, { 0, 0, 0 } },
};
-#endif
+Vec3f D_80AF7ABC = { 0.0f, 0.0f, 0.0f };
-extern ColliderCylinderInit D_80AF7A90;
+Vec3f D_80AF7AC8 = { 0.0f, -4.0f, 0.0f };
-extern UNK_TYPE D_06001AA0;
+Color_RGBA8 D_80AF7AD4 = { 255, 255, 255, 255 };
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Snowwd/EnSnowwd_Init.s")
+Color_RGBA8 D_80AF7AD8 = { 200, 200, 220, 0 };
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Snowwd/EnSnowwd_Destroy.s")
+void EnSnowwd_Init(Actor* thisx, PlayState* play) {
+ EnSnowwd* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Snowwd/func_80AF76F0.s")
+ this->actor.home.rot.z = 0;
+ this->actor.home.rot.y = 0;
+ this->unk190 = 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;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Snowwd/EnSnowwd_Update.s")
+void EnSnowwd_Destroy(Actor* thisx, PlayState* play) {
+ EnSnowwd* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Snowwd/EnSnowwd_Draw.s")
+ Collider_DestroyCylinder(play, &this->collider);
+}
+
+void func_80AF76F0(EnSnowwd* this, PlayState* play) {
+ s32 pad;
+ Actor* thisx = &this->actor;
+ f32 sp54;
+ Vec3f sp48;
+
+ 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;
+ 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);
+ }
+ thisx->home.rot.z = 1;
+ }
+ }
+ if (thisx->xzDistToPlayer < 600.0f) {
+ Collider_UpdateCylinder(thisx, &this->collider);
+ 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);
+ }
+}
+
+void EnSnowwd_Update(Actor* thisx, PlayState* play) {
+ EnSnowwd* this = THIS;
+
+ this->actionFunc(this, play);
+}
+
+void EnSnowwd_Draw(Actor* thisx, PlayState* play) {
+ OPEN_DISPS(play->state.gfxCtx);
+
+ gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ Gfx_SetupDL25_Opa(play->state.gfxCtx);
+ gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(object_snowwd_Tex_001AA0));
+ gSPDisplayList(POLY_OPA_DISP++, object_snowwd_DL_000198);
+
+ CLOSE_DISPS(play->state.gfxCtx);
+}
diff --git a/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.h b/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.h
index a83e5d05a..d336cb252 100644
--- a/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.h
+++ b/src/overlays/actors/ovl_En_Snowwd/z_en_snowwd.h
@@ -3,13 +3,16 @@
#include "global.h"
+#define SNOWWD_GET_PARAM_F80(thisx) (((thisx)->params & 0xF80) >> 7)
+
struct EnSnowwd;
typedef void (*EnSnowwdActionFunc)(struct EnSnowwd*, PlayState*);
typedef struct EnSnowwd {
/* 0x000 */ Actor actor;
- /* 0x144 */ char unk_144[0x50];
+ /* 0x144 */ ColliderCylinder collider;
+ /* 0x190 */ s16 unk190;
/* 0x194 */ EnSnowwdActionFunc actionFunc;
} EnSnowwd; // size = 0x198