summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaide <34639600+Kelebek1@users.noreply.github.com>2022-03-29 18:56:20 +0100
committerGitHub <noreply@github.com>2022-03-29 18:56:20 +0100
commit72265fac927658187cbb3c7a3a184677bf5f28fa (patch)
tree31f0ceb5b2ce571b5942cc4de2f570eb22ebf600 /src
parent6132d950e36f9b8638e1d44b8339ed7d1aa027bc (diff)
Obj_Entotu (#745)
* Obj_Entotu * Time macro * PR * Merge
Diffstat (limited to 'src')
-rw-r--r--src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c148
-rw-r--r--src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.h6
2 files changed, 141 insertions, 13 deletions
diff --git a/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c b/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c
index 72f0a8015..8ed237927 100644
--- a/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c
+++ b/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c
@@ -5,6 +5,7 @@
*/
#include "z_obj_entotu.h"
+#include "objects/object_f53_obj/object_f53_obj.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
@@ -15,7 +16,6 @@ void ObjEntotu_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ObjEntotu_Update(Actor* thisx, GlobalContext* globalCtx);
void ObjEntotu_Draw(Actor* thisx, GlobalContext* globalCtx);
-#if 0
const ActorInit Obj_Entotu_InitVars = {
ACTOR_OBJ_ENTOTU,
ACTORCAT_PROP,
@@ -28,23 +28,147 @@ const ActorInit Obj_Entotu_InitVars = {
(ActorFunc)ObjEntotu_Draw,
};
-#endif
+#include "overlays/ovl_Obj_Entotu/ovl_Obj_Entotu.c"
-extern UNK_TYPE D_06000158;
-extern UNK_TYPE D_06001C00;
+s32 func_80A34700(s16 minutes) {
+ s32 ret = 0;
+ s16 time = TIME_TO_MINUTES_F(gSaveContext.save.time);
+ s32 hours = time / 60;
+ s32 currMinutes = time % 60;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Entotu/func_80A34700.s")
+ if (hours >= 16) {
+ if ((hours == 16) && (currMinutes < minutes)) {
+ return 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Entotu/func_80A349C0.s")
+ if (hours >= 20) {
+ return 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Entotu/func_80A34A44.s")
+ if ((hours == 19) && (minutes < currMinutes)) {
+ return 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Entotu/func_80A34B28.s")
+ ret = 3;
+ } else if (hours >= 11) {
+ if ((hours == 11) && (currMinutes < minutes)) {
+ return 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Entotu/ObjEntotu_Init.s")
+ if (hours >= 14) {
+ return 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Entotu/ObjEntotu_Destroy.s")
+ if ((hours == 13) && (minutes < currMinutes)) {
+ return 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Entotu/ObjEntotu_Update.s")
+ ret = 2;
+ } else if (hours >= 6) {
+ if ((hours == 6) && (currMinutes < minutes)) {
+ return 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Entotu/ObjEntotu_Draw.s")
+ if (hours >= 9) {
+ return 0;
+ }
+
+ if ((hours == 8) && (minutes < currMinutes)) {
+ return 0;
+ }
+
+ ret = 1;
+ }
+ return ret;
+}
+
+void func_80A349C0(ObjEntotu* this) {
+ s32 temp_v0 = func_80A34700(this->unk_1C6);
+ u8 temp = temp_v0;
+ s16 temp2 = this->unk_1C4;
+
+ if (temp_v0 != temp2) {
+ this->unk_1C4 = temp;
+ this->unk_1C6 = Rand_S16Offset(0, 59);
+ }
+
+ temp2 = this->unk_1C4;
+ Math_ApproachF(&this->unk_1B8.x, (temp2 == 0) ? 0.0f : 1.0f, 0.02f, 1000.0f);
+}
+
+void func_80A34A44(ObjEntotu* this, GlobalContext* globalCtx) {
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
+ this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)));
+ Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_APPLY);
+ Matrix_Scale(0.1f, 0.1f, 0.0f, MTXMODE_APPLY);
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ func_8012C28C(globalCtx->state.gfxCtx);
+
+ gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_OPA_DISP++, object_f53_obj_DL_000158);
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
+
+void func_80A34B28(ObjEntotu* this, GlobalContext* globalCtx) {
+ u8 sp57;
+ u8 sp56;
+ s32 i;
+
+ this->unk_1B8.y += 1.8f;
+ this->unk_1B8.z += 0.6f;
+ sp57 = 0x7F - (u8)this->unk_1B8.y;
+ sp56 = 0x7F - (u8)this->unk_1B8.z;
+
+ this->unk_1B8.x = CLAMP(this->unk_1B8.x, 0.0f, 1.0f);
+
+ for (i = 0; i < ARRAY_COUNT(ovl_Obj_Entotu_Vtx_000D10); i++) {
+ this->unk_148[i].v.cn[3] = ovl_Obj_Entotu_Vtx_000D10[i].v.cn[3] * this->unk_1B8.x;
+ }
+
+ if (this->unk_1B8.x > 0.0f) {
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z,
+ MTXMODE_NEW);
+ this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)));
+ Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_APPLY);
+ Matrix_Scale(0.1f, 0.1f, 0.0f, MTXMODE_APPLY);
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ func_8012C28C(globalCtx->state.gfxCtx);
+
+ gSPSegment(POLY_XLU_DISP++, 0x08,
+ Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, sp57, 0x20, 0x20, 1, 0, sp56, 0x20, 0x20));
+ gSPSegment(POLY_XLU_DISP++, 0x09, Lib_SegmentedToVirtual(this->unk_148));
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, object_f53_obj_DL_001C00);
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+ }
+}
+
+void ObjEntotu_Init(Actor* thisx, GlobalContext* globalCtx) {
+ ObjEntotu* this = THIS;
+
+ Lib_MemCpy(this->unk_148, ovl_Obj_Entotu_Vtx_000D10, sizeof(ovl_Obj_Entotu_Vtx_000D10));
+ this->unk_1C6 = Rand_S16Offset(0, 59);
+ this->unk_1C4 = 0;
+}
+
+void ObjEntotu_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+}
+
+void ObjEntotu_Update(Actor* thisx, GlobalContext* globalCtx) {
+ ObjEntotu* this = THIS;
+
+ func_80A349C0(this);
+}
+
+void ObjEntotu_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ ObjEntotu* this = THIS;
+
+ func_80A34B28(this, globalCtx);
+ func_80A34A44(this, globalCtx);
+}
diff --git a/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.h b/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.h
index 5d0b3cedd..a00a7fcd4 100644
--- a/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.h
+++ b/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.h
@@ -7,7 +7,11 @@ struct ObjEntotu;
typedef struct ObjEntotu {
/* 0x000 */ Actor actor;
- /* 0x144 */ char unk_144[0x84];
+ /* 0x144 */ UNK_TYPE1 unk144[4];
+ /* 0x148 */ Vtx unk_148[7];
+ /* 0x1B8 */ Vec3f unk_1B8;
+ /* 0x1C4 */ u8 unk_1C4;
+ /* 0x1C6 */ s16 unk_1C6;
} ObjEntotu; // size = 0x1C8
extern const ActorInit Obj_Entotu_InitVars;